Skip to content

Commit 55bc923

Browse files
abhijitG-xlnxtmonjalo
authored andcommitted
bus/cdx: provide driver flag for resource mapping
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 <[email protected]>
1 parent 1e6cb8f commit 55bc923

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

drivers/bus/cdx/bus_cdx_driver.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ struct rte_cdx_bus;
3737
static const char DRV_EXP_TAG(name, cdx_tbl_export)[] __rte_used = \
3838
RTE_STR(table)
3939

40+
/** Device needs resource mapping */
41+
#define RTE_CDX_DRV_NEED_MAPPING 0x0001
42+
4043
/**
4144
* A structure describing an ID for a CDX driver. Each driver provides a
4245
* table of these IDs for each device that it supports.

drivers/bus/cdx/cdx.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,10 +383,12 @@ cdx_probe_one_driver(struct rte_cdx_driver *dr,
383383
CDX_BUS_DEBUG(" probe device %s using driver: %s", dev_name,
384384
dr->driver.name);
385385

386-
ret = cdx_vfio_map_resource(dev);
387-
if (ret != 0) {
388-
CDX_BUS_ERR("CDX map device failed: %d", ret);
389-
goto error_map_device;
386+
if (dr->drv_flags & RTE_CDX_DRV_NEED_MAPPING) {
387+
ret = cdx_vfio_map_resource(dev);
388+
if (ret != 0) {
389+
CDX_BUS_ERR("CDX map device failed: %d", ret);
390+
goto error_map_device;
391+
}
390392
}
391393

392394
/* call the driver probe() function */

0 commit comments

Comments
 (0)