bus/auxiliary: prevent device from being probed again

The device on auxiliary bus doesn't support being probed again
without being removed firstly. The PMD will detect and return error
for this unsupported operation. Some of the resources would be
cleared wrongly. When quitting, there will be unexpected error like
crash.

To prevent this, the device driver will be checked before probing a
device.

Fixes: 1afce3086c ("bus/auxiliary: introduce auxiliary bus")
CC: stable@dpdk.org

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Reviewed-by: Gregory Etelson <getelson@nvidia.com>
Reviewed-by: Matan Azrad <matan@nvidia.com>
This commit is contained in:
Bing Zhao 2022-11-09 16:53:56 +02:00 committed by David Marchand
parent 521171cf2a
commit bc96714996

View File

@ -108,6 +108,12 @@ rte_auxiliary_probe_one_driver(struct rte_auxiliary_driver *drv,
if (dev->device.numa_node < 0 && rte_socket_count() > 1) if (dev->device.numa_node < 0 && rte_socket_count() > 1)
RTE_LOG(INFO, EAL, "Device %s is not NUMA-aware\n", dev->name); RTE_LOG(INFO, EAL, "Device %s is not NUMA-aware\n", dev->name);
if (rte_dev_is_probed(&dev->device)) {
RTE_LOG(DEBUG, EAL, "Device %s is already probed on auxiliary bus\n",
dev->device.name);
return -EEXIST;
}
iova_mode = rte_eal_iova_mode(); iova_mode = rte_eal_iova_mode();
if ((drv->drv_flags & RTE_AUXILIARY_DRV_NEED_IOVA_AS_VA) > 0 && if ((drv->drv_flags & RTE_AUXILIARY_DRV_NEED_IOVA_AS_VA) > 0 &&
iova_mode != RTE_IOVA_VA) { iova_mode != RTE_IOVA_VA) {