[v4,1/1] bus/cdx: provide driver flag for optional resource mapping
Checks
Commit Message
Provide driver flag which gives an option to map the cdx device
resource before probing the device driver. External driver can
use rte_cdx_map_device() and rte_cdx_unmap_device() APIs to map/
unmap device resource separately.
Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com>
---
v4:
- rte_cdx_map_device() and rte_cdx_unmap_device() APIs are kept
as internal APIs.
v3:
- Changed APIs to __rte_experimental.
v2:
- Corrected _RTE_BUS_CDX_H_ to RTE_BUS_CDX_H
- Improved code comments.
drivers/bus/cdx/bus_cdx_driver.h | 3 +++
drivers/bus/cdx/cdx.c | 10 ++++++----
2 files changed, 9 insertions(+), 4 deletions(-)
Comments
16/10/2023 11:16, Abhijit Gangurde:
> Provide driver flag which gives an option to map the cdx device
> resource before probing the device driver. External driver can
> use rte_cdx_map_device() and rte_cdx_unmap_device() APIs to map/
> unmap device resource separately.
>
> Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com>
Applied, thanks.
@@ -37,6 +37,9 @@ struct rte_cdx_bus;
static const char DRV_EXP_TAG(name, cdx_tbl_export)[] __rte_used = \
RTE_STR(table)
+/** Device needs resource mapping */
+#define RTE_CDX_DRV_NEED_MAPPING 0x0001
+
/**
* A structure describing an ID for a CDX driver. Each driver provides a
* table of these IDs for each device that it supports.
@@ -383,10 +383,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 */