The bus cleanup callback is used to sunset all devices on bus gracefully. This patch supports the callback by unplug all devices on auxiliary bus.
Signed-off-by: Xueming Li <xuemi...@nvidia.com> --- drivers/bus/auxiliary/auxiliary_common.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c index ff1369353a..19bf523660 100644 --- a/drivers/bus/auxiliary/auxiliary_common.c +++ b/drivers/bus/auxiliary/auxiliary_common.c @@ -236,6 +236,7 @@ auxiliary_probe(void) return (probed && probed == failed) ? -1 : 0; } + static int auxiliary_parse(const char *name, void *addr) { @@ -337,6 +338,26 @@ auxiliary_unplug(struct rte_device *dev) return ret; } +static int +auxiliary_cleanup(void) +{ + struct rte_auxiliary_device *dev, *tmp_dev; + int error = 0; + + RTE_TAILQ_FOREACH_SAFE(dev, &auxiliary_bus.device_list, next, tmp_dev) { + struct rte_auxiliary_driver *drv = dev->driver; + int ret = 0; + + ret = auxiliary_unplug(&dev->device); + if (ret < 0) { + rte_errno = errno; + error = -1; + } + } + + return error; +} + static int auxiliary_dma_map(struct rte_device *dev, void *addr, uint64_t iova, size_t len) { @@ -406,6 +427,7 @@ struct rte_auxiliary_bus auxiliary_bus = { .bus = { .scan = auxiliary_scan, .probe = auxiliary_probe, + .cleanup = auxiliary_cleanup, .find_device = auxiliary_find_device, .plug = auxiliary_plug, .unplug = auxiliary_unplug, -- 2.25.1