Skip to content

Commit

Permalink
bus/cdx: provide driver flag for resource mapping
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
abhijitG-xlnx authored and tmonjalo committed Oct 16, 2023
1 parent 1e6cb8f commit 55bc923
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions drivers/bus/cdx/bus_cdx_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 6 additions & 4 deletions drivers/bus/cdx/cdx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 55bc923

Please sign in to comment.