[EXTERNAL] Re: [PATCH] rawdev: fix device ID retrieval function prototype
Akhil Goyal
gakhil at marvell.com
Fri Oct 17 13:05:26 CEST 2025
Hi Thomas,
> 16/10/2025 08:56, Nawal Kishor:
> >
> > >> Fixed rte_rawdev_get_dev_id() function prototype and its usage.
> > >
> > >What? Why?
> >
> > >[...]
> > >> -uint16_t
> > >> +int
> > >> rte_rawdev_get_dev_id(const char *name);
> >
> > >Other functions handle dev_id as uint16_t, so why changing this function?
> >
> > The spec says that rte_rawdev_get_dev_id() returns negative number in case of
> failure.
> > But in the definition it is returning uint16_t which will never be negative, hence
> changed it to int.
> >
> > If this is not acceptable, what fix will you suggest?
>
> You should change to int16_t for all rawdev id parameters.
>
Wont that be an API/ABI break for all the APIs?
We have a similar rte_cryptodev_get_dev_id() and rte_event_dev_get_dev_id() APIs which
return <0 value in case of failure and a positive value for valid ones.
dev_id is defined as unsigned value which is being used everywhere in all APIs of cryptodev, eventdev and rawdev.
The negative value here is just to denote that the API fails to retrieve dev_id and application should take action and not proceed further with that value.
Changing dev_id to a signed value in my opinion is not necessary just because this API may return <0 value on failure.
More information about the dev
mailing list