[PATCH 6/8] bus: factorize device selection
Stephen Hemminger
stephen at networkplumber.org
Tue Mar 24 17:12:33 CET 2026
On Mon, 23 Mar 2026 11:53:00 +0100
David Marchand <david.marchand at redhat.com> 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 <david.marchand at redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson at intel.com>
> Reviewed-by: Robin Jarry <rjarry at redhat.com>
> ---
> Changes since RFC v2:
> - changed API to query about a device name and hide the devargs meaning
> in the common code,
AI review found some issues in this one:
**Error**: In `drivers/dma/idxd/idxd_bus.c`, the refactored
`is_for_this_process_use` has a logic error. The old code could set
`retval` to 0 when a device was blocked:
```c
/* Old - retval could be set to 0 */
if (dsa_bus.bus.conf.scan_mode == RTE_BUS_SCAN_ALLOWLIST)
retval = rte_bus_find_devargs(...) != NULL;
else
retval = rte_bus_find_devargs(...) == NULL;
```
The new code only ever sets `retval = 1`, never clearing it:
```c
/* New - retval is never set to 0 */
if (retval && !rte_bus_is_ignored_device(&dsa_bus.bus, dev->device.name))
retval = 1;
```
If a device should be ignored (blocked or not on the allow list),
`rte_bus_is_ignored_device` returns true, the condition is false, and
`retval` stays 1 from the earlier name-matching check. Blocked devices
will incorrectly pass through.
Suggested fix:
```c
if (retval)
retval = !rte_bus_is_ignored_device(&dsa_bus.bus, dev->device.name);
```
More information about the dev
mailing list