On Sun, Sep 8, 2024 at 1:03 AM Akhil Goyal <gak...@marvell.com> wrote: > > Added an internal API for PMDs to get raw device pointer > from a device id. > > Signed-off-by: Akhil Goyal <gak...@marvell.com> > --- > lib/rawdev/rte_rawdev_pmd.h | 24 ++++++++++++++++++++++++
# This patch needs to go through the main tree. So please send this separate patch and rest of the patch as separate series. # verion.map update is missing for new API as INTERNAL section. > 1 file changed, 24 insertions(+) > > diff --git a/lib/rawdev/rte_rawdev_pmd.h b/lib/rawdev/rte_rawdev_pmd.h > index 22b406444d..8339122348 100644 > --- a/lib/rawdev/rte_rawdev_pmd.h > +++ b/lib/rawdev/rte_rawdev_pmd.h > @@ -102,6 +102,30 @@ rte_rawdev_pmd_get_named_dev(const char *name) > return NULL; > } > > +/** > + * Get the rte_rawdev structure device pointer for given device ID. > + * > + * @param dev_id > + * raw device index. > + * > + * @return > + * - The rte_rawdev structure pointer for the given device ID. > + */ > +static inline struct rte_rawdev * > +rte_rawdev_pmd_get_dev(uint8_t dev_id) > +{ > + struct rte_rawdev *dev; > + > + if (dev_id >= RTE_RAWDEV_MAX_DEVS) > + return NULL; > + > + dev = &rte_rawdevs[dev_id]; > + if (dev->attached == RTE_RAWDEV_ATTACHED) > + return dev; > + > + return NULL; > +} > + > /** > * Validate if the raw device index is a valid attached raw device. > * > -- > 2.25.1 >