[PATCH v3] bus/cdx: provide driver flag for optional resource mapping
Gangurde, Abhijit
abhijit.gangurde at amd.com
Wed Oct 4 12:06:44 CEST 2023
[AMD Official Use Only - General]
> <abhijit.gangurde at amd.com> wrote:
> > @@ -383,10 +384,12 @@ cdx_probe_one_driver(struct rte_cdx_driver *dr,
> > CDX_BUS_DEBUG(" probe device %s using driver: %s", dev_name,
> > dr->driver.name);
> >
> > - ret = cdx_vfio_map_resource(dev);
> > - if (ret != 0) {
> > - CDX_BUS_ERR("CDX map device failed: %d", ret);
> > - goto error_map_device;
> > + if (dr->drv_flags & RTE_CDX_DRV_NEED_MAPPING) {
> > + ret = cdx_vfio_map_resource(dev);
> > + if (ret != 0) {
> > + CDX_BUS_ERR("CDX map device failed: %d", ret);
> > + goto error_map_device;
> > + }
> > }
> >
> > /* call the driver probe() function */
> > diff --git a/drivers/bus/cdx/rte_bus_cdx.h b/drivers/bus/cdx/rte_bus_cdx.h
> > new file mode 100644
> > index 0000000000..4ca12f90c4
> > --- /dev/null
> > +++ b/drivers/bus/cdx/rte_bus_cdx.h
> > @@ -0,0 +1,52 @@
> > +/* SPDX-License-Identifier: BSD-3-Clause
> > + * Copyright (C) 2023, Advanced Micro Devices, Inc.
> > + */
> > +
> > +#ifndef RTE_BUS_CDX_H
> > +#define RTE_BUS_CDX_H
> > +
> > +/**
> > + * @file
> > + * CDX device & driver interface
> > + */
> > +
> > +#ifdef __cplusplus
> > +extern "C" {
> > +#endif
> > +
> > +/* Forward declarations */
> > +struct rte_cdx_device;
> > +
> > +/**
> > + * Map the CDX device resources in user space virtual memory address.
> > + *
> > + * Note that driver should not call this function when flag
> > + * RTE_CDX_DRV_NEED_MAPPING is set, as EAL will do that for
> > + * you when it's on.
>
> Why should we export this function in the application ABI, if it is
> only used by drivers?
This can be called from an application as well if this flag is not set hence, we need to export this function.
If needed, I can update the description of the API.
Thanks,
Abhijit
More information about the dev
mailing list