On Thu, Feb 26, 2026 at 05:20:55PM +0100, David Marchand wrote:
> All buses (thankfully) implement the same logic when it comes to
> selecting the devices to probe based on -a/-b options.
> As we want to adjust how devices are selected, provide a common helper
> in EAL and use it in the buses.
>
> Signed-off-by: David Marchand <[email protected]>
> ---
> drivers/bus/auxiliary/auxiliary_common.c | 15 +----------
> drivers/bus/cdx/cdx.c | 21 +---------------
> drivers/bus/dpaa/dpaa_bus.c | 24 ++++++------------
> drivers/bus/fslmc/fslmc_bus.c | 22 ++++++----------
> drivers/bus/pci/pci_common.c | 15 +----------
> drivers/bus/platform/platform.c | 28 ++-------------------
> drivers/bus/uacce/uacce.c | 22 +---------------
> drivers/bus/vmbus/vmbus_common.c | 21 +---------------
> drivers/dma/idxd/idxd_bus.c | 32 +++++++++---------------
> lib/eal/common/eal_common_bus.c | 18 +++++++++++++
> lib/eal/include/bus_driver.h | 7 ++++++
> 11 files changed, 58 insertions(+), 167 deletions(-)
>
<snip>
> diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
> index 0a2311a342..fbe20cfe35 100644
> --- a/lib/eal/common/eal_common_bus.c
> +++ b/lib/eal/common/eal_common_bus.c
> @@ -8,6 +8,7 @@
>
> #include <bus_driver.h>
> #include <rte_debug.h>
> +#include <rte_devargs.h>
> #include <rte_string_fns.h>
> #include <rte_errno.h>
>
> @@ -226,6 +227,23 @@ rte_bus_find_by_device_name(const char *str)
> return rte_bus_find(NULL, bus_can_parse, name);
> }
>
> +RTE_EXPORT_INTERNAL_SYMBOL(rte_bus_is_ignored_device)
> +bool
> +rte_bus_is_ignored_device(const struct rte_bus *bus, const struct
> rte_devargs *devargs)
> +{
> + switch (bus->conf.scan_mode) {
> + case RTE_BUS_SCAN_ALLOWLIST:
> + if (devargs && devargs->policy == RTE_DEV_ALLOWED)
> + return false;
> + break;
> + case RTE_BUS_SCAN_UNDEFINED:
> + case RTE_BUS_SCAN_BLOCKLIST:
> + if (devargs == NULL || devargs->policy != RTE_DEV_BLOCKED)
> + return false;
> + break;
> + }
> + return true;
> +}
I think this could do with more comments. Am I right in thinking that
devargs is NULL on input if the device in question is not referenced by any
devargs passed to the app? This seems a little obscure form of input
parameter, so I definitely think it needs documenting.
Is there any way the search for the device name that returns the devargs
null/non-null pointer can be similarly generalized?
>
> /*
> * Get iommu class of devices on the bus.
> diff --git a/lib/eal/include/bus_driver.h b/lib/eal/include/bus_driver.h
> index 60527b75b6..1ec1ff57bb 100644
> --- a/lib/eal/include/bus_driver.h
> +++ b/lib/eal/include/bus_driver.h
> @@ -302,6 +302,13 @@ RTE_INIT_PRIO(businitfn_ ##nm, BUS) \
> __rte_internal
> void rte_bus_unregister(struct rte_bus *bus);
>
> +/**
> + * Indicate if a device referenced by some devargs should be skipped during
> + * probing of a bus.
> + */
> +__rte_internal
> +bool rte_bus_is_ignored_device(const struct rte_bus *bus, const struct
> rte_devargs *devargs);
> +
> #ifdef __cplusplus
> }
> #endif
> --
> 2.53.0
>