* [PATCH 1/8] devtools: check packet forwarding in null test
2026-03-23 10:52 [PATCH 0/8] Rework device probing David Marchand
@ 2026-03-23 10:52 ` David Marchand
2026-03-23 10:52 ` [PATCH 2/8] bus/fslmc: fix bus cleanup David Marchand
` (10 subsequent siblings)
11 siblings, 0 replies; 67+ messages in thread
From: David Marchand @ 2026-03-23 10:52 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, Thomas Monjalon, Andrew Rybchenko
Add some simple checks that testpmd was indeed polling two ports, and
some packets got through it.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
devtools/test-null.sh | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/devtools/test-null.sh b/devtools/test-null.sh
index e3ac168ce3..8f21189262 100755
--- a/devtools/test-null.sh
+++ b/devtools/test-null.sh
@@ -26,8 +26,14 @@ else
libs=
fi
+logfile=$build/test-null.log
(sleep 1 && echo stop) |
# testpmd only needs 20M, make it x2 (default number of cores) for NUMA systems
$testpmd -l $corelist --no-huge -m 40 \
$libs -a 0:0.0 --vdev net_null1 --vdev net_null2 $eal_options -- \
- --no-mlockall --total-num-mbufs=2048 $testpmd_options -ia
+ --no-mlockall --total-num-mbufs=2048 $testpmd_options -ia | tee $logfile
+
+# we expect two ports and some traffic is received and transmitted
+grep -q 'io packet forwarding - ports=2 -' $build/test-null.log
+grep 'RX-packets: ' $logfile | tail -1 | grep -q 'RX-packets:[[:space:]]*[^0[:space:]]'
+grep 'TX-packets: ' $logfile | tail -1 | grep -q 'TX-packets:[[:space:]]*[^0[:space:]]'
--
2.53.0
^ permalink raw reply related [flat|nested] 67+ messages in thread* [PATCH 2/8] bus/fslmc: fix bus cleanup
2026-03-23 10:52 [PATCH 0/8] Rework device probing David Marchand
2026-03-23 10:52 ` [PATCH 1/8] devtools: check packet forwarding in null test David Marchand
@ 2026-03-23 10:52 ` David Marchand
2026-03-23 16:59 ` Kevin Traynor
` (2 more replies)
2026-03-23 10:52 ` [PATCH 3/8] drivers/bus: require probe function for NXP drivers David Marchand
` (9 subsequent siblings)
11 siblings, 3 replies; 67+ messages in thread
From: David Marchand @ 2026-03-23 10:52 UTC (permalink / raw)
To: dev; +Cc: stable, Hemant Agrawal, Sachin Saxena, Rohit Raj
The close operation was never closing probed devices.
Taking a step back, reevaluating the devargs makes no sense during the
close step, as a probed device must have passed the allow/block list
evaluation initially.
Since the device contains a reference to the driver that probed it,
simply call this driver remove op.
Fixes: 274fd921ff7f ("bus/fslmc: support close operation")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
drivers/bus/fslmc/fslmc_vfio.c | 21 ++++-----------------
1 file changed, 4 insertions(+), 17 deletions(-)
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 550d4e0e8d..7daa18d850 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -1393,7 +1393,7 @@ fslmc_close_iodevices(struct rte_dpaa2_device *dev,
{
struct rte_dpaa2_object *object = NULL;
struct rte_dpaa2_driver *drv;
- int ret, probe_all;
+ int ret;
switch (dev->dev_type) {
case DPAA2_IO:
@@ -1411,22 +1411,9 @@ fslmc_close_iodevices(struct rte_dpaa2_device *dev,
case DPAA2_ETH:
case DPAA2_CRYPTO:
case DPAA2_QDMA:
- probe_all = rte_fslmc_bus.bus.conf.scan_mode !=
- RTE_BUS_SCAN_ALLOWLIST;
- TAILQ_FOREACH(drv, &rte_fslmc_bus.driver_list, next) {
- if (drv->drv_type != dev->dev_type)
- continue;
- if (rte_dev_is_probed(&dev->device))
- continue;
- if (probe_all ||
- (dev->device.devargs &&
- dev->device.devargs->policy ==
- RTE_DEV_ALLOWED)) {
- ret = drv->remove(dev);
- if (ret)
- DPAA2_BUS_ERR("Unable to remove");
- }
- }
+ drv = dev->driver;
+ if (drv && drv->remove && drv->remove(dev))
+ DPAA2_BUS_ERR("Unable to remove");
break;
default:
break;
--
2.53.0
^ permalink raw reply related [flat|nested] 67+ messages in thread* Re: [PATCH 2/8] bus/fslmc: fix bus cleanup
2026-03-23 10:52 ` [PATCH 2/8] bus/fslmc: fix bus cleanup David Marchand
@ 2026-03-23 16:59 ` Kevin Traynor
2026-03-26 8:22 ` David Marchand
2026-03-24 5:15 ` Hemant Agrawal
2026-03-24 5:15 ` Hemant Agrawal
2 siblings, 1 reply; 67+ messages in thread
From: Kevin Traynor @ 2026-03-23 16:59 UTC (permalink / raw)
To: David Marchand, dev; +Cc: stable, Hemant Agrawal, Sachin Saxena, Rohit Raj
On 3/23/26 10:52 AM, David Marchand wrote:
> The close operation was never closing probed devices.
>
> Taking a step back, reevaluating the devargs makes no sense during the
> close step, as a probed device must have passed the allow/block list
> evaluation initially.
>
> Since the device contains a reference to the driver that probed it,
> simply call this driver remove op.
>
> Fixes: 274fd921ff7f ("bus/fslmc: support close operation")
> Cc: stable@dpdk.org
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
> drivers/bus/fslmc/fslmc_vfio.c | 21 ++++-----------------
> 1 file changed, 4 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
> index 550d4e0e8d..7daa18d850 100644
> --- a/drivers/bus/fslmc/fslmc_vfio.c
> +++ b/drivers/bus/fslmc/fslmc_vfio.c
> @@ -1393,7 +1393,7 @@ fslmc_close_iodevices(struct rte_dpaa2_device *dev,
> {
> struct rte_dpaa2_object *object = NULL;
> struct rte_dpaa2_driver *drv;
> - int ret, probe_all;
> + int ret;
>
> switch (dev->dev_type) {
> case DPAA2_IO:
> @@ -1411,22 +1411,9 @@ fslmc_close_iodevices(struct rte_dpaa2_device *dev,
> case DPAA2_ETH:
> case DPAA2_CRYPTO:
> case DPAA2_QDMA:
> - probe_all = rte_fslmc_bus.bus.conf.scan_mode !=
> - RTE_BUS_SCAN_ALLOWLIST;
> - TAILQ_FOREACH(drv, &rte_fslmc_bus.driver_list, next) {
> - if (drv->drv_type != dev->dev_type)
> - continue;
> - if (rte_dev_is_probed(&dev->device))
> - continue;
> - if (probe_all ||
> - (dev->device.devargs &&
> - dev->device.devargs->policy ==
> - RTE_DEV_ALLOWED)) {
> - ret = drv->remove(dev);
> - if (ret)
> - DPAA2_BUS_ERR("Unable to remove");
> - }
> - }
> + drv = dev->driver;
> + if (drv && drv->remove && drv->remove(dev))
Not new but dpaa2_qdma_remove doesn't return an error which seems like a
bug, but it has it's own log and it's just a log here anyway, so not
critical.
> + DPAA2_BUS_ERR("Unable to remove");
> break;
> default:
> break;
^ permalink raw reply [flat|nested] 67+ messages in thread* Re: [PATCH 2/8] bus/fslmc: fix bus cleanup
2026-03-23 16:59 ` Kevin Traynor
@ 2026-03-26 8:22 ` David Marchand
2026-03-26 8:49 ` Kevin Traynor
0 siblings, 1 reply; 67+ messages in thread
From: David Marchand @ 2026-03-26 8:22 UTC (permalink / raw)
To: Kevin Traynor; +Cc: dev, stable, Hemant Agrawal, Sachin Saxena, Rohit Raj
On Mon, 23 Mar 2026 at 17:59, Kevin Traynor <ktraynor@redhat.com> wrote:
>
> On 3/23/26 10:52 AM, David Marchand wrote:
> > The close operation was never closing probed devices.
> >
> > Taking a step back, reevaluating the devargs makes no sense during the
> > close step, as a probed device must have passed the allow/block list
> > evaluation initially.
> >
> > Since the device contains a reference to the driver that probed it,
> > simply call this driver remove op.
> >
> > Fixes: 274fd921ff7f ("bus/fslmc: support close operation")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
> > drivers/bus/fslmc/fslmc_vfio.c | 21 ++++-----------------
> > 1 file changed, 4 insertions(+), 17 deletions(-)
> >
> > diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
> > index 550d4e0e8d..7daa18d850 100644
> > --- a/drivers/bus/fslmc/fslmc_vfio.c
> > +++ b/drivers/bus/fslmc/fslmc_vfio.c
> > @@ -1393,7 +1393,7 @@ fslmc_close_iodevices(struct rte_dpaa2_device *dev,
> > {
> > struct rte_dpaa2_object *object = NULL;
> > struct rte_dpaa2_driver *drv;
> > - int ret, probe_all;
> > + int ret;
> >
> > switch (dev->dev_type) {
> > case DPAA2_IO:
> > @@ -1411,22 +1411,9 @@ fslmc_close_iodevices(struct rte_dpaa2_device *dev,
> > case DPAA2_ETH:
> > case DPAA2_CRYPTO:
> > case DPAA2_QDMA:
> > - probe_all = rte_fslmc_bus.bus.conf.scan_mode !=
> > - RTE_BUS_SCAN_ALLOWLIST;
> > - TAILQ_FOREACH(drv, &rte_fslmc_bus.driver_list, next) {
> > - if (drv->drv_type != dev->dev_type)
> > - continue;
> > - if (rte_dev_is_probed(&dev->device))
> > - continue;
> > - if (probe_all ||
> > - (dev->device.devargs &&
> > - dev->device.devargs->policy ==
> > - RTE_DEV_ALLOWED)) {
> > - ret = drv->remove(dev);
> > - if (ret)
> > - DPAA2_BUS_ERR("Unable to remove");
> > - }
> > - }
> > + drv = dev->driver;
> > + if (drv && drv->remove && drv->remove(dev))
>
> Not new but dpaa2_qdma_remove doesn't return an error which seems like a
> bug, but it has it's own log and it's just a log here anyway, so not
> critical.
>
> > + DPAA2_BUS_ERR("Unable to remove");
Indeed, the dma/dpaa2 driver does not report errors.
And there is probably more to fix in the fslmc bus, as I see that the
bus .unplug() does not check the driver .remove() return value either.
I did not dig deeper in this bus for now as I was focusing on the
devargs evaluation.
Could you open a bugzilla for tracking this issue?
Thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 67+ messages in thread* Re: [PATCH 2/8] bus/fslmc: fix bus cleanup
2026-03-26 8:22 ` David Marchand
@ 2026-03-26 8:49 ` Kevin Traynor
0 siblings, 0 replies; 67+ messages in thread
From: Kevin Traynor @ 2026-03-26 8:49 UTC (permalink / raw)
To: David Marchand; +Cc: dev, stable, Hemant Agrawal, Sachin Saxena, Rohit Raj
On 3/26/26 8:22 AM, David Marchand wrote:
> On Mon, 23 Mar 2026 at 17:59, Kevin Traynor <ktraynor@redhat.com> wrote:
>>
>> On 3/23/26 10:52 AM, David Marchand wrote:
>>> The close operation was never closing probed devices.
>>>
>>> Taking a step back, reevaluating the devargs makes no sense during the
>>> close step, as a probed device must have passed the allow/block list
>>> evaluation initially.
>>>
>>> Since the device contains a reference to the driver that probed it,
>>> simply call this driver remove op.
>>>
>>> Fixes: 274fd921ff7f ("bus/fslmc: support close operation")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: David Marchand <david.marchand@redhat.com>
>>> ---
>>> drivers/bus/fslmc/fslmc_vfio.c | 21 ++++-----------------
>>> 1 file changed, 4 insertions(+), 17 deletions(-)
>>>
>>> diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
>>> index 550d4e0e8d..7daa18d850 100644
>>> --- a/drivers/bus/fslmc/fslmc_vfio.c
>>> +++ b/drivers/bus/fslmc/fslmc_vfio.c
>>> @@ -1393,7 +1393,7 @@ fslmc_close_iodevices(struct rte_dpaa2_device *dev,
>>> {
>>> struct rte_dpaa2_object *object = NULL;
>>> struct rte_dpaa2_driver *drv;
>>> - int ret, probe_all;
>>> + int ret;
>>>
>>> switch (dev->dev_type) {
>>> case DPAA2_IO:
>>> @@ -1411,22 +1411,9 @@ fslmc_close_iodevices(struct rte_dpaa2_device *dev,
>>> case DPAA2_ETH:
>>> case DPAA2_CRYPTO:
>>> case DPAA2_QDMA:
>>> - probe_all = rte_fslmc_bus.bus.conf.scan_mode !=
>>> - RTE_BUS_SCAN_ALLOWLIST;
>>> - TAILQ_FOREACH(drv, &rte_fslmc_bus.driver_list, next) {
>>> - if (drv->drv_type != dev->dev_type)
>>> - continue;
>>> - if (rte_dev_is_probed(&dev->device))
>>> - continue;
>>> - if (probe_all ||
>>> - (dev->device.devargs &&
>>> - dev->device.devargs->policy ==
>>> - RTE_DEV_ALLOWED)) {
>>> - ret = drv->remove(dev);
>>> - if (ret)
>>> - DPAA2_BUS_ERR("Unable to remove");
>>> - }
>>> - }
>>> + drv = dev->driver;
>>> + if (drv && drv->remove && drv->remove(dev))
>>
>> Not new but dpaa2_qdma_remove doesn't return an error which seems like a
>> bug, but it has it's own log and it's just a log here anyway, so not
>> critical.
>>
>>> + DPAA2_BUS_ERR("Unable to remove");
>
> Indeed, the dma/dpaa2 driver does not report errors.
> And there is probably more to fix in the fslmc bus, as I see that the
> bus .unplug() does not check the driver .remove() return value either.
>
> I did not dig deeper in this bus for now as I was focusing on the
> devargs evaluation.
>
> Could you open a bugzilla for tracking this issue?
>
Sure, I will do that
> Thanks.
>
>
^ permalink raw reply [flat|nested] 67+ messages in thread
* Re: [PATCH 2/8] bus/fslmc: fix bus cleanup
2026-03-23 10:52 ` [PATCH 2/8] bus/fslmc: fix bus cleanup David Marchand
2026-03-23 16:59 ` Kevin Traynor
@ 2026-03-24 5:15 ` Hemant Agrawal
2026-03-24 5:15 ` Hemant Agrawal
2 siblings, 0 replies; 67+ messages in thread
From: Hemant Agrawal @ 2026-03-24 5:15 UTC (permalink / raw)
To: David Marchand, dev; +Cc: stable, Hemant Agrawal, Sachin Saxena, Rohit Raj
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
^ permalink raw reply [flat|nested] 67+ messages in thread
* Re: [PATCH 2/8] bus/fslmc: fix bus cleanup
2026-03-23 10:52 ` [PATCH 2/8] bus/fslmc: fix bus cleanup David Marchand
2026-03-23 16:59 ` Kevin Traynor
2026-03-24 5:15 ` Hemant Agrawal
@ 2026-03-24 5:15 ` Hemant Agrawal
2 siblings, 0 replies; 67+ messages in thread
From: Hemant Agrawal @ 2026-03-24 5:15 UTC (permalink / raw)
To: David Marchand, dev; +Cc: stable, Hemant Agrawal, Sachin Saxena
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
^ permalink raw reply [flat|nested] 67+ messages in thread
* [PATCH 3/8] drivers/bus: require probe function for NXP drivers
2026-03-23 10:52 [PATCH 0/8] Rework device probing David Marchand
2026-03-23 10:52 ` [PATCH 1/8] devtools: check packet forwarding in null test David Marchand
2026-03-23 10:52 ` [PATCH 2/8] bus/fslmc: fix bus cleanup David Marchand
@ 2026-03-23 10:52 ` David Marchand
2026-03-23 16:59 ` Kevin Traynor
2026-03-24 5:15 ` Hemant Agrawal
2026-03-23 10:52 ` [PATCH 4/8] drivers: cleanup devargs lookup in bus scan David Marchand
` (8 subsequent siblings)
11 siblings, 2 replies; 67+ messages in thread
From: David Marchand @ 2026-03-23 10:52 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, Hemant Agrawal, Sachin Saxena
Rather than silently ignore an invalid driver, enforce every registered
driver has a probe callback.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/bus/dpaa/dpaa_bus.c | 6 +++---
drivers/bus/fslmc/fslmc_bus.c | 7 +------
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index d9830b68ca..5e0f32bfe8 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -614,6 +614,7 @@ void
rte_dpaa_driver_register(struct rte_dpaa_driver *driver)
{
RTE_VERIFY(driver);
+ RTE_VERIFY(driver->probe != NULL);
BUS_INIT_FUNC_TRACE();
@@ -808,9 +809,8 @@ rte_dpaa_bus_probe(void)
if (rte_dev_is_probed(&dev->device))
continue;
- if (!drv->probe ||
- (dev->device.devargs &&
- dev->device.devargs->policy == RTE_DEV_BLOCKED))
+ if (dev->device.devargs &&
+ dev->device.devargs->policy == RTE_DEV_BLOCKED)
continue;
if (probe_all ||
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index abdb0ad50d..ac9fb7a08c 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -465,9 +465,6 @@ rte_fslmc_probe(void)
if (ret)
continue;
- if (!drv->probe)
- continue;
-
if (rte_dev_is_probed(&dev->device))
continue;
@@ -534,6 +531,7 @@ void
rte_fslmc_driver_register(struct rte_dpaa2_driver *driver)
{
RTE_VERIFY(driver);
+ RTE_VERIFY(driver->probe != NULL);
TAILQ_INSERT_TAIL(&rte_fslmc_bus.driver_list, driver, next);
}
@@ -601,9 +599,6 @@ fslmc_bus_plug(struct rte_device *rte_dev)
if (ret)
continue;
- if (!drv->probe)
- continue;
-
if (rte_dev_is_probed(&dev->device))
continue;
--
2.53.0
^ permalink raw reply related [flat|nested] 67+ messages in thread* Re: [PATCH 3/8] drivers/bus: require probe function for NXP drivers
2026-03-23 10:52 ` [PATCH 3/8] drivers/bus: require probe function for NXP drivers David Marchand
@ 2026-03-23 16:59 ` Kevin Traynor
2026-03-24 5:15 ` Hemant Agrawal
1 sibling, 0 replies; 67+ messages in thread
From: Kevin Traynor @ 2026-03-23 16:59 UTC (permalink / raw)
To: David Marchand, dev; +Cc: Bruce Richardson, Hemant Agrawal, Sachin Saxena
On 3/23/26 10:52 AM, David Marchand wrote:
> Rather than silently ignore an invalid driver, enforce every registered
> driver has a probe callback.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> drivers/bus/dpaa/dpaa_bus.c | 6 +++---
> drivers/bus/fslmc/fslmc_bus.c | 7 +------
> 2 files changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
> index d9830b68ca..5e0f32bfe8 100644
> --- a/drivers/bus/dpaa/dpaa_bus.c
> +++ b/drivers/bus/dpaa/dpaa_bus.c
> @@ -614,6 +614,7 @@ void
> rte_dpaa_driver_register(struct rte_dpaa_driver *driver)
> {
> RTE_VERIFY(driver);
> + RTE_VERIFY(driver->probe != NULL);
>
> BUS_INIT_FUNC_TRACE();
>
> @@ -808,9 +809,8 @@ rte_dpaa_bus_probe(void)
> if (rte_dev_is_probed(&dev->device))
> continue;
>
> - if (!drv->probe ||
> - (dev->device.devargs &&
> - dev->device.devargs->policy == RTE_DEV_BLOCKED))
> + if (dev->device.devargs &&
> + dev->device.devargs->policy == RTE_DEV_BLOCKED)
> continue;
>
> if (probe_all ||
> diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
> index abdb0ad50d..ac9fb7a08c 100644
> --- a/drivers/bus/fslmc/fslmc_bus.c
> +++ b/drivers/bus/fslmc/fslmc_bus.c
> @@ -465,9 +465,6 @@ rte_fslmc_probe(void)
> if (ret)
> continue;
>
> - if (!drv->probe)
> - continue;
> -
> if (rte_dev_is_probed(&dev->device))
> continue;
>
> @@ -534,6 +531,7 @@ void
> rte_fslmc_driver_register(struct rte_dpaa2_driver *driver)
> {
> RTE_VERIFY(driver);
> + RTE_VERIFY(driver->probe != NULL);
>
> TAILQ_INSERT_TAIL(&rte_fslmc_bus.driver_list, driver, next);
> }
> @@ -601,9 +599,6 @@ fslmc_bus_plug(struct rte_device *rte_dev)
> if (ret)
> continue;
>
> - if (!drv->probe)
> - continue;
> -
> if (rte_dev_is_probed(&dev->device))
> continue;
>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
^ permalink raw reply [flat|nested] 67+ messages in thread* Re: [PATCH 3/8] drivers/bus: require probe function for NXP drivers
2026-03-23 10:52 ` [PATCH 3/8] drivers/bus: require probe function for NXP drivers David Marchand
2026-03-23 16:59 ` Kevin Traynor
@ 2026-03-24 5:15 ` Hemant Agrawal
1 sibling, 0 replies; 67+ messages in thread
From: Hemant Agrawal @ 2026-03-24 5:15 UTC (permalink / raw)
To: David Marchand, dev; +Cc: Bruce Richardson, Hemant Agrawal, Sachin Saxena
On 23-03-2026 16:22, David Marchand wrote:
> Rather than silently ignore an invalid driver, enforce every registered
> driver has a probe callback.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>
^ permalink raw reply [flat|nested] 67+ messages in thread
* [PATCH 4/8] drivers: cleanup devargs lookup in bus scan
2026-03-23 10:52 [PATCH 0/8] Rework device probing David Marchand
` (2 preceding siblings ...)
2026-03-23 10:52 ` [PATCH 3/8] drivers/bus: require probe function for NXP drivers David Marchand
@ 2026-03-23 10:52 ` David Marchand
2026-03-24 5:16 ` Hemant Agrawal
` (2 more replies)
2026-03-23 10:52 ` [PATCH 5/8] bus: factorize devargs lookup David Marchand
` (7 subsequent siblings)
11 siblings, 3 replies; 67+ messages in thread
From: David Marchand @ 2026-03-23 10:52 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, Parav Pandit, Xueming Li, Nipun Gupta,
Nikhil Agarwal, Hemant Agrawal, Sachin Saxena, Rosen Xu,
Chenbo Xia, Tomasz Duszynski, Chengwen Feng, Long Li, Wei Hu
Don't hardcode the bus names in the RTE_EAL_DEVARGS_FOREACH() calls.
The bus name is set by code in EAL.
Even if there is nothing broken, let's reuse the name from the bus object.
And remove the now useless macros.
Note: in the ifpga bus case, the call was using an incorrect macro
(IFPGA_ARG_NAME instead of IFPGA_BUS_NAME), yet it was working fine
as this macro is aligned with the ifpga bus name.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/bus/auxiliary/auxiliary_common.c | 2 +-
drivers/bus/auxiliary/bus_auxiliary_driver.h | 2 --
drivers/bus/cdx/cdx.c | 3 +--
drivers/bus/dpaa/dpaa_bus.c | 6 ++----
drivers/bus/fslmc/fslmc_bus.c | 8 +++-----
drivers/bus/ifpga/bus_ifpga_driver.h | 2 --
drivers/bus/ifpga/ifpga_bus.c | 4 ++--
drivers/bus/pci/pci_common.c | 2 +-
drivers/bus/platform/platform.c | 2 +-
drivers/bus/uacce/uacce.c | 2 +-
drivers/bus/vdev/vdev.c | 2 +-
drivers/bus/vmbus/vmbus_common.c | 2 +-
drivers/raw/ifpga/ifpga_rawdev.c | 2 +-
13 files changed, 15 insertions(+), 24 deletions(-)
diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index ac766e283e..119533df28 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -30,7 +30,7 @@ auxiliary_devargs_lookup(const char *name)
{
struct rte_devargs *devargs;
- RTE_EAL_DEVARGS_FOREACH(RTE_BUS_AUXILIARY_NAME, devargs) {
+ RTE_EAL_DEVARGS_FOREACH(auxiliary_bus.bus.name, devargs) {
if (strcmp(devargs->name, name) == 0)
return devargs;
}
diff --git a/drivers/bus/auxiliary/bus_auxiliary_driver.h b/drivers/bus/auxiliary/bus_auxiliary_driver.h
index 1dc814151e..8450d56583 100644
--- a/drivers/bus/auxiliary/bus_auxiliary_driver.h
+++ b/drivers/bus/auxiliary/bus_auxiliary_driver.h
@@ -28,8 +28,6 @@
extern "C" {
#endif
-#define RTE_BUS_AUXILIARY_NAME "auxiliary"
-
/* Forward declarations */
struct rte_auxiliary_driver;
struct rte_auxiliary_device;
diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
index 729d54337c..b183d98453 100644
--- a/drivers/bus/cdx/cdx.c
+++ b/drivers/bus/cdx/cdx.c
@@ -82,7 +82,6 @@
#include "cdx_logs.h"
#include "private.h"
-#define CDX_BUS_NAME cdx
#define CDX_DEV_PREFIX "cdx-"
/* CDX Bus iterators */
@@ -157,7 +156,7 @@ cdx_devargs_lookup(const char *dev_name)
{
struct rte_devargs *devargs;
- RTE_EAL_DEVARGS_FOREACH("cdx", devargs) {
+ RTE_EAL_DEVARGS_FOREACH(rte_cdx_bus.bus.name, devargs) {
if (strcmp(devargs->name, dev_name) == 0)
return devargs;
}
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 5e0f32bfe8..e3c17d41f7 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -77,8 +77,6 @@ static pthread_key_t dpaa_portal_key;
struct dpaa_portal *dpaa_portals[RTE_MAX_LCORE] = {NULL};
static int dpaa_bus_global_init;
-#define FSL_DPAA_BUS_NAME dpaa_bus
-
RTE_EXPORT_INTERNAL_SYMBOL(per_lcore_dpaa_io)
RTE_DEFINE_PER_LCORE(struct dpaa_portal *, dpaa_io);
@@ -206,7 +204,7 @@ dpaa_devargs_lookup(struct rte_dpaa_device *dev)
struct rte_devargs *devargs;
char dev_name[32];
- RTE_EAL_DEVARGS_FOREACH("dpaa_bus", devargs) {
+ RTE_EAL_DEVARGS_FOREACH(rte_dpaa_bus.bus.name, devargs) {
devargs->bus->parse(devargs->name, &dev_name);
if (strcmp(dev_name, dev->device.name) == 0) {
DPAA_BUS_INFO("**Devargs matched %s", dev_name);
@@ -1003,5 +1001,5 @@ static struct rte_dpaa_bus rte_dpaa_bus = {
.device_count = 0,
};
-RTE_REGISTER_BUS(FSL_DPAA_BUS_NAME, rte_dpaa_bus.bus);
+RTE_REGISTER_BUS(dpaa_bus, rte_dpaa_bus.bus);
RTE_LOG_REGISTER_DEFAULT(dpaa_logtype_bus, NOTICE);
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index ac9fb7a08c..8f3e3dc1be 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -26,7 +26,6 @@
#include <dpaax_iova_table.h>
#define VFIO_IOMMU_GROUP_PATH "/sys/kernel/iommu_groups"
-#define FSLMC_BUS_NAME fslmc
struct rte_fslmc_bus rte_fslmc_bus;
@@ -106,7 +105,7 @@ fslmc_devargs_lookup(struct rte_dpaa2_device *dev)
struct rte_devargs *devargs;
char dev_name[32];
- RTE_EAL_DEVARGS_FOREACH("fslmc", devargs) {
+ RTE_EAL_DEVARGS_FOREACH(rte_fslmc_bus.bus.name, devargs) {
devargs->bus->parse(devargs->name, &dev_name);
if (strcmp(dev_name, dev->device.name) == 0) {
DPAA2_BUS_INFO("**Devargs matched %s", dev_name);
@@ -266,8 +265,7 @@ rte_fslmc_parse(const char *name, void *addr)
*/
if (sep_exists) {
/* If either of "fslmc" or "name" are starting part */
- if (!strncmp(name, RTE_STR(FSLMC_BUS_NAME),
- strlen(RTE_STR(FSLMC_BUS_NAME))) ||
+ if (!strncmp(name, rte_fslmc_bus.bus.name, strlen(rte_fslmc_bus.bus.name)) ||
(!strncmp(name, "name", strlen("name")))) {
goto jump_out;
} else {
@@ -704,5 +702,5 @@ struct rte_fslmc_bus rte_fslmc_bus = {
.device_count = {0},
};
-RTE_REGISTER_BUS(FSLMC_BUS_NAME, rte_fslmc_bus.bus);
+RTE_REGISTER_BUS(fslmc, rte_fslmc_bus.bus);
RTE_LOG_REGISTER_DEFAULT(dpaa2_logtype_bus, NOTICE);
diff --git a/drivers/bus/ifpga/bus_ifpga_driver.h b/drivers/bus/ifpga/bus_ifpga_driver.h
index d34ab8cec1..5e77a8f170 100644
--- a/drivers/bus/ifpga/bus_ifpga_driver.h
+++ b/drivers/bus/ifpga/bus_ifpga_driver.h
@@ -21,8 +21,6 @@
extern "C" {
#endif /* __cplusplus */
-#define IFPGA_BUS_NAME ifpga
-
/* Forward declarations */
struct rte_afu_device;
struct rte_afu_driver;
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index fdce1f6b1f..2692a09d15 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -220,7 +220,7 @@ ifpga_scan(void)
struct rte_afu_device *afu_dev = NULL;
/* for FPGA devices we scan the devargs_list populated via cmdline */
- RTE_EAL_DEVARGS_FOREACH(IFPGA_ARG_NAME, devargs) {
+ RTE_EAL_DEVARGS_FOREACH(rte_ifpga_bus.name, devargs) {
if (devargs->bus != &rte_ifpga_bus)
continue;
@@ -516,5 +516,5 @@ static struct rte_bus rte_ifpga_bus = {
.parse = ifpga_parse,
};
-RTE_REGISTER_BUS(IFPGA_BUS_NAME, rte_ifpga_bus);
+RTE_REGISTER_BUS(ifpga, rte_ifpga_bus);
RTE_LOG_REGISTER_DEFAULT(ifpga_bus_logtype, NOTICE);
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index bf5df3d94e..1d26fce680 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -85,7 +85,7 @@ pci_devargs_lookup(const struct rte_pci_addr *pci_addr)
struct rte_devargs *devargs;
struct rte_pci_addr addr;
- RTE_EAL_DEVARGS_FOREACH("pci", devargs) {
+ RTE_EAL_DEVARGS_FOREACH(rte_pci_bus.bus.name, devargs) {
devargs->bus->parse(devargs->name, &addr);
if (!rte_pci_addr_cmp(pci_addr, &addr))
return devargs;
diff --git a/drivers/bus/platform/platform.c b/drivers/bus/platform/platform.c
index f6673cf181..18fa73795c 100644
--- a/drivers/bus/platform/platform.c
+++ b/drivers/bus/platform/platform.c
@@ -48,7 +48,7 @@ dev_devargs(const char *dev_name)
{
struct rte_devargs *devargs;
- RTE_EAL_DEVARGS_FOREACH("platform", devargs) {
+ RTE_EAL_DEVARGS_FOREACH(platform_bus.bus.name, devargs) {
if (!strcmp(devargs->name, dev_name))
return devargs;
}
diff --git a/drivers/bus/uacce/uacce.c b/drivers/bus/uacce/uacce.c
index a471edcad0..06a3643290 100644
--- a/drivers/bus/uacce/uacce.c
+++ b/drivers/bus/uacce/uacce.c
@@ -77,7 +77,7 @@ uacce_devargs_lookup(const char *dev_name)
struct rte_devargs *devargs;
snprintf(name, sizeof(name), "%s%s", UACCE_DEV_PREFIX, dev_name);
- RTE_EAL_DEVARGS_FOREACH("uacce", devargs) {
+ RTE_EAL_DEVARGS_FOREACH(uacce_bus.bus.name, devargs) {
if (strcmp(devargs->name, name) == 0)
return devargs;
}
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index be375f63dc..eb1de0186e 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -526,7 +526,7 @@ vdev_scan(void)
rte_spinlock_unlock(&vdev_custom_scan_lock);
/* for virtual devices we scan the devargs_list populated via cmdline */
- RTE_EAL_DEVARGS_FOREACH("vdev", devargs) {
+ RTE_EAL_DEVARGS_FOREACH(rte_vdev_bus.name, devargs) {
dev = calloc(1, sizeof(*dev));
if (!dev)
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index a787d8b18d..f857244c85 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -271,7 +271,7 @@ vmbus_devargs_lookup(struct rte_vmbus_device *dev)
struct rte_devargs *devargs;
rte_uuid_t addr;
- RTE_EAL_DEVARGS_FOREACH("vmbus", devargs) {
+ RTE_EAL_DEVARGS_FOREACH(rte_vmbus_bus.bus.name, devargs) {
vmbus_parse(devargs->name, &addr);
if (rte_uuid_compare(dev->device_id, addr) == 0)
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 5b9b596435..01e9427d53 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -1823,7 +1823,7 @@ ifpga_cfg_probe(struct rte_vdev_device *vdev)
snprintf(dev_name, RTE_RAWDEV_NAME_MAX_LEN, "%d|%s",
args.port, args.bdf);
- ret = rte_eal_hotplug_add(RTE_STR(IFPGA_BUS_NAME),
+ ret = rte_eal_hotplug_add(vdev->device.devargs->bus->name,
dev_name, vdev->device.devargs->args);
if (ret) {
rte_free(ifpga_dev->vdev_name[i]);
--
2.53.0
^ permalink raw reply related [flat|nested] 67+ messages in thread* Re: [PATCH 4/8] drivers: cleanup devargs lookup in bus scan
2026-03-23 10:52 ` [PATCH 4/8] drivers: cleanup devargs lookup in bus scan David Marchand
@ 2026-03-24 5:16 ` Hemant Agrawal
2026-03-24 14:13 ` Kevin Traynor
2026-03-24 16:10 ` Stephen Hemminger
2 siblings, 0 replies; 67+ messages in thread
From: Hemant Agrawal @ 2026-03-24 5:16 UTC (permalink / raw)
To: David Marchand, dev
Cc: Bruce Richardson, Parav Pandit, Xueming Li, Nipun Gupta,
Nikhil Agarwal, Hemant Agrawal, Sachin Saxena, Rosen Xu,
Chenbo Xia, Tomasz Duszynski, Chengwen Feng, Long Li, Wei Hu
On 23-03-2026 16:22, David Marchand wrote:
> Don't hardcode the bus names in the RTE_EAL_DEVARGS_FOREACH() calls.
> The bus name is set by code in EAL.
> Even if there is nothing broken, let's reuse the name from the bus object.
>
> And remove the now useless macros.
>
> Note: in the ifpga bus case, the call was using an incorrect macro
> (IFPGA_ARG_NAME instead of IFPGA_BUS_NAME), yet it was working fine
> as this macro is aligned with the ifpga bus name.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> drivers/bus/auxiliary/auxiliary_common.c | 2 +-
> drivers/bus/auxiliary/bus_auxiliary_driver.h | 2 --
> drivers/bus/cdx/cdx.c | 3 +--
> drivers/bus/dpaa/dpaa_bus.c | 6 ++----
> drivers/bus/fslmc/fslmc_bus.c | 8 +++-----
> drivers/bus/ifpga/bus_ifpga_driver.h | 2 --
> drivers/bus/ifpga/ifpga_bus.c | 4 ++--
> drivers/bus/pci/pci_common.c | 2 +-
> drivers/bus/platform/platform.c | 2 +-
> drivers/bus/uacce/uacce.c | 2 +-
> drivers/bus/vdev/vdev.c | 2 +-
> drivers/bus/vmbus/vmbus_common.c | 2 +-
> drivers/raw/ifpga/ifpga_rawdev.c | 2 +-
> 13 files changed, 15 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
> index ac766e283e..119533df28 100644
> --- a/drivers/bus/auxiliary/auxiliary_common.c
> +++ b/drivers/bus/auxiliary/auxiliary_common.c
> @@ -30,7 +30,7 @@ auxiliary_devargs_lookup(const char *name)
> {
> struct rte_devargs *devargs;
>
> - RTE_EAL_DEVARGS_FOREACH(RTE_BUS_AUXILIARY_NAME, devargs) {
> + RTE_EAL_DEVARGS_FOREACH(auxiliary_bus.bus.name, devargs) {
> if (strcmp(devargs->name, name) == 0)
> return devargs;
> }
> diff --git a/drivers/bus/auxiliary/bus_auxiliary_driver.h b/drivers/bus/auxiliary/bus_auxiliary_driver.h
> index 1dc814151e..8450d56583 100644
> --- a/drivers/bus/auxiliary/bus_auxiliary_driver.h
> +++ b/drivers/bus/auxiliary/bus_auxiliary_driver.h
> @@ -28,8 +28,6 @@
> extern "C" {
> #endif
>
> -#define RTE_BUS_AUXILIARY_NAME "auxiliary"
> -
> /* Forward declarations */
> struct rte_auxiliary_driver;
> struct rte_auxiliary_device;
> diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
> index 729d54337c..b183d98453 100644
> --- a/drivers/bus/cdx/cdx.c
> +++ b/drivers/bus/cdx/cdx.c
> @@ -82,7 +82,6 @@
> #include "cdx_logs.h"
> #include "private.h"
>
> -#define CDX_BUS_NAME cdx
> #define CDX_DEV_PREFIX "cdx-"
>
> /* CDX Bus iterators */
> @@ -157,7 +156,7 @@ cdx_devargs_lookup(const char *dev_name)
> {
> struct rte_devargs *devargs;
>
> - RTE_EAL_DEVARGS_FOREACH("cdx", devargs) {
> + RTE_EAL_DEVARGS_FOREACH(rte_cdx_bus.bus.name, devargs) {
> if (strcmp(devargs->name, dev_name) == 0)
> return devargs;
> }
> diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
> index 5e0f32bfe8..e3c17d41f7 100644
> --- a/drivers/bus/dpaa/dpaa_bus.c
> +++ b/drivers/bus/dpaa/dpaa_bus.c
> @@ -77,8 +77,6 @@ static pthread_key_t dpaa_portal_key;
> struct dpaa_portal *dpaa_portals[RTE_MAX_LCORE] = {NULL};
> static int dpaa_bus_global_init;
>
> -#define FSL_DPAA_BUS_NAME dpaa_bus
> -
> RTE_EXPORT_INTERNAL_SYMBOL(per_lcore_dpaa_io)
> RTE_DEFINE_PER_LCORE(struct dpaa_portal *, dpaa_io);
>
> @@ -206,7 +204,7 @@ dpaa_devargs_lookup(struct rte_dpaa_device *dev)
> struct rte_devargs *devargs;
> char dev_name[32];
>
> - RTE_EAL_DEVARGS_FOREACH("dpaa_bus", devargs) {
> + RTE_EAL_DEVARGS_FOREACH(rte_dpaa_bus.bus.name, devargs) {
> devargs->bus->parse(devargs->name, &dev_name);
> if (strcmp(dev_name, dev->device.name) == 0) {
> DPAA_BUS_INFO("**Devargs matched %s", dev_name);
> @@ -1003,5 +1001,5 @@ static struct rte_dpaa_bus rte_dpaa_bus = {
> .device_count = 0,
> };
>
> -RTE_REGISTER_BUS(FSL_DPAA_BUS_NAME, rte_dpaa_bus.bus);
> +RTE_REGISTER_BUS(dpaa_bus, rte_dpaa_bus.bus);
> RTE_LOG_REGISTER_DEFAULT(dpaa_logtype_bus, NOTICE);
> diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
> index ac9fb7a08c..8f3e3dc1be 100644
> --- a/drivers/bus/fslmc/fslmc_bus.c
> +++ b/drivers/bus/fslmc/fslmc_bus.c
> @@ -26,7 +26,6 @@
> #include <dpaax_iova_table.h>
>
> #define VFIO_IOMMU_GROUP_PATH "/sys/kernel/iommu_groups"
> -#define FSLMC_BUS_NAME fslmc
>
> struct rte_fslmc_bus rte_fslmc_bus;
>
> @@ -106,7 +105,7 @@ fslmc_devargs_lookup(struct rte_dpaa2_device *dev)
> struct rte_devargs *devargs;
> char dev_name[32];
>
> - RTE_EAL_DEVARGS_FOREACH("fslmc", devargs) {
> + RTE_EAL_DEVARGS_FOREACH(rte_fslmc_bus.bus.name, devargs) {
> devargs->bus->parse(devargs->name, &dev_name);
> if (strcmp(dev_name, dev->device.name) == 0) {
> DPAA2_BUS_INFO("**Devargs matched %s", dev_name);
> @@ -266,8 +265,7 @@ rte_fslmc_parse(const char *name, void *addr)
> */
> if (sep_exists) {
> /* If either of "fslmc" or "name" are starting part */
> - if (!strncmp(name, RTE_STR(FSLMC_BUS_NAME),
> - strlen(RTE_STR(FSLMC_BUS_NAME))) ||
> + if (!strncmp(name, rte_fslmc_bus.bus.name, strlen(rte_fslmc_bus.bus.name)) ||
> (!strncmp(name, "name", strlen("name")))) {
> goto jump_out;
> } else {
> @@ -704,5 +702,5 @@ struct rte_fslmc_bus rte_fslmc_bus = {
> .device_count = {0},
> };
>
> -RTE_REGISTER_BUS(FSLMC_BUS_NAME, rte_fslmc_bus.bus);
> +RTE_REGISTER_BUS(fslmc, rte_fslmc_bus.bus);
> RTE_LOG_REGISTER_DEFAULT(dpaa2_logtype_bus, NOTICE);
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
^ permalink raw reply [flat|nested] 67+ messages in thread* Re: [PATCH 4/8] drivers: cleanup devargs lookup in bus scan
2026-03-23 10:52 ` [PATCH 4/8] drivers: cleanup devargs lookup in bus scan David Marchand
2026-03-24 5:16 ` Hemant Agrawal
@ 2026-03-24 14:13 ` Kevin Traynor
2026-03-24 16:10 ` Stephen Hemminger
2 siblings, 0 replies; 67+ messages in thread
From: Kevin Traynor @ 2026-03-24 14:13 UTC (permalink / raw)
To: David Marchand, dev
Cc: Bruce Richardson, Parav Pandit, Xueming Li, Nipun Gupta,
Nikhil Agarwal, Hemant Agrawal, Sachin Saxena, Rosen Xu,
Chenbo Xia, Tomasz Duszynski, Chengwen Feng, Long Li, Wei Hu
On 3/23/26 10:52 AM, David Marchand wrote:
> Don't hardcode the bus names in the RTE_EAL_DEVARGS_FOREACH() calls.
> The bus name is set by code in EAL.
> Even if there is nothing broken, let's reuse the name from the bus object.
>
> And remove the now useless macros.
>
> Note: in the ifpga bus case, the call was using an incorrect macro
> (IFPGA_ARG_NAME instead of IFPGA_BUS_NAME), yet it was working fine
> as this macro is aligned with the ifpga bus name.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> drivers/bus/auxiliary/auxiliary_common.c | 2 +-
> drivers/bus/auxiliary/bus_auxiliary_driver.h | 2 --
> drivers/bus/cdx/cdx.c | 3 +--
> drivers/bus/dpaa/dpaa_bus.c | 6 ++----
> drivers/bus/fslmc/fslmc_bus.c | 8 +++-----
> drivers/bus/ifpga/bus_ifpga_driver.h | 2 --
> drivers/bus/ifpga/ifpga_bus.c | 4 ++--
> drivers/bus/pci/pci_common.c | 2 +-
> drivers/bus/platform/platform.c | 2 +-
> drivers/bus/uacce/uacce.c | 2 +-
> drivers/bus/vdev/vdev.c | 2 +-
> drivers/bus/vmbus/vmbus_common.c | 2 +-
> drivers/raw/ifpga/ifpga_rawdev.c | 2 +-
> 13 files changed, 15 insertions(+), 24 deletions(-)
>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
^ permalink raw reply [flat|nested] 67+ messages in thread
* Re: [PATCH 4/8] drivers: cleanup devargs lookup in bus scan
2026-03-23 10:52 ` [PATCH 4/8] drivers: cleanup devargs lookup in bus scan David Marchand
2026-03-24 5:16 ` Hemant Agrawal
2026-03-24 14:13 ` Kevin Traynor
@ 2026-03-24 16:10 ` Stephen Hemminger
2 siblings, 0 replies; 67+ messages in thread
From: Stephen Hemminger @ 2026-03-24 16:10 UTC (permalink / raw)
To: David Marchand
Cc: dev, Bruce Richardson, Parav Pandit, Xueming Li, Nipun Gupta,
Nikhil Agarwal, Hemant Agrawal, Sachin Saxena, Rosen Xu,
Chenbo Xia, Tomasz Duszynski, Chengwen Feng, Long Li, Wei Hu
On Mon, 23 Mar 2026 11:52:58 +0100
David Marchand <david.marchand@redhat.com> wrote:
> Don't hardcode the bus names in the RTE_EAL_DEVARGS_FOREACH() calls.
> The bus name is set by code in EAL.
> Even if there is nothing broken, let's reuse the name from the bus object.
>
> And remove the now useless macros.
>
> Note: in the ifpga bus case, the call was using an incorrect macro
> (IFPGA_ARG_NAME instead of IFPGA_BUS_NAME), yet it was working fine
> as this macro is aligned with the ifpga bus name.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
AI review feedback:
Patch 4/8: drivers: cleanup devargs lookup in bus scan
Error: In drivers/raw/ifpga/ifpga_rawdev.c, the change from
RTE_STR(IFPGA_BUS_NAME) to vdev->device.devargs->bus->name passes the
wrong bus name to rte_eal_hotplug_add(). The vdev is a vdev device
(registered via --vdev ifpga_rawdev_cfg,...), so
vdev->device.devargs->bus is the vdev bus, and its name is "vdev". The
old code correctly passed "ifpga" to hotplug the device onto the ifpga
bus. The new code would attempt to add the device to the vdev bus
instead.
Suggested fix: use rte_ifpga_bus.name (the ifpga bus object) or a local
string "ifpga" rather than deriving it from the vdev's devargs.
^ permalink raw reply [flat|nested] 67+ messages in thread
* [PATCH 5/8] bus: factorize devargs lookup
2026-03-23 10:52 [PATCH 0/8] Rework device probing David Marchand
` (3 preceding siblings ...)
2026-03-23 10:52 ` [PATCH 4/8] drivers: cleanup devargs lookup in bus scan David Marchand
@ 2026-03-23 10:52 ` David Marchand
2026-03-24 14:16 ` Kevin Traynor
2026-03-24 16:11 ` Stephen Hemminger
2026-03-23 10:53 ` [PATCH 6/8] bus: factorize device selection David Marchand
` (6 subsequent siblings)
11 siblings, 2 replies; 67+ messages in thread
From: David Marchand @ 2026-03-23 10:52 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, Parav Pandit, Xueming Li, Nipun Gupta,
Nikhil Agarwal, Hemant Agrawal, Sachin Saxena, Chenbo Xia,
Tomasz Duszynski, Chengwen Feng, Long Li, Wei Hu, Kevin Laatz
Each bus reimplements some similar devargs lookup code.
The differences are in how some bus (PCI, VMBUS etc...) normalizes the
device names. We can't use the .parse existing handler from outside the
bus code itself, as the size of the bus specific device location address
is unknown.
Introduce a bus specific helper to compare two device names and
hide this ugly detail.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since RFC v3:
- fixed doxygen,
---
drivers/bus/auxiliary/auxiliary_common.c | 16 ++-------
drivers/bus/cdx/cdx.c | 14 +-------
drivers/bus/dpaa/dpaa_bus.c | 41 +++++++++++++-----------
drivers/bus/fslmc/fslmc_bus.c | 34 ++++++++++----------
drivers/bus/pci/pci_common.c | 38 +++++++++++-----------
drivers/bus/platform/platform.c | 17 ++--------
drivers/bus/uacce/uacce.c | 19 ++---------
drivers/bus/vmbus/linux/vmbus_bus.c | 2 +-
drivers/bus/vmbus/private.h | 3 --
drivers/bus/vmbus/vmbus_common.c | 30 ++++++++---------
drivers/dma/idxd/idxd_bus.c | 14 ++------
lib/eal/common/eal_common_bus.c | 20 ++++++++++++
lib/eal/include/bus_driver.h | 31 ++++++++++++++++++
13 files changed, 132 insertions(+), 147 deletions(-)
diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index 119533df28..e5b4f4460d 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -25,18 +25,6 @@
#include "private.h"
-static struct rte_devargs *
-auxiliary_devargs_lookup(const char *name)
-{
- struct rte_devargs *devargs;
-
- RTE_EAL_DEVARGS_FOREACH(auxiliary_bus.bus.name, devargs) {
- if (strcmp(devargs->name, name) == 0)
- return devargs;
- }
- return NULL;
-}
-
#ifndef AUXILIARY_OS_SUPPORTED
/*
* Test whether the auxiliary device exist.
@@ -68,7 +56,7 @@ auxiliary_scan(void)
void
auxiliary_on_scan(struct rte_auxiliary_device *aux_dev)
{
- aux_dev->device.devargs = auxiliary_devargs_lookup(aux_dev->name);
+ aux_dev->device.devargs = rte_bus_find_devargs(&auxiliary_bus.bus, aux_dev->name);
}
/*
@@ -399,7 +387,7 @@ auxiliary_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova,
bool
auxiliary_is_ignored_device(const char *name)
{
- struct rte_devargs *devargs = auxiliary_devargs_lookup(name);
+ struct rte_devargs *devargs = rte_bus_find_devargs(&auxiliary_bus.bus, name);
switch (auxiliary_bus.bus.conf.scan_mode) {
case RTE_BUS_SCAN_ALLOWLIST:
diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
index b183d98453..0801825ef5 100644
--- a/drivers/bus/cdx/cdx.c
+++ b/drivers/bus/cdx/cdx.c
@@ -151,22 +151,10 @@ void rte_cdx_unmap_device(struct rte_cdx_device *dev)
cdx_vfio_unmap_resource(dev);
}
-static struct rte_devargs *
-cdx_devargs_lookup(const char *dev_name)
-{
- struct rte_devargs *devargs;
-
- RTE_EAL_DEVARGS_FOREACH(rte_cdx_bus.bus.name, devargs) {
- if (strcmp(devargs->name, dev_name) == 0)
- return devargs;
- }
- return NULL;
-}
-
static bool
cdx_ignore_device(const char *dev_name)
{
- struct rte_devargs *devargs = cdx_devargs_lookup(dev_name);
+ struct rte_devargs *devargs = rte_bus_find_devargs(&rte_cdx_bus.bus, dev_name);
switch (rte_cdx_bus.bus.conf.scan_mode) {
case RTE_BUS_SCAN_ALLOWLIST:
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index e3c17d41f7..356c56d989 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -198,22 +198,6 @@ dpaa_sec_available(void)
static void dpaa_clean_device_list(void);
-static struct rte_devargs *
-dpaa_devargs_lookup(struct rte_dpaa_device *dev)
-{
- struct rte_devargs *devargs;
- char dev_name[32];
-
- RTE_EAL_DEVARGS_FOREACH(rte_dpaa_bus.bus.name, devargs) {
- devargs->bus->parse(devargs->name, &dev_name);
- if (strcmp(dev_name, dev->device.name) == 0) {
- DPAA_BUS_INFO("**Devargs matched %s", dev_name);
- return devargs;
- }
- }
- return NULL;
-}
-
static int
dpaa_create_device_list(void)
{
@@ -269,7 +253,9 @@ dpaa_create_device_list(void)
(fman_intf->fman->idx + 1), fman_intf->mac_idx);
}
dev->device.name = dev->name;
- dev->device.devargs = dpaa_devargs_lookup(dev);
+ dev->device.devargs = rte_bus_find_devargs(&rte_dpaa_bus.bus, dev->name);
+ if (dev->device.devargs != NULL)
+ DPAA_BUS_INFO("**Devargs matched %s", dev->name);
dpaa_add_to_device_list(dev);
}
@@ -317,7 +303,9 @@ dpaa_create_device_list(void)
sprintf(dev->name, "dpaa_sec-%d", i+1);
DPAA_BUS_LOG(INFO, "%s cryptodev added", dev->name);
dev->device.name = dev->name;
- dev->device.devargs = dpaa_devargs_lookup(dev);
+ dev->device.devargs = rte_bus_find_devargs(&rte_dpaa_bus.bus, dev->name);
+ if (dev->device.devargs != NULL)
+ DPAA_BUS_INFO("**Devargs matched %s", dev->name);
dpaa_add_to_device_list(dev);
}
@@ -341,7 +329,9 @@ dpaa_create_device_list(void)
sprintf(dev->name, "dpaa_qdma-%d", i+1);
DPAA_BUS_LOG(INFO, "%s qdma device added", dev->name);
dev->device.name = dev->name;
- dev->device.devargs = dpaa_devargs_lookup(dev);
+ dev->device.devargs = rte_bus_find_devargs(&rte_dpaa_bus.bus, dev->name);
+ if (dev->device.devargs != NULL)
+ DPAA_BUS_INFO("**Devargs matched %s", dev->name);
dpaa_add_to_device_list(dev);
}
@@ -572,6 +562,18 @@ rte_dpaa_bus_parse(const char *name, void *out)
return 0;
}
+static int
+dpaa_bus_devname_compare(const char *name1, const char *name2)
+{
+ char devname1[32], devname2[32];
+
+ if (rte_dpaa_bus_parse(name1, devname1) != 0 ||
+ rte_dpaa_bus_parse(name2, devname2) != 0)
+ return 1;
+
+ return strncmp(devname1, devname2, sizeof(devname1));
+}
+
#define DPAA_DEV_PATH1 "/sys/devices/platform/soc/soc:fsl,dpaa"
#define DPAA_DEV_PATH2 "/sys/devices/platform/fsl,dpaa"
@@ -988,6 +990,7 @@ static struct rte_dpaa_bus rte_dpaa_bus = {
.scan = rte_dpaa_bus_scan,
.probe = rte_dpaa_bus_probe,
.parse = rte_dpaa_bus_parse,
+ .devname_compare = dpaa_bus_devname_compare,
.find_device = rte_dpaa_find_device,
.get_iommu_class = rte_dpaa_get_iommu_class,
.plug = dpaa_bus_plug,
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 8f3e3dc1be..f72b512b1a 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -99,22 +99,6 @@ insert_in_device_list(struct rte_dpaa2_device *newdev)
TAILQ_INSERT_TAIL(&rte_fslmc_bus.device_list, newdev, next);
}
-static struct rte_devargs *
-fslmc_devargs_lookup(struct rte_dpaa2_device *dev)
-{
- struct rte_devargs *devargs;
- char dev_name[32];
-
- RTE_EAL_DEVARGS_FOREACH(rte_fslmc_bus.bus.name, devargs) {
- devargs->bus->parse(devargs->name, &dev_name);
- if (strcmp(dev_name, dev->device.name) == 0) {
- DPAA2_BUS_INFO("**Devargs matched %s", dev_name);
- return devargs;
- }
- }
- return NULL;
-}
-
static void
dump_device_list(void)
{
@@ -216,7 +200,10 @@ scan_one_fslmc_device(char *dev_name)
ret = -ENOMEM;
goto cleanup;
}
- dev->device.devargs = fslmc_devargs_lookup(dev);
+ dev->device.devargs = rte_bus_find_devargs(&rte_fslmc_bus.bus, dev_name);
+ if (dev->device.devargs != NULL)
+ DPAA2_BUS_INFO("**Devargs matched %s", dev_name);
+
/* Update the device found into the device_count table */
rte_fslmc_bus.device_count[dev->dev_type]++;
@@ -308,6 +295,18 @@ rte_fslmc_parse(const char *name, void *addr)
return ret;
}
+static int
+fslmc_devname_compare(const char *name1, const char *name2)
+{
+ char devname1[32], devname2[32];
+
+ if (rte_fslmc_parse(name1, devname1) != 0 ||
+ rte_fslmc_parse(name2, devname2) != 0)
+ return 1;
+
+ return strncmp(devname1, devname2, sizeof(devname1));
+}
+
static int
rte_fslmc_scan(void)
{
@@ -691,6 +690,7 @@ struct rte_fslmc_bus rte_fslmc_bus = {
.probe = rte_fslmc_probe,
.cleanup = rte_fslmc_close,
.parse = rte_fslmc_parse,
+ .devname_compare = fslmc_devname_compare,
.find_device = rte_fslmc_find_device,
.get_iommu_class = rte_dpaa2_get_iommu_class,
.plug = fslmc_bus_plug,
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 1d26fce680..8782dc342a 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -79,32 +79,15 @@ pci_asprintf(char **buffer, const char *format, ...)
}
#endif /* RTE_EXEC_ENV_WINDOWS */
-static struct rte_devargs *
-pci_devargs_lookup(const struct rte_pci_addr *pci_addr)
-{
- struct rte_devargs *devargs;
- struct rte_pci_addr addr;
-
- RTE_EAL_DEVARGS_FOREACH(rte_pci_bus.bus.name, devargs) {
- devargs->bus->parse(devargs->name, &addr);
- if (!rte_pci_addr_cmp(pci_addr, &addr))
- return devargs;
- }
- return NULL;
-}
-
void
pci_common_set(struct rte_pci_device *dev)
{
- struct rte_devargs *devargs;
-
/* Each device has its internal, canonical name set. */
rte_pci_device_name(&dev->addr,
dev->name, sizeof(dev->name));
dev->device.name = dev->name;
- devargs = pci_devargs_lookup(&dev->addr);
- dev->device.devargs = devargs;
+ dev->device.devargs = rte_bus_find_devargs(&rte_pci_bus.bus, dev->name);
if (dev->bus_info != NULL ||
asprintf(&dev->bus_info, "vendor_id=%"PRIx16", device_id=%"PRIx16,
@@ -503,6 +486,18 @@ pci_parse(const char *name, void *addr)
return parse == false;
}
+static int
+pci_devname_compare(const char *name1, const char *name2)
+{
+ struct rte_pci_addr addr1, addr2;
+
+ if (rte_pci_addr_parse(name1, &addr1) != 0 ||
+ rte_pci_addr_parse(name2, &addr2) != 0)
+ return 1;
+
+ return rte_pci_addr_cmp(&addr1, &addr2);
+}
+
/* register a driver */
RTE_EXPORT_INTERNAL_SYMBOL(rte_pci_register)
void
@@ -721,7 +716,11 @@ pci_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
bool
rte_pci_ignore_device(const struct rte_pci_addr *pci_addr)
{
- struct rte_devargs *devargs = pci_devargs_lookup(pci_addr);
+ char name[RTE_DEV_NAME_MAX_LEN];
+ struct rte_devargs *devargs;
+
+ rte_pci_device_name(pci_addr, name, sizeof(name));
+ devargs = rte_bus_find_devargs(&rte_pci_bus.bus, name);
switch (rte_pci_bus.bus.conf.scan_mode) {
case RTE_BUS_SCAN_ALLOWLIST:
@@ -946,6 +945,7 @@ struct rte_pci_bus rte_pci_bus = {
.plug = pci_plug,
.unplug = pci_unplug,
.parse = pci_parse,
+ .devname_compare = pci_devname_compare,
.devargs_parse = rte_pci_devargs_parse,
.dma_map = pci_dma_map,
.dma_unmap = pci_dma_unmap,
diff --git a/drivers/bus/platform/platform.c b/drivers/bus/platform/platform.c
index 18fa73795c..23c39aada6 100644
--- a/drivers/bus/platform/platform.c
+++ b/drivers/bus/platform/platform.c
@@ -43,25 +43,12 @@ rte_platform_unregister(struct rte_platform_driver *pdrv)
TAILQ_REMOVE(&platform_bus.driver_list, pdrv, next);
}
-static struct rte_devargs *
-dev_devargs(const char *dev_name)
-{
- struct rte_devargs *devargs;
-
- RTE_EAL_DEVARGS_FOREACH(platform_bus.bus.name, devargs) {
- if (!strcmp(devargs->name, dev_name))
- return devargs;
- }
-
- return NULL;
-}
-
static bool
dev_allowed(const char *dev_name)
{
struct rte_devargs *devargs;
- devargs = dev_devargs(dev_name);
+ devargs = rte_bus_find_devargs(&platform_bus.bus, dev_name);
if (devargs == NULL)
return true;
@@ -93,7 +80,7 @@ dev_add(const char *dev_name)
rte_strscpy(pdev->name, dev_name, sizeof(pdev->name));
pdev->device.name = pdev->name;
- pdev->device.devargs = dev_devargs(dev_name);
+ pdev->device.devargs = rte_bus_find_devargs(&platform_bus.bus, dev_name);
pdev->device.bus = &platform_bus.bus;
snprintf(path, sizeof(path), PLATFORM_BUS_DEVICES_PATH "/%s/numa_node", dev_name);
pdev->device.numa_node = eal_parse_sysfs_value(path, &val) ? rte_socket_id() : val;
diff --git a/drivers/bus/uacce/uacce.c b/drivers/bus/uacce/uacce.c
index 06a3643290..e6963dc18a 100644
--- a/drivers/bus/uacce/uacce.c
+++ b/drivers/bus/uacce/uacce.c
@@ -70,25 +70,10 @@ extern int uacce_bus_logtype;
#define UACCE_BUS_DEBUG(fmt, ...) UACCE_BUS_LOG(DEBUG, fmt, ##__VA_ARGS__)
-static struct rte_devargs *
-uacce_devargs_lookup(const char *dev_name)
-{
- char name[RTE_UACCE_DEV_PATH_SIZE] = {0};
- struct rte_devargs *devargs;
-
- snprintf(name, sizeof(name), "%s%s", UACCE_DEV_PREFIX, dev_name);
- RTE_EAL_DEVARGS_FOREACH(uacce_bus.bus.name, devargs) {
- if (strcmp(devargs->name, name) == 0)
- return devargs;
- }
-
- return NULL;
-}
-
static bool
uacce_ignore_device(const char *dev_name)
{
- struct rte_devargs *devargs = uacce_devargs_lookup(dev_name);
+ struct rte_devargs *devargs = rte_bus_find_devargs(&uacce_bus.bus, dev_name);
switch (uacce_bus.bus.conf.scan_mode) {
case RTE_BUS_SCAN_ALLOWLIST:
@@ -257,7 +242,7 @@ uacce_scan_one(const char *dev_name)
dev->device.bus = &uacce_bus.bus;
dev->device.name = dev->name;
- dev->device.devargs = uacce_devargs_lookup(dev_name);
+ dev->device.devargs = rte_bus_find_devargs(&uacce_bus.bus, dev_name);
snprintf(dev->name, sizeof(dev->name), "%s", dev_name);
snprintf(dev->dev_root, sizeof(dev->dev_root), "%s/%s",
UACCE_BUS_CLASS_PATH, dev_name);
diff --git a/drivers/bus/vmbus/linux/vmbus_bus.c b/drivers/bus/vmbus/linux/vmbus_bus.c
index 4c59097273..5958b97077 100644
--- a/drivers/bus/vmbus/linux/vmbus_bus.c
+++ b/drivers/bus/vmbus/linux/vmbus_bus.c
@@ -333,7 +333,7 @@ vmbus_scan_one(const char *name)
dev->monitor_id = UINT8_MAX;
}
- dev->device.devargs = vmbus_devargs_lookup(dev);
+ dev->device.devargs = rte_bus_find_devargs(&rte_vmbus_bus.bus, dev_name);
dev->device.numa_node = SOCKET_ID_ANY;
if (vmbus_use_numa(dev)) {
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index 25b8a27fcf..8ac6119ef2 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -98,9 +98,6 @@ struct vmbus_channel {
#define VMBUS_MAX_CHANNELS 64
-struct rte_devargs *
-vmbus_devargs_lookup(struct rte_vmbus_device *dev);
-
int vmbus_chan_create(const struct rte_vmbus_device *device,
uint16_t relid, uint16_t subid, uint8_t monitor_id,
struct vmbus_channel **new_chan);
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index f857244c85..96d16ff545 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -171,7 +171,11 @@ vmbus_probe_all_drivers(struct rte_vmbus_device *dev)
static bool
vmbus_ignore_device(struct rte_vmbus_device *dev)
{
- struct rte_devargs *devargs = vmbus_devargs_lookup(dev);
+ char name[RTE_DEV_NAME_MAX_LEN];
+ struct rte_devargs *devargs;
+
+ rte_uuid_unparse(dev->device_id, name, sizeof(name));
+ devargs = rte_bus_find_devargs(&rte_vmbus_bus.bus, name);
switch (rte_vmbus_bus.bus.conf.scan_mode) {
case RTE_BUS_SCAN_ALLOWLIST:
@@ -260,25 +264,16 @@ vmbus_parse(const char *name, void *addr)
return ret;
}
-/*
- * scan for matching device args on command line
- * example:
- * -a 'vmbus:635a7ae3-091e-4410-ad59-667c4f8c04c3,latency=20'
- */
-struct rte_devargs *
-vmbus_devargs_lookup(struct rte_vmbus_device *dev)
+static int
+vmbus_devname_compare(const char *name1, const char *name2)
{
- struct rte_devargs *devargs;
- rte_uuid_t addr;
-
- RTE_EAL_DEVARGS_FOREACH(rte_vmbus_bus.bus.name, devargs) {
- vmbus_parse(devargs->name, &addr);
+ rte_uuid_t guid1, guid2;
- if (rte_uuid_compare(dev->device_id, addr) == 0)
- return devargs;
- }
- return NULL;
+ if (vmbus_parse(name1, &guid1) != 0 ||
+ vmbus_parse(name2, &guid2) != 0)
+ return 1;
+ return rte_uuid_compare(guid1, guid2);
}
/* register vmbus driver */
@@ -349,6 +344,7 @@ struct rte_vmbus_bus rte_vmbus_bus = {
.cleanup = rte_vmbus_cleanup,
.find_device = vmbus_find_device,
.parse = vmbus_parse,
+ .devname_compare = vmbus_devname_compare,
},
.device_list = TAILQ_HEAD_INITIALIZER(rte_vmbus_bus.device_list),
.driver_list = TAILQ_HEAD_INITIALIZER(rte_vmbus_bus.driver_list),
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index 9a8213bbbe..136ac511ef 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -247,16 +247,6 @@ idxd_probe_dsa(struct rte_dsa_device *dev)
return 0;
}
-static int search_devargs(const char *name)
-{
- struct rte_devargs *devargs;
- RTE_EAL_DEVARGS_FOREACH(dsa_bus.bus.name, devargs) {
- if (strcmp(devargs->name, name) == 0)
- return 1;
- }
- return 0;
-}
-
static int
is_for_this_process_use(struct rte_dsa_device *dev, const char *name)
{
@@ -275,9 +265,9 @@ is_for_this_process_use(struct rte_dsa_device *dev, const char *name)
if (retval && dsa_bus.bus.conf.scan_mode != RTE_BUS_SCAN_UNDEFINED) {
if (dsa_bus.bus.conf.scan_mode == RTE_BUS_SCAN_ALLOWLIST)
- retval = search_devargs(dev->device.name);
+ retval = rte_bus_find_devargs(&dsa_bus.bus, dev->device.name) != NULL;
else
- retval = !search_devargs(dev->device.name);
+ retval = rte_bus_find_devargs(&dsa_bus.bus, dev->device.name) == NULL;
}
return retval;
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index 0a2311a342..863c7418bb 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>
@@ -205,6 +206,25 @@ rte_bus_find_by_name(const char *busname)
return rte_bus_find(NULL, cmp_bus_name, (const void *)busname);
}
+RTE_EXPORT_INTERNAL_SYMBOL(rte_bus_find_devargs)
+struct rte_devargs *
+rte_bus_find_devargs(const struct rte_bus *bus, const char *name)
+{
+ rte_bus_devname_compare_t cmp = bus->devname_compare;
+ struct rte_devargs *devargs;
+
+ if (cmp == NULL)
+ cmp = strcmp;
+
+ RTE_EAL_DEVARGS_FOREACH(rte_bus_name(bus), devargs) {
+ if (cmp(name, devargs->name) != 0)
+ continue;
+ return devargs;
+ }
+
+ return NULL;
+}
+
static int
bus_can_parse(const struct rte_bus *bus, const void *_name)
{
diff --git a/lib/eal/include/bus_driver.h b/lib/eal/include/bus_driver.h
index 60527b75b6..2a21e4ac54 100644
--- a/lib/eal/include/bus_driver.h
+++ b/lib/eal/include/bus_driver.h
@@ -118,6 +118,21 @@ typedef int (*rte_bus_unplug_t)(struct rte_device *dev);
*/
typedef int (*rte_bus_parse_t)(const char *name, void *addr);
+/**
+ * Bus specific device name comparison function.
+ * Bus can normalize the names of devices using an internal representation.
+ * This helper makes it possible to check whether two names refer to the same device.
+ *
+ * @param[in] name1
+ * device information location address,
+ * @param[in] name2
+ * device information location address,
+ *
+ * @return
+ * true or false
+ */
+typedef int (*rte_bus_devname_compare_t)(const char *name1, const char *name2);
+
/**
* Parse bus part of the device arguments.
*
@@ -258,6 +273,7 @@ struct rte_bus {
rte_bus_plug_t plug; /**< Probe single device for drivers */
rte_bus_unplug_t unplug; /**< Remove single device from driver */
rte_bus_parse_t parse; /**< Parse a device name */
+ rte_bus_devname_compare_t devname_compare; /**< Compare two device names */
rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
rte_dev_dma_map_t dma_map; /**< DMA map for device in the bus */
rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
@@ -281,6 +297,21 @@ struct rte_bus {
__rte_internal
void rte_bus_register(struct rte_bus *bus);
+/**
+ * Find the devargs associated to a device.
+ *
+ * @param bus
+ * A pointer to a rte_bus structure describing the bus
+ * to be unregistered.
+ * @param dev_name
+ * A device name.
+ *
+ * @return
+ * Pointer to the device devargs, or NULL if none found.
+ */
+__rte_internal
+struct rte_devargs *rte_bus_find_devargs(const struct rte_bus *bus, const char *dev_name);
+
/**
* Helper for Bus registration.
* The constructor has higher priority than PMD constructors.
--
2.53.0
^ permalink raw reply related [flat|nested] 67+ messages in thread* Re: [PATCH 5/8] bus: factorize devargs lookup
2026-03-23 10:52 ` [PATCH 5/8] bus: factorize devargs lookup David Marchand
@ 2026-03-24 14:16 ` Kevin Traynor
2026-03-24 16:11 ` Stephen Hemminger
1 sibling, 0 replies; 67+ messages in thread
From: Kevin Traynor @ 2026-03-24 14:16 UTC (permalink / raw)
To: David Marchand, dev
Cc: Bruce Richardson, Parav Pandit, Xueming Li, Nipun Gupta,
Nikhil Agarwal, Hemant Agrawal, Sachin Saxena, Chenbo Xia,
Tomasz Duszynski, Chengwen Feng, Long Li, Wei Hu, Kevin Laatz
On 3/23/26 10:52 AM, David Marchand wrote:
> Each bus reimplements some similar devargs lookup code.
>
> The differences are in how some bus (PCI, VMBUS etc...) normalizes the
> device names. We can't use the .parse existing handler from outside the
> bus code itself, as the size of the bus specific device location address
> is unknown.
> Introduce a bus specific helper to compare two device names and
> hide this ugly detail.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> Changes since RFC v3:
> - fixed doxygen,
>
> ---
> drivers/bus/auxiliary/auxiliary_common.c | 16 ++-------
> drivers/bus/cdx/cdx.c | 14 +-------
> drivers/bus/dpaa/dpaa_bus.c | 41 +++++++++++++-----------
> drivers/bus/fslmc/fslmc_bus.c | 34 ++++++++++----------
> drivers/bus/pci/pci_common.c | 38 +++++++++++-----------
> drivers/bus/platform/platform.c | 17 ++--------
> drivers/bus/uacce/uacce.c | 19 ++---------
> drivers/bus/vmbus/linux/vmbus_bus.c | 2 +-
> drivers/bus/vmbus/private.h | 3 --
> drivers/bus/vmbus/vmbus_common.c | 30 ++++++++---------
> drivers/dma/idxd/idxd_bus.c | 14 ++------
> lib/eal/common/eal_common_bus.c | 20 ++++++++++++
> lib/eal/include/bus_driver.h | 31 ++++++++++++++++++
> 13 files changed, 132 insertions(+), 147 deletions(-)
Acked-by: Kevin Traynor <ktraynor@redhat.com>
^ permalink raw reply [flat|nested] 67+ messages in thread
* Re: [PATCH 5/8] bus: factorize devargs lookup
2026-03-23 10:52 ` [PATCH 5/8] bus: factorize devargs lookup David Marchand
2026-03-24 14:16 ` Kevin Traynor
@ 2026-03-24 16:11 ` Stephen Hemminger
1 sibling, 0 replies; 67+ messages in thread
From: Stephen Hemminger @ 2026-03-24 16:11 UTC (permalink / raw)
To: David Marchand
Cc: dev, Bruce Richardson, Parav Pandit, Xueming Li, Nipun Gupta,
Nikhil Agarwal, Hemant Agrawal, Sachin Saxena, Chenbo Xia,
Tomasz Duszynski, Chengwen Feng, Long Li, Wei Hu, Kevin Laatz
On Mon, 23 Mar 2026 11:52:59 +0100
David Marchand <david.marchand@redhat.com> wrote:
> Each bus reimplements some similar devargs lookup code.
>
> The differences are in how some bus (PCI, VMBUS etc...) normalizes the
> device names. We can't use the .parse existing handler from outside the
> bus code itself, as the size of the bus specific device location address
> is unknown.
> Introduce a bus specific helper to compare two device names and
> hide this ugly detail.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> Changes since RFC v3:
> - fixed doxygen,
>
> ---
More AI review:
Patch 5/8: bus: factorize devargs lookup
Warning: The Doxygen for rte_bus_find_devargs() in bus_driver.h
describes the bus parameter as "A pointer to a rte_bus structure
describing the bus to be unregistered" -- this is copy-pasted from
rte_bus_unregister. Should say something like "the bus to search for
devargs on."
Warning: The Doxygen for rte_bus_devname_compare_t has two issues: the
@return says "true or false" but the function follows strcmp semantics
(0 for match, non-zero for no match), and the @param descriptions both
say "device information location address" when they should say "device
name string."
^ permalink raw reply [flat|nested] 67+ messages in thread
* [PATCH 6/8] bus: factorize device selection
2026-03-23 10:52 [PATCH 0/8] Rework device probing David Marchand
` (4 preceding siblings ...)
2026-03-23 10:52 ` [PATCH 5/8] bus: factorize devargs lookup David Marchand
@ 2026-03-23 10:53 ` David Marchand
2026-03-24 14:15 ` Kevin Traynor
2026-03-24 16:12 ` Stephen Hemminger
2026-03-23 10:53 ` [PATCH 7/8] bus: remove per bus scan mode David Marchand
` (5 subsequent siblings)
11 siblings, 2 replies; 67+ messages in thread
From: David Marchand @ 2026-03-23 10:53 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, Robin Jarry, Parav Pandit, Xueming Li,
Nipun Gupta, Nikhil Agarwal, Hemant Agrawal, Sachin Saxena,
Chenbo Xia, Tomasz Duszynski, Chengwen Feng, Long Li, Wei Hu,
Kevin Laatz
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@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Robin Jarry <rjarry@redhat.com>
---
Changes since RFC v2:
- changed API to query about a device name and hide the devargs meaning
in the common code,
---
drivers/bus/auxiliary/auxiliary_common.c | 19 ----------------
drivers/bus/auxiliary/linux/auxiliary.c | 2 +-
drivers/bus/auxiliary/private.h | 6 -----
drivers/bus/cdx/cdx.c | 21 +-----------------
drivers/bus/dpaa/dpaa_bus.c | 24 ++++++--------------
drivers/bus/fslmc/fslmc_bus.c | 22 ++++++-------------
drivers/bus/pci/bsd/pci.c | 5 ++++-
drivers/bus/pci/linux/pci.c | 2 +-
drivers/bus/pci/pci_common.c | 23 -------------------
drivers/bus/pci/private.h | 11 ----------
drivers/bus/pci/windows/pci.c | 4 +++-
drivers/bus/platform/platform.c | 28 ++----------------------
drivers/bus/uacce/uacce.c | 22 +------------------
drivers/bus/vmbus/vmbus_common.c | 25 +--------------------
drivers/dma/idxd/idxd_bus.c | 8 ++-----
lib/eal/common/eal_common_bus.c | 19 ++++++++++++++++
lib/eal/include/bus_driver.h | 6 +++++
17 files changed, 55 insertions(+), 192 deletions(-)
diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index e5b4f4460d..8f3e90eaf0 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -384,25 +384,6 @@ auxiliary_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova,
return aux_dev->driver->dma_unmap(aux_dev, addr, iova, len);
}
-bool
-auxiliary_is_ignored_device(const char *name)
-{
- struct rte_devargs *devargs = rte_bus_find_devargs(&auxiliary_bus.bus, name);
-
- switch (auxiliary_bus.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;
-}
-
static enum rte_iova_mode
auxiliary_get_iommu_class(void)
{
diff --git a/drivers/bus/auxiliary/linux/auxiliary.c b/drivers/bus/auxiliary/linux/auxiliary.c
index 02fc9285dc..ac9bf55efa 100644
--- a/drivers/bus/auxiliary/linux/auxiliary.c
+++ b/drivers/bus/auxiliary/linux/auxiliary.c
@@ -110,7 +110,7 @@ auxiliary_scan(void)
if (e->d_name[0] == '.')
continue;
- if (auxiliary_is_ignored_device(e->d_name))
+ if (rte_bus_is_ignored_device(&auxiliary_bus.bus, e->d_name))
continue;
snprintf(dirname, sizeof(dirname), "%s/%s",
diff --git a/drivers/bus/auxiliary/private.h b/drivers/bus/auxiliary/private.h
index 4604f6f4a7..6e61a5f494 100644
--- a/drivers/bus/auxiliary/private.h
+++ b/drivers/bus/auxiliary/private.h
@@ -53,12 +53,6 @@ int auxiliary_scan(void);
*/
void auxiliary_on_scan(struct rte_auxiliary_device *aux_dev);
-/*
- * Validate whether a device with given auxiliary device should be ignored
- * or not.
- */
-bool auxiliary_is_ignored_device(const char *name);
-
/*
* Add an auxiliary device to the auxiliary bus (append to auxiliary device
* list). This function also updates the bus references of the auxiliary
diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
index 0801825ef5..58d8c8b4da 100644
--- a/drivers/bus/cdx/cdx.c
+++ b/drivers/bus/cdx/cdx.c
@@ -151,25 +151,6 @@ void rte_cdx_unmap_device(struct rte_cdx_device *dev)
cdx_vfio_unmap_resource(dev);
}
-static bool
-cdx_ignore_device(const char *dev_name)
-{
- struct rte_devargs *devargs = rte_bus_find_devargs(&rte_cdx_bus.bus, dev_name);
-
- switch (rte_cdx_bus.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;
-}
-
/*
* Scan one cdx sysfs entry, and fill the devices list from it.
* It checks if the CDX device is bound to vfio-cdx driver. In case
@@ -269,7 +250,7 @@ cdx_scan(void)
if (e->d_name[0] == '.')
continue;
- if (cdx_ignore_device(e->d_name))
+ if (rte_bus_is_ignored_device(&rte_cdx_bus.bus, e->d_name))
continue;
snprintf(dirname, sizeof(dirname), "%s/%s",
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 356c56d989..9ff58af0c4 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -717,7 +717,6 @@ rte_dpaa_bus_probe(void)
struct rte_dpaa_driver *drv;
FILE *svr_file = NULL;
uint32_t svr_ver;
- int probe_all = rte_dpaa_bus.bus.conf.scan_mode != RTE_BUS_SCAN_ALLOWLIST;
static int process_once;
char *penv;
@@ -725,9 +724,6 @@ rte_dpaa_bus_probe(void)
if (!rte_dpaa_bus.detected)
return 0;
- if (rte_dpaa_bus.bus.conf.scan_mode != RTE_BUS_SCAN_ALLOWLIST)
- probe_all = true;
-
svr_file = fopen(DPAA_SOC_ID_FILE, "r");
if (svr_file) {
if (fscanf(svr_file, "svr:%x", &svr_ver) > 0)
@@ -809,21 +805,15 @@ rte_dpaa_bus_probe(void)
if (rte_dev_is_probed(&dev->device))
continue;
- if (dev->device.devargs &&
- dev->device.devargs->policy == RTE_DEV_BLOCKED)
+ if (rte_bus_is_ignored_device(&rte_dpaa_bus.bus, dev->name))
continue;
- if (probe_all ||
- (dev->device.devargs &&
- dev->device.devargs->policy == RTE_DEV_ALLOWED)) {
- ret = drv->probe(drv, dev);
- if (ret) {
- DPAA_BUS_ERR("unable to probe:%s",
- dev->name);
- } else {
- dev->driver = drv;
- dev->device.driver = &drv->driver;
- }
+ ret = drv->probe(drv, dev);
+ if (ret) {
+ DPAA_BUS_ERR("unable to probe: %s", dev->name);
+ } else {
+ dev->driver = drv;
+ dev->device.driver = &drv->driver;
}
break;
}
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index f72b512b1a..b5d839b6b0 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -407,7 +407,6 @@ static int
rte_fslmc_probe(void)
{
int ret = 0;
- int probe_all;
struct rte_dpaa2_device *dev;
struct rte_dpaa2_driver *drv;
@@ -454,8 +453,6 @@ rte_fslmc_probe(void)
return 0;
}
- probe_all = rte_fslmc_bus.bus.conf.scan_mode != RTE_BUS_SCAN_ALLOWLIST;
-
TAILQ_FOREACH(dev, &rte_fslmc_bus.device_list, next) {
TAILQ_FOREACH(drv, &rte_fslmc_bus.driver_list, next) {
ret = rte_fslmc_match(drv, dev);
@@ -465,23 +462,18 @@ rte_fslmc_probe(void)
if (rte_dev_is_probed(&dev->device))
continue;
- if (dev->device.devargs &&
- dev->device.devargs->policy == RTE_DEV_BLOCKED) {
+ if (rte_bus_is_ignored_device(&rte_fslmc_bus.bus, dev->device.name)) {
DPAA2_BUS_LOG(DEBUG, "%s Blocked, skipping",
dev->device.name);
continue;
}
- if (probe_all ||
- (dev->device.devargs &&
- dev->device.devargs->policy == RTE_DEV_ALLOWED)) {
- ret = drv->probe(drv, dev);
- if (ret) {
- DPAA2_BUS_ERR("Unable to probe");
- } else {
- dev->driver = drv;
- dev->device.driver = &drv->driver;
- }
+ ret = drv->probe(drv, dev);
+ if (ret) {
+ DPAA2_BUS_ERR("Unable to probe");
+ } else {
+ dev->driver = drv;
+ dev->device.driver = &drv->driver;
}
break;
}
diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index 3f13e1d6ac..ffd84ee5f0 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -370,12 +370,15 @@ rte_pci_scan(void)
}
for (i = 0; i < conf_io.num_matches; i++) {
+ char name[RTE_DEV_NAME_MAX_LEN];
+
pci_addr.domain = matches[i].pc_sel.pc_domain;
pci_addr.bus = matches[i].pc_sel.pc_bus;
pci_addr.devid = matches[i].pc_sel.pc_dev;
pci_addr.function = matches[i].pc_sel.pc_func;
+ rte_pci_device_name(&pci_addr, name, sizeof(name));
- if (rte_pci_ignore_device(&pci_addr))
+ if (rte_bus_is_ignored_device(&rte_pci_bus.bus, name))
continue;
if (pci_scan_one(fd, &matches[i]) < 0)
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index 2ffac82e94..03a3c37dea 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -458,7 +458,7 @@ rte_pci_scan(void)
if (parse_pci_addr_format(e->d_name, sizeof(e->d_name), &addr) != 0)
continue;
- if (rte_pci_ignore_device(&addr))
+ if (rte_bus_is_ignored_device(&rte_pci_bus.bus, e->d_name))
continue;
snprintf(dirname, sizeof(dirname), "%s/%s",
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 8782dc342a..5ef9e80e3e 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -713,29 +713,6 @@ pci_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
return -1;
}
-bool
-rte_pci_ignore_device(const struct rte_pci_addr *pci_addr)
-{
- char name[RTE_DEV_NAME_MAX_LEN];
- struct rte_devargs *devargs;
-
- rte_pci_device_name(pci_addr, name, sizeof(name));
- devargs = rte_bus_find_devargs(&rte_pci_bus.bus, name);
-
- switch (rte_pci_bus.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;
-}
-
enum rte_iova_mode
rte_pci_get_iommu_class(void)
{
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 38109844b9..8591c4a0a7 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -82,17 +82,6 @@ pci_common_set(struct rte_pci_device *dev);
void
pci_free(struct rte_pci_device_internal *pdev);
-/**
- * Validate whether a device with given PCI address should be ignored or not.
- *
- * @param pci_addr
- * PCI address of device to be validated
- * @return
- * true: if device is to be ignored,
- * false: if device is to be scanned,
- */
-bool rte_pci_ignore_device(const struct rte_pci_addr *pci_addr);
-
/**
* Add a PCI device to the PCI Bus (append to PCI Device list). This function
* also updates the bus references of the PCI Device (and the generic device
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index a5ce3b51f7..91c8e567d1 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -373,6 +373,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
struct rte_pci_device *dev = NULL;
int ret = -1;
char pci_device_info[REGSTR_VAL_MAX_HCID_LEN];
+ char name[RTE_DEV_NAME_MAX_LEN];
struct rte_pci_addr addr;
struct rte_pci_id pci_id;
@@ -380,7 +381,8 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
if (ret != 0)
goto end;
- if (rte_pci_ignore_device(&addr)) {
+ rte_pci_device_name(&addr, name, sizeof(name));
+ if (rte_bus_is_ignored_device(&rte_pci_bus.bus, name)) {
/*
* We won't add this device, but we want to continue
* looking for supported devices
diff --git a/drivers/bus/platform/platform.c b/drivers/bus/platform/platform.c
index 23c39aada6..ad7898f011 100644
--- a/drivers/bus/platform/platform.c
+++ b/drivers/bus/platform/platform.c
@@ -43,30 +43,6 @@ rte_platform_unregister(struct rte_platform_driver *pdrv)
TAILQ_REMOVE(&platform_bus.driver_list, pdrv, next);
}
-static bool
-dev_allowed(const char *dev_name)
-{
- struct rte_devargs *devargs;
-
- devargs = rte_bus_find_devargs(&platform_bus.bus, dev_name);
- if (devargs == NULL)
- return true;
-
- switch (platform_bus.bus.conf.scan_mode) {
- case RTE_BUS_SCAN_UNDEFINED:
- case RTE_BUS_SCAN_ALLOWLIST:
- if (devargs->policy == RTE_DEV_ALLOWED)
- return true;
- break;
- case RTE_BUS_SCAN_BLOCKLIST:
- if (devargs->policy == RTE_DEV_BLOCKED)
- return false;
- break;
- }
-
- return true;
-}
-
static int
dev_add(const char *dev_name)
{
@@ -160,7 +136,7 @@ platform_bus_scan(void)
if (dev_name[0] == '.')
continue;
- if (!dev_allowed(dev_name))
+ if (rte_bus_is_ignored_device(&platform_bus.bus, dev_name))
continue;
if (!dev_is_bound_vfio_platform(dev_name))
@@ -484,7 +460,7 @@ platform_bus_plug(struct rte_device *dev)
{
struct rte_platform_device *pdev;
- if (!dev_allowed(dev->name))
+ if (rte_bus_is_ignored_device(&platform_bus.bus, dev->name))
return -EPERM;
if (!dev_is_bound_vfio_platform(dev->name))
diff --git a/drivers/bus/uacce/uacce.c b/drivers/bus/uacce/uacce.c
index e6963dc18a..ee02ecd1ce 100644
--- a/drivers/bus/uacce/uacce.c
+++ b/drivers/bus/uacce/uacce.c
@@ -70,26 +70,6 @@ extern int uacce_bus_logtype;
#define UACCE_BUS_DEBUG(fmt, ...) UACCE_BUS_LOG(DEBUG, fmt, ##__VA_ARGS__)
-static bool
-uacce_ignore_device(const char *dev_name)
-{
- struct rte_devargs *devargs = rte_bus_find_devargs(&uacce_bus.bus, dev_name);
-
- switch (uacce_bus.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;
-}
-
/*
* Returns the number of bytes read (removed last newline) on success.
* Otherwise negative value is returned.
@@ -296,7 +276,7 @@ uacce_scan(void)
continue;
}
- if (uacce_ignore_device(e->d_name))
+ if (rte_bus_is_ignored_device(&uacce_bus.bus, e->d_name))
continue;
if (uacce_scan_one(e->d_name) < 0)
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index 96d16ff545..a9eb7cf933 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -168,29 +168,6 @@ vmbus_probe_all_drivers(struct rte_vmbus_device *dev)
return 1;
}
-static bool
-vmbus_ignore_device(struct rte_vmbus_device *dev)
-{
- char name[RTE_DEV_NAME_MAX_LEN];
- struct rte_devargs *devargs;
-
- rte_uuid_unparse(dev->device_id, name, sizeof(name));
- devargs = rte_bus_find_devargs(&rte_vmbus_bus.bus, name);
-
- switch (rte_vmbus_bus.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;
-}
-
/*
* Scan the vmbus, and call the devinit() function for
* all registered drivers that have a matching entry in its id_table
@@ -209,7 +186,7 @@ rte_vmbus_probe(void)
rte_uuid_unparse(dev->device_id, ubuf, sizeof(ubuf));
- if (vmbus_ignore_device(dev))
+ if (rte_bus_is_ignored_device(&rte_vmbus_bus.bus, ubuf))
continue;
if (vmbus_probe_all_drivers(dev) < 0) {
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index 136ac511ef..00e7e7315c 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -263,12 +263,8 @@ is_for_this_process_use(struct rte_dsa_device *dev, const char *name)
if (strncmp(name, prefix, prefixlen) == 0 && name[prefixlen] == '_')
retval = 1;
- if (retval && dsa_bus.bus.conf.scan_mode != RTE_BUS_SCAN_UNDEFINED) {
- if (dsa_bus.bus.conf.scan_mode == RTE_BUS_SCAN_ALLOWLIST)
- retval = rte_bus_find_devargs(&dsa_bus.bus, dev->device.name) != NULL;
- else
- retval = rte_bus_find_devargs(&dsa_bus.bus, dev->device.name) == NULL;
- }
+ if (retval && !rte_bus_is_ignored_device(&dsa_bus.bus, dev->device.name))
+ retval = 1;
return retval;
}
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index 863c7418bb..2ca0af7914 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -246,6 +246,25 @@ 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 char *dev_name)
+{
+ struct rte_devargs *devargs = rte_bus_find_devargs(bus, dev_name);
+
+ 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;
+}
/*
* 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 2a21e4ac54..e67e052404 100644
--- a/lib/eal/include/bus_driver.h
+++ b/lib/eal/include/bus_driver.h
@@ -312,6 +312,12 @@ void rte_bus_register(struct rte_bus *bus);
__rte_internal
struct rte_devargs *rte_bus_find_devargs(const struct rte_bus *bus, const char *dev_name);
+/**
+ * Indicate if a device should be skipped during probing of a bus.
+ */
+__rte_internal
+bool rte_bus_is_ignored_device(const struct rte_bus *bus, const char *dev_name);
+
/**
* Helper for Bus registration.
* The constructor has higher priority than PMD constructors.
--
2.53.0
^ permalink raw reply related [flat|nested] 67+ messages in thread* Re: [PATCH 6/8] bus: factorize device selection
2026-03-23 10:53 ` [PATCH 6/8] bus: factorize device selection David Marchand
@ 2026-03-24 14:15 ` Kevin Traynor
2026-03-26 8:48 ` David Marchand
2026-03-24 16:12 ` Stephen Hemminger
1 sibling, 1 reply; 67+ messages in thread
From: Kevin Traynor @ 2026-03-24 14:15 UTC (permalink / raw)
To: David Marchand, dev
Cc: Bruce Richardson, Robin Jarry, Parav Pandit, Xueming Li,
Nipun Gupta, Nikhil Agarwal, Hemant Agrawal, Sachin Saxena,
Chenbo Xia, Tomasz Duszynski, Chengwen Feng, Long Li, Wei Hu,
Kevin Laatz
On 3/23/26 10:53 AM, 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 <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Reviewed-by: Robin Jarry <rjarry@redhat.com>
> ---
> Changes since RFC v2:
> - changed API to query about a device name and hide the devargs meaning
> in the common code,
>
> ---
> drivers/bus/auxiliary/auxiliary_common.c | 19 ----------------
> drivers/bus/auxiliary/linux/auxiliary.c | 2 +-
> drivers/bus/auxiliary/private.h | 6 -----
> drivers/bus/cdx/cdx.c | 21 +-----------------
> drivers/bus/dpaa/dpaa_bus.c | 24 ++++++--------------
> drivers/bus/fslmc/fslmc_bus.c | 22 ++++++-------------
> drivers/bus/pci/bsd/pci.c | 5 ++++-
> drivers/bus/pci/linux/pci.c | 2 +-
> drivers/bus/pci/pci_common.c | 23 -------------------
> drivers/bus/pci/private.h | 11 ----------
> drivers/bus/pci/windows/pci.c | 4 +++-
> drivers/bus/platform/platform.c | 28 ++----------------------
> drivers/bus/uacce/uacce.c | 22 +------------------
> drivers/bus/vmbus/vmbus_common.c | 25 +--------------------
> drivers/dma/idxd/idxd_bus.c | 8 ++-----
> lib/eal/common/eal_common_bus.c | 19 ++++++++++++++++
> lib/eal/include/bus_driver.h | 6 +++++
> 17 files changed, 55 insertions(+), 192 deletions(-)
>
> diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
> index e5b4f4460d..8f3e90eaf0 100644
> --- a/drivers/bus/auxiliary/auxiliary_common.c
> +++ b/drivers/bus/auxiliary/auxiliary_common.c
> @@ -384,25 +384,6 @@ auxiliary_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova,
> return aux_dev->driver->dma_unmap(aux_dev, addr, iova, len);
> }
>
> -bool
> -auxiliary_is_ignored_device(const char *name)
> -{
> - struct rte_devargs *devargs = rte_bus_find_devargs(&auxiliary_bus.bus, name);
> -
> - switch (auxiliary_bus.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;
> -}
> -
> static enum rte_iova_mode
> auxiliary_get_iommu_class(void)
> {
> diff --git a/drivers/bus/auxiliary/linux/auxiliary.c b/drivers/bus/auxiliary/linux/auxiliary.c
> index 02fc9285dc..ac9bf55efa 100644
> --- a/drivers/bus/auxiliary/linux/auxiliary.c
> +++ b/drivers/bus/auxiliary/linux/auxiliary.c
> @@ -110,7 +110,7 @@ auxiliary_scan(void)
> if (e->d_name[0] == '.')
> continue;
>
> - if (auxiliary_is_ignored_device(e->d_name))
> + if (rte_bus_is_ignored_device(&auxiliary_bus.bus, e->d_name))
> continue;
>
> snprintf(dirname, sizeof(dirname), "%s/%s",
> diff --git a/drivers/bus/auxiliary/private.h b/drivers/bus/auxiliary/private.h
> index 4604f6f4a7..6e61a5f494 100644
> --- a/drivers/bus/auxiliary/private.h
> +++ b/drivers/bus/auxiliary/private.h
> @@ -53,12 +53,6 @@ int auxiliary_scan(void);
> */
> void auxiliary_on_scan(struct rte_auxiliary_device *aux_dev);
>
> -/*
> - * Validate whether a device with given auxiliary device should be ignored
> - * or not.
> - */
> -bool auxiliary_is_ignored_device(const char *name);
> -
> /*
> * Add an auxiliary device to the auxiliary bus (append to auxiliary device
> * list). This function also updates the bus references of the auxiliary
> diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
> index 0801825ef5..58d8c8b4da 100644
> --- a/drivers/bus/cdx/cdx.c
> +++ b/drivers/bus/cdx/cdx.c
> @@ -151,25 +151,6 @@ void rte_cdx_unmap_device(struct rte_cdx_device *dev)
> cdx_vfio_unmap_resource(dev);
> }
>
> -static bool
> -cdx_ignore_device(const char *dev_name)
> -{
> - struct rte_devargs *devargs = rte_bus_find_devargs(&rte_cdx_bus.bus, dev_name);
> -
> - switch (rte_cdx_bus.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;
> -}
> -
> /*
> * Scan one cdx sysfs entry, and fill the devices list from it.
> * It checks if the CDX device is bound to vfio-cdx driver. In case
> @@ -269,7 +250,7 @@ cdx_scan(void)
> if (e->d_name[0] == '.')
> continue;
>
> - if (cdx_ignore_device(e->d_name))
> + if (rte_bus_is_ignored_device(&rte_cdx_bus.bus, e->d_name))
> continue;
>
> snprintf(dirname, sizeof(dirname), "%s/%s",
> diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
> index 356c56d989..9ff58af0c4 100644
> --- a/drivers/bus/dpaa/dpaa_bus.c
> +++ b/drivers/bus/dpaa/dpaa_bus.c
> @@ -717,7 +717,6 @@ rte_dpaa_bus_probe(void)
> struct rte_dpaa_driver *drv;
> FILE *svr_file = NULL;
> uint32_t svr_ver;
> - int probe_all = rte_dpaa_bus.bus.conf.scan_mode != RTE_BUS_SCAN_ALLOWLIST;
> static int process_once;
> char *penv;
>
> @@ -725,9 +724,6 @@ rte_dpaa_bus_probe(void)
> if (!rte_dpaa_bus.detected)
> return 0;
>
> - if (rte_dpaa_bus.bus.conf.scan_mode != RTE_BUS_SCAN_ALLOWLIST)
> - probe_all = true;
> -
> svr_file = fopen(DPAA_SOC_ID_FILE, "r");
> if (svr_file) {
> if (fscanf(svr_file, "svr:%x", &svr_ver) > 0)
> @@ -809,21 +805,15 @@ rte_dpaa_bus_probe(void)
> if (rte_dev_is_probed(&dev->device))
> continue;
>
> - if (dev->device.devargs &&
> - dev->device.devargs->policy == RTE_DEV_BLOCKED)
> + if (rte_bus_is_ignored_device(&rte_dpaa_bus.bus, dev->name))
> continue;
>
> - if (probe_all ||
> - (dev->device.devargs &&
> - dev->device.devargs->policy == RTE_DEV_ALLOWED)) {
> - ret = drv->probe(drv, dev);
> - if (ret) {
> - DPAA_BUS_ERR("unable to probe:%s",
> - dev->name);
> - } else {
> - dev->driver = drv;
> - dev->device.driver = &drv->driver;
> - }
> + ret = drv->probe(drv, dev);
> + if (ret) {
> + DPAA_BUS_ERR("unable to probe: %s", dev->name);
> + } else {
> + dev->driver = drv;
> + dev->device.driver = &drv->driver;
> }
> break;
> }
> diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
> index f72b512b1a..b5d839b6b0 100644
> --- a/drivers/bus/fslmc/fslmc_bus.c
> +++ b/drivers/bus/fslmc/fslmc_bus.c
> @@ -407,7 +407,6 @@ static int
> rte_fslmc_probe(void)
> {
> int ret = 0;
> - int probe_all;
>
> struct rte_dpaa2_device *dev;
> struct rte_dpaa2_driver *drv;
> @@ -454,8 +453,6 @@ rte_fslmc_probe(void)
> return 0;
> }
>
> - probe_all = rte_fslmc_bus.bus.conf.scan_mode != RTE_BUS_SCAN_ALLOWLIST;
> -
> TAILQ_FOREACH(dev, &rte_fslmc_bus.device_list, next) {
> TAILQ_FOREACH(drv, &rte_fslmc_bus.driver_list, next) {
> ret = rte_fslmc_match(drv, dev);
> @@ -465,23 +462,18 @@ rte_fslmc_probe(void)
> if (rte_dev_is_probed(&dev->device))
> continue;
>
> - if (dev->device.devargs &&
> - dev->device.devargs->policy == RTE_DEV_BLOCKED) {
> + if (rte_bus_is_ignored_device(&rte_fslmc_bus.bus, dev->device.name)) {
> DPAA2_BUS_LOG(DEBUG, "%s Blocked, skipping",
> dev->device.name);
> continue;
> }
>
> - if (probe_all ||
> - (dev->device.devargs &&
> - dev->device.devargs->policy == RTE_DEV_ALLOWED)) {
> - ret = drv->probe(drv, dev);
> - if (ret) {
> - DPAA2_BUS_ERR("Unable to probe");
> - } else {
> - dev->driver = drv;
> - dev->device.driver = &drv->driver;
> - }
> + ret = drv->probe(drv, dev);
> + if (ret) {
> + DPAA2_BUS_ERR("Unable to probe");
> + } else {
> + dev->driver = drv;
> + dev->device.driver = &drv->driver;
> }
> break;
> }
> diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
> index 3f13e1d6ac..ffd84ee5f0 100644
> --- a/drivers/bus/pci/bsd/pci.c
> +++ b/drivers/bus/pci/bsd/pci.c
> @@ -370,12 +370,15 @@ rte_pci_scan(void)
> }
>
> for (i = 0; i < conf_io.num_matches; i++) {
> + char name[RTE_DEV_NAME_MAX_LEN];
> +
> pci_addr.domain = matches[i].pc_sel.pc_domain;
> pci_addr.bus = matches[i].pc_sel.pc_bus;
> pci_addr.devid = matches[i].pc_sel.pc_dev;
> pci_addr.function = matches[i].pc_sel.pc_func;
> + rte_pci_device_name(&pci_addr, name, sizeof(name));
>
> - if (rte_pci_ignore_device(&pci_addr))
> + if (rte_bus_is_ignored_device(&rte_pci_bus.bus, name))
> continue;
>
> if (pci_scan_one(fd, &matches[i]) < 0)
> diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
> index 2ffac82e94..03a3c37dea 100644
> --- a/drivers/bus/pci/linux/pci.c
> +++ b/drivers/bus/pci/linux/pci.c
> @@ -458,7 +458,7 @@ rte_pci_scan(void)
> if (parse_pci_addr_format(e->d_name, sizeof(e->d_name), &addr) != 0)
> continue;
>
> - if (rte_pci_ignore_device(&addr))
> + if (rte_bus_is_ignored_device(&rte_pci_bus.bus, e->d_name))
> continue;
>
> snprintf(dirname, sizeof(dirname), "%s/%s",
> diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
> index 8782dc342a..5ef9e80e3e 100644
> --- a/drivers/bus/pci/pci_common.c
> +++ b/drivers/bus/pci/pci_common.c
> @@ -713,29 +713,6 @@ pci_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
> return -1;
> }
>
> -bool
> -rte_pci_ignore_device(const struct rte_pci_addr *pci_addr)
> -{
> - char name[RTE_DEV_NAME_MAX_LEN];
> - struct rte_devargs *devargs;
> -
> - rte_pci_device_name(pci_addr, name, sizeof(name));
> - devargs = rte_bus_find_devargs(&rte_pci_bus.bus, name);
> -
> - switch (rte_pci_bus.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;
> -}
> -
> enum rte_iova_mode
> rte_pci_get_iommu_class(void)
> {
> diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
> index 38109844b9..8591c4a0a7 100644
> --- a/drivers/bus/pci/private.h
> +++ b/drivers/bus/pci/private.h
> @@ -82,17 +82,6 @@ pci_common_set(struct rte_pci_device *dev);
> void
> pci_free(struct rte_pci_device_internal *pdev);
>
> -/**
> - * Validate whether a device with given PCI address should be ignored or not.
> - *
> - * @param pci_addr
> - * PCI address of device to be validated
> - * @return
> - * true: if device is to be ignored,
> - * false: if device is to be scanned,
> - */
> -bool rte_pci_ignore_device(const struct rte_pci_addr *pci_addr);
> -
> /**
> * Add a PCI device to the PCI Bus (append to PCI Device list). This function
> * also updates the bus references of the PCI Device (and the generic device
> diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
> index a5ce3b51f7..91c8e567d1 100644
> --- a/drivers/bus/pci/windows/pci.c
> +++ b/drivers/bus/pci/windows/pci.c
> @@ -373,6 +373,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
> struct rte_pci_device *dev = NULL;
> int ret = -1;
> char pci_device_info[REGSTR_VAL_MAX_HCID_LEN];
> + char name[RTE_DEV_NAME_MAX_LEN];
> struct rte_pci_addr addr;
> struct rte_pci_id pci_id;
>
> @@ -380,7 +381,8 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
> if (ret != 0)
> goto end;
>
> - if (rte_pci_ignore_device(&addr)) {
> + rte_pci_device_name(&addr, name, sizeof(name));
> + if (rte_bus_is_ignored_device(&rte_pci_bus.bus, name)) {
> /*
> * We won't add this device, but we want to continue
> * looking for supported devices
> diff --git a/drivers/bus/platform/platform.c b/drivers/bus/platform/platform.c
> index 23c39aada6..ad7898f011 100644
> --- a/drivers/bus/platform/platform.c
> +++ b/drivers/bus/platform/platform.c
> @@ -43,30 +43,6 @@ rte_platform_unregister(struct rte_platform_driver *pdrv)
> TAILQ_REMOVE(&platform_bus.driver_list, pdrv, next);
> }
>
> -static bool
> -dev_allowed(const char *dev_name)
> -{
> - struct rte_devargs *devargs;
> -
> - devargs = rte_bus_find_devargs(&platform_bus.bus, dev_name);
> - if (devargs == NULL)
> - return true;
> -
> - switch (platform_bus.bus.conf.scan_mode) {
> - case RTE_BUS_SCAN_UNDEFINED:
> - case RTE_BUS_SCAN_ALLOWLIST:
> - if (devargs->policy == RTE_DEV_ALLOWED)
> - return true;
> - break;
> - case RTE_BUS_SCAN_BLOCKLIST:
> - if (devargs->policy == RTE_DEV_BLOCKED)
> - return false;
> - break;
> - }
> -
> - return true;
> -}
> -
> static int
> dev_add(const char *dev_name)
> {
> @@ -160,7 +136,7 @@ platform_bus_scan(void)
> if (dev_name[0] == '.')
> continue;
>
> - if (!dev_allowed(dev_name))
> + if (rte_bus_is_ignored_device(&platform_bus.bus, dev_name))
> continue;
>
> if (!dev_is_bound_vfio_platform(dev_name))
> @@ -484,7 +460,7 @@ platform_bus_plug(struct rte_device *dev)
> {
> struct rte_platform_device *pdev;
>
> - if (!dev_allowed(dev->name))
> + if (rte_bus_is_ignored_device(&platform_bus.bus, dev->name))
> return -EPERM;
>
> if (!dev_is_bound_vfio_platform(dev->name))
> diff --git a/drivers/bus/uacce/uacce.c b/drivers/bus/uacce/uacce.c
> index e6963dc18a..ee02ecd1ce 100644
> --- a/drivers/bus/uacce/uacce.c
> +++ b/drivers/bus/uacce/uacce.c
> @@ -70,26 +70,6 @@ extern int uacce_bus_logtype;
> #define UACCE_BUS_DEBUG(fmt, ...) UACCE_BUS_LOG(DEBUG, fmt, ##__VA_ARGS__)
>
>
> -static bool
> -uacce_ignore_device(const char *dev_name)
> -{
> - struct rte_devargs *devargs = rte_bus_find_devargs(&uacce_bus.bus, dev_name);
> -
> - switch (uacce_bus.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;
> -}
> -
> /*
> * Returns the number of bytes read (removed last newline) on success.
> * Otherwise negative value is returned.
> @@ -296,7 +276,7 @@ uacce_scan(void)
> continue;
> }
>
> - if (uacce_ignore_device(e->d_name))
> + if (rte_bus_is_ignored_device(&uacce_bus.bus, e->d_name))
> continue;
>
> if (uacce_scan_one(e->d_name) < 0)
> diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
> index 96d16ff545..a9eb7cf933 100644
> --- a/drivers/bus/vmbus/vmbus_common.c
> +++ b/drivers/bus/vmbus/vmbus_common.c
> @@ -168,29 +168,6 @@ vmbus_probe_all_drivers(struct rte_vmbus_device *dev)
> return 1;
> }
>
> -static bool
> -vmbus_ignore_device(struct rte_vmbus_device *dev)
> -{
> - char name[RTE_DEV_NAME_MAX_LEN];
> - struct rte_devargs *devargs;
> -
> - rte_uuid_unparse(dev->device_id, name, sizeof(name));
> - devargs = rte_bus_find_devargs(&rte_vmbus_bus.bus, name);
> -
> - switch (rte_vmbus_bus.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;
> -}
> -
> /*
> * Scan the vmbus, and call the devinit() function for
> * all registered drivers that have a matching entry in its id_table
> @@ -209,7 +186,7 @@ rte_vmbus_probe(void)
>
> rte_uuid_unparse(dev->device_id, ubuf, sizeof(ubuf));
>
> - if (vmbus_ignore_device(dev))
> + if (rte_bus_is_ignored_device(&rte_vmbus_bus.bus, ubuf))
> continue;
>
> if (vmbus_probe_all_drivers(dev) < 0) {
> diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
> index 136ac511ef..00e7e7315c 100644
> --- a/drivers/dma/idxd/idxd_bus.c
> +++ b/drivers/dma/idxd/idxd_bus.c
> @@ -263,12 +263,8 @@ is_for_this_process_use(struct rte_dsa_device *dev, const char *name)
> if (strncmp(name, prefix, prefixlen) == 0 && name[prefixlen] == '_')
> retval = 1;
>
> - if (retval && dsa_bus.bus.conf.scan_mode != RTE_BUS_SCAN_UNDEFINED) {
> - if (dsa_bus.bus.conf.scan_mode == RTE_BUS_SCAN_ALLOWLIST)
> - retval = rte_bus_find_devargs(&dsa_bus.bus, dev->device.name) != NULL;
> - else
> - retval = rte_bus_find_devargs(&dsa_bus.bus, dev->device.name) == NULL;
> - }
> + if (retval && !rte_bus_is_ignored_device(&dsa_bus.bus, dev->device.name))
> + retval = 1;
hmm, should this be
if (retval && rte_bus_is_ignored_device(&dsa_bus.bus, dev->device.name))
retval = 0;
>
> return retval;
> }
> diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
> index 863c7418bb..2ca0af7914 100644
> --- a/lib/eal/common/eal_common_bus.c
> +++ b/lib/eal/common/eal_common_bus.c
> @@ -246,6 +246,25 @@ 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 char *dev_name)
> +{
> + struct rte_devargs *devargs = rte_bus_find_devargs(bus, dev_name);
> +
> + 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;
> +}
>
> /*
> * 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 2a21e4ac54..e67e052404 100644
> --- a/lib/eal/include/bus_driver.h
> +++ b/lib/eal/include/bus_driver.h
> @@ -312,6 +312,12 @@ void rte_bus_register(struct rte_bus *bus);
> __rte_internal
> struct rte_devargs *rte_bus_find_devargs(const struct rte_bus *bus, const char *dev_name);
>
> +/**
> + * Indicate if a device should be skipped during probing of a bus.
> + */
> +__rte_internal
> +bool rte_bus_is_ignored_device(const struct rte_bus *bus, const char *dev_name);
> +
> /**
> * Helper for Bus registration.
> * The constructor has higher priority than PMD constructors.
^ permalink raw reply [flat|nested] 67+ messages in thread* Re: [PATCH 6/8] bus: factorize device selection
2026-03-24 14:15 ` Kevin Traynor
@ 2026-03-26 8:48 ` David Marchand
0 siblings, 0 replies; 67+ messages in thread
From: David Marchand @ 2026-03-26 8:48 UTC (permalink / raw)
To: Kevin Traynor
Cc: dev, Bruce Richardson, Robin Jarry, Parav Pandit, Xueming Li,
Nipun Gupta, Nikhil Agarwal, Hemant Agrawal, Sachin Saxena,
Chenbo Xia, Tomasz Duszynski, Chengwen Feng, Long Li, Wei Hu,
Kevin Laatz
On Tue, 24 Mar 2026 at 15:15, Kevin Traynor <ktraynor@redhat.com> wrote:
> > diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
> > index 136ac511ef..00e7e7315c 100644
> > --- a/drivers/dma/idxd/idxd_bus.c
> > +++ b/drivers/dma/idxd/idxd_bus.c
> > @@ -263,12 +263,8 @@ is_for_this_process_use(struct rte_dsa_device *dev, const char *name)
> > if (strncmp(name, prefix, prefixlen) == 0 && name[prefixlen] == '_')
> > retval = 1;
> >
> > - if (retval && dsa_bus.bus.conf.scan_mode != RTE_BUS_SCAN_UNDEFINED) {
> > - if (dsa_bus.bus.conf.scan_mode == RTE_BUS_SCAN_ALLOWLIST)
> > - retval = rte_bus_find_devargs(&dsa_bus.bus, dev->device.name) != NULL;
> > - else
> > - retval = rte_bus_find_devargs(&dsa_bus.bus, dev->device.name) == NULL;
> > - }
> > + if (retval && !rte_bus_is_ignored_device(&dsa_bus.bus, dev->device.name))
> > + retval = 1;
>
> hmm, should this be
>
> if (retval && rte_bus_is_ignored_device(&dsa_bus.bus, dev->device.name))
> retval = 0;
>
> >
> > return retval;
> > }
Indeed, something is wrong with my change.
I will go with a if (retval) retval =
!rte_bus_is_ignored_device(&dsa_bus.bus, dev->device.name);
--
David Marchand
^ permalink raw reply [flat|nested] 67+ messages in thread
* Re: [PATCH 6/8] bus: factorize device selection
2026-03-23 10:53 ` [PATCH 6/8] bus: factorize device selection David Marchand
2026-03-24 14:15 ` Kevin Traynor
@ 2026-03-24 16:12 ` Stephen Hemminger
1 sibling, 0 replies; 67+ messages in thread
From: Stephen Hemminger @ 2026-03-24 16:12 UTC (permalink / raw)
To: David Marchand
Cc: dev, Bruce Richardson, Robin Jarry, Parav Pandit, Xueming Li,
Nipun Gupta, Nikhil Agarwal, Hemant Agrawal, Sachin Saxena,
Chenbo Xia, Tomasz Duszynski, Chengwen Feng, Long Li, Wei Hu,
Kevin Laatz
On Mon, 23 Mar 2026 11:53:00 +0100
David Marchand <david.marchand@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@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Reviewed-by: Robin Jarry <rjarry@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);
```
^ permalink raw reply [flat|nested] 67+ messages in thread
* [PATCH 7/8] bus: remove per bus scan mode
2026-03-23 10:52 [PATCH 0/8] Rework device probing David Marchand
` (5 preceding siblings ...)
2026-03-23 10:53 ` [PATCH 6/8] bus: factorize device selection David Marchand
@ 2026-03-23 10:53 ` David Marchand
2026-03-24 16:02 ` Kevin Traynor
2026-03-23 10:53 ` [PATCH 8/8] eal: configure initial device probing David Marchand
` (4 subsequent siblings)
11 siblings, 1 reply; 67+ messages in thread
From: David Marchand @ 2026-03-23 10:53 UTC (permalink / raw)
To: dev
Following the refactoring of device selection, it becomes more apparent
that there is no need for a per bus scan mode.
-a / -b options are mutually exclusive.
--vdev option works in parallel of allow/block list scan mode.
Remove this (internal) notion.
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
lib/eal/common/eal_common_bus.c | 20 ++++++++++++++++++-
lib/eal/common/eal_common_devargs.c | 8 +++-----
lib/eal/common/eal_private.h | 31 +++++++++++++++++++++++++++++
lib/eal/include/bus_driver.h | 18 -----------------
4 files changed, 53 insertions(+), 24 deletions(-)
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index 2ca0af7914..27a31bbefa 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -18,6 +18,8 @@
static struct rte_bus_list rte_bus_list =
TAILQ_HEAD_INITIALIZER(rte_bus_list);
+static enum rte_bus_scan_mode bus_scan_mode;
+
RTE_EXPORT_SYMBOL(rte_bus_name)
const char *
rte_bus_name(const struct rte_bus *bus)
@@ -252,7 +254,7 @@ rte_bus_is_ignored_device(const struct rte_bus *bus, const char *dev_name)
{
struct rte_devargs *devargs = rte_bus_find_devargs(bus, dev_name);
- switch (bus->conf.scan_mode) {
+ switch (rte_bus_scan_mode_get()) {
case RTE_BUS_SCAN_ALLOWLIST:
if (devargs && devargs->policy == RTE_DEV_ALLOWED)
return false;
@@ -266,6 +268,22 @@ rte_bus_is_ignored_device(const struct rte_bus *bus, const char *dev_name)
return true;
}
+enum rte_bus_scan_mode
+rte_bus_scan_mode_get(void)
+{
+ return bus_scan_mode;
+}
+
+int
+rte_bus_scan_mode_set(enum rte_bus_scan_mode scan_mode)
+{
+ if (bus_scan_mode != RTE_BUS_SCAN_UNDEFINED)
+ return -EINVAL;
+
+ bus_scan_mode = scan_mode;
+ return 0;
+}
+
/*
* Get iommu class of devices on the bus.
*/
diff --git a/lib/eal/common/eal_common_devargs.c b/lib/eal/common/eal_common_devargs.c
index c523429d67..8083bdebc2 100644
--- a/lib/eal/common/eal_common_devargs.c
+++ b/lib/eal/common/eal_common_devargs.c
@@ -330,7 +330,6 @@ int
rte_devargs_add(enum rte_devtype devtype, const char *devargs_str)
{
struct rte_devargs *devargs = NULL;
- struct rte_bus *bus = NULL;
const char *dev = devargs_str;
/* use calloc instead of rte_zmalloc as it's called early at init */
@@ -341,14 +340,13 @@ rte_devargs_add(enum rte_devtype devtype, const char *devargs_str)
if (rte_devargs_parse(devargs, dev))
goto fail;
devargs->type = devtype;
- bus = devargs->bus;
if (devargs->type == RTE_DEVTYPE_BLOCKED)
devargs->policy = RTE_DEV_BLOCKED;
- if (bus->conf.scan_mode == RTE_BUS_SCAN_UNDEFINED) {
+ if (rte_bus_scan_mode_get() == RTE_BUS_SCAN_UNDEFINED) {
if (devargs->policy == RTE_DEV_ALLOWED)
- bus->conf.scan_mode = RTE_BUS_SCAN_ALLOWLIST;
+ rte_bus_scan_mode_set(RTE_BUS_SCAN_ALLOWLIST);
else if (devargs->policy == RTE_DEV_BLOCKED)
- bus->conf.scan_mode = RTE_BUS_SCAN_BLOCKLIST;
+ rte_bus_scan_mode_set(RTE_BUS_SCAN_BLOCKLIST);
}
TAILQ_INSERT_TAIL(&devargs_list, devargs, next);
return 0;
diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h
index e032dd10c9..12db04dce2 100644
--- a/lib/eal/common/eal_private.h
+++ b/lib/eal/common/eal_private.h
@@ -469,6 +469,37 @@ int rte_eal_memory_detach(void);
*/
struct rte_bus *rte_bus_find_by_device_name(const char *str);
+/**
+ * Bus scan policies
+ */
+enum rte_bus_scan_mode {
+ RTE_BUS_SCAN_UNDEFINED,
+ RTE_BUS_SCAN_ALLOWLIST,
+ RTE_BUS_SCAN_BLOCKLIST,
+};
+
+/**
+ * Retrieve the current bus scanning mode.
+ *
+ * @return
+ * The current bus scanning mode.
+ */
+enum rte_bus_scan_mode rte_bus_scan_mode_get(void);
+
+/**
+ * Change the bus scanning mode.
+ * Changing the mode can only be done once from undefined to allow list or to block list.
+ * No change from allow to block (or vice versa) is allowed.
+ *
+ * @param scan_mode
+ * The scanning mode to apply.
+ *
+ * @return
+ * 0 on successful change.
+ * < 0 on failure.
+ */
+int rte_bus_scan_mode_set(enum rte_bus_scan_mode scan_mode);
+
/**
* For each device on the buses, call the driver-specific function for
* device cleanup.
diff --git a/lib/eal/include/bus_driver.h b/lib/eal/include/bus_driver.h
index e67e052404..9045d64816 100644
--- a/lib/eal/include/bus_driver.h
+++ b/lib/eal/include/bus_driver.h
@@ -232,23 +232,6 @@ typedef int (*rte_bus_sigbus_handler_t)(const void *failure_addr);
*/
typedef int (*rte_bus_cleanup_t)(void);
-/**
- * Bus scan policies
- */
-enum rte_bus_scan_mode {
- RTE_BUS_SCAN_UNDEFINED,
- RTE_BUS_SCAN_ALLOWLIST,
- RTE_BUS_SCAN_BLOCKLIST,
-};
-
-/**
- * A structure used to configure bus operations.
- */
-struct rte_bus_conf {
- enum rte_bus_scan_mode scan_mode; /**< Scan policy. */
-};
-
-
/**
* Get common iommu class of the all the devices on the bus. The bus may
* check that those devices are attached to iommu driver.
@@ -277,7 +260,6 @@ struct rte_bus {
rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
rte_dev_dma_map_t dma_map; /**< DMA map for device in the bus */
rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
- struct rte_bus_conf conf; /**< Bus configuration */
rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
rte_dev_iterate_t dev_iterate; /**< Device iterator. */
rte_bus_hot_unplug_handler_t hot_unplug_handler;
--
2.53.0
^ permalink raw reply related [flat|nested] 67+ messages in thread* Re: [PATCH 7/8] bus: remove per bus scan mode
2026-03-23 10:53 ` [PATCH 7/8] bus: remove per bus scan mode David Marchand
@ 2026-03-24 16:02 ` Kevin Traynor
2026-03-24 16:27 ` Kevin Traynor
2026-03-26 8:54 ` David Marchand
0 siblings, 2 replies; 67+ messages in thread
From: Kevin Traynor @ 2026-03-24 16:02 UTC (permalink / raw)
To: David Marchand, dev
On 3/23/26 10:53 AM, David Marchand wrote:
> Following the refactoring of device selection, it becomes more apparent
> that there is no need for a per bus scan mode.
> -a / -b options are mutually exclusive.
> --vdev option works in parallel of allow/block list scan mode.
>
-a/-b are mutually exclusive but does it mean "-a 0000:01:00.0" stops
default probe for all devices on other buses ? Is it a change in behavior ?
(I could probably test but I guess you thought about this case given the
nature of patch.)
> Remove this (internal) notion.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
> lib/eal/common/eal_common_bus.c | 20 ++++++++++++++++++-
> lib/eal/common/eal_common_devargs.c | 8 +++-----
> lib/eal/common/eal_private.h | 31 +++++++++++++++++++++++++++++
> lib/eal/include/bus_driver.h | 18 -----------------
> 4 files changed, 53 insertions(+), 24 deletions(-)
>
> diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
> index 2ca0af7914..27a31bbefa 100644
> --- a/lib/eal/common/eal_common_bus.c
> +++ b/lib/eal/common/eal_common_bus.c
> @@ -18,6 +18,8 @@
> static struct rte_bus_list rte_bus_list =
> TAILQ_HEAD_INITIALIZER(rte_bus_list);
>
> +static enum rte_bus_scan_mode bus_scan_mode;
> +
> RTE_EXPORT_SYMBOL(rte_bus_name)
> const char *
> rte_bus_name(const struct rte_bus *bus)
> @@ -252,7 +254,7 @@ rte_bus_is_ignored_device(const struct rte_bus *bus, const char *dev_name)
> {
> struct rte_devargs *devargs = rte_bus_find_devargs(bus, dev_name);
>
> - switch (bus->conf.scan_mode) {
> + switch (rte_bus_scan_mode_get()) {
> case RTE_BUS_SCAN_ALLOWLIST:
> if (devargs && devargs->policy == RTE_DEV_ALLOWED)
> return false;
> @@ -266,6 +268,22 @@ rte_bus_is_ignored_device(const struct rte_bus *bus, const char *dev_name)
> return true;
> }
>
> +enum rte_bus_scan_mode
> +rte_bus_scan_mode_get(void)
> +{
> + return bus_scan_mode;
> +}
> +
> +int
> +rte_bus_scan_mode_set(enum rte_bus_scan_mode scan_mode)
> +{
> + if (bus_scan_mode != RTE_BUS_SCAN_UNDEFINED)
> + return -EINVAL;
> +
> + bus_scan_mode = scan_mode;
> + return 0;
> +}
> +
> /*
> * Get iommu class of devices on the bus.
> */
> diff --git a/lib/eal/common/eal_common_devargs.c b/lib/eal/common/eal_common_devargs.c
> index c523429d67..8083bdebc2 100644
> --- a/lib/eal/common/eal_common_devargs.c
> +++ b/lib/eal/common/eal_common_devargs.c
> @@ -330,7 +330,6 @@ int
> rte_devargs_add(enum rte_devtype devtype, const char *devargs_str)
> {
> struct rte_devargs *devargs = NULL;
> - struct rte_bus *bus = NULL;
> const char *dev = devargs_str;
>
> /* use calloc instead of rte_zmalloc as it's called early at init */
> @@ -341,14 +340,13 @@ rte_devargs_add(enum rte_devtype devtype, const char *devargs_str)
> if (rte_devargs_parse(devargs, dev))
> goto fail;
> devargs->type = devtype;
> - bus = devargs->bus;
> if (devargs->type == RTE_DEVTYPE_BLOCKED)
> devargs->policy = RTE_DEV_BLOCKED;
> - if (bus->conf.scan_mode == RTE_BUS_SCAN_UNDEFINED) {
> + if (rte_bus_scan_mode_get() == RTE_BUS_SCAN_UNDEFINED) {
> if (devargs->policy == RTE_DEV_ALLOWED)
> - bus->conf.scan_mode = RTE_BUS_SCAN_ALLOWLIST;
> + rte_bus_scan_mode_set(RTE_BUS_SCAN_ALLOWLIST);
> else if (devargs->policy == RTE_DEV_BLOCKED)
> - bus->conf.scan_mode = RTE_BUS_SCAN_BLOCKLIST;
> + rte_bus_scan_mode_set(RTE_BUS_SCAN_BLOCKLIST);
> }
> TAILQ_INSERT_TAIL(&devargs_list, devargs, next);
> return 0;
> diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h
> index e032dd10c9..12db04dce2 100644
> --- a/lib/eal/common/eal_private.h
> +++ b/lib/eal/common/eal_private.h
> @@ -469,6 +469,37 @@ int rte_eal_memory_detach(void);
> */
> struct rte_bus *rte_bus_find_by_device_name(const char *str);
>
> +/**
> + * Bus scan policies
> + */
> +enum rte_bus_scan_mode {
> + RTE_BUS_SCAN_UNDEFINED,
> + RTE_BUS_SCAN_ALLOWLIST,
> + RTE_BUS_SCAN_BLOCKLIST,
> +};
> +
> +/**
> + * Retrieve the current bus scanning mode.
> + *
> + * @return
> + * The current bus scanning mode.
> + */
> +enum rte_bus_scan_mode rte_bus_scan_mode_get(void);
> +
> +/**
> + * Change the bus scanning mode.
> + * Changing the mode can only be done once from undefined to allow list or to block list.
> + * No change from allow to block (or vice versa) is allowed.
> + *
> + * @param scan_mode
> + * The scanning mode to apply.
> + *
> + * @return
> + * 0 on successful change.
> + * < 0 on failure.
> + */
> +int rte_bus_scan_mode_set(enum rte_bus_scan_mode scan_mode);
> +
> /**
> * For each device on the buses, call the driver-specific function for
> * device cleanup.
> diff --git a/lib/eal/include/bus_driver.h b/lib/eal/include/bus_driver.h
> index e67e052404..9045d64816 100644
> --- a/lib/eal/include/bus_driver.h
> +++ b/lib/eal/include/bus_driver.h
> @@ -232,23 +232,6 @@ typedef int (*rte_bus_sigbus_handler_t)(const void *failure_addr);
> */
> typedef int (*rte_bus_cleanup_t)(void);
>
> -/**
> - * Bus scan policies
> - */
> -enum rte_bus_scan_mode {
> - RTE_BUS_SCAN_UNDEFINED,
> - RTE_BUS_SCAN_ALLOWLIST,
> - RTE_BUS_SCAN_BLOCKLIST,
> -};
> -
> -/**
> - * A structure used to configure bus operations.
> - */
> -struct rte_bus_conf {
> - enum rte_bus_scan_mode scan_mode; /**< Scan policy. */
> -};
> -
> -
> /**
> * Get common iommu class of the all the devices on the bus. The bus may
> * check that those devices are attached to iommu driver.
> @@ -277,7 +260,6 @@ struct rte_bus {
> rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
> rte_dev_dma_map_t dma_map; /**< DMA map for device in the bus */
> rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
> - struct rte_bus_conf conf; /**< Bus configuration */
> rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
> rte_dev_iterate_t dev_iterate; /**< Device iterator. */
> rte_bus_hot_unplug_handler_t hot_unplug_handler;
^ permalink raw reply [flat|nested] 67+ messages in thread* Re: [PATCH 7/8] bus: remove per bus scan mode
2026-03-24 16:02 ` Kevin Traynor
@ 2026-03-24 16:27 ` Kevin Traynor
2026-03-26 8:54 ` David Marchand
1 sibling, 0 replies; 67+ messages in thread
From: Kevin Traynor @ 2026-03-24 16:27 UTC (permalink / raw)
To: David Marchand, dev
On 3/24/26 4:02 PM, Kevin Traynor wrote:
> On 3/23/26 10:53 AM, David Marchand wrote:
>> Following the refactoring of device selection, it becomes more apparent
>> that there is no need for a per bus scan mode.
>> -a / -b options are mutually exclusive.
>> --vdev option works in parallel of allow/block list scan mode.
>>
>
> -a/-b are mutually exclusive but does it mean "-a 0000:01:00.0" stops
> default probe for all devices on other buses ? Is it a change in behavior ?
>
Given that -a/-b are not mutually exclusive, i suppose we can say the
current behavior is designed to be global and there should not be
independence between buses, which is in keeping with what is done in
this patch.
> (I could probably test but I guess you thought about this case given the
> nature of patch.)
>
>> Remove this (internal) notion.
>>
>> Signed-off-by: David Marchand <david.marchand@redhat.com>
>> ---
>> lib/eal/common/eal_common_bus.c | 20 ++++++++++++++++++-
>> lib/eal/common/eal_common_devargs.c | 8 +++-----
>> lib/eal/common/eal_private.h | 31 +++++++++++++++++++++++++++++
>> lib/eal/include/bus_driver.h | 18 -----------------
>> 4 files changed, 53 insertions(+), 24 deletions(-)
>>
>> diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
>> index 2ca0af7914..27a31bbefa 100644
>> --- a/lib/eal/common/eal_common_bus.c
>> +++ b/lib/eal/common/eal_common_bus.c
>> @@ -18,6 +18,8 @@
>> static struct rte_bus_list rte_bus_list =
>> TAILQ_HEAD_INITIALIZER(rte_bus_list);
>>
>> +static enum rte_bus_scan_mode bus_scan_mode;
>> +
>> RTE_EXPORT_SYMBOL(rte_bus_name)
>> const char *
>> rte_bus_name(const struct rte_bus *bus)
>> @@ -252,7 +254,7 @@ rte_bus_is_ignored_device(const struct rte_bus *bus, const char *dev_name)
>> {
>> struct rte_devargs *devargs = rte_bus_find_devargs(bus, dev_name);
>>
>> - switch (bus->conf.scan_mode) {
>> + switch (rte_bus_scan_mode_get()) {
>> case RTE_BUS_SCAN_ALLOWLIST:
>> if (devargs && devargs->policy == RTE_DEV_ALLOWED)
>> return false;
>> @@ -266,6 +268,22 @@ rte_bus_is_ignored_device(const struct rte_bus *bus, const char *dev_name)
>> return true;
>> }
>>
>> +enum rte_bus_scan_mode
>> +rte_bus_scan_mode_get(void)
>> +{
>> + return bus_scan_mode;
>> +}
>> +
>> +int
>> +rte_bus_scan_mode_set(enum rte_bus_scan_mode scan_mode)
>> +{
>> + if (bus_scan_mode != RTE_BUS_SCAN_UNDEFINED)
>> + return -EINVAL;
>> +
>> + bus_scan_mode = scan_mode;
>> + return 0;
>> +}
>> +
>> /*
>> * Get iommu class of devices on the bus.
>> */
>> diff --git a/lib/eal/common/eal_common_devargs.c b/lib/eal/common/eal_common_devargs.c
>> index c523429d67..8083bdebc2 100644
>> --- a/lib/eal/common/eal_common_devargs.c
>> +++ b/lib/eal/common/eal_common_devargs.c
>> @@ -330,7 +330,6 @@ int
>> rte_devargs_add(enum rte_devtype devtype, const char *devargs_str)
>> {
>> struct rte_devargs *devargs = NULL;
>> - struct rte_bus *bus = NULL;
>> const char *dev = devargs_str;
>>
>> /* use calloc instead of rte_zmalloc as it's called early at init */
>> @@ -341,14 +340,13 @@ rte_devargs_add(enum rte_devtype devtype, const char *devargs_str)
>> if (rte_devargs_parse(devargs, dev))
>> goto fail;
>> devargs->type = devtype;
>> - bus = devargs->bus;
>> if (devargs->type == RTE_DEVTYPE_BLOCKED)
>> devargs->policy = RTE_DEV_BLOCKED;
>> - if (bus->conf.scan_mode == RTE_BUS_SCAN_UNDEFINED) {
>> + if (rte_bus_scan_mode_get() == RTE_BUS_SCAN_UNDEFINED) {
>> if (devargs->policy == RTE_DEV_ALLOWED)
>> - bus->conf.scan_mode = RTE_BUS_SCAN_ALLOWLIST;
>> + rte_bus_scan_mode_set(RTE_BUS_SCAN_ALLOWLIST);
>> else if (devargs->policy == RTE_DEV_BLOCKED)
>> - bus->conf.scan_mode = RTE_BUS_SCAN_BLOCKLIST;
>> + rte_bus_scan_mode_set(RTE_BUS_SCAN_BLOCKLIST);
>> }
>> TAILQ_INSERT_TAIL(&devargs_list, devargs, next);
>> return 0;
>> diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h
>> index e032dd10c9..12db04dce2 100644
>> --- a/lib/eal/common/eal_private.h
>> +++ b/lib/eal/common/eal_private.h
>> @@ -469,6 +469,37 @@ int rte_eal_memory_detach(void);
>> */
>> struct rte_bus *rte_bus_find_by_device_name(const char *str);
>>
>> +/**
>> + * Bus scan policies
>> + */
>> +enum rte_bus_scan_mode {
>> + RTE_BUS_SCAN_UNDEFINED,
>> + RTE_BUS_SCAN_ALLOWLIST,
>> + RTE_BUS_SCAN_BLOCKLIST,
>> +};
>> +
>> +/**
>> + * Retrieve the current bus scanning mode.
>> + *
>> + * @return
>> + * The current bus scanning mode.
>> + */
>> +enum rte_bus_scan_mode rte_bus_scan_mode_get(void);
>> +
>> +/**
>> + * Change the bus scanning mode.
>> + * Changing the mode can only be done once from undefined to allow list or to block list.
>> + * No change from allow to block (or vice versa) is allowed.
>> + *
>> + * @param scan_mode
>> + * The scanning mode to apply.
>> + *
>> + * @return
>> + * 0 on successful change.
>> + * < 0 on failure.
>> + */
>> +int rte_bus_scan_mode_set(enum rte_bus_scan_mode scan_mode);
>> +
>> /**
>> * For each device on the buses, call the driver-specific function for
>> * device cleanup.
>> diff --git a/lib/eal/include/bus_driver.h b/lib/eal/include/bus_driver.h
>> index e67e052404..9045d64816 100644
>> --- a/lib/eal/include/bus_driver.h
>> +++ b/lib/eal/include/bus_driver.h
>> @@ -232,23 +232,6 @@ typedef int (*rte_bus_sigbus_handler_t)(const void *failure_addr);
>> */
>> typedef int (*rte_bus_cleanup_t)(void);
>>
>> -/**
>> - * Bus scan policies
>> - */
>> -enum rte_bus_scan_mode {
>> - RTE_BUS_SCAN_UNDEFINED,
>> - RTE_BUS_SCAN_ALLOWLIST,
>> - RTE_BUS_SCAN_BLOCKLIST,
>> -};
>> -
>> -/**
>> - * A structure used to configure bus operations.
>> - */
>> -struct rte_bus_conf {
>> - enum rte_bus_scan_mode scan_mode; /**< Scan policy. */
>> -};
>> -
>> -
>> /**
>> * Get common iommu class of the all the devices on the bus. The bus may
>> * check that those devices are attached to iommu driver.
>> @@ -277,7 +260,6 @@ struct rte_bus {
>> rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
>> rte_dev_dma_map_t dma_map; /**< DMA map for device in the bus */
>> rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
>> - struct rte_bus_conf conf; /**< Bus configuration */
>> rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
>> rte_dev_iterate_t dev_iterate; /**< Device iterator. */
>> rte_bus_hot_unplug_handler_t hot_unplug_handler;
>
^ permalink raw reply [flat|nested] 67+ messages in thread* Re: [PATCH 7/8] bus: remove per bus scan mode
2026-03-24 16:02 ` Kevin Traynor
2026-03-24 16:27 ` Kevin Traynor
@ 2026-03-26 8:54 ` David Marchand
1 sibling, 0 replies; 67+ messages in thread
From: David Marchand @ 2026-03-26 8:54 UTC (permalink / raw)
To: Kevin Traynor; +Cc: dev
On Tue, 24 Mar 2026 at 17:02, Kevin Traynor <ktraynor@redhat.com> wrote:
>
> On 3/23/26 10:53 AM, David Marchand wrote:
> > Following the refactoring of device selection, it becomes more apparent
> > that there is no need for a per bus scan mode.
> > -a / -b options are mutually exclusive.
> > --vdev option works in parallel of allow/block list scan mode.
> >
>
> -a/-b are mutually exclusive but does it mean "-a 0000:01:00.0" stops
> default probe for all devices on other buses ? Is it a change in behavior ?
>
> (I could probably test but I guess you thought about this case given the
> nature of patch.)
Hum, yeah, it is a change in behavior, I was too focused on the next
patch (where the new mode can't be used with -b option).
This patch was an attempt at simplifying.
Since there is a risk some user may have relied on this combination
(iow some user setting -a busA:XXX yet relying on block mode for other
buses), I'll just drop it and return to how it was in RFC v3.
--
David Marchand
^ permalink raw reply [flat|nested] 67+ messages in thread
* [PATCH 8/8] eal: configure initial device probing
2026-03-23 10:52 [PATCH 0/8] Rework device probing David Marchand
` (6 preceding siblings ...)
2026-03-23 10:53 ` [PATCH 7/8] bus: remove per bus scan mode David Marchand
@ 2026-03-23 10:53 ` David Marchand
2026-03-25 10:57 ` Kevin Traynor
2026-03-24 5:17 ` [PATCH 0/8] Rework " Hemant Agrawal
` (3 subsequent siblings)
11 siblings, 1 reply; 67+ messages in thread
From: David Marchand @ 2026-03-23 10:53 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, Robin Jarry, Thomas Monjalon, Andrew Rybchenko
Some applications use port hotplug as their primary way for using DPDK
resources.
Having a systematic device probing is a problem when not all available
resources will be used by the application, as such applications won't set
an explicit allow list at startup.
This is the case for OVS on systems with multiple mlx5 devices:
one device can be used by the kernel while the other(s) are used by DPDK.
In such a setup, the kernel used device may get reconfigured in
unexpected ways and trigger issues like the one described by Kevin
not so long ago in bugzilla 1873.
Add an EAL option so that we can change the default behavior from
block-listing to allow-listing which can be summed up as disabling
automatic probing.
In case some applications want to require automatic probing, add the
opposite option.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Robin Jarry <rjarry@redhat.com>
---
Changes since RFC v2:
- added -A short option alias as it seems intuitive to use with -a,
- renamed option to --no-auto-probing (half Robin and half Thomas
suggestions),
- made -A and -b conflicting options,
- added opposite option in case an application wants an explicit behavior,
- updated unit tests accordingly,
- updated documentation (namely some detail on --vdev),
Changes since RFC v1:
- changed approach following Bruce suggestion,
---
app/test/test_eal_flags.c | 63 +++++++++++++++++++++++
devtools/test-null.sh | 2 +-
doc/guides/linux_gsg/eal_args.include.rst | 13 +++++
lib/eal/common/eal_common_bus.c | 17 +++---
lib/eal/common/eal_common_options.c | 10 ++++
lib/eal/common/eal_internal_cfg.h | 1 +
lib/eal/common/eal_option_list.h | 2 +
7 files changed, 101 insertions(+), 7 deletions(-)
diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
index b3a8d0ae6f..5594cc992d 100644
--- a/app/test/test_eal_flags.c
+++ b/app/test/test_eal_flags.c
@@ -119,6 +119,8 @@ test_misc_flags(void)
#define no_hpet "--no-hpet"
#define no_huge "--no-huge"
#define no_shconf "--no-shconf"
+#define auto_probing "--auto-probing"
+#define no_auto_probing "--no-auto-probing"
#define allow "--allow"
#define vdev "--vdev"
#define no_pci "--no-pci"
@@ -338,6 +340,14 @@ test_allow_flag(void)
allow, "09:0B.3,type=test",
allow, "08:00.1,type=normal",
};
+ const char *wlval4[] = {prgname, prefix, mp_flag, eal_debug_logs,
+ no_auto_probing };
+ const char *wlval5[] = {prgname, prefix, mp_flag, eal_debug_logs,
+ no_auto_probing, allow, "00FF:09:0B.3"};
+ const char *wlval6[] = {prgname, prefix, mp_flag, eal_debug_logs,
+ auto_probing };
+ const char *wlval7[] = {prgname, prefix, mp_flag, eal_debug_logs,
+ auto_probing, allow, "00FF:09:0B.3"};
for (i = 0; i < RTE_DIM(wlinval); i++) {
if (launch_proc(wlinval[i]) == 0) {
@@ -360,6 +370,26 @@ test_allow_flag(void)
__LINE__);
return -1;
}
+ if (launch_proc(wlval4) != 0) {
+ printf("Error (line %d) - process did not run ok with no-auto-probing\n",
+ __LINE__);
+ return -1;
+ }
+ if (launch_proc(wlval5) != 0) {
+ printf("Error (line %d) - process did not run ok with no-auto-probing + allow\n",
+ __LINE__);
+ return -1;
+ }
+ if (launch_proc(wlval6) != 0) {
+ printf("Error (line %d) - process did not run ok with auto-probing\n",
+ __LINE__);
+ return -1;
+ }
+ if (launch_proc(wlval7) != 0) {
+ printf("Error (line %d) - process did not run ok with auto-probing + allow\n",
+ __LINE__);
+ return -1;
+ }
return 0;
}
@@ -383,6 +413,11 @@ test_invalid_b_flag(void)
{prgname, prefix, mp_flag, eal_debug_logs, "-b", "error0:0:0.1"},
{prgname, prefix, mp_flag, eal_debug_logs, "-b", "0:0:0.1.2"},
};
+ const char *blinval_probing[] =
+ {prgname, prefix, mp_flag, eal_debug_logs, "-b", "0:0.0", auto_probing};
+ const char *blinval_probing_inval[] =
+ {prgname, prefix, mp_flag, eal_debug_logs, "-b", "0:0.0", no_auto_probing};
+
/* Test with valid blocklist option */
const char *blval[] = {prgname, prefix, mp_flag, eal_debug_logs,
"-b", "FF:09:0B.3"};
@@ -396,6 +431,16 @@ test_invalid_b_flag(void)
return -1;
}
}
+ if (launch_proc(blinval_probing) != 0) {
+ printf("Error (line %d) - process did not run ok with blocklist and auto-probing\n",
+ __LINE__);
+ return -1;
+ }
+ if (launch_proc(blinval_probing_inval) == 0) {
+ printf("Error (line %d) - process did run ok with blocklist and no-auto-probing\n",
+ __LINE__);
+ return -1;
+ }
if (launch_proc(blval) != 0) {
printf("Error (line %d) - process did not run ok with valid blocklist value\n",
__LINE__);
@@ -434,6 +479,12 @@ test_invalid_vdev_flag(void)
const char *vdevval3[] = {prgname, prefix, no_huge, eal_debug_logs,
bus_debug_logs, no_pci, vdev, "net_ring0,nodeaction=r1:0:CREATE"};
+ const char *vdevval4[] = {prgname, prefix, no_huge, eal_debug_logs,
+ bus_debug_logs, no_auto_probing, vdev, "net_ring0"};
+
+ const char *vdevval5[] = {prgname, prefix, no_huge, eal_debug_logs,
+ bus_debug_logs, auto_probing, vdev, "net_ring0"};
+
if (launch_proc(vdevinval) == 0) {
printf("Error (line %d) - process did run ok with invalid vdev parameter\n",
__LINE__);
@@ -457,6 +508,18 @@ test_invalid_vdev_flag(void)
__LINE__);
return -1;
}
+
+ if (launch_proc(vdevval4) != 0) {
+ printf("Error (line %d) - process did not run ok with valid vdev value and no-auto-probing\n",
+ __LINE__);
+ return -1;
+ }
+
+ if (launch_proc(vdevval5) != 0) {
+ printf("Error (line %d) - process did not run ok with valid vdev value and auto-probing\n",
+ __LINE__);
+ return -1;
+ }
return 0;
#else
return TEST_SKIPPED;
diff --git a/devtools/test-null.sh b/devtools/test-null.sh
index 8f21189262..5e8a1b20cd 100755
--- a/devtools/test-null.sh
+++ b/devtools/test-null.sh
@@ -30,7 +30,7 @@ logfile=$build/test-null.log
(sleep 1 && echo stop) |
# testpmd only needs 20M, make it x2 (default number of cores) for NUMA systems
$testpmd -l $corelist --no-huge -m 40 \
- $libs -a 0:0.0 --vdev net_null1 --vdev net_null2 $eal_options -- \
+ $libs -A --vdev net_null1 --vdev net_null2 $eal_options -- \
--no-mlockall --total-num-mbufs=2048 $testpmd_options -ia | tee $logfile
# we expect two ports and some traffic is received and transmitted
diff --git a/doc/guides/linux_gsg/eal_args.include.rst b/doc/guides/linux_gsg/eal_args.include.rst
index 4a3c4d9b5f..db9eff9321 100644
--- a/doc/guides/linux_gsg/eal_args.include.rst
+++ b/doc/guides/linux_gsg/eal_args.include.rst
@@ -101,6 +101,19 @@ Lcore-related options
Device-related options
~~~~~~~~~~~~~~~~~~~~~~
+* ``-A, --no-auto-probing``
+
+ By default, EAL probes all devices on every available bus, unless some ``-a``/``-b``
+ options are passed.
+ Disable automatic probing of non-blocked devices.
+
+.. Note::
+ Block list cannot be used when auto probing is disabled.
+
+ On the other hand, disabling auto probing does not affect the VDEV bus.
+ The VDEV bus is not concerned by automatic probing and requires explicit
+ ``-a`` or ``--vdev``.
+
* ``-b, --block <[domain:]bus:devid.func>``
Skip probing a PCI device to prevent EAL from using it.
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index 27a31bbefa..43503e6b13 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -252,18 +252,23 @@ RTE_EXPORT_INTERNAL_SYMBOL(rte_bus_is_ignored_device)
bool
rte_bus_is_ignored_device(const struct rte_bus *bus, const char *dev_name)
{
+ const struct internal_config *internal_conf = eal_get_internal_configuration();
struct rte_devargs *devargs = rte_bus_find_devargs(bus, dev_name);
+ enum rte_bus_scan_mode scan_mode = rte_bus_scan_mode_get();
- switch (rte_bus_scan_mode_get()) {
- case RTE_BUS_SCAN_ALLOWLIST:
+ if (scan_mode == RTE_BUS_SCAN_UNDEFINED) {
+ if (internal_conf->no_auto_probing != 0)
+ scan_mode = RTE_BUS_SCAN_ALLOWLIST;
+ else
+ scan_mode = RTE_BUS_SCAN_BLOCKLIST;
+ }
+
+ if (scan_mode == RTE_BUS_SCAN_ALLOWLIST) {
if (devargs && devargs->policy == RTE_DEV_ALLOWED)
return false;
- break;
- case RTE_BUS_SCAN_UNDEFINED:
- case RTE_BUS_SCAN_BLOCKLIST:
+ } else {
if (devargs == NULL || devargs->policy != RTE_DEV_BLOCKED)
return false;
- break;
}
return true;
}
diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c
index aad676a004..290386dc63 100644
--- a/lib/eal/common/eal_common_options.c
+++ b/lib/eal/common/eal_common_options.c
@@ -233,10 +233,15 @@ eal_collate_args(int argc, char **argv)
EAL_LOG(ERR, "Options allow (-a) and block (-b) can't be used at the same time");
return -1;
}
+ if (args.no_auto_probing && !TAILQ_EMPTY(&args.block)) {
+ EAL_LOG(ERR, "Options no-auto-probing and block (-b) can't be used at the same time");
+ return -1;
+ }
/* for non-list args, we can just check for zero/null values using macro */
if (CONFLICTING_OPTIONS(args, coremask, lcores) ||
CONFLICTING_OPTIONS(args, service_coremask, service_corelist) ||
+ CONFLICTING_OPTIONS(args, no_auto_probing, auto_probing) ||
CONFLICTING_OPTIONS(args, no_telemetry, telemetry) ||
CONFLICTING_OPTIONS(args, memory_size, numa_mem) ||
CONFLICTING_OPTIONS(args, no_huge, numa_mem) ||
@@ -518,6 +523,8 @@ eal_reset_internal_config(struct internal_config *internal_cfg)
memset(internal_cfg->vfio_vf_token, 0,
sizeof(internal_cfg->vfio_vf_token));
+ internal_cfg->no_auto_probing = 0;
+
#ifdef RTE_LIBEAL_USE_HPET
internal_cfg->no_hpet = 0;
#else
@@ -1972,6 +1979,9 @@ eal_parse_args(void)
}
}
+ if (args.no_auto_probing)
+ int_cfg->no_auto_probing = 1;
+
/* device -a/-b/-vdev options*/
TAILQ_FOREACH(arg, &args.allow, next)
if (eal_option_device_add(RTE_DEVTYPE_ALLOWED, arg->arg) < 0)
diff --git a/lib/eal/common/eal_internal_cfg.h b/lib/eal/common/eal_internal_cfg.h
index 95d327a613..fac45cbe66 100644
--- a/lib/eal/common/eal_internal_cfg.h
+++ b/lib/eal/common/eal_internal_cfg.h
@@ -104,6 +104,7 @@ struct internal_config {
struct simd_bitwidth max_simd_bitwidth;
/**< max simd bitwidth path to use */
size_t huge_worker_stack_size; /**< worker thread stack size */
+ unsigned int no_auto_probing; /**< true to switch from block-listing to allow-listing */
};
void eal_reset_internal_config(struct internal_config *internal_cfg);
diff --git a/lib/eal/common/eal_option_list.h b/lib/eal/common/eal_option_list.h
index abee16340b..6a5ddfd8d1 100644
--- a/lib/eal/common/eal_option_list.h
+++ b/lib/eal/common/eal_option_list.h
@@ -32,6 +32,7 @@
* Format of each entry: long name, short name, help string, struct member name.
*/
/* (Alphabetical) List of common options first */
+BOOL_ARG("--auto-probing", NULL, "Let EAL probe all available devices unless some -a/-b option is set.", auto_probing)
LIST_ARG("--allow", "-a", "Add device to allow-list, causing DPDK to only use specified devices", allow)
STR_ARG("--base-virtaddr", NULL, "Base virtual address to reserve memory", base_virtaddr)
LIST_ARG("--block", "-b", "Add device to block-list, preventing DPDK from using the device", block)
@@ -51,6 +52,7 @@ STR_ARG("--mbuf-pool-ops-name", NULL, "User defined mbuf default pool ops name",
STR_ARG("--memory-channels", "-n", "Number of memory channels per socket", memory_channels)
STR_ARG("--memory-ranks", "-r", "Force number of memory ranks (don't detect)", memory_ranks)
STR_ARG("--memory-size", "-m", "Total size of memory to allocate initially", memory_size)
+BOOL_ARG("--no-auto-probing", "-A", "Do not probe any devices unless some -a option is set", no_auto_probing)
BOOL_ARG("--no-hpet", NULL, "Disable HPET timer", no_hpet)
BOOL_ARG("--no-huge", NULL, "Disable hugetlbfs support", no_huge)
BOOL_ARG("--no-pci", NULL, "Disable all PCI devices", no_pci)
--
2.53.0
^ permalink raw reply related [flat|nested] 67+ messages in thread* Re: [PATCH 8/8] eal: configure initial device probing
2026-03-23 10:53 ` [PATCH 8/8] eal: configure initial device probing David Marchand
@ 2026-03-25 10:57 ` Kevin Traynor
0 siblings, 0 replies; 67+ messages in thread
From: Kevin Traynor @ 2026-03-25 10:57 UTC (permalink / raw)
To: David Marchand, dev
Cc: Bruce Richardson, Robin Jarry, Thomas Monjalon, Andrew Rybchenko
On 3/23/26 10:53 AM, David Marchand wrote:
> Some applications use port hotplug as their primary way for using DPDK
> resources.
> Having a systematic device probing is a problem when not all available
> resources will be used by the application, as such applications won't set
> an explicit allow list at startup.
>
> This is the case for OVS on systems with multiple mlx5 devices:
> one device can be used by the kernel while the other(s) are used by DPDK.
> In such a setup, the kernel used device may get reconfigured in
> unexpected ways and trigger issues like the one described by Kevin
> not so long ago in bugzilla 1873.
>
> Add an EAL option so that we can change the default behavior from
> block-listing to allow-listing which can be summed up as disabling
> automatic probing.
> In case some applications want to require automatic probing, add the
> opposite option.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Reviewed-by: Robin Jarry <rjarry@redhat.com>
> ---
> Changes since RFC v2:
> - added -A short option alias as it seems intuitive to use with -a,
nit: I think I would have said '-B' as it's not allowing anything and
it's equivalent of adding a -b for all devices, but let's not bike shed
on it :-)
> - renamed option to --no-auto-probing (half Robin and half Thomas
> suggestions),
> - made -A and -b conflicting options,
> - added opposite option in case an application wants an explicit behavior,
> - updated unit tests accordingly,
> - updated documentation (namely some detail on --vdev),
>
> Changes since RFC v1:
> - changed approach following Bruce suggestion,
>
> ---
> app/test/test_eal_flags.c | 63 +++++++++++++++++++++++
> devtools/test-null.sh | 2 +-
> doc/guides/linux_gsg/eal_args.include.rst | 13 +++++
> lib/eal/common/eal_common_bus.c | 17 +++---
> lib/eal/common/eal_common_options.c | 10 ++++
> lib/eal/common/eal_internal_cfg.h | 1 +
> lib/eal/common/eal_option_list.h | 2 +
> 7 files changed, 101 insertions(+), 7 deletions(-)
>
LGTM
Acked-by: Kevin Traynor <ktraynor@redhat.com>
^ permalink raw reply [flat|nested] 67+ messages in thread
* Re: [PATCH 0/8] Rework device probing
2026-03-23 10:52 [PATCH 0/8] Rework device probing David Marchand
` (7 preceding siblings ...)
2026-03-23 10:53 ` [PATCH 8/8] eal: configure initial device probing David Marchand
@ 2026-03-24 5:17 ` Hemant Agrawal
2026-03-25 15:22 ` Maxime Leroy
` (2 subsequent siblings)
11 siblings, 0 replies; 67+ messages in thread
From: Hemant Agrawal @ 2026-03-24 5:17 UTC (permalink / raw)
To: dev
On 23-03-2026 16:22, David Marchand wrote:
> Applications relying on device hotplug don't work well with the default
> probing of all available resources.
> This series proposes to change this behavior via a new EAL option.
>
Series-
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
^ permalink raw reply [flat|nested] 67+ messages in thread* Re: [PATCH 0/8] Rework device probing
2026-03-23 10:52 [PATCH 0/8] Rework device probing David Marchand
` (8 preceding siblings ...)
2026-03-24 5:17 ` [PATCH 0/8] Rework " Hemant Agrawal
@ 2026-03-25 15:22 ` Maxime Leroy
2026-03-26 10:24 ` [PATCH v2 0/7] " David Marchand
2026-04-07 11:52 ` [PATCH v3 0/7] Rework " David Marchand
11 siblings, 0 replies; 67+ messages in thread
From: Maxime Leroy @ 2026-03-25 15:22 UTC (permalink / raw)
To: David Marchand; +Cc: dev
Hi David,
On Mon, Mar 23, 2026 at 11:53 AM David Marchand
<david.marchand@redhat.com> wrote:
>
> Applications relying on device hotplug don't work well with the default
> probing of all available resources.
> This series proposes to change this behavior via a new EAL option.
On my side, the whole series works fine with Grout on NXP CPUs.
I can add DPDK ports, send/receive traffic, delete ports, recreate them, etc.
>
>
> --
> David Marchand
>
> Changes since RFC v3:
> - removed per bus scan mode,
>
> Changes since RFC v2:
> - went one step further and reworked devargs lookup in buses following
> Bruce comment (see patch 4 which is cosmetic, and patch 5),
> - updated device selection helper accordingly and
> changed API to be device name based,
> - renamed option, added check on -b presence, updated doc in the last
> patch,
>
> Changes since RFC v1:
> - reviewed bus probe() and cleaned up NXP drivers,
> - changed approach following Bruce comment,
>
> David Marchand (8):
> devtools: check packet forwarding in null test
> bus/fslmc: fix bus cleanup
> drivers/bus: require probe function for NXP drivers
> drivers: cleanup devargs lookup in bus scan
> bus: factorize devargs lookup
> bus: factorize device selection
> bus: remove per bus scan mode
> eal: configure initial device probing
>
> app/test/test_eal_flags.c | 63 +++++++++++++++++
> devtools/test-null.sh | 10 ++-
> doc/guides/linux_gsg/eal_args.include.rst | 13 ++++
> drivers/bus/auxiliary/auxiliary_common.c | 33 +--------
> drivers/bus/auxiliary/bus_auxiliary_driver.h | 2 -
> drivers/bus/auxiliary/linux/auxiliary.c | 2 +-
> drivers/bus/auxiliary/private.h | 6 --
> drivers/bus/cdx/cdx.c | 34 +---------
> drivers/bus/dpaa/dpaa_bus.c | 71 +++++++++-----------
> drivers/bus/fslmc/fslmc_bus.c | 69 ++++++++-----------
> drivers/bus/fslmc/fslmc_vfio.c | 21 ++----
> drivers/bus/ifpga/bus_ifpga_driver.h | 2 -
> drivers/bus/ifpga/ifpga_bus.c | 4 +-
> drivers/bus/pci/bsd/pci.c | 5 +-
> drivers/bus/pci/linux/pci.c | 2 +-
> drivers/bus/pci/pci_common.c | 51 ++++----------
> drivers/bus/pci/private.h | 11 ---
> drivers/bus/pci/windows/pci.c | 4 +-
> drivers/bus/platform/platform.c | 43 +-----------
> drivers/bus/uacce/uacce.c | 39 +----------
> drivers/bus/vdev/vdev.c | 2 +-
> drivers/bus/vmbus/linux/vmbus_bus.c | 2 +-
> drivers/bus/vmbus/private.h | 3 -
> drivers/bus/vmbus/vmbus_common.c | 45 +++----------
> drivers/dma/idxd/idxd_bus.c | 18 +----
> drivers/raw/ifpga/ifpga_rawdev.c | 2 +-
> lib/eal/common/eal_common_bus.c | 62 +++++++++++++++++
> lib/eal/common/eal_common_devargs.c | 8 +--
> lib/eal/common/eal_common_options.c | 10 +++
> lib/eal/common/eal_internal_cfg.h | 1 +
> lib/eal/common/eal_option_list.h | 2 +
> lib/eal/common/eal_private.h | 31 +++++++++
> lib/eal/include/bus_driver.h | 55 ++++++++++-----
> 33 files changed, 338 insertions(+), 388 deletions(-)
>
> --
> 2.53.0
>
Best regards,
Maxime Leroy
^ permalink raw reply [flat|nested] 67+ messages in thread* [PATCH v2 0/7] Rework device probing
2026-03-23 10:52 [PATCH 0/8] Rework device probing David Marchand
` (9 preceding siblings ...)
2026-03-25 15:22 ` Maxime Leroy
@ 2026-03-26 10:24 ` David Marchand
2026-03-26 10:24 ` [PATCH v2 1/7] devtools: check packet forwarding in null test David Marchand
` (6 more replies)
2026-04-07 11:52 ` [PATCH v3 0/7] Rework " David Marchand
11 siblings, 7 replies; 67+ messages in thread
From: David Marchand @ 2026-03-26 10:24 UTC (permalink / raw)
To: dev
Applications relying on device hotplug don't work well with the default
probing of all available resources.
This series proposes to change this behavior via a new EAL option.
--
David Marchand
Changes since v1:
- restored per bus scan mode,
- fixed logic in device selection for dma/idxd,
- fixed raw/ifpga hotplug on ifpga bus,
- fixed some doxygen,
Changes since RFC v3:
- removed per bus scan mode,
Changes since RFC v2:
- went one step further and reworked devargs lookup in buses following
Bruce comment (see patch 4 which is cosmetic, and patch 5),
- updated device selection helper accordingly and
changed API to be device name based,
- renamed option, added check on -b presence, updated doc in the last
patch,
Changes since RFC v1:
- reviewed bus probe() and cleaned up NXP drivers,
- changed approach following Bruce comment,
David Marchand (7):
devtools: check packet forwarding in null test
bus/fslmc: fix bus cleanup
drivers/bus: require probe function for NXP drivers
drivers: cleanup devargs lookup in bus scan
bus: factorize devargs lookup
bus: factorize device selection
eal: configure initial device probing
app/test/test_eal_flags.c | 63 +++++++++++++++++
devtools/test-null.sh | 10 ++-
doc/guides/linux_gsg/eal_args.include.rst | 13 ++++
drivers/bus/auxiliary/auxiliary_common.c | 33 +--------
drivers/bus/auxiliary/bus_auxiliary_driver.h | 2 -
drivers/bus/auxiliary/linux/auxiliary.c | 2 +-
drivers/bus/auxiliary/private.h | 6 --
drivers/bus/cdx/cdx.c | 34 +---------
drivers/bus/dpaa/dpaa_bus.c | 71 +++++++++-----------
drivers/bus/fslmc/fslmc_bus.c | 69 ++++++++-----------
drivers/bus/fslmc/fslmc_vfio.c | 21 ++----
drivers/bus/ifpga/ifpga_bus.c | 8 ++-
drivers/bus/pci/bsd/pci.c | 5 +-
drivers/bus/pci/linux/pci.c | 2 +-
drivers/bus/pci/pci_common.c | 51 ++++----------
drivers/bus/pci/private.h | 11 ---
drivers/bus/pci/windows/pci.c | 4 +-
drivers/bus/platform/platform.c | 43 +-----------
drivers/bus/uacce/uacce.c | 39 +----------
drivers/bus/vdev/vdev.c | 2 +-
drivers/bus/vmbus/linux/vmbus_bus.c | 2 +-
drivers/bus/vmbus/private.h | 3 -
drivers/bus/vmbus/vmbus_common.c | 45 +++----------
drivers/dma/idxd/idxd_bus.c | 18 +----
lib/eal/common/eal_common_bus.c | 44 ++++++++++++
lib/eal/common/eal_common_options.c | 10 +++
lib/eal/common/eal_internal_cfg.h | 1 +
lib/eal/common/eal_option_list.h | 2 +
lib/eal/include/bus_driver.h | 38 +++++++++++
29 files changed, 290 insertions(+), 362 deletions(-)
--
2.53.0
^ permalink raw reply [flat|nested] 67+ messages in thread* [PATCH v2 1/7] devtools: check packet forwarding in null test
2026-03-26 10:24 ` [PATCH v2 0/7] " David Marchand
@ 2026-03-26 10:24 ` David Marchand
2026-03-26 10:24 ` [PATCH v2 2/7] bus/fslmc: fix bus cleanup David Marchand
` (5 subsequent siblings)
6 siblings, 0 replies; 67+ messages in thread
From: David Marchand @ 2026-03-26 10:24 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, Hemant Agrawal, Maxime Leroy, Thomas Monjalon,
Andrew Rybchenko
Add some simple checks that testpmd was indeed polling two ports, and
some packets got through it.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Maxime Leroy <maxime@leroys.fr>
---
devtools/test-null.sh | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/devtools/test-null.sh b/devtools/test-null.sh
index e3ac168ce3..8f21189262 100755
--- a/devtools/test-null.sh
+++ b/devtools/test-null.sh
@@ -26,8 +26,14 @@ else
libs=
fi
+logfile=$build/test-null.log
(sleep 1 && echo stop) |
# testpmd only needs 20M, make it x2 (default number of cores) for NUMA systems
$testpmd -l $corelist --no-huge -m 40 \
$libs -a 0:0.0 --vdev net_null1 --vdev net_null2 $eal_options -- \
- --no-mlockall --total-num-mbufs=2048 $testpmd_options -ia
+ --no-mlockall --total-num-mbufs=2048 $testpmd_options -ia | tee $logfile
+
+# we expect two ports and some traffic is received and transmitted
+grep -q 'io packet forwarding - ports=2 -' $build/test-null.log
+grep 'RX-packets: ' $logfile | tail -1 | grep -q 'RX-packets:[[:space:]]*[^0[:space:]]'
+grep 'TX-packets: ' $logfile | tail -1 | grep -q 'TX-packets:[[:space:]]*[^0[:space:]]'
--
2.53.0
^ permalink raw reply related [flat|nested] 67+ messages in thread* [PATCH v2 2/7] bus/fslmc: fix bus cleanup
2026-03-26 10:24 ` [PATCH v2 0/7] " David Marchand
2026-03-26 10:24 ` [PATCH v2 1/7] devtools: check packet forwarding in null test David Marchand
@ 2026-03-26 10:24 ` David Marchand
2026-03-26 11:50 ` Kevin Traynor
2026-03-26 10:24 ` [PATCH v2 3/7] drivers/bus: require probe function for NXP drivers David Marchand
` (4 subsequent siblings)
6 siblings, 1 reply; 67+ messages in thread
From: David Marchand @ 2026-03-26 10:24 UTC (permalink / raw)
To: dev; +Cc: stable, Hemant Agrawal, Maxime Leroy, Sachin Saxena, Rohit Raj
The close operation was never closing probed devices.
Taking a step back, reevaluating the devargs makes no sense during the
close step, as a probed device must have passed the allow/block list
evaluation initially.
Since the device contains a reference to the driver that probed it,
simply call this driver remove op.
Fixes: 274fd921ff7f ("bus/fslmc: support close operation")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Maxime Leroy <maxime@leroys.fr>
---
drivers/bus/fslmc/fslmc_vfio.c | 21 ++++-----------------
1 file changed, 4 insertions(+), 17 deletions(-)
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 550d4e0e8d..7daa18d850 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -1393,7 +1393,7 @@ fslmc_close_iodevices(struct rte_dpaa2_device *dev,
{
struct rte_dpaa2_object *object = NULL;
struct rte_dpaa2_driver *drv;
- int ret, probe_all;
+ int ret;
switch (dev->dev_type) {
case DPAA2_IO:
@@ -1411,22 +1411,9 @@ fslmc_close_iodevices(struct rte_dpaa2_device *dev,
case DPAA2_ETH:
case DPAA2_CRYPTO:
case DPAA2_QDMA:
- probe_all = rte_fslmc_bus.bus.conf.scan_mode !=
- RTE_BUS_SCAN_ALLOWLIST;
- TAILQ_FOREACH(drv, &rte_fslmc_bus.driver_list, next) {
- if (drv->drv_type != dev->dev_type)
- continue;
- if (rte_dev_is_probed(&dev->device))
- continue;
- if (probe_all ||
- (dev->device.devargs &&
- dev->device.devargs->policy ==
- RTE_DEV_ALLOWED)) {
- ret = drv->remove(dev);
- if (ret)
- DPAA2_BUS_ERR("Unable to remove");
- }
- }
+ drv = dev->driver;
+ if (drv && drv->remove && drv->remove(dev))
+ DPAA2_BUS_ERR("Unable to remove");
break;
default:
break;
--
2.53.0
^ permalink raw reply related [flat|nested] 67+ messages in thread* Re: [PATCH v2 2/7] bus/fslmc: fix bus cleanup
2026-03-26 10:24 ` [PATCH v2 2/7] bus/fslmc: fix bus cleanup David Marchand
@ 2026-03-26 11:50 ` Kevin Traynor
0 siblings, 0 replies; 67+ messages in thread
From: Kevin Traynor @ 2026-03-26 11:50 UTC (permalink / raw)
To: David Marchand, dev
Cc: stable, Hemant Agrawal, Maxime Leroy, Sachin Saxena, Rohit Raj
On 3/26/26 10:24 AM, David Marchand wrote:
> The close operation was never closing probed devices.
>
> Taking a step back, reevaluating the devargs makes no sense during the
> close step, as a probed device must have passed the allow/block list
> evaluation initially.
>
> Since the device contains a reference to the driver that probed it,
> simply call this driver remove op.
>
> Fixes: 274fd921ff7f ("bus/fslmc: support close operation")
> Cc: stable@dpdk.org
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> Tested-by: Maxime Leroy <maxime@leroys.fr>
> ---
> drivers/bus/fslmc/fslmc_vfio.c | 21 ++++-----------------
> 1 file changed, 4 insertions(+), 17 deletions(-)
Acked-by: Kevin Traynor <ktraynor@redhat.com>
^ permalink raw reply [flat|nested] 67+ messages in thread
* [PATCH v2 3/7] drivers/bus: require probe function for NXP drivers
2026-03-26 10:24 ` [PATCH v2 0/7] " David Marchand
2026-03-26 10:24 ` [PATCH v2 1/7] devtools: check packet forwarding in null test David Marchand
2026-03-26 10:24 ` [PATCH v2 2/7] bus/fslmc: fix bus cleanup David Marchand
@ 2026-03-26 10:24 ` David Marchand
2026-03-26 10:24 ` [PATCH v2 4/7] drivers: cleanup devargs lookup in bus scan David Marchand
` (3 subsequent siblings)
6 siblings, 0 replies; 67+ messages in thread
From: David Marchand @ 2026-03-26 10:24 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, Kevin Traynor, Hemant Agrawal, Maxime Leroy,
Sachin Saxena
Rather than silently ignore an invalid driver, enforce every registered
driver has a probe callback.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Maxime Leroy <maxime@leroys.fr>
---
drivers/bus/dpaa/dpaa_bus.c | 6 +++---
drivers/bus/fslmc/fslmc_bus.c | 7 +------
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index d9830b68ca..5e0f32bfe8 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -614,6 +614,7 @@ void
rte_dpaa_driver_register(struct rte_dpaa_driver *driver)
{
RTE_VERIFY(driver);
+ RTE_VERIFY(driver->probe != NULL);
BUS_INIT_FUNC_TRACE();
@@ -808,9 +809,8 @@ rte_dpaa_bus_probe(void)
if (rte_dev_is_probed(&dev->device))
continue;
- if (!drv->probe ||
- (dev->device.devargs &&
- dev->device.devargs->policy == RTE_DEV_BLOCKED))
+ if (dev->device.devargs &&
+ dev->device.devargs->policy == RTE_DEV_BLOCKED)
continue;
if (probe_all ||
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index abdb0ad50d..ac9fb7a08c 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -465,9 +465,6 @@ rte_fslmc_probe(void)
if (ret)
continue;
- if (!drv->probe)
- continue;
-
if (rte_dev_is_probed(&dev->device))
continue;
@@ -534,6 +531,7 @@ void
rte_fslmc_driver_register(struct rte_dpaa2_driver *driver)
{
RTE_VERIFY(driver);
+ RTE_VERIFY(driver->probe != NULL);
TAILQ_INSERT_TAIL(&rte_fslmc_bus.driver_list, driver, next);
}
@@ -601,9 +599,6 @@ fslmc_bus_plug(struct rte_device *rte_dev)
if (ret)
continue;
- if (!drv->probe)
- continue;
-
if (rte_dev_is_probed(&dev->device))
continue;
--
2.53.0
^ permalink raw reply related [flat|nested] 67+ messages in thread* [PATCH v2 4/7] drivers: cleanup devargs lookup in bus scan
2026-03-26 10:24 ` [PATCH v2 0/7] " David Marchand
` (2 preceding siblings ...)
2026-03-26 10:24 ` [PATCH v2 3/7] drivers/bus: require probe function for NXP drivers David Marchand
@ 2026-03-26 10:24 ` David Marchand
2026-03-28 3:13 ` fengchengwen
2026-03-26 10:24 ` [PATCH v2 5/7] bus: factorize devargs lookup David Marchand
` (2 subsequent siblings)
6 siblings, 1 reply; 67+ messages in thread
From: David Marchand @ 2026-03-26 10:24 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, Hemant Agrawal, Kevin Traynor, Maxime Leroy,
Parav Pandit, Xueming Li, Nipun Gupta, Nikhil Agarwal,
Sachin Saxena, Rosen Xu, Chenbo Xia, Tomasz Duszynski,
Chengwen Feng, Long Li, Wei Hu
Don't hardcode the bus names in the RTE_EAL_DEVARGS_FOREACH() calls.
The bus name is set by code in EAL.
Even if there is nothing broken, let's reuse the name from the bus object.
And remove the now useless macros.
Note: in the ifpga bus case, the lookup loop was using an incorrect macro
(IFPGA_ARG_NAME instead of IFPGA_BUS_NAME), yet it was working fine
as this macro is aligned with the ifpga bus name.
Besides, the raw/ifpga wants to hotplug a device in this bus, so keep
this bus name macro and add a check the bus name is aligned at init time.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Tested-by: Maxime Leroy <maxime@leroys.fr>
---
Changes since v1:
- fixed ifpga hotplug in raw/ifpga,
---
drivers/bus/auxiliary/auxiliary_common.c | 2 +-
drivers/bus/auxiliary/bus_auxiliary_driver.h | 2 --
drivers/bus/cdx/cdx.c | 3 +--
drivers/bus/dpaa/dpaa_bus.c | 6 ++----
drivers/bus/fslmc/fslmc_bus.c | 8 +++-----
drivers/bus/ifpga/ifpga_bus.c | 8 ++++++--
drivers/bus/pci/pci_common.c | 2 +-
drivers/bus/platform/platform.c | 2 +-
drivers/bus/uacce/uacce.c | 2 +-
drivers/bus/vdev/vdev.c | 2 +-
drivers/bus/vmbus/vmbus_common.c | 2 +-
11 files changed, 18 insertions(+), 21 deletions(-)
diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index ac766e283e..119533df28 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -30,7 +30,7 @@ auxiliary_devargs_lookup(const char *name)
{
struct rte_devargs *devargs;
- RTE_EAL_DEVARGS_FOREACH(RTE_BUS_AUXILIARY_NAME, devargs) {
+ RTE_EAL_DEVARGS_FOREACH(auxiliary_bus.bus.name, devargs) {
if (strcmp(devargs->name, name) == 0)
return devargs;
}
diff --git a/drivers/bus/auxiliary/bus_auxiliary_driver.h b/drivers/bus/auxiliary/bus_auxiliary_driver.h
index 1dc814151e..8450d56583 100644
--- a/drivers/bus/auxiliary/bus_auxiliary_driver.h
+++ b/drivers/bus/auxiliary/bus_auxiliary_driver.h
@@ -28,8 +28,6 @@
extern "C" {
#endif
-#define RTE_BUS_AUXILIARY_NAME "auxiliary"
-
/* Forward declarations */
struct rte_auxiliary_driver;
struct rte_auxiliary_device;
diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
index 729d54337c..b183d98453 100644
--- a/drivers/bus/cdx/cdx.c
+++ b/drivers/bus/cdx/cdx.c
@@ -82,7 +82,6 @@
#include "cdx_logs.h"
#include "private.h"
-#define CDX_BUS_NAME cdx
#define CDX_DEV_PREFIX "cdx-"
/* CDX Bus iterators */
@@ -157,7 +156,7 @@ cdx_devargs_lookup(const char *dev_name)
{
struct rte_devargs *devargs;
- RTE_EAL_DEVARGS_FOREACH("cdx", devargs) {
+ RTE_EAL_DEVARGS_FOREACH(rte_cdx_bus.bus.name, devargs) {
if (strcmp(devargs->name, dev_name) == 0)
return devargs;
}
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 5e0f32bfe8..e3c17d41f7 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -77,8 +77,6 @@ static pthread_key_t dpaa_portal_key;
struct dpaa_portal *dpaa_portals[RTE_MAX_LCORE] = {NULL};
static int dpaa_bus_global_init;
-#define FSL_DPAA_BUS_NAME dpaa_bus
-
RTE_EXPORT_INTERNAL_SYMBOL(per_lcore_dpaa_io)
RTE_DEFINE_PER_LCORE(struct dpaa_portal *, dpaa_io);
@@ -206,7 +204,7 @@ dpaa_devargs_lookup(struct rte_dpaa_device *dev)
struct rte_devargs *devargs;
char dev_name[32];
- RTE_EAL_DEVARGS_FOREACH("dpaa_bus", devargs) {
+ RTE_EAL_DEVARGS_FOREACH(rte_dpaa_bus.bus.name, devargs) {
devargs->bus->parse(devargs->name, &dev_name);
if (strcmp(dev_name, dev->device.name) == 0) {
DPAA_BUS_INFO("**Devargs matched %s", dev_name);
@@ -1003,5 +1001,5 @@ static struct rte_dpaa_bus rte_dpaa_bus = {
.device_count = 0,
};
-RTE_REGISTER_BUS(FSL_DPAA_BUS_NAME, rte_dpaa_bus.bus);
+RTE_REGISTER_BUS(dpaa_bus, rte_dpaa_bus.bus);
RTE_LOG_REGISTER_DEFAULT(dpaa_logtype_bus, NOTICE);
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index ac9fb7a08c..8f3e3dc1be 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -26,7 +26,6 @@
#include <dpaax_iova_table.h>
#define VFIO_IOMMU_GROUP_PATH "/sys/kernel/iommu_groups"
-#define FSLMC_BUS_NAME fslmc
struct rte_fslmc_bus rte_fslmc_bus;
@@ -106,7 +105,7 @@ fslmc_devargs_lookup(struct rte_dpaa2_device *dev)
struct rte_devargs *devargs;
char dev_name[32];
- RTE_EAL_DEVARGS_FOREACH("fslmc", devargs) {
+ RTE_EAL_DEVARGS_FOREACH(rte_fslmc_bus.bus.name, devargs) {
devargs->bus->parse(devargs->name, &dev_name);
if (strcmp(dev_name, dev->device.name) == 0) {
DPAA2_BUS_INFO("**Devargs matched %s", dev_name);
@@ -266,8 +265,7 @@ rte_fslmc_parse(const char *name, void *addr)
*/
if (sep_exists) {
/* If either of "fslmc" or "name" are starting part */
- if (!strncmp(name, RTE_STR(FSLMC_BUS_NAME),
- strlen(RTE_STR(FSLMC_BUS_NAME))) ||
+ if (!strncmp(name, rte_fslmc_bus.bus.name, strlen(rte_fslmc_bus.bus.name)) ||
(!strncmp(name, "name", strlen("name")))) {
goto jump_out;
} else {
@@ -704,5 +702,5 @@ struct rte_fslmc_bus rte_fslmc_bus = {
.device_count = {0},
};
-RTE_REGISTER_BUS(FSLMC_BUS_NAME, rte_fslmc_bus.bus);
+RTE_REGISTER_BUS(fslmc, rte_fslmc_bus.bus);
RTE_LOG_REGISTER_DEFAULT(dpaa2_logtype_bus, NOTICE);
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index fdce1f6b1f..ca2812a960 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -220,7 +220,7 @@ ifpga_scan(void)
struct rte_afu_device *afu_dev = NULL;
/* for FPGA devices we scan the devargs_list populated via cmdline */
- RTE_EAL_DEVARGS_FOREACH(IFPGA_ARG_NAME, devargs) {
+ RTE_EAL_DEVARGS_FOREACH(rte_ifpga_bus.name, devargs) {
if (devargs->bus != &rte_ifpga_bus)
continue;
@@ -516,5 +516,9 @@ static struct rte_bus rte_ifpga_bus = {
.parse = ifpga_parse,
};
-RTE_REGISTER_BUS(IFPGA_BUS_NAME, rte_ifpga_bus);
+RTE_REGISTER_BUS(ifpga, rte_ifpga_bus);
+RTE_INIT(ifpga_bus_init)
+{
+ RTE_VERIFY(strcmp(rte_ifpga_bus.name, RTE_STR(IFPGA_BUS_NAME)) == 0);
+}
RTE_LOG_REGISTER_DEFAULT(ifpga_bus_logtype, NOTICE);
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index bf5df3d94e..1d26fce680 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -85,7 +85,7 @@ pci_devargs_lookup(const struct rte_pci_addr *pci_addr)
struct rte_devargs *devargs;
struct rte_pci_addr addr;
- RTE_EAL_DEVARGS_FOREACH("pci", devargs) {
+ RTE_EAL_DEVARGS_FOREACH(rte_pci_bus.bus.name, devargs) {
devargs->bus->parse(devargs->name, &addr);
if (!rte_pci_addr_cmp(pci_addr, &addr))
return devargs;
diff --git a/drivers/bus/platform/platform.c b/drivers/bus/platform/platform.c
index f6673cf181..18fa73795c 100644
--- a/drivers/bus/platform/platform.c
+++ b/drivers/bus/platform/platform.c
@@ -48,7 +48,7 @@ dev_devargs(const char *dev_name)
{
struct rte_devargs *devargs;
- RTE_EAL_DEVARGS_FOREACH("platform", devargs) {
+ RTE_EAL_DEVARGS_FOREACH(platform_bus.bus.name, devargs) {
if (!strcmp(devargs->name, dev_name))
return devargs;
}
diff --git a/drivers/bus/uacce/uacce.c b/drivers/bus/uacce/uacce.c
index a471edcad0..06a3643290 100644
--- a/drivers/bus/uacce/uacce.c
+++ b/drivers/bus/uacce/uacce.c
@@ -77,7 +77,7 @@ uacce_devargs_lookup(const char *dev_name)
struct rte_devargs *devargs;
snprintf(name, sizeof(name), "%s%s", UACCE_DEV_PREFIX, dev_name);
- RTE_EAL_DEVARGS_FOREACH("uacce", devargs) {
+ RTE_EAL_DEVARGS_FOREACH(uacce_bus.bus.name, devargs) {
if (strcmp(devargs->name, name) == 0)
return devargs;
}
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index be375f63dc..eb1de0186e 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -526,7 +526,7 @@ vdev_scan(void)
rte_spinlock_unlock(&vdev_custom_scan_lock);
/* for virtual devices we scan the devargs_list populated via cmdline */
- RTE_EAL_DEVARGS_FOREACH("vdev", devargs) {
+ RTE_EAL_DEVARGS_FOREACH(rte_vdev_bus.name, devargs) {
dev = calloc(1, sizeof(*dev));
if (!dev)
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index a787d8b18d..f857244c85 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -271,7 +271,7 @@ vmbus_devargs_lookup(struct rte_vmbus_device *dev)
struct rte_devargs *devargs;
rte_uuid_t addr;
- RTE_EAL_DEVARGS_FOREACH("vmbus", devargs) {
+ RTE_EAL_DEVARGS_FOREACH(rte_vmbus_bus.bus.name, devargs) {
vmbus_parse(devargs->name, &addr);
if (rte_uuid_compare(dev->device_id, addr) == 0)
--
2.53.0
^ permalink raw reply related [flat|nested] 67+ messages in thread* Re: [PATCH v2 4/7] drivers: cleanup devargs lookup in bus scan
2026-03-26 10:24 ` [PATCH v2 4/7] drivers: cleanup devargs lookup in bus scan David Marchand
@ 2026-03-28 3:13 ` fengchengwen
0 siblings, 0 replies; 67+ messages in thread
From: fengchengwen @ 2026-03-28 3:13 UTC (permalink / raw)
To: David Marchand, dev
Cc: Bruce Richardson, Hemant Agrawal, Kevin Traynor, Maxime Leroy,
Parav Pandit, Xueming Li, Nipun Gupta, Nikhil Agarwal,
Sachin Saxena, Rosen Xu, Chenbo Xia, Tomasz Duszynski, Long Li,
Wei Hu
For uacce part,
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
On 3/26/2026 6:24 PM, David Marchand wrote:
> Don't hardcode the bus names in the RTE_EAL_DEVARGS_FOREACH() calls.
> The bus name is set by code in EAL.
> Even if there is nothing broken, let's reuse the name from the bus object.
>
> And remove the now useless macros.
>
> Note: in the ifpga bus case, the lookup loop was using an incorrect macro
> (IFPGA_ARG_NAME instead of IFPGA_BUS_NAME), yet it was working fine
> as this macro is aligned with the ifpga bus name.
> Besides, the raw/ifpga wants to hotplug a device in this bus, so keep
> this bus name macro and add a check the bus name is aligned at init time.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> Acked-by: Kevin Traynor <ktraynor@redhat.com>
> Tested-by: Maxime Leroy <maxime@leroys.fr>
> ---
> Changes since v1:
> - fixed ifpga hotplug in raw/ifpga,
^ permalink raw reply [flat|nested] 67+ messages in thread
* [PATCH v2 5/7] bus: factorize devargs lookup
2026-03-26 10:24 ` [PATCH v2 0/7] " David Marchand
` (3 preceding siblings ...)
2026-03-26 10:24 ` [PATCH v2 4/7] drivers: cleanup devargs lookup in bus scan David Marchand
@ 2026-03-26 10:24 ` David Marchand
2026-03-26 11:51 ` Kevin Traynor
2026-03-28 3:33 ` fengchengwen
2026-03-26 10:24 ` [PATCH v2 6/7] bus: factorize device selection David Marchand
2026-03-26 10:24 ` [PATCH v2 7/7] eal: configure initial device probing David Marchand
6 siblings, 2 replies; 67+ messages in thread
From: David Marchand @ 2026-03-26 10:24 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, Hemant Agrawal, Maxime Leroy, Parav Pandit,
Xueming Li, Nipun Gupta, Nikhil Agarwal, Sachin Saxena,
Chenbo Xia, Tomasz Duszynski, Chengwen Feng, Long Li, Wei Hu,
Kevin Laatz
Each bus reimplements some similar devargs lookup code.
The differences are in how some bus (PCI, VMBUS etc...) normalizes the
device names. We can't use the .parse existing handler from outside the
bus code itself, as the size of the bus specific device location address
is unknown.
Introduce a bus specific helper to compare two device names and
hide this ugly detail.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Maxime Leroy <maxime@leroys.fr>
---
Changes since v1:
- fixed copy/paste descriptions in doxygen,
Changes since RFC v3:
- fixed doxygen,
---
drivers/bus/auxiliary/auxiliary_common.c | 16 ++-------
drivers/bus/cdx/cdx.c | 14 +-------
drivers/bus/dpaa/dpaa_bus.c | 41 +++++++++++++-----------
drivers/bus/fslmc/fslmc_bus.c | 34 ++++++++++----------
drivers/bus/pci/pci_common.c | 38 +++++++++++-----------
drivers/bus/platform/platform.c | 17 ++--------
drivers/bus/uacce/uacce.c | 19 ++---------
drivers/bus/vmbus/linux/vmbus_bus.c | 2 +-
drivers/bus/vmbus/private.h | 3 --
drivers/bus/vmbus/vmbus_common.c | 30 ++++++++---------
drivers/dma/idxd/idxd_bus.c | 14 ++------
lib/eal/common/eal_common_bus.c | 20 ++++++++++++
lib/eal/include/bus_driver.h | 32 ++++++++++++++++++
13 files changed, 133 insertions(+), 147 deletions(-)
diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index 119533df28..e5b4f4460d 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -25,18 +25,6 @@
#include "private.h"
-static struct rte_devargs *
-auxiliary_devargs_lookup(const char *name)
-{
- struct rte_devargs *devargs;
-
- RTE_EAL_DEVARGS_FOREACH(auxiliary_bus.bus.name, devargs) {
- if (strcmp(devargs->name, name) == 0)
- return devargs;
- }
- return NULL;
-}
-
#ifndef AUXILIARY_OS_SUPPORTED
/*
* Test whether the auxiliary device exist.
@@ -68,7 +56,7 @@ auxiliary_scan(void)
void
auxiliary_on_scan(struct rte_auxiliary_device *aux_dev)
{
- aux_dev->device.devargs = auxiliary_devargs_lookup(aux_dev->name);
+ aux_dev->device.devargs = rte_bus_find_devargs(&auxiliary_bus.bus, aux_dev->name);
}
/*
@@ -399,7 +387,7 @@ auxiliary_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova,
bool
auxiliary_is_ignored_device(const char *name)
{
- struct rte_devargs *devargs = auxiliary_devargs_lookup(name);
+ struct rte_devargs *devargs = rte_bus_find_devargs(&auxiliary_bus.bus, name);
switch (auxiliary_bus.bus.conf.scan_mode) {
case RTE_BUS_SCAN_ALLOWLIST:
diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
index b183d98453..0801825ef5 100644
--- a/drivers/bus/cdx/cdx.c
+++ b/drivers/bus/cdx/cdx.c
@@ -151,22 +151,10 @@ void rte_cdx_unmap_device(struct rte_cdx_device *dev)
cdx_vfio_unmap_resource(dev);
}
-static struct rte_devargs *
-cdx_devargs_lookup(const char *dev_name)
-{
- struct rte_devargs *devargs;
-
- RTE_EAL_DEVARGS_FOREACH(rte_cdx_bus.bus.name, devargs) {
- if (strcmp(devargs->name, dev_name) == 0)
- return devargs;
- }
- return NULL;
-}
-
static bool
cdx_ignore_device(const char *dev_name)
{
- struct rte_devargs *devargs = cdx_devargs_lookup(dev_name);
+ struct rte_devargs *devargs = rte_bus_find_devargs(&rte_cdx_bus.bus, dev_name);
switch (rte_cdx_bus.bus.conf.scan_mode) {
case RTE_BUS_SCAN_ALLOWLIST:
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index e3c17d41f7..356c56d989 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -198,22 +198,6 @@ dpaa_sec_available(void)
static void dpaa_clean_device_list(void);
-static struct rte_devargs *
-dpaa_devargs_lookup(struct rte_dpaa_device *dev)
-{
- struct rte_devargs *devargs;
- char dev_name[32];
-
- RTE_EAL_DEVARGS_FOREACH(rte_dpaa_bus.bus.name, devargs) {
- devargs->bus->parse(devargs->name, &dev_name);
- if (strcmp(dev_name, dev->device.name) == 0) {
- DPAA_BUS_INFO("**Devargs matched %s", dev_name);
- return devargs;
- }
- }
- return NULL;
-}
-
static int
dpaa_create_device_list(void)
{
@@ -269,7 +253,9 @@ dpaa_create_device_list(void)
(fman_intf->fman->idx + 1), fman_intf->mac_idx);
}
dev->device.name = dev->name;
- dev->device.devargs = dpaa_devargs_lookup(dev);
+ dev->device.devargs = rte_bus_find_devargs(&rte_dpaa_bus.bus, dev->name);
+ if (dev->device.devargs != NULL)
+ DPAA_BUS_INFO("**Devargs matched %s", dev->name);
dpaa_add_to_device_list(dev);
}
@@ -317,7 +303,9 @@ dpaa_create_device_list(void)
sprintf(dev->name, "dpaa_sec-%d", i+1);
DPAA_BUS_LOG(INFO, "%s cryptodev added", dev->name);
dev->device.name = dev->name;
- dev->device.devargs = dpaa_devargs_lookup(dev);
+ dev->device.devargs = rte_bus_find_devargs(&rte_dpaa_bus.bus, dev->name);
+ if (dev->device.devargs != NULL)
+ DPAA_BUS_INFO("**Devargs matched %s", dev->name);
dpaa_add_to_device_list(dev);
}
@@ -341,7 +329,9 @@ dpaa_create_device_list(void)
sprintf(dev->name, "dpaa_qdma-%d", i+1);
DPAA_BUS_LOG(INFO, "%s qdma device added", dev->name);
dev->device.name = dev->name;
- dev->device.devargs = dpaa_devargs_lookup(dev);
+ dev->device.devargs = rte_bus_find_devargs(&rte_dpaa_bus.bus, dev->name);
+ if (dev->device.devargs != NULL)
+ DPAA_BUS_INFO("**Devargs matched %s", dev->name);
dpaa_add_to_device_list(dev);
}
@@ -572,6 +562,18 @@ rte_dpaa_bus_parse(const char *name, void *out)
return 0;
}
+static int
+dpaa_bus_devname_compare(const char *name1, const char *name2)
+{
+ char devname1[32], devname2[32];
+
+ if (rte_dpaa_bus_parse(name1, devname1) != 0 ||
+ rte_dpaa_bus_parse(name2, devname2) != 0)
+ return 1;
+
+ return strncmp(devname1, devname2, sizeof(devname1));
+}
+
#define DPAA_DEV_PATH1 "/sys/devices/platform/soc/soc:fsl,dpaa"
#define DPAA_DEV_PATH2 "/sys/devices/platform/fsl,dpaa"
@@ -988,6 +990,7 @@ static struct rte_dpaa_bus rte_dpaa_bus = {
.scan = rte_dpaa_bus_scan,
.probe = rte_dpaa_bus_probe,
.parse = rte_dpaa_bus_parse,
+ .devname_compare = dpaa_bus_devname_compare,
.find_device = rte_dpaa_find_device,
.get_iommu_class = rte_dpaa_get_iommu_class,
.plug = dpaa_bus_plug,
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 8f3e3dc1be..f72b512b1a 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -99,22 +99,6 @@ insert_in_device_list(struct rte_dpaa2_device *newdev)
TAILQ_INSERT_TAIL(&rte_fslmc_bus.device_list, newdev, next);
}
-static struct rte_devargs *
-fslmc_devargs_lookup(struct rte_dpaa2_device *dev)
-{
- struct rte_devargs *devargs;
- char dev_name[32];
-
- RTE_EAL_DEVARGS_FOREACH(rte_fslmc_bus.bus.name, devargs) {
- devargs->bus->parse(devargs->name, &dev_name);
- if (strcmp(dev_name, dev->device.name) == 0) {
- DPAA2_BUS_INFO("**Devargs matched %s", dev_name);
- return devargs;
- }
- }
- return NULL;
-}
-
static void
dump_device_list(void)
{
@@ -216,7 +200,10 @@ scan_one_fslmc_device(char *dev_name)
ret = -ENOMEM;
goto cleanup;
}
- dev->device.devargs = fslmc_devargs_lookup(dev);
+ dev->device.devargs = rte_bus_find_devargs(&rte_fslmc_bus.bus, dev_name);
+ if (dev->device.devargs != NULL)
+ DPAA2_BUS_INFO("**Devargs matched %s", dev_name);
+
/* Update the device found into the device_count table */
rte_fslmc_bus.device_count[dev->dev_type]++;
@@ -308,6 +295,18 @@ rte_fslmc_parse(const char *name, void *addr)
return ret;
}
+static int
+fslmc_devname_compare(const char *name1, const char *name2)
+{
+ char devname1[32], devname2[32];
+
+ if (rte_fslmc_parse(name1, devname1) != 0 ||
+ rte_fslmc_parse(name2, devname2) != 0)
+ return 1;
+
+ return strncmp(devname1, devname2, sizeof(devname1));
+}
+
static int
rte_fslmc_scan(void)
{
@@ -691,6 +690,7 @@ struct rte_fslmc_bus rte_fslmc_bus = {
.probe = rte_fslmc_probe,
.cleanup = rte_fslmc_close,
.parse = rte_fslmc_parse,
+ .devname_compare = fslmc_devname_compare,
.find_device = rte_fslmc_find_device,
.get_iommu_class = rte_dpaa2_get_iommu_class,
.plug = fslmc_bus_plug,
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 1d26fce680..8782dc342a 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -79,32 +79,15 @@ pci_asprintf(char **buffer, const char *format, ...)
}
#endif /* RTE_EXEC_ENV_WINDOWS */
-static struct rte_devargs *
-pci_devargs_lookup(const struct rte_pci_addr *pci_addr)
-{
- struct rte_devargs *devargs;
- struct rte_pci_addr addr;
-
- RTE_EAL_DEVARGS_FOREACH(rte_pci_bus.bus.name, devargs) {
- devargs->bus->parse(devargs->name, &addr);
- if (!rte_pci_addr_cmp(pci_addr, &addr))
- return devargs;
- }
- return NULL;
-}
-
void
pci_common_set(struct rte_pci_device *dev)
{
- struct rte_devargs *devargs;
-
/* Each device has its internal, canonical name set. */
rte_pci_device_name(&dev->addr,
dev->name, sizeof(dev->name));
dev->device.name = dev->name;
- devargs = pci_devargs_lookup(&dev->addr);
- dev->device.devargs = devargs;
+ dev->device.devargs = rte_bus_find_devargs(&rte_pci_bus.bus, dev->name);
if (dev->bus_info != NULL ||
asprintf(&dev->bus_info, "vendor_id=%"PRIx16", device_id=%"PRIx16,
@@ -503,6 +486,18 @@ pci_parse(const char *name, void *addr)
return parse == false;
}
+static int
+pci_devname_compare(const char *name1, const char *name2)
+{
+ struct rte_pci_addr addr1, addr2;
+
+ if (rte_pci_addr_parse(name1, &addr1) != 0 ||
+ rte_pci_addr_parse(name2, &addr2) != 0)
+ return 1;
+
+ return rte_pci_addr_cmp(&addr1, &addr2);
+}
+
/* register a driver */
RTE_EXPORT_INTERNAL_SYMBOL(rte_pci_register)
void
@@ -721,7 +716,11 @@ pci_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
bool
rte_pci_ignore_device(const struct rte_pci_addr *pci_addr)
{
- struct rte_devargs *devargs = pci_devargs_lookup(pci_addr);
+ char name[RTE_DEV_NAME_MAX_LEN];
+ struct rte_devargs *devargs;
+
+ rte_pci_device_name(pci_addr, name, sizeof(name));
+ devargs = rte_bus_find_devargs(&rte_pci_bus.bus, name);
switch (rte_pci_bus.bus.conf.scan_mode) {
case RTE_BUS_SCAN_ALLOWLIST:
@@ -946,6 +945,7 @@ struct rte_pci_bus rte_pci_bus = {
.plug = pci_plug,
.unplug = pci_unplug,
.parse = pci_parse,
+ .devname_compare = pci_devname_compare,
.devargs_parse = rte_pci_devargs_parse,
.dma_map = pci_dma_map,
.dma_unmap = pci_dma_unmap,
diff --git a/drivers/bus/platform/platform.c b/drivers/bus/platform/platform.c
index 18fa73795c..23c39aada6 100644
--- a/drivers/bus/platform/platform.c
+++ b/drivers/bus/platform/platform.c
@@ -43,25 +43,12 @@ rte_platform_unregister(struct rte_platform_driver *pdrv)
TAILQ_REMOVE(&platform_bus.driver_list, pdrv, next);
}
-static struct rte_devargs *
-dev_devargs(const char *dev_name)
-{
- struct rte_devargs *devargs;
-
- RTE_EAL_DEVARGS_FOREACH(platform_bus.bus.name, devargs) {
- if (!strcmp(devargs->name, dev_name))
- return devargs;
- }
-
- return NULL;
-}
-
static bool
dev_allowed(const char *dev_name)
{
struct rte_devargs *devargs;
- devargs = dev_devargs(dev_name);
+ devargs = rte_bus_find_devargs(&platform_bus.bus, dev_name);
if (devargs == NULL)
return true;
@@ -93,7 +80,7 @@ dev_add(const char *dev_name)
rte_strscpy(pdev->name, dev_name, sizeof(pdev->name));
pdev->device.name = pdev->name;
- pdev->device.devargs = dev_devargs(dev_name);
+ pdev->device.devargs = rte_bus_find_devargs(&platform_bus.bus, dev_name);
pdev->device.bus = &platform_bus.bus;
snprintf(path, sizeof(path), PLATFORM_BUS_DEVICES_PATH "/%s/numa_node", dev_name);
pdev->device.numa_node = eal_parse_sysfs_value(path, &val) ? rte_socket_id() : val;
diff --git a/drivers/bus/uacce/uacce.c b/drivers/bus/uacce/uacce.c
index 06a3643290..e6963dc18a 100644
--- a/drivers/bus/uacce/uacce.c
+++ b/drivers/bus/uacce/uacce.c
@@ -70,25 +70,10 @@ extern int uacce_bus_logtype;
#define UACCE_BUS_DEBUG(fmt, ...) UACCE_BUS_LOG(DEBUG, fmt, ##__VA_ARGS__)
-static struct rte_devargs *
-uacce_devargs_lookup(const char *dev_name)
-{
- char name[RTE_UACCE_DEV_PATH_SIZE] = {0};
- struct rte_devargs *devargs;
-
- snprintf(name, sizeof(name), "%s%s", UACCE_DEV_PREFIX, dev_name);
- RTE_EAL_DEVARGS_FOREACH(uacce_bus.bus.name, devargs) {
- if (strcmp(devargs->name, name) == 0)
- return devargs;
- }
-
- return NULL;
-}
-
static bool
uacce_ignore_device(const char *dev_name)
{
- struct rte_devargs *devargs = uacce_devargs_lookup(dev_name);
+ struct rte_devargs *devargs = rte_bus_find_devargs(&uacce_bus.bus, dev_name);
switch (uacce_bus.bus.conf.scan_mode) {
case RTE_BUS_SCAN_ALLOWLIST:
@@ -257,7 +242,7 @@ uacce_scan_one(const char *dev_name)
dev->device.bus = &uacce_bus.bus;
dev->device.name = dev->name;
- dev->device.devargs = uacce_devargs_lookup(dev_name);
+ dev->device.devargs = rte_bus_find_devargs(&uacce_bus.bus, dev_name);
snprintf(dev->name, sizeof(dev->name), "%s", dev_name);
snprintf(dev->dev_root, sizeof(dev->dev_root), "%s/%s",
UACCE_BUS_CLASS_PATH, dev_name);
diff --git a/drivers/bus/vmbus/linux/vmbus_bus.c b/drivers/bus/vmbus/linux/vmbus_bus.c
index 4c59097273..5958b97077 100644
--- a/drivers/bus/vmbus/linux/vmbus_bus.c
+++ b/drivers/bus/vmbus/linux/vmbus_bus.c
@@ -333,7 +333,7 @@ vmbus_scan_one(const char *name)
dev->monitor_id = UINT8_MAX;
}
- dev->device.devargs = vmbus_devargs_lookup(dev);
+ dev->device.devargs = rte_bus_find_devargs(&rte_vmbus_bus.bus, dev_name);
dev->device.numa_node = SOCKET_ID_ANY;
if (vmbus_use_numa(dev)) {
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index 25b8a27fcf..8ac6119ef2 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -98,9 +98,6 @@ struct vmbus_channel {
#define VMBUS_MAX_CHANNELS 64
-struct rte_devargs *
-vmbus_devargs_lookup(struct rte_vmbus_device *dev);
-
int vmbus_chan_create(const struct rte_vmbus_device *device,
uint16_t relid, uint16_t subid, uint8_t monitor_id,
struct vmbus_channel **new_chan);
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index f857244c85..96d16ff545 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -171,7 +171,11 @@ vmbus_probe_all_drivers(struct rte_vmbus_device *dev)
static bool
vmbus_ignore_device(struct rte_vmbus_device *dev)
{
- struct rte_devargs *devargs = vmbus_devargs_lookup(dev);
+ char name[RTE_DEV_NAME_MAX_LEN];
+ struct rte_devargs *devargs;
+
+ rte_uuid_unparse(dev->device_id, name, sizeof(name));
+ devargs = rte_bus_find_devargs(&rte_vmbus_bus.bus, name);
switch (rte_vmbus_bus.bus.conf.scan_mode) {
case RTE_BUS_SCAN_ALLOWLIST:
@@ -260,25 +264,16 @@ vmbus_parse(const char *name, void *addr)
return ret;
}
-/*
- * scan for matching device args on command line
- * example:
- * -a 'vmbus:635a7ae3-091e-4410-ad59-667c4f8c04c3,latency=20'
- */
-struct rte_devargs *
-vmbus_devargs_lookup(struct rte_vmbus_device *dev)
+static int
+vmbus_devname_compare(const char *name1, const char *name2)
{
- struct rte_devargs *devargs;
- rte_uuid_t addr;
-
- RTE_EAL_DEVARGS_FOREACH(rte_vmbus_bus.bus.name, devargs) {
- vmbus_parse(devargs->name, &addr);
+ rte_uuid_t guid1, guid2;
- if (rte_uuid_compare(dev->device_id, addr) == 0)
- return devargs;
- }
- return NULL;
+ if (vmbus_parse(name1, &guid1) != 0 ||
+ vmbus_parse(name2, &guid2) != 0)
+ return 1;
+ return rte_uuid_compare(guid1, guid2);
}
/* register vmbus driver */
@@ -349,6 +344,7 @@ struct rte_vmbus_bus rte_vmbus_bus = {
.cleanup = rte_vmbus_cleanup,
.find_device = vmbus_find_device,
.parse = vmbus_parse,
+ .devname_compare = vmbus_devname_compare,
},
.device_list = TAILQ_HEAD_INITIALIZER(rte_vmbus_bus.device_list),
.driver_list = TAILQ_HEAD_INITIALIZER(rte_vmbus_bus.driver_list),
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index 9a8213bbbe..136ac511ef 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -247,16 +247,6 @@ idxd_probe_dsa(struct rte_dsa_device *dev)
return 0;
}
-static int search_devargs(const char *name)
-{
- struct rte_devargs *devargs;
- RTE_EAL_DEVARGS_FOREACH(dsa_bus.bus.name, devargs) {
- if (strcmp(devargs->name, name) == 0)
- return 1;
- }
- return 0;
-}
-
static int
is_for_this_process_use(struct rte_dsa_device *dev, const char *name)
{
@@ -275,9 +265,9 @@ is_for_this_process_use(struct rte_dsa_device *dev, const char *name)
if (retval && dsa_bus.bus.conf.scan_mode != RTE_BUS_SCAN_UNDEFINED) {
if (dsa_bus.bus.conf.scan_mode == RTE_BUS_SCAN_ALLOWLIST)
- retval = search_devargs(dev->device.name);
+ retval = rte_bus_find_devargs(&dsa_bus.bus, dev->device.name) != NULL;
else
- retval = !search_devargs(dev->device.name);
+ retval = rte_bus_find_devargs(&dsa_bus.bus, dev->device.name) == NULL;
}
return retval;
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index 0a2311a342..863c7418bb 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>
@@ -205,6 +206,25 @@ rte_bus_find_by_name(const char *busname)
return rte_bus_find(NULL, cmp_bus_name, (const void *)busname);
}
+RTE_EXPORT_INTERNAL_SYMBOL(rte_bus_find_devargs)
+struct rte_devargs *
+rte_bus_find_devargs(const struct rte_bus *bus, const char *name)
+{
+ rte_bus_devname_compare_t cmp = bus->devname_compare;
+ struct rte_devargs *devargs;
+
+ if (cmp == NULL)
+ cmp = strcmp;
+
+ RTE_EAL_DEVARGS_FOREACH(rte_bus_name(bus), devargs) {
+ if (cmp(name, devargs->name) != 0)
+ continue;
+ return devargs;
+ }
+
+ return NULL;
+}
+
static int
bus_can_parse(const struct rte_bus *bus, const void *_name)
{
diff --git a/lib/eal/include/bus_driver.h b/lib/eal/include/bus_driver.h
index 60527b75b6..0760b09b8f 100644
--- a/lib/eal/include/bus_driver.h
+++ b/lib/eal/include/bus_driver.h
@@ -118,6 +118,22 @@ typedef int (*rte_bus_unplug_t)(struct rte_device *dev);
*/
typedef int (*rte_bus_parse_t)(const char *name, void *addr);
+/**
+ * Bus specific device name comparison function.
+ * Bus can normalize the names of devices using an internal representation.
+ * This helper makes it possible to check whether two names refer to the same device.
+ *
+ * @param[in] name1
+ * device name
+ * @param[in] name2
+ * device name
+ *
+ * @return
+ * 0 if the two names refer to the same device.
+ * !0 otherwise.
+ */
+typedef int (*rte_bus_devname_compare_t)(const char *name1, const char *name2);
+
/**
* Parse bus part of the device arguments.
*
@@ -258,6 +274,7 @@ struct rte_bus {
rte_bus_plug_t plug; /**< Probe single device for drivers */
rte_bus_unplug_t unplug; /**< Remove single device from driver */
rte_bus_parse_t parse; /**< Parse a device name */
+ rte_bus_devname_compare_t devname_compare; /**< Compare two device names */
rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
rte_dev_dma_map_t dma_map; /**< DMA map for device in the bus */
rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
@@ -281,6 +298,21 @@ struct rte_bus {
__rte_internal
void rte_bus_register(struct rte_bus *bus);
+/**
+ * Find the devargs associated to a device.
+ *
+ * @param bus
+ * A pointer to a rte_bus structure describing the bus
+ * to search for devargs on.
+ * @param dev_name
+ * A device name.
+ *
+ * @return
+ * Pointer to the device devargs, or NULL if none found.
+ */
+__rte_internal
+struct rte_devargs *rte_bus_find_devargs(const struct rte_bus *bus, const char *dev_name);
+
/**
* Helper for Bus registration.
* The constructor has higher priority than PMD constructors.
--
2.53.0
^ permalink raw reply related [flat|nested] 67+ messages in thread* Re: [PATCH v2 5/7] bus: factorize devargs lookup
2026-03-26 10:24 ` [PATCH v2 5/7] bus: factorize devargs lookup David Marchand
@ 2026-03-26 11:51 ` Kevin Traynor
2026-03-28 3:33 ` fengchengwen
1 sibling, 0 replies; 67+ messages in thread
From: Kevin Traynor @ 2026-03-26 11:51 UTC (permalink / raw)
To: David Marchand, dev
Cc: Bruce Richardson, Hemant Agrawal, Maxime Leroy, Parav Pandit,
Xueming Li, Nipun Gupta, Nikhil Agarwal, Sachin Saxena,
Chenbo Xia, Tomasz Duszynski, Chengwen Feng, Long Li, Wei Hu,
Kevin Laatz
On 3/26/26 10:24 AM, David Marchand wrote:
> Each bus reimplements some similar devargs lookup code.
>
> The differences are in how some bus (PCI, VMBUS etc...) normalizes the
> device names. We can't use the .parse existing handler from outside the
> bus code itself, as the size of the bus specific device location address
> is unknown.
> Introduce a bus specific helper to compare two device names and
> hide this ugly detail.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> Tested-by: Maxime Leroy <maxime@leroys.fr>
> ---
> Changes since v1:
> - fixed copy/paste descriptions in doxygen,
>
> Changes since RFC v3:
> - fixed doxygen,
>
> ---
> drivers/bus/auxiliary/auxiliary_common.c | 16 ++-------
> drivers/bus/cdx/cdx.c | 14 +-------
> drivers/bus/dpaa/dpaa_bus.c | 41 +++++++++++++-----------
> drivers/bus/fslmc/fslmc_bus.c | 34 ++++++++++----------
> drivers/bus/pci/pci_common.c | 38 +++++++++++-----------
> drivers/bus/platform/platform.c | 17 ++--------
> drivers/bus/uacce/uacce.c | 19 ++---------
> drivers/bus/vmbus/linux/vmbus_bus.c | 2 +-
> drivers/bus/vmbus/private.h | 3 --
> drivers/bus/vmbus/vmbus_common.c | 30 ++++++++---------
> drivers/dma/idxd/idxd_bus.c | 14 ++------
> lib/eal/common/eal_common_bus.c | 20 ++++++++++++
> lib/eal/include/bus_driver.h | 32 ++++++++++++++++++
> 13 files changed, 133 insertions(+), 147 deletions(-)
Acked-by: Kevin Traynor <ktraynor@redhat.com>
^ permalink raw reply [flat|nested] 67+ messages in thread
* Re: [PATCH v2 5/7] bus: factorize devargs lookup
2026-03-26 10:24 ` [PATCH v2 5/7] bus: factorize devargs lookup David Marchand
2026-03-26 11:51 ` Kevin Traynor
@ 2026-03-28 3:33 ` fengchengwen
2026-04-03 14:22 ` David Marchand
1 sibling, 1 reply; 67+ messages in thread
From: fengchengwen @ 2026-03-28 3:33 UTC (permalink / raw)
To: David Marchand, dev
Cc: Bruce Richardson, Hemant Agrawal, Maxime Leroy, Parav Pandit,
Xueming Li, Nipun Gupta, Nikhil Agarwal, Sachin Saxena,
Chenbo Xia, Tomasz Duszynski, Long Li, Wei Hu, Kevin Laatz
On 3/26/2026 6:24 PM, David Marchand wrote:
> Each bus reimplements some similar devargs lookup code.
>
> The differences are in how some bus (PCI, VMBUS etc...) normalizes the
> device names. We can't use the .parse existing handler from outside the
> bus code itself, as the size of the bus specific device location address
> is unknown.
> Introduce a bus specific helper to compare two device names and
> hide this ugly detail.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> Tested-by: Maxime Leroy <maxime@leroys.fr>
> ---
...
> diff --git a/drivers/bus/uacce/uacce.c b/drivers/bus/uacce/uacce.c
> index 06a3643290..e6963dc18a 100644
> --- a/drivers/bus/uacce/uacce.c
> +++ b/drivers/bus/uacce/uacce.c
> @@ -70,25 +70,10 @@ extern int uacce_bus_logtype;
> #define UACCE_BUS_DEBUG(fmt, ...) UACCE_BUS_LOG(DEBUG, fmt, ##__VA_ARGS__)
>
>
> -static struct rte_devargs *
> -uacce_devargs_lookup(const char *dev_name)
> -{
> - char name[RTE_UACCE_DEV_PATH_SIZE] = {0};
> - struct rte_devargs *devargs;
> -
> - snprintf(name, sizeof(name), "%s%s", UACCE_DEV_PREFIX, dev_name);
For uacce, application should pass device with prefix uacce, e.g:
dpdk-testpmd -a uacce:hisi_zip-0,queues=2 --file-prefix=feng -- -i
And the scan device is hisi_zip-0, so in match we should combined which is
above snprintf does.
> - RTE_EAL_DEVARGS_FOREACH(uacce_bus.bus.name, devargs) {
> - if (strcmp(devargs->name, name) == 0)
> - return devargs;
> - }
> -
> - return NULL;
> -}
> -
> static bool
> uacce_ignore_device(const char *dev_name)
> {
> - struct rte_devargs *devargs = uacce_devargs_lookup(dev_name);
> + struct rte_devargs *devargs = rte_bus_find_devargs(&uacce_bus.bus, dev_name);
>
...
>
> return retval;
> diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
>
> +RTE_EXPORT_INTERNAL_SYMBOL(rte_bus_find_devargs)
> +struct rte_devargs *
> +rte_bus_find_devargs(const struct rte_bus *bus, const char *name)
> +{
> + rte_bus_devname_compare_t cmp = bus->devname_compare;
> + struct rte_devargs *devargs;
> +
> + if (cmp == NULL)
> + cmp = strcmp;
> +
> + RTE_EAL_DEVARGS_FOREACH(rte_bus_name(bus), devargs) {
> + if (cmp(name, devargs->name) != 0)
> + continue;
> + return devargs;
> + }
> +
> + return NULL;
> +}
> +
...
^ permalink raw reply [flat|nested] 67+ messages in thread* Re: [PATCH v2 5/7] bus: factorize devargs lookup
2026-03-28 3:33 ` fengchengwen
@ 2026-04-03 14:22 ` David Marchand
0 siblings, 0 replies; 67+ messages in thread
From: David Marchand @ 2026-04-03 14:22 UTC (permalink / raw)
To: fengchengwen
Cc: dev, Bruce Richardson, Hemant Agrawal, Maxime Leroy, Parav Pandit,
Xueming Li, Nipun Gupta, Nikhil Agarwal, Sachin Saxena,
Chenbo Xia, Tomasz Duszynski, Long Li, Wei Hu, Kevin Laatz
Hello,
On Sat, 28 Mar 2026 at 04:33, fengchengwen <fengchengwen@huawei.com> wrote:
> > diff --git a/drivers/bus/uacce/uacce.c b/drivers/bus/uacce/uacce.c
> > index 06a3643290..e6963dc18a 100644
> > --- a/drivers/bus/uacce/uacce.c
> > +++ b/drivers/bus/uacce/uacce.c
> > @@ -70,25 +70,10 @@ extern int uacce_bus_logtype;
> > #define UACCE_BUS_DEBUG(fmt, ...) UACCE_BUS_LOG(DEBUG, fmt, ##__VA_ARGS__)
> >
> >
> > -static struct rte_devargs *
> > -uacce_devargs_lookup(const char *dev_name)
> > -{
> > - char name[RTE_UACCE_DEV_PATH_SIZE] = {0};
> > - struct rte_devargs *devargs;
> > -
> > - snprintf(name, sizeof(name), "%s%s", UACCE_DEV_PREFIX, dev_name);
>
> For uacce, application should pass device with prefix uacce, e.g:
> dpdk-testpmd -a uacce:hisi_zip-0,queues=2 --file-prefix=feng -- -i
>
> And the scan device is hisi_zip-0, so in match we should combined which is
> above snprintf does.
Erm, strange that I did not see this during my tests, but I think you are right.
It means the matching is broken in rte_bus_find_devargs().
I'll respin (I need to, anyway, as there was some fslmc change that
got merged late in v26.03).
>
> > - RTE_EAL_DEVARGS_FOREACH(uacce_bus.bus.name, devargs) {
> > - if (strcmp(devargs->name, name) == 0)
> > - return devargs;
> > - }
> > -
> > - return NULL;
> > -}
> > -
--
David Marchand
^ permalink raw reply [flat|nested] 67+ messages in thread
* [PATCH v2 6/7] bus: factorize device selection
2026-03-26 10:24 ` [PATCH v2 0/7] " David Marchand
` (4 preceding siblings ...)
2026-03-26 10:24 ` [PATCH v2 5/7] bus: factorize devargs lookup David Marchand
@ 2026-03-26 10:24 ` David Marchand
2026-03-26 11:52 ` Kevin Traynor
2026-03-28 3:38 ` fengchengwen
2026-03-26 10:24 ` [PATCH v2 7/7] eal: configure initial device probing David Marchand
6 siblings, 2 replies; 67+ messages in thread
From: David Marchand @ 2026-03-26 10:24 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, Robin Jarry, Hemant Agrawal, Maxime Leroy,
Parav Pandit, Xueming Li, Nipun Gupta, Nikhil Agarwal,
Sachin Saxena, Chenbo Xia, Tomasz Duszynski, Chengwen Feng,
Long Li, Wei Hu, Kevin Laatz
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@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Robin Jarry <rjarry@redhat.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Maxime Leroy <maxime@leroys.fr>
---
Changes since v1:
- fixed device selection in dma/idxd,
Changes since RFC v2:
- changed API to query about a device name and hide the devargs meaning
in the common code,
---
drivers/bus/auxiliary/auxiliary_common.c | 19 ----------------
drivers/bus/auxiliary/linux/auxiliary.c | 2 +-
drivers/bus/auxiliary/private.h | 6 -----
drivers/bus/cdx/cdx.c | 21 +-----------------
drivers/bus/dpaa/dpaa_bus.c | 24 ++++++--------------
drivers/bus/fslmc/fslmc_bus.c | 22 ++++++-------------
drivers/bus/pci/bsd/pci.c | 5 ++++-
drivers/bus/pci/linux/pci.c | 2 +-
drivers/bus/pci/pci_common.c | 23 -------------------
drivers/bus/pci/private.h | 11 ----------
drivers/bus/pci/windows/pci.c | 4 +++-
drivers/bus/platform/platform.c | 28 ++----------------------
drivers/bus/uacce/uacce.c | 22 +------------------
drivers/bus/vmbus/vmbus_common.c | 25 +--------------------
drivers/dma/idxd/idxd_bus.c | 8 ++-----
lib/eal/common/eal_common_bus.c | 19 ++++++++++++++++
lib/eal/include/bus_driver.h | 6 +++++
17 files changed, 55 insertions(+), 192 deletions(-)
diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index e5b4f4460d..8f3e90eaf0 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -384,25 +384,6 @@ auxiliary_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova,
return aux_dev->driver->dma_unmap(aux_dev, addr, iova, len);
}
-bool
-auxiliary_is_ignored_device(const char *name)
-{
- struct rte_devargs *devargs = rte_bus_find_devargs(&auxiliary_bus.bus, name);
-
- switch (auxiliary_bus.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;
-}
-
static enum rte_iova_mode
auxiliary_get_iommu_class(void)
{
diff --git a/drivers/bus/auxiliary/linux/auxiliary.c b/drivers/bus/auxiliary/linux/auxiliary.c
index 02fc9285dc..ac9bf55efa 100644
--- a/drivers/bus/auxiliary/linux/auxiliary.c
+++ b/drivers/bus/auxiliary/linux/auxiliary.c
@@ -110,7 +110,7 @@ auxiliary_scan(void)
if (e->d_name[0] == '.')
continue;
- if (auxiliary_is_ignored_device(e->d_name))
+ if (rte_bus_is_ignored_device(&auxiliary_bus.bus, e->d_name))
continue;
snprintf(dirname, sizeof(dirname), "%s/%s",
diff --git a/drivers/bus/auxiliary/private.h b/drivers/bus/auxiliary/private.h
index 4604f6f4a7..6e61a5f494 100644
--- a/drivers/bus/auxiliary/private.h
+++ b/drivers/bus/auxiliary/private.h
@@ -53,12 +53,6 @@ int auxiliary_scan(void);
*/
void auxiliary_on_scan(struct rte_auxiliary_device *aux_dev);
-/*
- * Validate whether a device with given auxiliary device should be ignored
- * or not.
- */
-bool auxiliary_is_ignored_device(const char *name);
-
/*
* Add an auxiliary device to the auxiliary bus (append to auxiliary device
* list). This function also updates the bus references of the auxiliary
diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
index 0801825ef5..58d8c8b4da 100644
--- a/drivers/bus/cdx/cdx.c
+++ b/drivers/bus/cdx/cdx.c
@@ -151,25 +151,6 @@ void rte_cdx_unmap_device(struct rte_cdx_device *dev)
cdx_vfio_unmap_resource(dev);
}
-static bool
-cdx_ignore_device(const char *dev_name)
-{
- struct rte_devargs *devargs = rte_bus_find_devargs(&rte_cdx_bus.bus, dev_name);
-
- switch (rte_cdx_bus.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;
-}
-
/*
* Scan one cdx sysfs entry, and fill the devices list from it.
* It checks if the CDX device is bound to vfio-cdx driver. In case
@@ -269,7 +250,7 @@ cdx_scan(void)
if (e->d_name[0] == '.')
continue;
- if (cdx_ignore_device(e->d_name))
+ if (rte_bus_is_ignored_device(&rte_cdx_bus.bus, e->d_name))
continue;
snprintf(dirname, sizeof(dirname), "%s/%s",
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 356c56d989..9ff58af0c4 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -717,7 +717,6 @@ rte_dpaa_bus_probe(void)
struct rte_dpaa_driver *drv;
FILE *svr_file = NULL;
uint32_t svr_ver;
- int probe_all = rte_dpaa_bus.bus.conf.scan_mode != RTE_BUS_SCAN_ALLOWLIST;
static int process_once;
char *penv;
@@ -725,9 +724,6 @@ rte_dpaa_bus_probe(void)
if (!rte_dpaa_bus.detected)
return 0;
- if (rte_dpaa_bus.bus.conf.scan_mode != RTE_BUS_SCAN_ALLOWLIST)
- probe_all = true;
-
svr_file = fopen(DPAA_SOC_ID_FILE, "r");
if (svr_file) {
if (fscanf(svr_file, "svr:%x", &svr_ver) > 0)
@@ -809,21 +805,15 @@ rte_dpaa_bus_probe(void)
if (rte_dev_is_probed(&dev->device))
continue;
- if (dev->device.devargs &&
- dev->device.devargs->policy == RTE_DEV_BLOCKED)
+ if (rte_bus_is_ignored_device(&rte_dpaa_bus.bus, dev->name))
continue;
- if (probe_all ||
- (dev->device.devargs &&
- dev->device.devargs->policy == RTE_DEV_ALLOWED)) {
- ret = drv->probe(drv, dev);
- if (ret) {
- DPAA_BUS_ERR("unable to probe:%s",
- dev->name);
- } else {
- dev->driver = drv;
- dev->device.driver = &drv->driver;
- }
+ ret = drv->probe(drv, dev);
+ if (ret) {
+ DPAA_BUS_ERR("unable to probe: %s", dev->name);
+ } else {
+ dev->driver = drv;
+ dev->device.driver = &drv->driver;
}
break;
}
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index f72b512b1a..b5d839b6b0 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -407,7 +407,6 @@ static int
rte_fslmc_probe(void)
{
int ret = 0;
- int probe_all;
struct rte_dpaa2_device *dev;
struct rte_dpaa2_driver *drv;
@@ -454,8 +453,6 @@ rte_fslmc_probe(void)
return 0;
}
- probe_all = rte_fslmc_bus.bus.conf.scan_mode != RTE_BUS_SCAN_ALLOWLIST;
-
TAILQ_FOREACH(dev, &rte_fslmc_bus.device_list, next) {
TAILQ_FOREACH(drv, &rte_fslmc_bus.driver_list, next) {
ret = rte_fslmc_match(drv, dev);
@@ -465,23 +462,18 @@ rte_fslmc_probe(void)
if (rte_dev_is_probed(&dev->device))
continue;
- if (dev->device.devargs &&
- dev->device.devargs->policy == RTE_DEV_BLOCKED) {
+ if (rte_bus_is_ignored_device(&rte_fslmc_bus.bus, dev->device.name)) {
DPAA2_BUS_LOG(DEBUG, "%s Blocked, skipping",
dev->device.name);
continue;
}
- if (probe_all ||
- (dev->device.devargs &&
- dev->device.devargs->policy == RTE_DEV_ALLOWED)) {
- ret = drv->probe(drv, dev);
- if (ret) {
- DPAA2_BUS_ERR("Unable to probe");
- } else {
- dev->driver = drv;
- dev->device.driver = &drv->driver;
- }
+ ret = drv->probe(drv, dev);
+ if (ret) {
+ DPAA2_BUS_ERR("Unable to probe");
+ } else {
+ dev->driver = drv;
+ dev->device.driver = &drv->driver;
}
break;
}
diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index 3f13e1d6ac..ffd84ee5f0 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -370,12 +370,15 @@ rte_pci_scan(void)
}
for (i = 0; i < conf_io.num_matches; i++) {
+ char name[RTE_DEV_NAME_MAX_LEN];
+
pci_addr.domain = matches[i].pc_sel.pc_domain;
pci_addr.bus = matches[i].pc_sel.pc_bus;
pci_addr.devid = matches[i].pc_sel.pc_dev;
pci_addr.function = matches[i].pc_sel.pc_func;
+ rte_pci_device_name(&pci_addr, name, sizeof(name));
- if (rte_pci_ignore_device(&pci_addr))
+ if (rte_bus_is_ignored_device(&rte_pci_bus.bus, name))
continue;
if (pci_scan_one(fd, &matches[i]) < 0)
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index 2ffac82e94..03a3c37dea 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -458,7 +458,7 @@ rte_pci_scan(void)
if (parse_pci_addr_format(e->d_name, sizeof(e->d_name), &addr) != 0)
continue;
- if (rte_pci_ignore_device(&addr))
+ if (rte_bus_is_ignored_device(&rte_pci_bus.bus, e->d_name))
continue;
snprintf(dirname, sizeof(dirname), "%s/%s",
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 8782dc342a..5ef9e80e3e 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -713,29 +713,6 @@ pci_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
return -1;
}
-bool
-rte_pci_ignore_device(const struct rte_pci_addr *pci_addr)
-{
- char name[RTE_DEV_NAME_MAX_LEN];
- struct rte_devargs *devargs;
-
- rte_pci_device_name(pci_addr, name, sizeof(name));
- devargs = rte_bus_find_devargs(&rte_pci_bus.bus, name);
-
- switch (rte_pci_bus.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;
-}
-
enum rte_iova_mode
rte_pci_get_iommu_class(void)
{
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 38109844b9..8591c4a0a7 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -82,17 +82,6 @@ pci_common_set(struct rte_pci_device *dev);
void
pci_free(struct rte_pci_device_internal *pdev);
-/**
- * Validate whether a device with given PCI address should be ignored or not.
- *
- * @param pci_addr
- * PCI address of device to be validated
- * @return
- * true: if device is to be ignored,
- * false: if device is to be scanned,
- */
-bool rte_pci_ignore_device(const struct rte_pci_addr *pci_addr);
-
/**
* Add a PCI device to the PCI Bus (append to PCI Device list). This function
* also updates the bus references of the PCI Device (and the generic device
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index a5ce3b51f7..91c8e567d1 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -373,6 +373,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
struct rte_pci_device *dev = NULL;
int ret = -1;
char pci_device_info[REGSTR_VAL_MAX_HCID_LEN];
+ char name[RTE_DEV_NAME_MAX_LEN];
struct rte_pci_addr addr;
struct rte_pci_id pci_id;
@@ -380,7 +381,8 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
if (ret != 0)
goto end;
- if (rte_pci_ignore_device(&addr)) {
+ rte_pci_device_name(&addr, name, sizeof(name));
+ if (rte_bus_is_ignored_device(&rte_pci_bus.bus, name)) {
/*
* We won't add this device, but we want to continue
* looking for supported devices
diff --git a/drivers/bus/platform/platform.c b/drivers/bus/platform/platform.c
index 23c39aada6..ad7898f011 100644
--- a/drivers/bus/platform/platform.c
+++ b/drivers/bus/platform/platform.c
@@ -43,30 +43,6 @@ rte_platform_unregister(struct rte_platform_driver *pdrv)
TAILQ_REMOVE(&platform_bus.driver_list, pdrv, next);
}
-static bool
-dev_allowed(const char *dev_name)
-{
- struct rte_devargs *devargs;
-
- devargs = rte_bus_find_devargs(&platform_bus.bus, dev_name);
- if (devargs == NULL)
- return true;
-
- switch (platform_bus.bus.conf.scan_mode) {
- case RTE_BUS_SCAN_UNDEFINED:
- case RTE_BUS_SCAN_ALLOWLIST:
- if (devargs->policy == RTE_DEV_ALLOWED)
- return true;
- break;
- case RTE_BUS_SCAN_BLOCKLIST:
- if (devargs->policy == RTE_DEV_BLOCKED)
- return false;
- break;
- }
-
- return true;
-}
-
static int
dev_add(const char *dev_name)
{
@@ -160,7 +136,7 @@ platform_bus_scan(void)
if (dev_name[0] == '.')
continue;
- if (!dev_allowed(dev_name))
+ if (rte_bus_is_ignored_device(&platform_bus.bus, dev_name))
continue;
if (!dev_is_bound_vfio_platform(dev_name))
@@ -484,7 +460,7 @@ platform_bus_plug(struct rte_device *dev)
{
struct rte_platform_device *pdev;
- if (!dev_allowed(dev->name))
+ if (rte_bus_is_ignored_device(&platform_bus.bus, dev->name))
return -EPERM;
if (!dev_is_bound_vfio_platform(dev->name))
diff --git a/drivers/bus/uacce/uacce.c b/drivers/bus/uacce/uacce.c
index e6963dc18a..ee02ecd1ce 100644
--- a/drivers/bus/uacce/uacce.c
+++ b/drivers/bus/uacce/uacce.c
@@ -70,26 +70,6 @@ extern int uacce_bus_logtype;
#define UACCE_BUS_DEBUG(fmt, ...) UACCE_BUS_LOG(DEBUG, fmt, ##__VA_ARGS__)
-static bool
-uacce_ignore_device(const char *dev_name)
-{
- struct rte_devargs *devargs = rte_bus_find_devargs(&uacce_bus.bus, dev_name);
-
- switch (uacce_bus.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;
-}
-
/*
* Returns the number of bytes read (removed last newline) on success.
* Otherwise negative value is returned.
@@ -296,7 +276,7 @@ uacce_scan(void)
continue;
}
- if (uacce_ignore_device(e->d_name))
+ if (rte_bus_is_ignored_device(&uacce_bus.bus, e->d_name))
continue;
if (uacce_scan_one(e->d_name) < 0)
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index 96d16ff545..a9eb7cf933 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -168,29 +168,6 @@ vmbus_probe_all_drivers(struct rte_vmbus_device *dev)
return 1;
}
-static bool
-vmbus_ignore_device(struct rte_vmbus_device *dev)
-{
- char name[RTE_DEV_NAME_MAX_LEN];
- struct rte_devargs *devargs;
-
- rte_uuid_unparse(dev->device_id, name, sizeof(name));
- devargs = rte_bus_find_devargs(&rte_vmbus_bus.bus, name);
-
- switch (rte_vmbus_bus.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;
-}
-
/*
* Scan the vmbus, and call the devinit() function for
* all registered drivers that have a matching entry in its id_table
@@ -209,7 +186,7 @@ rte_vmbus_probe(void)
rte_uuid_unparse(dev->device_id, ubuf, sizeof(ubuf));
- if (vmbus_ignore_device(dev))
+ if (rte_bus_is_ignored_device(&rte_vmbus_bus.bus, ubuf))
continue;
if (vmbus_probe_all_drivers(dev) < 0) {
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index 136ac511ef..f46719f4d7 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -263,12 +263,8 @@ is_for_this_process_use(struct rte_dsa_device *dev, const char *name)
if (strncmp(name, prefix, prefixlen) == 0 && name[prefixlen] == '_')
retval = 1;
- if (retval && dsa_bus.bus.conf.scan_mode != RTE_BUS_SCAN_UNDEFINED) {
- if (dsa_bus.bus.conf.scan_mode == RTE_BUS_SCAN_ALLOWLIST)
- retval = rte_bus_find_devargs(&dsa_bus.bus, dev->device.name) != NULL;
- else
- retval = rte_bus_find_devargs(&dsa_bus.bus, dev->device.name) == NULL;
- }
+ if (retval)
+ retval = !rte_bus_is_ignored_device(&dsa_bus.bus, dev->device.name);
return retval;
}
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index 863c7418bb..2ca0af7914 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -246,6 +246,25 @@ 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 char *dev_name)
+{
+ struct rte_devargs *devargs = rte_bus_find_devargs(bus, dev_name);
+
+ 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;
+}
/*
* 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 0760b09b8f..d9f59a54a1 100644
--- a/lib/eal/include/bus_driver.h
+++ b/lib/eal/include/bus_driver.h
@@ -313,6 +313,12 @@ void rte_bus_register(struct rte_bus *bus);
__rte_internal
struct rte_devargs *rte_bus_find_devargs(const struct rte_bus *bus, const char *dev_name);
+/**
+ * Indicate if a device should be skipped during probing of a bus.
+ */
+__rte_internal
+bool rte_bus_is_ignored_device(const struct rte_bus *bus, const char *dev_name);
+
/**
* Helper for Bus registration.
* The constructor has higher priority than PMD constructors.
--
2.53.0
^ permalink raw reply related [flat|nested] 67+ messages in thread* Re: [PATCH v2 6/7] bus: factorize device selection
2026-03-26 10:24 ` [PATCH v2 6/7] bus: factorize device selection David Marchand
@ 2026-03-26 11:52 ` Kevin Traynor
2026-03-28 3:38 ` fengchengwen
1 sibling, 0 replies; 67+ messages in thread
From: Kevin Traynor @ 2026-03-26 11:52 UTC (permalink / raw)
To: David Marchand, dev
Cc: Bruce Richardson, Robin Jarry, Hemant Agrawal, Maxime Leroy,
Parav Pandit, Xueming Li, Nipun Gupta, Nikhil Agarwal,
Sachin Saxena, Chenbo Xia, Tomasz Duszynski, Chengwen Feng,
Long Li, Wei Hu, Kevin Laatz
On 3/26/26 10:24 AM, 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 <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Reviewed-by: Robin Jarry <rjarry@redhat.com>
> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> Tested-by: Maxime Leroy <maxime@leroys.fr>
> ---
> Changes since v1:
> - fixed device selection in dma/idxd,
>
> Changes since RFC v2:
> - changed API to query about a device name and hide the devargs meaning
> in the common code,
>
> ---
> drivers/bus/auxiliary/auxiliary_common.c | 19 ----------------
> drivers/bus/auxiliary/linux/auxiliary.c | 2 +-
> drivers/bus/auxiliary/private.h | 6 -----
> drivers/bus/cdx/cdx.c | 21 +-----------------
> drivers/bus/dpaa/dpaa_bus.c | 24 ++++++--------------
> drivers/bus/fslmc/fslmc_bus.c | 22 ++++++-------------
> drivers/bus/pci/bsd/pci.c | 5 ++++-
> drivers/bus/pci/linux/pci.c | 2 +-
> drivers/bus/pci/pci_common.c | 23 -------------------
> drivers/bus/pci/private.h | 11 ----------
> drivers/bus/pci/windows/pci.c | 4 +++-
> drivers/bus/platform/platform.c | 28 ++----------------------
> drivers/bus/uacce/uacce.c | 22 +------------------
> drivers/bus/vmbus/vmbus_common.c | 25 +--------------------
> drivers/dma/idxd/idxd_bus.c | 8 ++-----
> lib/eal/common/eal_common_bus.c | 19 ++++++++++++++++
> lib/eal/include/bus_driver.h | 6 +++++
> 17 files changed, 55 insertions(+), 192 deletions(-)
Acked-by: Kevin Traynor <ktraynor@redhat.com>
^ permalink raw reply [flat|nested] 67+ messages in thread
* Re: [PATCH v2 6/7] bus: factorize device selection
2026-03-26 10:24 ` [PATCH v2 6/7] bus: factorize device selection David Marchand
2026-03-26 11:52 ` Kevin Traynor
@ 2026-03-28 3:38 ` fengchengwen
1 sibling, 0 replies; 67+ messages in thread
From: fengchengwen @ 2026-03-28 3:38 UTC (permalink / raw)
To: David Marchand, dev
Cc: Bruce Richardson, Robin Jarry, Hemant Agrawal, Maxime Leroy,
Parav Pandit, Xueming Li, Nipun Gupta, Nikhil Agarwal,
Sachin Saxena, Chenbo Xia, Tomasz Duszynski, Long Li, Wei Hu,
Kevin Laatz
For uacce part,
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
On 3/26/2026 6:24 PM, 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 <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Reviewed-by: Robin Jarry <rjarry@redhat.com>
> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> Tested-by: Maxime Leroy <maxime@leroys.fr>
^ permalink raw reply [flat|nested] 67+ messages in thread
* [PATCH v2 7/7] eal: configure initial device probing
2026-03-26 10:24 ` [PATCH v2 0/7] " David Marchand
` (5 preceding siblings ...)
2026-03-26 10:24 ` [PATCH v2 6/7] bus: factorize device selection David Marchand
@ 2026-03-26 10:24 ` David Marchand
2026-03-28 4:00 ` fengchengwen
6 siblings, 1 reply; 67+ messages in thread
From: David Marchand @ 2026-03-26 10:24 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, Robin Jarry, Hemant Agrawal, Maxime Leroy,
Kevin Traynor, Thomas Monjalon, Andrew Rybchenko
Some applications use port hotplug as their primary way for using DPDK
resources.
Having a systematic device probing is a problem when not all available
resources will be used by the application, as such applications won't set
an explicit allow list at startup.
This is the case for OVS on systems with multiple mlx5 devices:
one device can be used by the kernel while the other(s) are used by DPDK.
In such a setup, the kernel used device may get reconfigured in
unexpected ways and trigger issues like the one described by Kevin
not so long ago in bugzilla 1873.
Add an EAL option so that we can change the default behavior from
block-listing to allow-listing which can be summed up as disabling
automatic probing.
In case some applications want to require automatic probing, add the
opposite option.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Robin Jarry <rjarry@redhat.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Maxime Leroy <maxime@leroys.fr>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
---
Changes since RFC v2:
- added -A short option alias as it seems intuitive to use with -a,
- renamed option to --no-auto-probing (half Robin and half Thomas
suggestions),
- made -A and -b conflicting options,
- added opposite option in case an application wants an explicit behavior,
- updated unit tests accordingly,
- updated documentation (namely some detail on --vdev),
Changes since RFC v1:
- changed approach following Bruce suggestion,
---
app/test/test_eal_flags.c | 63 +++++++++++++++++++++++
devtools/test-null.sh | 2 +-
doc/guides/linux_gsg/eal_args.include.rst | 13 +++++
lib/eal/common/eal_common_bus.c | 17 +++---
lib/eal/common/eal_common_options.c | 10 ++++
lib/eal/common/eal_internal_cfg.h | 1 +
lib/eal/common/eal_option_list.h | 2 +
7 files changed, 101 insertions(+), 7 deletions(-)
diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
index b3a8d0ae6f..5594cc992d 100644
--- a/app/test/test_eal_flags.c
+++ b/app/test/test_eal_flags.c
@@ -119,6 +119,8 @@ test_misc_flags(void)
#define no_hpet "--no-hpet"
#define no_huge "--no-huge"
#define no_shconf "--no-shconf"
+#define auto_probing "--auto-probing"
+#define no_auto_probing "--no-auto-probing"
#define allow "--allow"
#define vdev "--vdev"
#define no_pci "--no-pci"
@@ -338,6 +340,14 @@ test_allow_flag(void)
allow, "09:0B.3,type=test",
allow, "08:00.1,type=normal",
};
+ const char *wlval4[] = {prgname, prefix, mp_flag, eal_debug_logs,
+ no_auto_probing };
+ const char *wlval5[] = {prgname, prefix, mp_flag, eal_debug_logs,
+ no_auto_probing, allow, "00FF:09:0B.3"};
+ const char *wlval6[] = {prgname, prefix, mp_flag, eal_debug_logs,
+ auto_probing };
+ const char *wlval7[] = {prgname, prefix, mp_flag, eal_debug_logs,
+ auto_probing, allow, "00FF:09:0B.3"};
for (i = 0; i < RTE_DIM(wlinval); i++) {
if (launch_proc(wlinval[i]) == 0) {
@@ -360,6 +370,26 @@ test_allow_flag(void)
__LINE__);
return -1;
}
+ if (launch_proc(wlval4) != 0) {
+ printf("Error (line %d) - process did not run ok with no-auto-probing\n",
+ __LINE__);
+ return -1;
+ }
+ if (launch_proc(wlval5) != 0) {
+ printf("Error (line %d) - process did not run ok with no-auto-probing + allow\n",
+ __LINE__);
+ return -1;
+ }
+ if (launch_proc(wlval6) != 0) {
+ printf("Error (line %d) - process did not run ok with auto-probing\n",
+ __LINE__);
+ return -1;
+ }
+ if (launch_proc(wlval7) != 0) {
+ printf("Error (line %d) - process did not run ok with auto-probing + allow\n",
+ __LINE__);
+ return -1;
+ }
return 0;
}
@@ -383,6 +413,11 @@ test_invalid_b_flag(void)
{prgname, prefix, mp_flag, eal_debug_logs, "-b", "error0:0:0.1"},
{prgname, prefix, mp_flag, eal_debug_logs, "-b", "0:0:0.1.2"},
};
+ const char *blinval_probing[] =
+ {prgname, prefix, mp_flag, eal_debug_logs, "-b", "0:0.0", auto_probing};
+ const char *blinval_probing_inval[] =
+ {prgname, prefix, mp_flag, eal_debug_logs, "-b", "0:0.0", no_auto_probing};
+
/* Test with valid blocklist option */
const char *blval[] = {prgname, prefix, mp_flag, eal_debug_logs,
"-b", "FF:09:0B.3"};
@@ -396,6 +431,16 @@ test_invalid_b_flag(void)
return -1;
}
}
+ if (launch_proc(blinval_probing) != 0) {
+ printf("Error (line %d) - process did not run ok with blocklist and auto-probing\n",
+ __LINE__);
+ return -1;
+ }
+ if (launch_proc(blinval_probing_inval) == 0) {
+ printf("Error (line %d) - process did run ok with blocklist and no-auto-probing\n",
+ __LINE__);
+ return -1;
+ }
if (launch_proc(blval) != 0) {
printf("Error (line %d) - process did not run ok with valid blocklist value\n",
__LINE__);
@@ -434,6 +479,12 @@ test_invalid_vdev_flag(void)
const char *vdevval3[] = {prgname, prefix, no_huge, eal_debug_logs,
bus_debug_logs, no_pci, vdev, "net_ring0,nodeaction=r1:0:CREATE"};
+ const char *vdevval4[] = {prgname, prefix, no_huge, eal_debug_logs,
+ bus_debug_logs, no_auto_probing, vdev, "net_ring0"};
+
+ const char *vdevval5[] = {prgname, prefix, no_huge, eal_debug_logs,
+ bus_debug_logs, auto_probing, vdev, "net_ring0"};
+
if (launch_proc(vdevinval) == 0) {
printf("Error (line %d) - process did run ok with invalid vdev parameter\n",
__LINE__);
@@ -457,6 +508,18 @@ test_invalid_vdev_flag(void)
__LINE__);
return -1;
}
+
+ if (launch_proc(vdevval4) != 0) {
+ printf("Error (line %d) - process did not run ok with valid vdev value and no-auto-probing\n",
+ __LINE__);
+ return -1;
+ }
+
+ if (launch_proc(vdevval5) != 0) {
+ printf("Error (line %d) - process did not run ok with valid vdev value and auto-probing\n",
+ __LINE__);
+ return -1;
+ }
return 0;
#else
return TEST_SKIPPED;
diff --git a/devtools/test-null.sh b/devtools/test-null.sh
index 8f21189262..5e8a1b20cd 100755
--- a/devtools/test-null.sh
+++ b/devtools/test-null.sh
@@ -30,7 +30,7 @@ logfile=$build/test-null.log
(sleep 1 && echo stop) |
# testpmd only needs 20M, make it x2 (default number of cores) for NUMA systems
$testpmd -l $corelist --no-huge -m 40 \
- $libs -a 0:0.0 --vdev net_null1 --vdev net_null2 $eal_options -- \
+ $libs -A --vdev net_null1 --vdev net_null2 $eal_options -- \
--no-mlockall --total-num-mbufs=2048 $testpmd_options -ia | tee $logfile
# we expect two ports and some traffic is received and transmitted
diff --git a/doc/guides/linux_gsg/eal_args.include.rst b/doc/guides/linux_gsg/eal_args.include.rst
index 4a3c4d9b5f..db9eff9321 100644
--- a/doc/guides/linux_gsg/eal_args.include.rst
+++ b/doc/guides/linux_gsg/eal_args.include.rst
@@ -101,6 +101,19 @@ Lcore-related options
Device-related options
~~~~~~~~~~~~~~~~~~~~~~
+* ``-A, --no-auto-probing``
+
+ By default, EAL probes all devices on every available bus, unless some ``-a``/``-b``
+ options are passed.
+ Disable automatic probing of non-blocked devices.
+
+.. Note::
+ Block list cannot be used when auto probing is disabled.
+
+ On the other hand, disabling auto probing does not affect the VDEV bus.
+ The VDEV bus is not concerned by automatic probing and requires explicit
+ ``-a`` or ``--vdev``.
+
* ``-b, --block <[domain:]bus:devid.func>``
Skip probing a PCI device to prevent EAL from using it.
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index 2ca0af7914..47ba303468 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -250,18 +250,23 @@ RTE_EXPORT_INTERNAL_SYMBOL(rte_bus_is_ignored_device)
bool
rte_bus_is_ignored_device(const struct rte_bus *bus, const char *dev_name)
{
+ const struct internal_config *internal_conf = eal_get_internal_configuration();
struct rte_devargs *devargs = rte_bus_find_devargs(bus, dev_name);
+ enum rte_bus_scan_mode scan_mode = bus->conf.scan_mode;
- switch (bus->conf.scan_mode) {
- case RTE_BUS_SCAN_ALLOWLIST:
+ if (scan_mode == RTE_BUS_SCAN_UNDEFINED) {
+ if (internal_conf->no_auto_probing != 0)
+ scan_mode = RTE_BUS_SCAN_ALLOWLIST;
+ else
+ scan_mode = RTE_BUS_SCAN_BLOCKLIST;
+ }
+
+ if (scan_mode == RTE_BUS_SCAN_ALLOWLIST) {
if (devargs && devargs->policy == RTE_DEV_ALLOWED)
return false;
- break;
- case RTE_BUS_SCAN_UNDEFINED:
- case RTE_BUS_SCAN_BLOCKLIST:
+ } else {
if (devargs == NULL || devargs->policy != RTE_DEV_BLOCKED)
return false;
- break;
}
return true;
}
diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c
index aad676a004..290386dc63 100644
--- a/lib/eal/common/eal_common_options.c
+++ b/lib/eal/common/eal_common_options.c
@@ -233,10 +233,15 @@ eal_collate_args(int argc, char **argv)
EAL_LOG(ERR, "Options allow (-a) and block (-b) can't be used at the same time");
return -1;
}
+ if (args.no_auto_probing && !TAILQ_EMPTY(&args.block)) {
+ EAL_LOG(ERR, "Options no-auto-probing and block (-b) can't be used at the same time");
+ return -1;
+ }
/* for non-list args, we can just check for zero/null values using macro */
if (CONFLICTING_OPTIONS(args, coremask, lcores) ||
CONFLICTING_OPTIONS(args, service_coremask, service_corelist) ||
+ CONFLICTING_OPTIONS(args, no_auto_probing, auto_probing) ||
CONFLICTING_OPTIONS(args, no_telemetry, telemetry) ||
CONFLICTING_OPTIONS(args, memory_size, numa_mem) ||
CONFLICTING_OPTIONS(args, no_huge, numa_mem) ||
@@ -518,6 +523,8 @@ eal_reset_internal_config(struct internal_config *internal_cfg)
memset(internal_cfg->vfio_vf_token, 0,
sizeof(internal_cfg->vfio_vf_token));
+ internal_cfg->no_auto_probing = 0;
+
#ifdef RTE_LIBEAL_USE_HPET
internal_cfg->no_hpet = 0;
#else
@@ -1972,6 +1979,9 @@ eal_parse_args(void)
}
}
+ if (args.no_auto_probing)
+ int_cfg->no_auto_probing = 1;
+
/* device -a/-b/-vdev options*/
TAILQ_FOREACH(arg, &args.allow, next)
if (eal_option_device_add(RTE_DEVTYPE_ALLOWED, arg->arg) < 0)
diff --git a/lib/eal/common/eal_internal_cfg.h b/lib/eal/common/eal_internal_cfg.h
index 95d327a613..fac45cbe66 100644
--- a/lib/eal/common/eal_internal_cfg.h
+++ b/lib/eal/common/eal_internal_cfg.h
@@ -104,6 +104,7 @@ struct internal_config {
struct simd_bitwidth max_simd_bitwidth;
/**< max simd bitwidth path to use */
size_t huge_worker_stack_size; /**< worker thread stack size */
+ unsigned int no_auto_probing; /**< true to switch from block-listing to allow-listing */
};
void eal_reset_internal_config(struct internal_config *internal_cfg);
diff --git a/lib/eal/common/eal_option_list.h b/lib/eal/common/eal_option_list.h
index abee16340b..6a5ddfd8d1 100644
--- a/lib/eal/common/eal_option_list.h
+++ b/lib/eal/common/eal_option_list.h
@@ -32,6 +32,7 @@
* Format of each entry: long name, short name, help string, struct member name.
*/
/* (Alphabetical) List of common options first */
+BOOL_ARG("--auto-probing", NULL, "Let EAL probe all available devices unless some -a/-b option is set.", auto_probing)
LIST_ARG("--allow", "-a", "Add device to allow-list, causing DPDK to only use specified devices", allow)
STR_ARG("--base-virtaddr", NULL, "Base virtual address to reserve memory", base_virtaddr)
LIST_ARG("--block", "-b", "Add device to block-list, preventing DPDK from using the device", block)
@@ -51,6 +52,7 @@ STR_ARG("--mbuf-pool-ops-name", NULL, "User defined mbuf default pool ops name",
STR_ARG("--memory-channels", "-n", "Number of memory channels per socket", memory_channels)
STR_ARG("--memory-ranks", "-r", "Force number of memory ranks (don't detect)", memory_ranks)
STR_ARG("--memory-size", "-m", "Total size of memory to allocate initially", memory_size)
+BOOL_ARG("--no-auto-probing", "-A", "Do not probe any devices unless some -a option is set", no_auto_probing)
BOOL_ARG("--no-hpet", NULL, "Disable HPET timer", no_hpet)
BOOL_ARG("--no-huge", NULL, "Disable hugetlbfs support", no_huge)
BOOL_ARG("--no-pci", NULL, "Disable all PCI devices", no_pci)
--
2.53.0
^ permalink raw reply related [flat|nested] 67+ messages in thread* Re: [PATCH v2 7/7] eal: configure initial device probing
2026-03-26 10:24 ` [PATCH v2 7/7] eal: configure initial device probing David Marchand
@ 2026-03-28 4:00 ` fengchengwen
2026-04-03 14:25 ` David Marchand
0 siblings, 1 reply; 67+ messages in thread
From: fengchengwen @ 2026-03-28 4:00 UTC (permalink / raw)
To: David Marchand, dev
Cc: Bruce Richardson, Robin Jarry, Hemant Agrawal, Maxime Leroy,
Kevin Traynor, Thomas Monjalon, Andrew Rybchenko
On 3/26/2026 6:24 PM, David Marchand wrote:
> Some applications use port hotplug as their primary way for using DPDK
> resources.
> Having a systematic device probing is a problem when not all available
> resources will be used by the application, as such applications won't set
> an explicit allow list at startup.
>
> This is the case for OVS on systems with multiple mlx5 devices:
> one device can be used by the kernel while the other(s) are used by DPDK.
> In such a setup, the kernel used device may get reconfigured in
> unexpected ways and trigger issues like the one described by Kevin
> not so long ago in bugzilla 1873.
>
> Add an EAL option so that we can change the default behavior from
> block-listing to allow-listing which can be summed up as disabling
> automatic probing.
> In case some applications want to require automatic probing, add the
> opposite option.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Reviewed-by: Robin Jarry <rjarry@redhat.com>
> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> Tested-by: Maxime Leroy <maxime@leroys.fr>
> Acked-by: Kevin Traynor <ktraynor@redhat.com>
> ---
> Changes since RFC v2:
> - added -A short option alias as it seems intuitive to use with -a,
> - renamed option to --no-auto-probing (half Robin and half Thomas
> suggestions),
> - made -A and -b conflicting options,
> - added opposite option in case an application wants an explicit behavior,
> - updated unit tests accordingly,
> - updated documentation (namely some detail on --vdev),
>
> Changes since RFC v1:
> - changed approach following Bruce suggestion,
>
> ---
> app/test/test_eal_flags.c | 63 +++++++++++++++++++++++
> devtools/test-null.sh | 2 +-
> doc/guides/linux_gsg/eal_args.include.rst | 13 +++++
> lib/eal/common/eal_common_bus.c | 17 +++---
> lib/eal/common/eal_common_options.c | 10 ++++
> lib/eal/common/eal_internal_cfg.h | 1 +
> lib/eal/common/eal_option_list.h | 2 +
> 7 files changed, 101 insertions(+), 7 deletions(-)
>
> diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
> index b3a8d0ae6f..5594cc992d 100644
> --- a/app/test/test_eal_flags.c
> +++ b/app/test/test_eal_flags.c
> @@ -119,6 +119,8 @@ test_misc_flags(void)
> #define no_hpet "--no-hpet"
> #define no_huge "--no-huge"
> #define no_shconf "--no-shconf"
> +#define auto_probing "--auto-probing"
> +#define no_auto_probing "--no-auto-probing"
> #define allow "--allow"
> #define vdev "--vdev"
> #define no_pci "--no-pci"
> @@ -338,6 +340,14 @@ test_allow_flag(void)
> allow, "09:0B.3,type=test",
> allow, "08:00.1,type=normal",
> };
> + const char *wlval4[] = {prgname, prefix, mp_flag, eal_debug_logs,
> + no_auto_probing };
> + const char *wlval5[] = {prgname, prefix, mp_flag, eal_debug_logs,
> + no_auto_probing, allow, "00FF:09:0B.3"};
> + const char *wlval6[] = {prgname, prefix, mp_flag, eal_debug_logs,
> + auto_probing };
> + const char *wlval7[] = {prgname, prefix, mp_flag, eal_debug_logs,
> + auto_probing, allow, "00FF:09:0B.3"};
>
> for (i = 0; i < RTE_DIM(wlinval); i++) {
> if (launch_proc(wlinval[i]) == 0) {
> @@ -360,6 +370,26 @@ test_allow_flag(void)
> __LINE__);
> return -1;
> }
> + if (launch_proc(wlval4) != 0) {
> + printf("Error (line %d) - process did not run ok with no-auto-probing\n",
> + __LINE__);
> + return -1;
> + }
> + if (launch_proc(wlval5) != 0) {
> + printf("Error (line %d) - process did not run ok with no-auto-probing + allow\n",
> + __LINE__);
> + return -1;
> + }
> + if (launch_proc(wlval6) != 0) {
> + printf("Error (line %d) - process did not run ok with auto-probing\n",
> + __LINE__);
> + return -1;
> + }
> + if (launch_proc(wlval7) != 0) {
> + printf("Error (line %d) - process did not run ok with auto-probing + allow\n",
> + __LINE__);
> + return -1;
> + }
>
> return 0;
> }
> @@ -383,6 +413,11 @@ test_invalid_b_flag(void)
> {prgname, prefix, mp_flag, eal_debug_logs, "-b", "error0:0:0.1"},
> {prgname, prefix, mp_flag, eal_debug_logs, "-b", "0:0:0.1.2"},
> };
> + const char *blinval_probing[] =
> + {prgname, prefix, mp_flag, eal_debug_logs, "-b", "0:0.0", auto_probing};
> + const char *blinval_probing_inval[] =
> + {prgname, prefix, mp_flag, eal_debug_logs, "-b", "0:0.0", no_auto_probing};
> +
> /* Test with valid blocklist option */
> const char *blval[] = {prgname, prefix, mp_flag, eal_debug_logs,
> "-b", "FF:09:0B.3"};
> @@ -396,6 +431,16 @@ test_invalid_b_flag(void)
> return -1;
> }
> }
> + if (launch_proc(blinval_probing) != 0) {
> + printf("Error (line %d) - process did not run ok with blocklist and auto-probing\n",
> + __LINE__);
> + return -1;
> + }
> + if (launch_proc(blinval_probing_inval) == 0) {
> + printf("Error (line %d) - process did run ok with blocklist and no-auto-probing\n",
> + __LINE__);
> + return -1;
> + }
> if (launch_proc(blval) != 0) {
> printf("Error (line %d) - process did not run ok with valid blocklist value\n",
> __LINE__);
> @@ -434,6 +479,12 @@ test_invalid_vdev_flag(void)
> const char *vdevval3[] = {prgname, prefix, no_huge, eal_debug_logs,
> bus_debug_logs, no_pci, vdev, "net_ring0,nodeaction=r1:0:CREATE"};
>
> + const char *vdevval4[] = {prgname, prefix, no_huge, eal_debug_logs,
> + bus_debug_logs, no_auto_probing, vdev, "net_ring0"};
> +
> + const char *vdevval5[] = {prgname, prefix, no_huge, eal_debug_logs,
> + bus_debug_logs, auto_probing, vdev, "net_ring0"};
> +
> if (launch_proc(vdevinval) == 0) {
> printf("Error (line %d) - process did run ok with invalid vdev parameter\n",
> __LINE__);
> @@ -457,6 +508,18 @@ test_invalid_vdev_flag(void)
> __LINE__);
> return -1;
> }
> +
> + if (launch_proc(vdevval4) != 0) {
> + printf("Error (line %d) - process did not run ok with valid vdev value and no-auto-probing\n",
> + __LINE__);
> + return -1;
> + }
> +
> + if (launch_proc(vdevval5) != 0) {
> + printf("Error (line %d) - process did not run ok with valid vdev value and auto-probing\n",
> + __LINE__);
> + return -1;
> + }
> return 0;
> #else
> return TEST_SKIPPED;
> diff --git a/devtools/test-null.sh b/devtools/test-null.sh
> index 8f21189262..5e8a1b20cd 100755
> --- a/devtools/test-null.sh
> +++ b/devtools/test-null.sh
> @@ -30,7 +30,7 @@ logfile=$build/test-null.log
> (sleep 1 && echo stop) |
> # testpmd only needs 20M, make it x2 (default number of cores) for NUMA systems
> $testpmd -l $corelist --no-huge -m 40 \
> - $libs -a 0:0.0 --vdev net_null1 --vdev net_null2 $eal_options -- \
> + $libs -A --vdev net_null1 --vdev net_null2 $eal_options -- \
> --no-mlockall --total-num-mbufs=2048 $testpmd_options -ia | tee $logfile
>
> # we expect two ports and some traffic is received and transmitted
> diff --git a/doc/guides/linux_gsg/eal_args.include.rst b/doc/guides/linux_gsg/eal_args.include.rst
> index 4a3c4d9b5f..db9eff9321 100644
> --- a/doc/guides/linux_gsg/eal_args.include.rst
> +++ b/doc/guides/linux_gsg/eal_args.include.rst
> @@ -101,6 +101,19 @@ Lcore-related options
> Device-related options
> ~~~~~~~~~~~~~~~~~~~~~~
>
> +* ``-A, --no-auto-probing``
> +
> + By default, EAL probes all devices on every available bus, unless some ``-a``/``-b``
> + options are passed.
> + Disable automatic probing of non-blocked devices.
> +
> +.. Note::
> + Block list cannot be used when auto probing is disabled.
> +
> + On the other hand, disabling auto probing does not affect the VDEV bus.
> + The VDEV bus is not concerned by automatic probing and requires explicit
> + ``-a`` or ``--vdev``.
> +
> * ``-b, --block <[domain:]bus:devid.func>``
>
> Skip probing a PCI device to prevent EAL from using it.
> diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
> index 2ca0af7914..47ba303468 100644
> --- a/lib/eal/common/eal_common_bus.c
> +++ b/lib/eal/common/eal_common_bus.c
> @@ -250,18 +250,23 @@ RTE_EXPORT_INTERNAL_SYMBOL(rte_bus_is_ignored_device)
> bool
> rte_bus_is_ignored_device(const struct rte_bus *bus, const char *dev_name)
> {
> + const struct internal_config *internal_conf = eal_get_internal_configuration();
> struct rte_devargs *devargs = rte_bus_find_devargs(bus, dev_name);
> + enum rte_bus_scan_mode scan_mode = bus->conf.scan_mode;
>
> - switch (bus->conf.scan_mode) {
> - case RTE_BUS_SCAN_ALLOWLIST:
> + if (scan_mode == RTE_BUS_SCAN_UNDEFINED) {
> + if (internal_conf->no_auto_probing != 0)
> + scan_mode = RTE_BUS_SCAN_ALLOWLIST;
> + else
> + scan_mode = RTE_BUS_SCAN_BLOCKLIST;
> + }
> +
> + if (scan_mode == RTE_BUS_SCAN_ALLOWLIST) {
> if (devargs && devargs->policy == RTE_DEV_ALLOWED)
> return false;
> - break;
> - case RTE_BUS_SCAN_UNDEFINED:
> - case RTE_BUS_SCAN_BLOCKLIST:
> + } else {
> if (devargs == NULL || devargs->policy != RTE_DEV_BLOCKED)
> return false;
> - break;
> }
> return true;
> }
> diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c
> index aad676a004..290386dc63 100644
> --- a/lib/eal/common/eal_common_options.c
> +++ b/lib/eal/common/eal_common_options.c
> @@ -233,10 +233,15 @@ eal_collate_args(int argc, char **argv)
> EAL_LOG(ERR, "Options allow (-a) and block (-b) can't be used at the same time");
> return -1;
> }
> + if (args.no_auto_probing && !TAILQ_EMPTY(&args.block)) {
> + EAL_LOG(ERR, "Options no-auto-probing and block (-b) can't be used at the same time");
> + return -1;
> + }
>
> /* for non-list args, we can just check for zero/null values using macro */
> if (CONFLICTING_OPTIONS(args, coremask, lcores) ||
> CONFLICTING_OPTIONS(args, service_coremask, service_corelist) ||
> + CONFLICTING_OPTIONS(args, no_auto_probing, auto_probing) ||
> CONFLICTING_OPTIONS(args, no_telemetry, telemetry) ||
> CONFLICTING_OPTIONS(args, memory_size, numa_mem) ||
> CONFLICTING_OPTIONS(args, no_huge, numa_mem) ||
> @@ -518,6 +523,8 @@ eal_reset_internal_config(struct internal_config *internal_cfg)
> memset(internal_cfg->vfio_vf_token, 0,
> sizeof(internal_cfg->vfio_vf_token));
>
> + internal_cfg->no_auto_probing = 0;
> +
> #ifdef RTE_LIBEAL_USE_HPET
> internal_cfg->no_hpet = 0;
> #else
> @@ -1972,6 +1979,9 @@ eal_parse_args(void)
> }
> }
>
> + if (args.no_auto_probing)
> + int_cfg->no_auto_probing = 1;
> +
> /* device -a/-b/-vdev options*/
> TAILQ_FOREACH(arg, &args.allow, next)
> if (eal_option_device_add(RTE_DEVTYPE_ALLOWED, arg->arg) < 0)
> diff --git a/lib/eal/common/eal_internal_cfg.h b/lib/eal/common/eal_internal_cfg.h
> index 95d327a613..fac45cbe66 100644
> --- a/lib/eal/common/eal_internal_cfg.h
> +++ b/lib/eal/common/eal_internal_cfg.h
> @@ -104,6 +104,7 @@ struct internal_config {
> struct simd_bitwidth max_simd_bitwidth;
> /**< max simd bitwidth path to use */
> size_t huge_worker_stack_size; /**< worker thread stack size */
> + unsigned int no_auto_probing; /**< true to switch from block-listing to allow-listing */
> };
>
> void eal_reset_internal_config(struct internal_config *internal_cfg);
> diff --git a/lib/eal/common/eal_option_list.h b/lib/eal/common/eal_option_list.h
> index abee16340b..6a5ddfd8d1 100644
> --- a/lib/eal/common/eal_option_list.h
> +++ b/lib/eal/common/eal_option_list.h
> @@ -32,6 +32,7 @@
> * Format of each entry: long name, short name, help string, struct member name.
> */
> /* (Alphabetical) List of common options first */
> +BOOL_ARG("--auto-probing", NULL, "Let EAL probe all available devices unless some -a/-b option is set.", auto_probing)
This commit only check auto_probing and no_auto_probing conflict,
I think it no need add this arg because auto-probing is default behavir when -a/-b not exist.
> LIST_ARG("--allow", "-a", "Add device to allow-list, causing DPDK to only use specified devices", allow)
> STR_ARG("--base-virtaddr", NULL, "Base virtual address to reserve memory", base_virtaddr)
> LIST_ARG("--block", "-b", "Add device to block-list, preventing DPDK from using the device", block)
> @@ -51,6 +52,7 @@ STR_ARG("--mbuf-pool-ops-name", NULL, "User defined mbuf default pool ops name",
> STR_ARG("--memory-channels", "-n", "Number of memory channels per socket", memory_channels)
> STR_ARG("--memory-ranks", "-r", "Force number of memory ranks (don't detect)", memory_ranks)
> STR_ARG("--memory-size", "-m", "Total size of memory to allocate initially", memory_size)
> +BOOL_ARG("--no-auto-probing", "-A", "Do not probe any devices unless some -a option is set", no_auto_probing)
> BOOL_ARG("--no-hpet", NULL, "Disable HPET timer", no_hpet)
> BOOL_ARG("--no-huge", NULL, "Disable hugetlbfs support", no_huge)
> BOOL_ARG("--no-pci", NULL, "Disable all PCI devices", no_pci)
^ permalink raw reply [flat|nested] 67+ messages in thread* Re: [PATCH v2 7/7] eal: configure initial device probing
2026-03-28 4:00 ` fengchengwen
@ 2026-04-03 14:25 ` David Marchand
0 siblings, 0 replies; 67+ messages in thread
From: David Marchand @ 2026-04-03 14:25 UTC (permalink / raw)
To: fengchengwen
Cc: dev, Bruce Richardson, Robin Jarry, Hemant Agrawal, Maxime Leroy,
Kevin Traynor, Thomas Monjalon, Andrew Rybchenko
On Sat, 28 Mar 2026 at 05:01, fengchengwen <fengchengwen@huawei.com> wrote:
> > diff --git a/lib/eal/common/eal_internal_cfg.h b/lib/eal/common/eal_internal_cfg.h
> > index 95d327a613..fac45cbe66 100644
> > --- a/lib/eal/common/eal_internal_cfg.h
> > +++ b/lib/eal/common/eal_internal_cfg.h
> > @@ -104,6 +104,7 @@ struct internal_config {
> > struct simd_bitwidth max_simd_bitwidth;
> > /**< max simd bitwidth path to use */
> > size_t huge_worker_stack_size; /**< worker thread stack size */
> > + unsigned int no_auto_probing; /**< true to switch from block-listing to allow-listing */
> > };
> >
> > void eal_reset_internal_config(struct internal_config *internal_cfg);
> > diff --git a/lib/eal/common/eal_option_list.h b/lib/eal/common/eal_option_list.h
> > index abee16340b..6a5ddfd8d1 100644
> > --- a/lib/eal/common/eal_option_list.h
> > +++ b/lib/eal/common/eal_option_list.h
> > @@ -32,6 +32,7 @@
> > * Format of each entry: long name, short name, help string, struct member name.
> > */
> > /* (Alphabetical) List of common options first */
> > +BOOL_ARG("--auto-probing", NULL, "Let EAL probe all available devices unless some -a/-b option is set.", auto_probing)
>
> This commit only check auto_probing and no_auto_probing conflict,
> I think it no need add this arg because auto-probing is default behavir when -a/-b not exist.
Introducing the --auto-probing was an ask from Thomas, so that
applications can start requesting an explicit behavior, rather than
just rely on the *current* default behavior.
--
David Marchand
^ permalink raw reply [flat|nested] 67+ messages in thread
* [PATCH v3 0/7] Rework device probing
2026-03-23 10:52 [PATCH 0/8] Rework device probing David Marchand
` (10 preceding siblings ...)
2026-03-26 10:24 ` [PATCH v2 0/7] " David Marchand
@ 2026-04-07 11:52 ` David Marchand
2026-04-07 11:52 ` [PATCH v3 1/7] devtools: check packet forwarding in null test David Marchand
` (9 more replies)
11 siblings, 10 replies; 67+ messages in thread
From: David Marchand @ 2026-04-07 11:52 UTC (permalink / raw)
To: dev
Applications relying on device hotplug don't work well with the default
probing of all available resources.
This series proposes to change this behavior via a new EAL option.
--
David Marchand
Changes since v2:
- rebased for late 26.03 fslmc bus changes,
- fixed devargs lookup,
- added debug logs,
Changes since v1:
- restored per bus scan mode,
- fixed logic in device selection for dma/idxd,
- fixed raw/ifpga hotplug on ifpga bus,
- fixed some doxygen,
Changes since RFC v3:
- removed per bus scan mode,
Changes since RFC v2:
- went one step further and reworked devargs lookup in buses following
Bruce comment (see patch 4 which is cosmetic, and patch 5),
- updated device selection helper accordingly and
changed API to be device name based,
- renamed option, added check on -b presence, updated doc in the last
patch,
Changes since RFC v1:
- reviewed bus probe() and cleaned up NXP drivers,
- changed approach following Bruce comment,
David Marchand (7):
devtools: check packet forwarding in null test
bus/fslmc: fix bus cleanup
drivers/bus: require probe function for NXP drivers
drivers/bus: cleanup devargs lookup in scan
bus: factorize devargs lookup
bus: factorize device selection
eal: configure initial device probing
app/test/test_eal_flags.c | 63 ++++++++++++++++
devtools/test-null.sh | 10 ++-
doc/guides/linux_gsg/eal_args.include.rst | 13 ++++
drivers/bus/auxiliary/auxiliary_common.c | 33 +--------
drivers/bus/auxiliary/bus_auxiliary_driver.h | 2 -
drivers/bus/auxiliary/linux/auxiliary.c | 2 +-
drivers/bus/auxiliary/private.h | 6 --
drivers/bus/cdx/cdx.c | 34 +--------
drivers/bus/dpaa/dpaa_bus.c | 71 ++++++++----------
drivers/bus/fslmc/fslmc_bus.c | 75 ++++++++------------
drivers/bus/fslmc/fslmc_vfio.c | 21 ++----
drivers/bus/ifpga/ifpga_bus.c | 8 ++-
drivers/bus/pci/bsd/pci.c | 5 +-
drivers/bus/pci/linux/pci.c | 2 +-
drivers/bus/pci/pci_common.c | 51 ++++---------
drivers/bus/pci/private.h | 11 ---
drivers/bus/pci/windows/pci.c | 4 +-
drivers/bus/platform/platform.c | 43 +----------
drivers/bus/uacce/uacce.c | 39 +---------
drivers/bus/vdev/vdev.c | 2 +-
drivers/bus/vmbus/linux/vmbus_bus.c | 2 +-
drivers/bus/vmbus/private.h | 3 -
drivers/bus/vmbus/vmbus_common.c | 45 +++---------
drivers/dma/idxd/idxd_bus.c | 18 +----
lib/eal/common/eal_common_bus.c | 54 ++++++++++++++
lib/eal/common/eal_common_options.c | 10 +++
lib/eal/common/eal_internal_cfg.h | 1 +
lib/eal/common/eal_option_list.h | 2 +
lib/eal/include/bus_driver.h | 38 ++++++++++
29 files changed, 301 insertions(+), 367 deletions(-)
--
2.53.0
^ permalink raw reply [flat|nested] 67+ messages in thread* [PATCH v3 1/7] devtools: check packet forwarding in null test
2026-04-07 11:52 ` [PATCH v3 0/7] Rework " David Marchand
@ 2026-04-07 11:52 ` David Marchand
2026-04-07 11:52 ` [PATCH v3 2/7] bus/fslmc: fix bus cleanup David Marchand
` (8 subsequent siblings)
9 siblings, 0 replies; 67+ messages in thread
From: David Marchand @ 2026-04-07 11:52 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, Hemant Agrawal, Maxime Leroy, Thomas Monjalon,
Andrew Rybchenko
Add some simple checks that testpmd was indeed polling two ports, and
some packets got through it.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Maxime Leroy <maxime@leroys.fr>
---
devtools/test-null.sh | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/devtools/test-null.sh b/devtools/test-null.sh
index e3ac168ce3..8f21189262 100755
--- a/devtools/test-null.sh
+++ b/devtools/test-null.sh
@@ -26,8 +26,14 @@ else
libs=
fi
+logfile=$build/test-null.log
(sleep 1 && echo stop) |
# testpmd only needs 20M, make it x2 (default number of cores) for NUMA systems
$testpmd -l $corelist --no-huge -m 40 \
$libs -a 0:0.0 --vdev net_null1 --vdev net_null2 $eal_options -- \
- --no-mlockall --total-num-mbufs=2048 $testpmd_options -ia
+ --no-mlockall --total-num-mbufs=2048 $testpmd_options -ia | tee $logfile
+
+# we expect two ports and some traffic is received and transmitted
+grep -q 'io packet forwarding - ports=2 -' $build/test-null.log
+grep 'RX-packets: ' $logfile | tail -1 | grep -q 'RX-packets:[[:space:]]*[^0[:space:]]'
+grep 'TX-packets: ' $logfile | tail -1 | grep -q 'TX-packets:[[:space:]]*[^0[:space:]]'
--
2.53.0
^ permalink raw reply related [flat|nested] 67+ messages in thread* [PATCH v3 2/7] bus/fslmc: fix bus cleanup
2026-04-07 11:52 ` [PATCH v3 0/7] Rework " David Marchand
2026-04-07 11:52 ` [PATCH v3 1/7] devtools: check packet forwarding in null test David Marchand
@ 2026-04-07 11:52 ` David Marchand
2026-04-07 11:52 ` [PATCH v3 3/7] drivers/bus: require probe function for NXP drivers David Marchand
` (7 subsequent siblings)
9 siblings, 0 replies; 67+ messages in thread
From: David Marchand @ 2026-04-07 11:52 UTC (permalink / raw)
To: dev
Cc: stable, Hemant Agrawal, Maxime Leroy, Kevin Traynor,
Sachin Saxena, Rohit Raj
The close operation was never closing probed devices.
Taking a step back, reevaluating the devargs makes no sense during the
close step, as a probed device must have passed the allow/block list
evaluation initially.
Since the device contains a reference to the driver that probed it,
simply call this driver remove op.
Fixes: 274fd921ff7f ("bus/fslmc: support close operation")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Maxime Leroy <maxime@leroys.fr>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
---
drivers/bus/fslmc/fslmc_vfio.c | 21 ++++-----------------
1 file changed, 4 insertions(+), 17 deletions(-)
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 550d4e0e8d..7daa18d850 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -1393,7 +1393,7 @@ fslmc_close_iodevices(struct rte_dpaa2_device *dev,
{
struct rte_dpaa2_object *object = NULL;
struct rte_dpaa2_driver *drv;
- int ret, probe_all;
+ int ret;
switch (dev->dev_type) {
case DPAA2_IO:
@@ -1411,22 +1411,9 @@ fslmc_close_iodevices(struct rte_dpaa2_device *dev,
case DPAA2_ETH:
case DPAA2_CRYPTO:
case DPAA2_QDMA:
- probe_all = rte_fslmc_bus.bus.conf.scan_mode !=
- RTE_BUS_SCAN_ALLOWLIST;
- TAILQ_FOREACH(drv, &rte_fslmc_bus.driver_list, next) {
- if (drv->drv_type != dev->dev_type)
- continue;
- if (rte_dev_is_probed(&dev->device))
- continue;
- if (probe_all ||
- (dev->device.devargs &&
- dev->device.devargs->policy ==
- RTE_DEV_ALLOWED)) {
- ret = drv->remove(dev);
- if (ret)
- DPAA2_BUS_ERR("Unable to remove");
- }
- }
+ drv = dev->driver;
+ if (drv && drv->remove && drv->remove(dev))
+ DPAA2_BUS_ERR("Unable to remove");
break;
default:
break;
--
2.53.0
^ permalink raw reply related [flat|nested] 67+ messages in thread* [PATCH v3 3/7] drivers/bus: require probe function for NXP drivers
2026-04-07 11:52 ` [PATCH v3 0/7] Rework " David Marchand
2026-04-07 11:52 ` [PATCH v3 1/7] devtools: check packet forwarding in null test David Marchand
2026-04-07 11:52 ` [PATCH v3 2/7] bus/fslmc: fix bus cleanup David Marchand
@ 2026-04-07 11:52 ` David Marchand
2026-04-07 11:52 ` [PATCH v3 4/7] drivers/bus: cleanup devargs lookup in scan David Marchand
` (6 subsequent siblings)
9 siblings, 0 replies; 67+ messages in thread
From: David Marchand @ 2026-04-07 11:52 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, Kevin Traynor, Hemant Agrawal, Maxime Leroy,
Sachin Saxena
Rather than silently ignore an invalid driver, enforce every registered
driver has a probe callback.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Maxime Leroy <maxime@leroys.fr>
---
drivers/bus/dpaa/dpaa_bus.c | 6 +++---
drivers/bus/fslmc/fslmc_bus.c | 7 +------
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index d9830b68ca..5e0f32bfe8 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -614,6 +614,7 @@ void
rte_dpaa_driver_register(struct rte_dpaa_driver *driver)
{
RTE_VERIFY(driver);
+ RTE_VERIFY(driver->probe != NULL);
BUS_INIT_FUNC_TRACE();
@@ -808,9 +809,8 @@ rte_dpaa_bus_probe(void)
if (rte_dev_is_probed(&dev->device))
continue;
- if (!drv->probe ||
- (dev->device.devargs &&
- dev->device.devargs->policy == RTE_DEV_BLOCKED))
+ if (dev->device.devargs &&
+ dev->device.devargs->policy == RTE_DEV_BLOCKED)
continue;
if (probe_all ||
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index d058441a3f..20b08639b7 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -469,9 +469,6 @@ rte_fslmc_probe(void)
if (ret)
continue;
- if (!drv->probe)
- continue;
-
if (rte_dev_is_probed(&dev->device))
continue;
@@ -538,6 +535,7 @@ void
rte_fslmc_driver_register(struct rte_dpaa2_driver *driver)
{
RTE_VERIFY(driver);
+ RTE_VERIFY(driver->probe != NULL);
TAILQ_INSERT_TAIL(&rte_fslmc_bus.driver_list, driver, next);
}
@@ -605,9 +603,6 @@ fslmc_bus_plug(struct rte_device *rte_dev)
if (ret)
continue;
- if (!drv->probe)
- continue;
-
if (rte_dev_is_probed(&dev->device))
continue;
--
2.53.0
^ permalink raw reply related [flat|nested] 67+ messages in thread* [PATCH v3 4/7] drivers/bus: cleanup devargs lookup in scan
2026-04-07 11:52 ` [PATCH v3 0/7] Rework " David Marchand
` (2 preceding siblings ...)
2026-04-07 11:52 ` [PATCH v3 3/7] drivers/bus: require probe function for NXP drivers David Marchand
@ 2026-04-07 11:52 ` David Marchand
2026-04-07 11:52 ` [PATCH v3 5/7] bus: factorize devargs lookup David Marchand
` (5 subsequent siblings)
9 siblings, 0 replies; 67+ messages in thread
From: David Marchand @ 2026-04-07 11:52 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, Hemant Agrawal, Kevin Traynor, Maxime Leroy,
Chengwen Feng, Parav Pandit, Xueming Li, Nipun Gupta,
Nikhil Agarwal, Sachin Saxena, Rosen Xu, Chenbo Xia,
Tomasz Duszynski, Long Li, Wei Hu
Don't hardcode the bus names in the RTE_EAL_DEVARGS_FOREACH() calls.
The bus name is set by code in EAL.
Even if there is nothing broken, let's reuse the name from the bus object.
And remove the now useless macros.
Note: in the ifpga bus case, the lookup loop was using an incorrect macro
(IFPGA_ARG_NAME instead of IFPGA_BUS_NAME), yet it was working fine
as this macro is aligned with the ifpga bus name.
Besides, the raw/ifpga wants to hotplug a device in this bus, so keep
this bus name macro and add a check the bus name is aligned at init time.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Tested-by: Maxime Leroy <maxime@leroys.fr>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
Changes since v1:
- fixed ifpga hotplug in raw/ifpga,
---
drivers/bus/auxiliary/auxiliary_common.c | 2 +-
drivers/bus/auxiliary/bus_auxiliary_driver.h | 2 --
drivers/bus/cdx/cdx.c | 3 +--
drivers/bus/dpaa/dpaa_bus.c | 6 ++----
drivers/bus/fslmc/fslmc_bus.c | 8 +++-----
drivers/bus/ifpga/ifpga_bus.c | 8 ++++++--
drivers/bus/pci/pci_common.c | 2 +-
drivers/bus/platform/platform.c | 2 +-
drivers/bus/uacce/uacce.c | 2 +-
drivers/bus/vdev/vdev.c | 2 +-
drivers/bus/vmbus/vmbus_common.c | 2 +-
11 files changed, 18 insertions(+), 21 deletions(-)
diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index ac766e283e..119533df28 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -30,7 +30,7 @@ auxiliary_devargs_lookup(const char *name)
{
struct rte_devargs *devargs;
- RTE_EAL_DEVARGS_FOREACH(RTE_BUS_AUXILIARY_NAME, devargs) {
+ RTE_EAL_DEVARGS_FOREACH(auxiliary_bus.bus.name, devargs) {
if (strcmp(devargs->name, name) == 0)
return devargs;
}
diff --git a/drivers/bus/auxiliary/bus_auxiliary_driver.h b/drivers/bus/auxiliary/bus_auxiliary_driver.h
index 1dc814151e..8450d56583 100644
--- a/drivers/bus/auxiliary/bus_auxiliary_driver.h
+++ b/drivers/bus/auxiliary/bus_auxiliary_driver.h
@@ -28,8 +28,6 @@
extern "C" {
#endif
-#define RTE_BUS_AUXILIARY_NAME "auxiliary"
-
/* Forward declarations */
struct rte_auxiliary_driver;
struct rte_auxiliary_device;
diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
index 729d54337c..b183d98453 100644
--- a/drivers/bus/cdx/cdx.c
+++ b/drivers/bus/cdx/cdx.c
@@ -82,7 +82,6 @@
#include "cdx_logs.h"
#include "private.h"
-#define CDX_BUS_NAME cdx
#define CDX_DEV_PREFIX "cdx-"
/* CDX Bus iterators */
@@ -157,7 +156,7 @@ cdx_devargs_lookup(const char *dev_name)
{
struct rte_devargs *devargs;
- RTE_EAL_DEVARGS_FOREACH("cdx", devargs) {
+ RTE_EAL_DEVARGS_FOREACH(rte_cdx_bus.bus.name, devargs) {
if (strcmp(devargs->name, dev_name) == 0)
return devargs;
}
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 5e0f32bfe8..e3c17d41f7 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -77,8 +77,6 @@ static pthread_key_t dpaa_portal_key;
struct dpaa_portal *dpaa_portals[RTE_MAX_LCORE] = {NULL};
static int dpaa_bus_global_init;
-#define FSL_DPAA_BUS_NAME dpaa_bus
-
RTE_EXPORT_INTERNAL_SYMBOL(per_lcore_dpaa_io)
RTE_DEFINE_PER_LCORE(struct dpaa_portal *, dpaa_io);
@@ -206,7 +204,7 @@ dpaa_devargs_lookup(struct rte_dpaa_device *dev)
struct rte_devargs *devargs;
char dev_name[32];
- RTE_EAL_DEVARGS_FOREACH("dpaa_bus", devargs) {
+ RTE_EAL_DEVARGS_FOREACH(rte_dpaa_bus.bus.name, devargs) {
devargs->bus->parse(devargs->name, &dev_name);
if (strcmp(dev_name, dev->device.name) == 0) {
DPAA_BUS_INFO("**Devargs matched %s", dev_name);
@@ -1003,5 +1001,5 @@ static struct rte_dpaa_bus rte_dpaa_bus = {
.device_count = 0,
};
-RTE_REGISTER_BUS(FSL_DPAA_BUS_NAME, rte_dpaa_bus.bus);
+RTE_REGISTER_BUS(dpaa_bus, rte_dpaa_bus.bus);
RTE_LOG_REGISTER_DEFAULT(dpaa_logtype_bus, NOTICE);
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 20b08639b7..bfedc53b55 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -26,7 +26,6 @@
#include <dpaax_iova_table.h>
#define VFIO_IOMMU_GROUP_PATH "/sys/kernel/iommu_groups"
-#define FSLMC_BUS_NAME fslmc
struct rte_fslmc_bus rte_fslmc_bus;
@@ -106,7 +105,7 @@ fslmc_devargs_lookup(struct rte_dpaa2_device *dev)
struct rte_devargs *devargs;
char dev_name[32];
- RTE_EAL_DEVARGS_FOREACH("fslmc", devargs) {
+ RTE_EAL_DEVARGS_FOREACH(rte_fslmc_bus.bus.name, devargs) {
devargs->bus->parse(devargs->name, &dev_name);
if (strcmp(dev_name, dev->device.name) == 0) {
DPAA2_BUS_INFO("**Devargs matched %s", dev_name);
@@ -266,8 +265,7 @@ rte_fslmc_parse(const char *name, void *addr)
*/
if (sep_exists) {
/* If either of "fslmc" or "name" are starting part */
- if (!strncmp(name, RTE_STR(FSLMC_BUS_NAME),
- strlen(RTE_STR(FSLMC_BUS_NAME))) ||
+ if (!strncmp(name, rte_fslmc_bus.bus.name, strlen(rte_fslmc_bus.bus.name)) ||
(!strncmp(name, "name", strlen("name")))) {
goto jump_out;
} else {
@@ -708,5 +706,5 @@ struct rte_fslmc_bus rte_fslmc_bus = {
.device_count = {0},
};
-RTE_REGISTER_BUS(FSLMC_BUS_NAME, rte_fslmc_bus.bus);
+RTE_REGISTER_BUS(fslmc, rte_fslmc_bus.bus);
RTE_LOG_REGISTER_DEFAULT(dpaa2_logtype_bus, NOTICE);
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index fdce1f6b1f..ca2812a960 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -220,7 +220,7 @@ ifpga_scan(void)
struct rte_afu_device *afu_dev = NULL;
/* for FPGA devices we scan the devargs_list populated via cmdline */
- RTE_EAL_DEVARGS_FOREACH(IFPGA_ARG_NAME, devargs) {
+ RTE_EAL_DEVARGS_FOREACH(rte_ifpga_bus.name, devargs) {
if (devargs->bus != &rte_ifpga_bus)
continue;
@@ -516,5 +516,9 @@ static struct rte_bus rte_ifpga_bus = {
.parse = ifpga_parse,
};
-RTE_REGISTER_BUS(IFPGA_BUS_NAME, rte_ifpga_bus);
+RTE_REGISTER_BUS(ifpga, rte_ifpga_bus);
+RTE_INIT(ifpga_bus_init)
+{
+ RTE_VERIFY(strcmp(rte_ifpga_bus.name, RTE_STR(IFPGA_BUS_NAME)) == 0);
+}
RTE_LOG_REGISTER_DEFAULT(ifpga_bus_logtype, NOTICE);
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index bf5df3d94e..1d26fce680 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -85,7 +85,7 @@ pci_devargs_lookup(const struct rte_pci_addr *pci_addr)
struct rte_devargs *devargs;
struct rte_pci_addr addr;
- RTE_EAL_DEVARGS_FOREACH("pci", devargs) {
+ RTE_EAL_DEVARGS_FOREACH(rte_pci_bus.bus.name, devargs) {
devargs->bus->parse(devargs->name, &addr);
if (!rte_pci_addr_cmp(pci_addr, &addr))
return devargs;
diff --git a/drivers/bus/platform/platform.c b/drivers/bus/platform/platform.c
index f6673cf181..18fa73795c 100644
--- a/drivers/bus/platform/platform.c
+++ b/drivers/bus/platform/platform.c
@@ -48,7 +48,7 @@ dev_devargs(const char *dev_name)
{
struct rte_devargs *devargs;
- RTE_EAL_DEVARGS_FOREACH("platform", devargs) {
+ RTE_EAL_DEVARGS_FOREACH(platform_bus.bus.name, devargs) {
if (!strcmp(devargs->name, dev_name))
return devargs;
}
diff --git a/drivers/bus/uacce/uacce.c b/drivers/bus/uacce/uacce.c
index a471edcad0..06a3643290 100644
--- a/drivers/bus/uacce/uacce.c
+++ b/drivers/bus/uacce/uacce.c
@@ -77,7 +77,7 @@ uacce_devargs_lookup(const char *dev_name)
struct rte_devargs *devargs;
snprintf(name, sizeof(name), "%s%s", UACCE_DEV_PREFIX, dev_name);
- RTE_EAL_DEVARGS_FOREACH("uacce", devargs) {
+ RTE_EAL_DEVARGS_FOREACH(uacce_bus.bus.name, devargs) {
if (strcmp(devargs->name, name) == 0)
return devargs;
}
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index be375f63dc..eb1de0186e 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -526,7 +526,7 @@ vdev_scan(void)
rte_spinlock_unlock(&vdev_custom_scan_lock);
/* for virtual devices we scan the devargs_list populated via cmdline */
- RTE_EAL_DEVARGS_FOREACH("vdev", devargs) {
+ RTE_EAL_DEVARGS_FOREACH(rte_vdev_bus.name, devargs) {
dev = calloc(1, sizeof(*dev));
if (!dev)
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index a787d8b18d..f857244c85 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -271,7 +271,7 @@ vmbus_devargs_lookup(struct rte_vmbus_device *dev)
struct rte_devargs *devargs;
rte_uuid_t addr;
- RTE_EAL_DEVARGS_FOREACH("vmbus", devargs) {
+ RTE_EAL_DEVARGS_FOREACH(rte_vmbus_bus.bus.name, devargs) {
vmbus_parse(devargs->name, &addr);
if (rte_uuid_compare(dev->device_id, addr) == 0)
--
2.53.0
^ permalink raw reply related [flat|nested] 67+ messages in thread* [PATCH v3 5/7] bus: factorize devargs lookup
2026-04-07 11:52 ` [PATCH v3 0/7] Rework " David Marchand
` (3 preceding siblings ...)
2026-04-07 11:52 ` [PATCH v3 4/7] drivers/bus: cleanup devargs lookup in scan David Marchand
@ 2026-04-07 11:52 ` David Marchand
2026-04-08 1:18 ` fengchengwen
2026-04-07 11:52 ` [PATCH v3 6/7] bus: factorize device selection David Marchand
` (4 subsequent siblings)
9 siblings, 1 reply; 67+ messages in thread
From: David Marchand @ 2026-04-07 11:52 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, Hemant Agrawal, Maxime Leroy, Kevin Traynor,
Parav Pandit, Xueming Li, Nipun Gupta, Nikhil Agarwal,
Sachin Saxena, Chenbo Xia, Tomasz Duszynski, Chengwen Feng,
Long Li, Wei Hu, Kevin Laatz
Each bus reimplements some similar devargs lookup code.
The differences are in how some bus (PCI, VMBUS etc...) normalizes the
device names. We can't use the .parse existing handler from outside the
bus code itself, as the size of the bus specific device location address
is unknown.
Introduce a bus specific helper to compare two device names and
hide this ugly detail.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Maxime Leroy <maxime@leroys.fr>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
---
Changes since v2:
- rebased on 26.03 fslmc changes,
- fixed devargs lookup for uacce bus (and buses != pci, fslmc),
- added a debug log,
Changes since v1:
- fixed copy/paste descriptions in doxygen,
Changes since RFC v3:
- fixed doxygen,
---
drivers/bus/auxiliary/auxiliary_common.c | 16 ++-------
drivers/bus/cdx/cdx.c | 14 +-------
drivers/bus/dpaa/dpaa_bus.c | 41 +++++++++++++-----------
drivers/bus/fslmc/fslmc_bus.c | 37 +++++++++++----------
drivers/bus/pci/pci_common.c | 38 +++++++++++-----------
drivers/bus/platform/platform.c | 17 ++--------
drivers/bus/uacce/uacce.c | 19 ++---------
drivers/bus/vmbus/linux/vmbus_bus.c | 2 +-
drivers/bus/vmbus/private.h | 3 --
drivers/bus/vmbus/vmbus_common.c | 30 ++++++++---------
drivers/dma/idxd/idxd_bus.c | 14 ++------
lib/eal/common/eal_common_bus.c | 28 ++++++++++++++++
lib/eal/include/bus_driver.h | 32 ++++++++++++++++++
13 files changed, 142 insertions(+), 149 deletions(-)
diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index 119533df28..e5b4f4460d 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -25,18 +25,6 @@
#include "private.h"
-static struct rte_devargs *
-auxiliary_devargs_lookup(const char *name)
-{
- struct rte_devargs *devargs;
-
- RTE_EAL_DEVARGS_FOREACH(auxiliary_bus.bus.name, devargs) {
- if (strcmp(devargs->name, name) == 0)
- return devargs;
- }
- return NULL;
-}
-
#ifndef AUXILIARY_OS_SUPPORTED
/*
* Test whether the auxiliary device exist.
@@ -68,7 +56,7 @@ auxiliary_scan(void)
void
auxiliary_on_scan(struct rte_auxiliary_device *aux_dev)
{
- aux_dev->device.devargs = auxiliary_devargs_lookup(aux_dev->name);
+ aux_dev->device.devargs = rte_bus_find_devargs(&auxiliary_bus.bus, aux_dev->name);
}
/*
@@ -399,7 +387,7 @@ auxiliary_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova,
bool
auxiliary_is_ignored_device(const char *name)
{
- struct rte_devargs *devargs = auxiliary_devargs_lookup(name);
+ struct rte_devargs *devargs = rte_bus_find_devargs(&auxiliary_bus.bus, name);
switch (auxiliary_bus.bus.conf.scan_mode) {
case RTE_BUS_SCAN_ALLOWLIST:
diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
index b183d98453..0801825ef5 100644
--- a/drivers/bus/cdx/cdx.c
+++ b/drivers/bus/cdx/cdx.c
@@ -151,22 +151,10 @@ void rte_cdx_unmap_device(struct rte_cdx_device *dev)
cdx_vfio_unmap_resource(dev);
}
-static struct rte_devargs *
-cdx_devargs_lookup(const char *dev_name)
-{
- struct rte_devargs *devargs;
-
- RTE_EAL_DEVARGS_FOREACH(rte_cdx_bus.bus.name, devargs) {
- if (strcmp(devargs->name, dev_name) == 0)
- return devargs;
- }
- return NULL;
-}
-
static bool
cdx_ignore_device(const char *dev_name)
{
- struct rte_devargs *devargs = cdx_devargs_lookup(dev_name);
+ struct rte_devargs *devargs = rte_bus_find_devargs(&rte_cdx_bus.bus, dev_name);
switch (rte_cdx_bus.bus.conf.scan_mode) {
case RTE_BUS_SCAN_ALLOWLIST:
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index e3c17d41f7..356c56d989 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -198,22 +198,6 @@ dpaa_sec_available(void)
static void dpaa_clean_device_list(void);
-static struct rte_devargs *
-dpaa_devargs_lookup(struct rte_dpaa_device *dev)
-{
- struct rte_devargs *devargs;
- char dev_name[32];
-
- RTE_EAL_DEVARGS_FOREACH(rte_dpaa_bus.bus.name, devargs) {
- devargs->bus->parse(devargs->name, &dev_name);
- if (strcmp(dev_name, dev->device.name) == 0) {
- DPAA_BUS_INFO("**Devargs matched %s", dev_name);
- return devargs;
- }
- }
- return NULL;
-}
-
static int
dpaa_create_device_list(void)
{
@@ -269,7 +253,9 @@ dpaa_create_device_list(void)
(fman_intf->fman->idx + 1), fman_intf->mac_idx);
}
dev->device.name = dev->name;
- dev->device.devargs = dpaa_devargs_lookup(dev);
+ dev->device.devargs = rte_bus_find_devargs(&rte_dpaa_bus.bus, dev->name);
+ if (dev->device.devargs != NULL)
+ DPAA_BUS_INFO("**Devargs matched %s", dev->name);
dpaa_add_to_device_list(dev);
}
@@ -317,7 +303,9 @@ dpaa_create_device_list(void)
sprintf(dev->name, "dpaa_sec-%d", i+1);
DPAA_BUS_LOG(INFO, "%s cryptodev added", dev->name);
dev->device.name = dev->name;
- dev->device.devargs = dpaa_devargs_lookup(dev);
+ dev->device.devargs = rte_bus_find_devargs(&rte_dpaa_bus.bus, dev->name);
+ if (dev->device.devargs != NULL)
+ DPAA_BUS_INFO("**Devargs matched %s", dev->name);
dpaa_add_to_device_list(dev);
}
@@ -341,7 +329,9 @@ dpaa_create_device_list(void)
sprintf(dev->name, "dpaa_qdma-%d", i+1);
DPAA_BUS_LOG(INFO, "%s qdma device added", dev->name);
dev->device.name = dev->name;
- dev->device.devargs = dpaa_devargs_lookup(dev);
+ dev->device.devargs = rte_bus_find_devargs(&rte_dpaa_bus.bus, dev->name);
+ if (dev->device.devargs != NULL)
+ DPAA_BUS_INFO("**Devargs matched %s", dev->name);
dpaa_add_to_device_list(dev);
}
@@ -572,6 +562,18 @@ rte_dpaa_bus_parse(const char *name, void *out)
return 0;
}
+static int
+dpaa_bus_devname_compare(const char *name1, const char *name2)
+{
+ char devname1[32], devname2[32];
+
+ if (rte_dpaa_bus_parse(name1, devname1) != 0 ||
+ rte_dpaa_bus_parse(name2, devname2) != 0)
+ return 1;
+
+ return strncmp(devname1, devname2, sizeof(devname1));
+}
+
#define DPAA_DEV_PATH1 "/sys/devices/platform/soc/soc:fsl,dpaa"
#define DPAA_DEV_PATH2 "/sys/devices/platform/fsl,dpaa"
@@ -988,6 +990,7 @@ static struct rte_dpaa_bus rte_dpaa_bus = {
.scan = rte_dpaa_bus_scan,
.probe = rte_dpaa_bus_probe,
.parse = rte_dpaa_bus_parse,
+ .devname_compare = dpaa_bus_devname_compare,
.find_device = rte_dpaa_find_device,
.get_iommu_class = rte_dpaa_get_iommu_class,
.plug = dpaa_bus_plug,
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index bfedc53b55..c853d34294 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -99,22 +99,6 @@ insert_in_device_list(struct rte_dpaa2_device *newdev)
TAILQ_INSERT_TAIL(&rte_fslmc_bus.device_list, newdev, next);
}
-static struct rte_devargs *
-fslmc_devargs_lookup(struct rte_dpaa2_device *dev)
-{
- struct rte_devargs *devargs;
- char dev_name[32];
-
- RTE_EAL_DEVARGS_FOREACH(rte_fslmc_bus.bus.name, devargs) {
- devargs->bus->parse(devargs->name, &dev_name);
- if (strcmp(dev_name, dev->device.name) == 0) {
- DPAA2_BUS_INFO("**Devargs matched %s", dev_name);
- return devargs;
- }
- }
- return NULL;
-}
-
static void
dump_device_list(void)
{
@@ -216,7 +200,7 @@ scan_one_fslmc_device(char *dev_name)
ret = -ENOMEM;
goto cleanup;
}
- dev->device.devargs = fslmc_devargs_lookup(dev);
+ dev->device.devargs = rte_bus_find_devargs(&rte_fslmc_bus.bus, dev_name);
/* Update the device found into the device_count table */
rte_fslmc_bus.device_count[dev->dev_type]++;
@@ -308,6 +292,18 @@ rte_fslmc_parse(const char *name, void *addr)
return ret;
}
+static int
+fslmc_devname_compare(const char *name1, const char *name2)
+{
+ char devname1[32], devname2[32];
+
+ if (rte_fslmc_parse(name1, devname1) != 0 ||
+ rte_fslmc_parse(name2, devname2) != 0)
+ return 1;
+
+ return strncmp(devname1, devname2, sizeof(devname1));
+}
+
static int
rte_fslmc_scan(void)
{
@@ -323,8 +319,10 @@ rte_fslmc_scan(void)
struct rte_dpaa2_device *dev;
DPAA2_BUS_DEBUG("Fslmc bus already scanned. Not rescanning");
- TAILQ_FOREACH(dev, &rte_fslmc_bus.device_list, next)
- dev->device.devargs = fslmc_devargs_lookup(dev);
+ TAILQ_FOREACH(dev, &rte_fslmc_bus.device_list, next) {
+ dev->device.devargs = rte_bus_find_devargs(&rte_fslmc_bus.bus,
+ dev->device.name);
+ }
return 0;
}
process_once = 1;
@@ -695,6 +693,7 @@ struct rte_fslmc_bus rte_fslmc_bus = {
.probe = rte_fslmc_probe,
.cleanup = rte_fslmc_close,
.parse = rte_fslmc_parse,
+ .devname_compare = fslmc_devname_compare,
.find_device = rte_fslmc_find_device,
.get_iommu_class = rte_dpaa2_get_iommu_class,
.plug = fslmc_bus_plug,
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 1d26fce680..8782dc342a 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -79,32 +79,15 @@ pci_asprintf(char **buffer, const char *format, ...)
}
#endif /* RTE_EXEC_ENV_WINDOWS */
-static struct rte_devargs *
-pci_devargs_lookup(const struct rte_pci_addr *pci_addr)
-{
- struct rte_devargs *devargs;
- struct rte_pci_addr addr;
-
- RTE_EAL_DEVARGS_FOREACH(rte_pci_bus.bus.name, devargs) {
- devargs->bus->parse(devargs->name, &addr);
- if (!rte_pci_addr_cmp(pci_addr, &addr))
- return devargs;
- }
- return NULL;
-}
-
void
pci_common_set(struct rte_pci_device *dev)
{
- struct rte_devargs *devargs;
-
/* Each device has its internal, canonical name set. */
rte_pci_device_name(&dev->addr,
dev->name, sizeof(dev->name));
dev->device.name = dev->name;
- devargs = pci_devargs_lookup(&dev->addr);
- dev->device.devargs = devargs;
+ dev->device.devargs = rte_bus_find_devargs(&rte_pci_bus.bus, dev->name);
if (dev->bus_info != NULL ||
asprintf(&dev->bus_info, "vendor_id=%"PRIx16", device_id=%"PRIx16,
@@ -503,6 +486,18 @@ pci_parse(const char *name, void *addr)
return parse == false;
}
+static int
+pci_devname_compare(const char *name1, const char *name2)
+{
+ struct rte_pci_addr addr1, addr2;
+
+ if (rte_pci_addr_parse(name1, &addr1) != 0 ||
+ rte_pci_addr_parse(name2, &addr2) != 0)
+ return 1;
+
+ return rte_pci_addr_cmp(&addr1, &addr2);
+}
+
/* register a driver */
RTE_EXPORT_INTERNAL_SYMBOL(rte_pci_register)
void
@@ -721,7 +716,11 @@ pci_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
bool
rte_pci_ignore_device(const struct rte_pci_addr *pci_addr)
{
- struct rte_devargs *devargs = pci_devargs_lookup(pci_addr);
+ char name[RTE_DEV_NAME_MAX_LEN];
+ struct rte_devargs *devargs;
+
+ rte_pci_device_name(pci_addr, name, sizeof(name));
+ devargs = rte_bus_find_devargs(&rte_pci_bus.bus, name);
switch (rte_pci_bus.bus.conf.scan_mode) {
case RTE_BUS_SCAN_ALLOWLIST:
@@ -946,6 +945,7 @@ struct rte_pci_bus rte_pci_bus = {
.plug = pci_plug,
.unplug = pci_unplug,
.parse = pci_parse,
+ .devname_compare = pci_devname_compare,
.devargs_parse = rte_pci_devargs_parse,
.dma_map = pci_dma_map,
.dma_unmap = pci_dma_unmap,
diff --git a/drivers/bus/platform/platform.c b/drivers/bus/platform/platform.c
index 18fa73795c..23c39aada6 100644
--- a/drivers/bus/platform/platform.c
+++ b/drivers/bus/platform/platform.c
@@ -43,25 +43,12 @@ rte_platform_unregister(struct rte_platform_driver *pdrv)
TAILQ_REMOVE(&platform_bus.driver_list, pdrv, next);
}
-static struct rte_devargs *
-dev_devargs(const char *dev_name)
-{
- struct rte_devargs *devargs;
-
- RTE_EAL_DEVARGS_FOREACH(platform_bus.bus.name, devargs) {
- if (!strcmp(devargs->name, dev_name))
- return devargs;
- }
-
- return NULL;
-}
-
static bool
dev_allowed(const char *dev_name)
{
struct rte_devargs *devargs;
- devargs = dev_devargs(dev_name);
+ devargs = rte_bus_find_devargs(&platform_bus.bus, dev_name);
if (devargs == NULL)
return true;
@@ -93,7 +80,7 @@ dev_add(const char *dev_name)
rte_strscpy(pdev->name, dev_name, sizeof(pdev->name));
pdev->device.name = pdev->name;
- pdev->device.devargs = dev_devargs(dev_name);
+ pdev->device.devargs = rte_bus_find_devargs(&platform_bus.bus, dev_name);
pdev->device.bus = &platform_bus.bus;
snprintf(path, sizeof(path), PLATFORM_BUS_DEVICES_PATH "/%s/numa_node", dev_name);
pdev->device.numa_node = eal_parse_sysfs_value(path, &val) ? rte_socket_id() : val;
diff --git a/drivers/bus/uacce/uacce.c b/drivers/bus/uacce/uacce.c
index 06a3643290..e6963dc18a 100644
--- a/drivers/bus/uacce/uacce.c
+++ b/drivers/bus/uacce/uacce.c
@@ -70,25 +70,10 @@ extern int uacce_bus_logtype;
#define UACCE_BUS_DEBUG(fmt, ...) UACCE_BUS_LOG(DEBUG, fmt, ##__VA_ARGS__)
-static struct rte_devargs *
-uacce_devargs_lookup(const char *dev_name)
-{
- char name[RTE_UACCE_DEV_PATH_SIZE] = {0};
- struct rte_devargs *devargs;
-
- snprintf(name, sizeof(name), "%s%s", UACCE_DEV_PREFIX, dev_name);
- RTE_EAL_DEVARGS_FOREACH(uacce_bus.bus.name, devargs) {
- if (strcmp(devargs->name, name) == 0)
- return devargs;
- }
-
- return NULL;
-}
-
static bool
uacce_ignore_device(const char *dev_name)
{
- struct rte_devargs *devargs = uacce_devargs_lookup(dev_name);
+ struct rte_devargs *devargs = rte_bus_find_devargs(&uacce_bus.bus, dev_name);
switch (uacce_bus.bus.conf.scan_mode) {
case RTE_BUS_SCAN_ALLOWLIST:
@@ -257,7 +242,7 @@ uacce_scan_one(const char *dev_name)
dev->device.bus = &uacce_bus.bus;
dev->device.name = dev->name;
- dev->device.devargs = uacce_devargs_lookup(dev_name);
+ dev->device.devargs = rte_bus_find_devargs(&uacce_bus.bus, dev_name);
snprintf(dev->name, sizeof(dev->name), "%s", dev_name);
snprintf(dev->dev_root, sizeof(dev->dev_root), "%s/%s",
UACCE_BUS_CLASS_PATH, dev_name);
diff --git a/drivers/bus/vmbus/linux/vmbus_bus.c b/drivers/bus/vmbus/linux/vmbus_bus.c
index 4c59097273..5958b97077 100644
--- a/drivers/bus/vmbus/linux/vmbus_bus.c
+++ b/drivers/bus/vmbus/linux/vmbus_bus.c
@@ -333,7 +333,7 @@ vmbus_scan_one(const char *name)
dev->monitor_id = UINT8_MAX;
}
- dev->device.devargs = vmbus_devargs_lookup(dev);
+ dev->device.devargs = rte_bus_find_devargs(&rte_vmbus_bus.bus, dev_name);
dev->device.numa_node = SOCKET_ID_ANY;
if (vmbus_use_numa(dev)) {
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index 25b8a27fcf..8ac6119ef2 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -98,9 +98,6 @@ struct vmbus_channel {
#define VMBUS_MAX_CHANNELS 64
-struct rte_devargs *
-vmbus_devargs_lookup(struct rte_vmbus_device *dev);
-
int vmbus_chan_create(const struct rte_vmbus_device *device,
uint16_t relid, uint16_t subid, uint8_t monitor_id,
struct vmbus_channel **new_chan);
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index f857244c85..96d16ff545 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -171,7 +171,11 @@ vmbus_probe_all_drivers(struct rte_vmbus_device *dev)
static bool
vmbus_ignore_device(struct rte_vmbus_device *dev)
{
- struct rte_devargs *devargs = vmbus_devargs_lookup(dev);
+ char name[RTE_DEV_NAME_MAX_LEN];
+ struct rte_devargs *devargs;
+
+ rte_uuid_unparse(dev->device_id, name, sizeof(name));
+ devargs = rte_bus_find_devargs(&rte_vmbus_bus.bus, name);
switch (rte_vmbus_bus.bus.conf.scan_mode) {
case RTE_BUS_SCAN_ALLOWLIST:
@@ -260,25 +264,16 @@ vmbus_parse(const char *name, void *addr)
return ret;
}
-/*
- * scan for matching device args on command line
- * example:
- * -a 'vmbus:635a7ae3-091e-4410-ad59-667c4f8c04c3,latency=20'
- */
-struct rte_devargs *
-vmbus_devargs_lookup(struct rte_vmbus_device *dev)
+static int
+vmbus_devname_compare(const char *name1, const char *name2)
{
- struct rte_devargs *devargs;
- rte_uuid_t addr;
-
- RTE_EAL_DEVARGS_FOREACH(rte_vmbus_bus.bus.name, devargs) {
- vmbus_parse(devargs->name, &addr);
+ rte_uuid_t guid1, guid2;
- if (rte_uuid_compare(dev->device_id, addr) == 0)
- return devargs;
- }
- return NULL;
+ if (vmbus_parse(name1, &guid1) != 0 ||
+ vmbus_parse(name2, &guid2) != 0)
+ return 1;
+ return rte_uuid_compare(guid1, guid2);
}
/* register vmbus driver */
@@ -349,6 +344,7 @@ struct rte_vmbus_bus rte_vmbus_bus = {
.cleanup = rte_vmbus_cleanup,
.find_device = vmbus_find_device,
.parse = vmbus_parse,
+ .devname_compare = vmbus_devname_compare,
},
.device_list = TAILQ_HEAD_INITIALIZER(rte_vmbus_bus.device_list),
.driver_list = TAILQ_HEAD_INITIALIZER(rte_vmbus_bus.driver_list),
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index 9a8213bbbe..136ac511ef 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -247,16 +247,6 @@ idxd_probe_dsa(struct rte_dsa_device *dev)
return 0;
}
-static int search_devargs(const char *name)
-{
- struct rte_devargs *devargs;
- RTE_EAL_DEVARGS_FOREACH(dsa_bus.bus.name, devargs) {
- if (strcmp(devargs->name, name) == 0)
- return 1;
- }
- return 0;
-}
-
static int
is_for_this_process_use(struct rte_dsa_device *dev, const char *name)
{
@@ -275,9 +265,9 @@ is_for_this_process_use(struct rte_dsa_device *dev, const char *name)
if (retval && dsa_bus.bus.conf.scan_mode != RTE_BUS_SCAN_UNDEFINED) {
if (dsa_bus.bus.conf.scan_mode == RTE_BUS_SCAN_ALLOWLIST)
- retval = search_devargs(dev->device.name);
+ retval = rte_bus_find_devargs(&dsa_bus.bus, dev->device.name) != NULL;
else
- retval = !search_devargs(dev->device.name);
+ retval = rte_bus_find_devargs(&dsa_bus.bus, dev->device.name) == NULL;
}
return retval;
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index 0a2311a342..de866a18c7 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>
@@ -205,6 +206,33 @@ rte_bus_find_by_name(const char *busname)
return rte_bus_find(NULL, cmp_bus_name, (const void *)busname);
}
+RTE_EXPORT_INTERNAL_SYMBOL(rte_bus_find_devargs)
+struct rte_devargs *
+rte_bus_find_devargs(const struct rte_bus *bus, const char *name)
+{
+ rte_bus_devname_compare_t cmp = bus->devname_compare;
+ const char *bus_name = rte_bus_name(bus);
+ struct rte_devargs *devargs;
+
+ if (cmp == NULL)
+ cmp = strcmp;
+
+ RTE_EAL_DEVARGS_FOREACH(bus_name, devargs) {
+ const char *devargs_name = devargs->name;
+
+ /* The name in the devargs is usually prefixed with <bus>: */
+ if (strncmp(devargs_name, bus_name, strlen(bus_name)) == 0)
+ devargs_name += strlen(bus_name) + 1;
+ if (cmp(name, devargs_name) != 0)
+ continue;
+ EAL_LOG(DEBUG, "found devargs for %s:%s", bus_name, name);
+ return devargs;
+ }
+
+ EAL_LOG(DEBUG, "no devargs for %s:%s", bus_name, name);
+ return NULL;
+}
+
static int
bus_can_parse(const struct rte_bus *bus, const void *_name)
{
diff --git a/lib/eal/include/bus_driver.h b/lib/eal/include/bus_driver.h
index 60527b75b6..0760b09b8f 100644
--- a/lib/eal/include/bus_driver.h
+++ b/lib/eal/include/bus_driver.h
@@ -118,6 +118,22 @@ typedef int (*rte_bus_unplug_t)(struct rte_device *dev);
*/
typedef int (*rte_bus_parse_t)(const char *name, void *addr);
+/**
+ * Bus specific device name comparison function.
+ * Bus can normalize the names of devices using an internal representation.
+ * This helper makes it possible to check whether two names refer to the same device.
+ *
+ * @param[in] name1
+ * device name
+ * @param[in] name2
+ * device name
+ *
+ * @return
+ * 0 if the two names refer to the same device.
+ * !0 otherwise.
+ */
+typedef int (*rte_bus_devname_compare_t)(const char *name1, const char *name2);
+
/**
* Parse bus part of the device arguments.
*
@@ -258,6 +274,7 @@ struct rte_bus {
rte_bus_plug_t plug; /**< Probe single device for drivers */
rte_bus_unplug_t unplug; /**< Remove single device from driver */
rte_bus_parse_t parse; /**< Parse a device name */
+ rte_bus_devname_compare_t devname_compare; /**< Compare two device names */
rte_bus_devargs_parse_t devargs_parse; /**< Parse bus devargs */
rte_dev_dma_map_t dma_map; /**< DMA map for device in the bus */
rte_dev_dma_unmap_t dma_unmap; /**< DMA unmap for device in the bus */
@@ -281,6 +298,21 @@ struct rte_bus {
__rte_internal
void rte_bus_register(struct rte_bus *bus);
+/**
+ * Find the devargs associated to a device.
+ *
+ * @param bus
+ * A pointer to a rte_bus structure describing the bus
+ * to search for devargs on.
+ * @param dev_name
+ * A device name.
+ *
+ * @return
+ * Pointer to the device devargs, or NULL if none found.
+ */
+__rte_internal
+struct rte_devargs *rte_bus_find_devargs(const struct rte_bus *bus, const char *dev_name);
+
/**
* Helper for Bus registration.
* The constructor has higher priority than PMD constructors.
--
2.53.0
^ permalink raw reply related [flat|nested] 67+ messages in thread* Re: [PATCH v3 5/7] bus: factorize devargs lookup
2026-04-07 11:52 ` [PATCH v3 5/7] bus: factorize devargs lookup David Marchand
@ 2026-04-08 1:18 ` fengchengwen
0 siblings, 0 replies; 67+ messages in thread
From: fengchengwen @ 2026-04-08 1:18 UTC (permalink / raw)
To: David Marchand, dev
Cc: Bruce Richardson, Hemant Agrawal, Maxime Leroy, Kevin Traynor,
Parav Pandit, Xueming Li, Nipun Gupta, Nikhil Agarwal,
Sachin Saxena, Chenbo Xia, Tomasz Duszynski, Long Li, Wei Hu,
Kevin Laatz
For uacce part:
Tested-by: Chengwen Feng <fengchengwen@huawei.com>
On 4/7/2026 7:52 PM, David Marchand wrote:
> Each bus reimplements some similar devargs lookup code.
>
> The differences are in how some bus (PCI, VMBUS etc...) normalizes the
> device names. We can't use the .parse existing handler from outside the
> bus code itself, as the size of the bus specific device location address
> is unknown.
> Introduce a bus specific helper to compare two device names and
> hide this ugly detail.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> Tested-by: Maxime Leroy <maxime@leroys.fr>
> Acked-by: Kevin Traynor <ktraynor@redhat.com>
^ permalink raw reply [flat|nested] 67+ messages in thread
* [PATCH v3 6/7] bus: factorize device selection
2026-04-07 11:52 ` [PATCH v3 0/7] Rework " David Marchand
` (4 preceding siblings ...)
2026-04-07 11:52 ` [PATCH v3 5/7] bus: factorize devargs lookup David Marchand
@ 2026-04-07 11:52 ` David Marchand
2026-04-07 11:52 ` [PATCH v3 7/7] eal: configure initial device probing David Marchand
` (3 subsequent siblings)
9 siblings, 0 replies; 67+ messages in thread
From: David Marchand @ 2026-04-07 11:52 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, Robin Jarry, Hemant Agrawal, Maxime Leroy,
Kevin Traynor, Chengwen Feng, Parav Pandit, Xueming Li,
Nipun Gupta, Nikhil Agarwal, Sachin Saxena, Chenbo Xia,
Tomasz Duszynski, Long Li, Wei Hu, Kevin Laatz
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@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Robin Jarry <rjarry@redhat.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Maxime Leroy <maxime@leroys.fr>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
Changes since v2:
- added a debug log in the helper,
Changes since v1:
- fixed device selection in dma/idxd,
Changes since RFC v2:
- changed API to query about a device name and hide the devargs meaning
in the common code,
---
drivers/bus/auxiliary/auxiliary_common.c | 19 ----------------
drivers/bus/auxiliary/linux/auxiliary.c | 2 +-
drivers/bus/auxiliary/private.h | 6 -----
drivers/bus/cdx/cdx.c | 21 +-----------------
drivers/bus/dpaa/dpaa_bus.c | 24 ++++++--------------
drivers/bus/fslmc/fslmc_bus.c | 25 ++++++---------------
drivers/bus/pci/bsd/pci.c | 5 ++++-
drivers/bus/pci/linux/pci.c | 2 +-
drivers/bus/pci/pci_common.c | 23 -------------------
drivers/bus/pci/private.h | 11 ----------
drivers/bus/pci/windows/pci.c | 4 +++-
drivers/bus/platform/platform.c | 28 ++----------------------
drivers/bus/uacce/uacce.c | 22 +------------------
drivers/bus/vmbus/vmbus_common.c | 25 +--------------------
drivers/dma/idxd/idxd_bus.c | 8 ++-----
lib/eal/common/eal_common_bus.c | 21 ++++++++++++++++++
lib/eal/include/bus_driver.h | 6 +++++
17 files changed, 57 insertions(+), 195 deletions(-)
diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index e5b4f4460d..8f3e90eaf0 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -384,25 +384,6 @@ auxiliary_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova,
return aux_dev->driver->dma_unmap(aux_dev, addr, iova, len);
}
-bool
-auxiliary_is_ignored_device(const char *name)
-{
- struct rte_devargs *devargs = rte_bus_find_devargs(&auxiliary_bus.bus, name);
-
- switch (auxiliary_bus.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;
-}
-
static enum rte_iova_mode
auxiliary_get_iommu_class(void)
{
diff --git a/drivers/bus/auxiliary/linux/auxiliary.c b/drivers/bus/auxiliary/linux/auxiliary.c
index 02fc9285dc..ac9bf55efa 100644
--- a/drivers/bus/auxiliary/linux/auxiliary.c
+++ b/drivers/bus/auxiliary/linux/auxiliary.c
@@ -110,7 +110,7 @@ auxiliary_scan(void)
if (e->d_name[0] == '.')
continue;
- if (auxiliary_is_ignored_device(e->d_name))
+ if (rte_bus_is_ignored_device(&auxiliary_bus.bus, e->d_name))
continue;
snprintf(dirname, sizeof(dirname), "%s/%s",
diff --git a/drivers/bus/auxiliary/private.h b/drivers/bus/auxiliary/private.h
index 4604f6f4a7..6e61a5f494 100644
--- a/drivers/bus/auxiliary/private.h
+++ b/drivers/bus/auxiliary/private.h
@@ -53,12 +53,6 @@ int auxiliary_scan(void);
*/
void auxiliary_on_scan(struct rte_auxiliary_device *aux_dev);
-/*
- * Validate whether a device with given auxiliary device should be ignored
- * or not.
- */
-bool auxiliary_is_ignored_device(const char *name);
-
/*
* Add an auxiliary device to the auxiliary bus (append to auxiliary device
* list). This function also updates the bus references of the auxiliary
diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
index 0801825ef5..58d8c8b4da 100644
--- a/drivers/bus/cdx/cdx.c
+++ b/drivers/bus/cdx/cdx.c
@@ -151,25 +151,6 @@ void rte_cdx_unmap_device(struct rte_cdx_device *dev)
cdx_vfio_unmap_resource(dev);
}
-static bool
-cdx_ignore_device(const char *dev_name)
-{
- struct rte_devargs *devargs = rte_bus_find_devargs(&rte_cdx_bus.bus, dev_name);
-
- switch (rte_cdx_bus.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;
-}
-
/*
* Scan one cdx sysfs entry, and fill the devices list from it.
* It checks if the CDX device is bound to vfio-cdx driver. In case
@@ -269,7 +250,7 @@ cdx_scan(void)
if (e->d_name[0] == '.')
continue;
- if (cdx_ignore_device(e->d_name))
+ if (rte_bus_is_ignored_device(&rte_cdx_bus.bus, e->d_name))
continue;
snprintf(dirname, sizeof(dirname), "%s/%s",
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 356c56d989..9ff58af0c4 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -717,7 +717,6 @@ rte_dpaa_bus_probe(void)
struct rte_dpaa_driver *drv;
FILE *svr_file = NULL;
uint32_t svr_ver;
- int probe_all = rte_dpaa_bus.bus.conf.scan_mode != RTE_BUS_SCAN_ALLOWLIST;
static int process_once;
char *penv;
@@ -725,9 +724,6 @@ rte_dpaa_bus_probe(void)
if (!rte_dpaa_bus.detected)
return 0;
- if (rte_dpaa_bus.bus.conf.scan_mode != RTE_BUS_SCAN_ALLOWLIST)
- probe_all = true;
-
svr_file = fopen(DPAA_SOC_ID_FILE, "r");
if (svr_file) {
if (fscanf(svr_file, "svr:%x", &svr_ver) > 0)
@@ -809,21 +805,15 @@ rte_dpaa_bus_probe(void)
if (rte_dev_is_probed(&dev->device))
continue;
- if (dev->device.devargs &&
- dev->device.devargs->policy == RTE_DEV_BLOCKED)
+ if (rte_bus_is_ignored_device(&rte_dpaa_bus.bus, dev->name))
continue;
- if (probe_all ||
- (dev->device.devargs &&
- dev->device.devargs->policy == RTE_DEV_ALLOWED)) {
- ret = drv->probe(drv, dev);
- if (ret) {
- DPAA_BUS_ERR("unable to probe:%s",
- dev->name);
- } else {
- dev->driver = drv;
- dev->device.driver = &drv->driver;
- }
+ ret = drv->probe(drv, dev);
+ if (ret) {
+ DPAA_BUS_ERR("unable to probe: %s", dev->name);
+ } else {
+ dev->driver = drv;
+ dev->device.driver = &drv->driver;
}
break;
}
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index c853d34294..c5a7f3d8ff 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -410,7 +410,6 @@ static int
rte_fslmc_probe(void)
{
int ret = 0;
- int probe_all;
struct rte_dpaa2_device *dev;
struct rte_dpaa2_driver *drv;
@@ -457,8 +456,6 @@ rte_fslmc_probe(void)
return 0;
}
- probe_all = rte_fslmc_bus.bus.conf.scan_mode != RTE_BUS_SCAN_ALLOWLIST;
-
TAILQ_FOREACH(dev, &rte_fslmc_bus.device_list, next) {
TAILQ_FOREACH(drv, &rte_fslmc_bus.driver_list, next) {
ret = rte_fslmc_match(drv, dev);
@@ -468,23 +465,15 @@ rte_fslmc_probe(void)
if (rte_dev_is_probed(&dev->device))
continue;
- if (dev->device.devargs &&
- dev->device.devargs->policy == RTE_DEV_BLOCKED) {
- DPAA2_BUS_LOG(DEBUG, "%s Blocked, skipping",
- dev->device.name);
+ if (rte_bus_is_ignored_device(&rte_fslmc_bus.bus, dev->device.name))
continue;
- }
- if (probe_all ||
- (dev->device.devargs &&
- dev->device.devargs->policy == RTE_DEV_ALLOWED)) {
- ret = drv->probe(drv, dev);
- if (ret) {
- DPAA2_BUS_ERR("Unable to probe");
- } else {
- dev->driver = drv;
- dev->device.driver = &drv->driver;
- }
+ ret = drv->probe(drv, dev);
+ if (ret) {
+ DPAA2_BUS_ERR("Unable to probe");
+ } else {
+ dev->driver = drv;
+ dev->device.driver = &drv->driver;
}
break;
}
diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index 3f13e1d6ac..ffd84ee5f0 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -370,12 +370,15 @@ rte_pci_scan(void)
}
for (i = 0; i < conf_io.num_matches; i++) {
+ char name[RTE_DEV_NAME_MAX_LEN];
+
pci_addr.domain = matches[i].pc_sel.pc_domain;
pci_addr.bus = matches[i].pc_sel.pc_bus;
pci_addr.devid = matches[i].pc_sel.pc_dev;
pci_addr.function = matches[i].pc_sel.pc_func;
+ rte_pci_device_name(&pci_addr, name, sizeof(name));
- if (rte_pci_ignore_device(&pci_addr))
+ if (rte_bus_is_ignored_device(&rte_pci_bus.bus, name))
continue;
if (pci_scan_one(fd, &matches[i]) < 0)
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index 2ffac82e94..03a3c37dea 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -458,7 +458,7 @@ rte_pci_scan(void)
if (parse_pci_addr_format(e->d_name, sizeof(e->d_name), &addr) != 0)
continue;
- if (rte_pci_ignore_device(&addr))
+ if (rte_bus_is_ignored_device(&rte_pci_bus.bus, e->d_name))
continue;
snprintf(dirname, sizeof(dirname), "%s/%s",
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 8782dc342a..5ef9e80e3e 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -713,29 +713,6 @@ pci_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
return -1;
}
-bool
-rte_pci_ignore_device(const struct rte_pci_addr *pci_addr)
-{
- char name[RTE_DEV_NAME_MAX_LEN];
- struct rte_devargs *devargs;
-
- rte_pci_device_name(pci_addr, name, sizeof(name));
- devargs = rte_bus_find_devargs(&rte_pci_bus.bus, name);
-
- switch (rte_pci_bus.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;
-}
-
enum rte_iova_mode
rte_pci_get_iommu_class(void)
{
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 38109844b9..8591c4a0a7 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -82,17 +82,6 @@ pci_common_set(struct rte_pci_device *dev);
void
pci_free(struct rte_pci_device_internal *pdev);
-/**
- * Validate whether a device with given PCI address should be ignored or not.
- *
- * @param pci_addr
- * PCI address of device to be validated
- * @return
- * true: if device is to be ignored,
- * false: if device is to be scanned,
- */
-bool rte_pci_ignore_device(const struct rte_pci_addr *pci_addr);
-
/**
* Add a PCI device to the PCI Bus (append to PCI Device list). This function
* also updates the bus references of the PCI Device (and the generic device
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index a5ce3b51f7..91c8e567d1 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -373,6 +373,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
struct rte_pci_device *dev = NULL;
int ret = -1;
char pci_device_info[REGSTR_VAL_MAX_HCID_LEN];
+ char name[RTE_DEV_NAME_MAX_LEN];
struct rte_pci_addr addr;
struct rte_pci_id pci_id;
@@ -380,7 +381,8 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
if (ret != 0)
goto end;
- if (rte_pci_ignore_device(&addr)) {
+ rte_pci_device_name(&addr, name, sizeof(name));
+ if (rte_bus_is_ignored_device(&rte_pci_bus.bus, name)) {
/*
* We won't add this device, but we want to continue
* looking for supported devices
diff --git a/drivers/bus/platform/platform.c b/drivers/bus/platform/platform.c
index 23c39aada6..ad7898f011 100644
--- a/drivers/bus/platform/platform.c
+++ b/drivers/bus/platform/platform.c
@@ -43,30 +43,6 @@ rte_platform_unregister(struct rte_platform_driver *pdrv)
TAILQ_REMOVE(&platform_bus.driver_list, pdrv, next);
}
-static bool
-dev_allowed(const char *dev_name)
-{
- struct rte_devargs *devargs;
-
- devargs = rte_bus_find_devargs(&platform_bus.bus, dev_name);
- if (devargs == NULL)
- return true;
-
- switch (platform_bus.bus.conf.scan_mode) {
- case RTE_BUS_SCAN_UNDEFINED:
- case RTE_BUS_SCAN_ALLOWLIST:
- if (devargs->policy == RTE_DEV_ALLOWED)
- return true;
- break;
- case RTE_BUS_SCAN_BLOCKLIST:
- if (devargs->policy == RTE_DEV_BLOCKED)
- return false;
- break;
- }
-
- return true;
-}
-
static int
dev_add(const char *dev_name)
{
@@ -160,7 +136,7 @@ platform_bus_scan(void)
if (dev_name[0] == '.')
continue;
- if (!dev_allowed(dev_name))
+ if (rte_bus_is_ignored_device(&platform_bus.bus, dev_name))
continue;
if (!dev_is_bound_vfio_platform(dev_name))
@@ -484,7 +460,7 @@ platform_bus_plug(struct rte_device *dev)
{
struct rte_platform_device *pdev;
- if (!dev_allowed(dev->name))
+ if (rte_bus_is_ignored_device(&platform_bus.bus, dev->name))
return -EPERM;
if (!dev_is_bound_vfio_platform(dev->name))
diff --git a/drivers/bus/uacce/uacce.c b/drivers/bus/uacce/uacce.c
index e6963dc18a..ee02ecd1ce 100644
--- a/drivers/bus/uacce/uacce.c
+++ b/drivers/bus/uacce/uacce.c
@@ -70,26 +70,6 @@ extern int uacce_bus_logtype;
#define UACCE_BUS_DEBUG(fmt, ...) UACCE_BUS_LOG(DEBUG, fmt, ##__VA_ARGS__)
-static bool
-uacce_ignore_device(const char *dev_name)
-{
- struct rte_devargs *devargs = rte_bus_find_devargs(&uacce_bus.bus, dev_name);
-
- switch (uacce_bus.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;
-}
-
/*
* Returns the number of bytes read (removed last newline) on success.
* Otherwise negative value is returned.
@@ -296,7 +276,7 @@ uacce_scan(void)
continue;
}
- if (uacce_ignore_device(e->d_name))
+ if (rte_bus_is_ignored_device(&uacce_bus.bus, e->d_name))
continue;
if (uacce_scan_one(e->d_name) < 0)
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index 96d16ff545..a9eb7cf933 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -168,29 +168,6 @@ vmbus_probe_all_drivers(struct rte_vmbus_device *dev)
return 1;
}
-static bool
-vmbus_ignore_device(struct rte_vmbus_device *dev)
-{
- char name[RTE_DEV_NAME_MAX_LEN];
- struct rte_devargs *devargs;
-
- rte_uuid_unparse(dev->device_id, name, sizeof(name));
- devargs = rte_bus_find_devargs(&rte_vmbus_bus.bus, name);
-
- switch (rte_vmbus_bus.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;
-}
-
/*
* Scan the vmbus, and call the devinit() function for
* all registered drivers that have a matching entry in its id_table
@@ -209,7 +186,7 @@ rte_vmbus_probe(void)
rte_uuid_unparse(dev->device_id, ubuf, sizeof(ubuf));
- if (vmbus_ignore_device(dev))
+ if (rte_bus_is_ignored_device(&rte_vmbus_bus.bus, ubuf))
continue;
if (vmbus_probe_all_drivers(dev) < 0) {
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index 136ac511ef..f46719f4d7 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -263,12 +263,8 @@ is_for_this_process_use(struct rte_dsa_device *dev, const char *name)
if (strncmp(name, prefix, prefixlen) == 0 && name[prefixlen] == '_')
retval = 1;
- if (retval && dsa_bus.bus.conf.scan_mode != RTE_BUS_SCAN_UNDEFINED) {
- if (dsa_bus.bus.conf.scan_mode == RTE_BUS_SCAN_ALLOWLIST)
- retval = rte_bus_find_devargs(&dsa_bus.bus, dev->device.name) != NULL;
- else
- retval = rte_bus_find_devargs(&dsa_bus.bus, dev->device.name) == NULL;
- }
+ if (retval)
+ retval = !rte_bus_is_ignored_device(&dsa_bus.bus, dev->device.name);
return retval;
}
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index de866a18c7..d07d912c77 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -254,6 +254,27 @@ 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 char *dev_name)
+{
+ struct rte_devargs *devargs = rte_bus_find_devargs(bus, dev_name);
+
+ 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;
+ }
+
+ EAL_LOG(DEBUG, "device %s:%s is ignored", rte_bus_name(bus), dev_name);
+ return true;
+}
/*
* 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 0760b09b8f..d9f59a54a1 100644
--- a/lib/eal/include/bus_driver.h
+++ b/lib/eal/include/bus_driver.h
@@ -313,6 +313,12 @@ void rte_bus_register(struct rte_bus *bus);
__rte_internal
struct rte_devargs *rte_bus_find_devargs(const struct rte_bus *bus, const char *dev_name);
+/**
+ * Indicate if a device should be skipped during probing of a bus.
+ */
+__rte_internal
+bool rte_bus_is_ignored_device(const struct rte_bus *bus, const char *dev_name);
+
/**
* Helper for Bus registration.
* The constructor has higher priority than PMD constructors.
--
2.53.0
^ permalink raw reply related [flat|nested] 67+ messages in thread* [PATCH v3 7/7] eal: configure initial device probing
2026-04-07 11:52 ` [PATCH v3 0/7] Rework " David Marchand
` (5 preceding siblings ...)
2026-04-07 11:52 ` [PATCH v3 6/7] bus: factorize device selection David Marchand
@ 2026-04-07 11:52 ` David Marchand
2026-04-08 1:44 ` fengchengwen
2026-04-07 11:58 ` [PATCH v3 0/7] Rework " David Marchand
` (2 subsequent siblings)
9 siblings, 1 reply; 67+ messages in thread
From: David Marchand @ 2026-04-07 11:52 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, Robin Jarry, Hemant Agrawal, Maxime Leroy,
Kevin Traynor, Thomas Monjalon, Andrew Rybchenko
Some applications use port hotplug as their primary way for using DPDK
resources.
Having a systematic device probing is a problem when not all available
resources will be used by the application, as such applications won't set
an explicit allow list at startup.
This is the case for OVS on systems with multiple mlx5 devices:
one device can be used by the kernel while the other(s) are used by DPDK.
In such a setup, the kernel used device may get reconfigured in
unexpected ways and trigger issues like the one described by Kevin
not so long ago in bugzilla 1873.
Add an EAL option so that we can change the default behavior from
block-listing to allow-listing which can be summed up as disabling
automatic probing.
In case some applications want to require automatic probing, add the
opposite option.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Robin Jarry <rjarry@redhat.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Maxime Leroy <maxime@leroys.fr>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
---
Changes since RFC v2:
- added -A short option alias as it seems intuitive to use with -a,
- renamed option to --no-auto-probing (half Robin and half Thomas
suggestions),
- made -A and -b conflicting options,
- added opposite option in case an application wants an explicit behavior,
- updated unit tests accordingly,
- updated documentation (namely some detail on --vdev),
Changes since RFC v1:
- changed approach following Bruce suggestion,
---
app/test/test_eal_flags.c | 63 +++++++++++++++++++++++
devtools/test-null.sh | 2 +-
doc/guides/linux_gsg/eal_args.include.rst | 13 +++++
lib/eal/common/eal_common_bus.c | 17 +++---
lib/eal/common/eal_common_options.c | 10 ++++
lib/eal/common/eal_internal_cfg.h | 1 +
lib/eal/common/eal_option_list.h | 2 +
7 files changed, 101 insertions(+), 7 deletions(-)
diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
index b3a8d0ae6f..5594cc992d 100644
--- a/app/test/test_eal_flags.c
+++ b/app/test/test_eal_flags.c
@@ -119,6 +119,8 @@ test_misc_flags(void)
#define no_hpet "--no-hpet"
#define no_huge "--no-huge"
#define no_shconf "--no-shconf"
+#define auto_probing "--auto-probing"
+#define no_auto_probing "--no-auto-probing"
#define allow "--allow"
#define vdev "--vdev"
#define no_pci "--no-pci"
@@ -338,6 +340,14 @@ test_allow_flag(void)
allow, "09:0B.3,type=test",
allow, "08:00.1,type=normal",
};
+ const char *wlval4[] = {prgname, prefix, mp_flag, eal_debug_logs,
+ no_auto_probing };
+ const char *wlval5[] = {prgname, prefix, mp_flag, eal_debug_logs,
+ no_auto_probing, allow, "00FF:09:0B.3"};
+ const char *wlval6[] = {prgname, prefix, mp_flag, eal_debug_logs,
+ auto_probing };
+ const char *wlval7[] = {prgname, prefix, mp_flag, eal_debug_logs,
+ auto_probing, allow, "00FF:09:0B.3"};
for (i = 0; i < RTE_DIM(wlinval); i++) {
if (launch_proc(wlinval[i]) == 0) {
@@ -360,6 +370,26 @@ test_allow_flag(void)
__LINE__);
return -1;
}
+ if (launch_proc(wlval4) != 0) {
+ printf("Error (line %d) - process did not run ok with no-auto-probing\n",
+ __LINE__);
+ return -1;
+ }
+ if (launch_proc(wlval5) != 0) {
+ printf("Error (line %d) - process did not run ok with no-auto-probing + allow\n",
+ __LINE__);
+ return -1;
+ }
+ if (launch_proc(wlval6) != 0) {
+ printf("Error (line %d) - process did not run ok with auto-probing\n",
+ __LINE__);
+ return -1;
+ }
+ if (launch_proc(wlval7) != 0) {
+ printf("Error (line %d) - process did not run ok with auto-probing + allow\n",
+ __LINE__);
+ return -1;
+ }
return 0;
}
@@ -383,6 +413,11 @@ test_invalid_b_flag(void)
{prgname, prefix, mp_flag, eal_debug_logs, "-b", "error0:0:0.1"},
{prgname, prefix, mp_flag, eal_debug_logs, "-b", "0:0:0.1.2"},
};
+ const char *blinval_probing[] =
+ {prgname, prefix, mp_flag, eal_debug_logs, "-b", "0:0.0", auto_probing};
+ const char *blinval_probing_inval[] =
+ {prgname, prefix, mp_flag, eal_debug_logs, "-b", "0:0.0", no_auto_probing};
+
/* Test with valid blocklist option */
const char *blval[] = {prgname, prefix, mp_flag, eal_debug_logs,
"-b", "FF:09:0B.3"};
@@ -396,6 +431,16 @@ test_invalid_b_flag(void)
return -1;
}
}
+ if (launch_proc(blinval_probing) != 0) {
+ printf("Error (line %d) - process did not run ok with blocklist and auto-probing\n",
+ __LINE__);
+ return -1;
+ }
+ if (launch_proc(blinval_probing_inval) == 0) {
+ printf("Error (line %d) - process did run ok with blocklist and no-auto-probing\n",
+ __LINE__);
+ return -1;
+ }
if (launch_proc(blval) != 0) {
printf("Error (line %d) - process did not run ok with valid blocklist value\n",
__LINE__);
@@ -434,6 +479,12 @@ test_invalid_vdev_flag(void)
const char *vdevval3[] = {prgname, prefix, no_huge, eal_debug_logs,
bus_debug_logs, no_pci, vdev, "net_ring0,nodeaction=r1:0:CREATE"};
+ const char *vdevval4[] = {prgname, prefix, no_huge, eal_debug_logs,
+ bus_debug_logs, no_auto_probing, vdev, "net_ring0"};
+
+ const char *vdevval5[] = {prgname, prefix, no_huge, eal_debug_logs,
+ bus_debug_logs, auto_probing, vdev, "net_ring0"};
+
if (launch_proc(vdevinval) == 0) {
printf("Error (line %d) - process did run ok with invalid vdev parameter\n",
__LINE__);
@@ -457,6 +508,18 @@ test_invalid_vdev_flag(void)
__LINE__);
return -1;
}
+
+ if (launch_proc(vdevval4) != 0) {
+ printf("Error (line %d) - process did not run ok with valid vdev value and no-auto-probing\n",
+ __LINE__);
+ return -1;
+ }
+
+ if (launch_proc(vdevval5) != 0) {
+ printf("Error (line %d) - process did not run ok with valid vdev value and auto-probing\n",
+ __LINE__);
+ return -1;
+ }
return 0;
#else
return TEST_SKIPPED;
diff --git a/devtools/test-null.sh b/devtools/test-null.sh
index 8f21189262..5e8a1b20cd 100755
--- a/devtools/test-null.sh
+++ b/devtools/test-null.sh
@@ -30,7 +30,7 @@ logfile=$build/test-null.log
(sleep 1 && echo stop) |
# testpmd only needs 20M, make it x2 (default number of cores) for NUMA systems
$testpmd -l $corelist --no-huge -m 40 \
- $libs -a 0:0.0 --vdev net_null1 --vdev net_null2 $eal_options -- \
+ $libs -A --vdev net_null1 --vdev net_null2 $eal_options -- \
--no-mlockall --total-num-mbufs=2048 $testpmd_options -ia | tee $logfile
# we expect two ports and some traffic is received and transmitted
diff --git a/doc/guides/linux_gsg/eal_args.include.rst b/doc/guides/linux_gsg/eal_args.include.rst
index a0c17da9b9..990ba9a20b 100644
--- a/doc/guides/linux_gsg/eal_args.include.rst
+++ b/doc/guides/linux_gsg/eal_args.include.rst
@@ -101,6 +101,19 @@ Lcore-related options
Device-related options
~~~~~~~~~~~~~~~~~~~~~~
+* ``-A, --no-auto-probing``
+
+ By default, EAL probes all devices on every available bus, unless some ``-a``/``-b``
+ options are passed.
+ Disable automatic probing of non-blocked devices.
+
+.. Note::
+ Block list cannot be used when auto probing is disabled.
+
+ On the other hand, disabling auto probing does not affect the VDEV bus.
+ The VDEV bus is not concerned by automatic probing and requires explicit
+ ``-a`` or ``--vdev``.
+
* ``-b, --block <[domain:]bus:devid.func>``
Skip probing a PCI device to prevent EAL from using it.
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index d07d912c77..14079342fc 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -258,18 +258,23 @@ RTE_EXPORT_INTERNAL_SYMBOL(rte_bus_is_ignored_device)
bool
rte_bus_is_ignored_device(const struct rte_bus *bus, const char *dev_name)
{
+ const struct internal_config *internal_conf = eal_get_internal_configuration();
struct rte_devargs *devargs = rte_bus_find_devargs(bus, dev_name);
+ enum rte_bus_scan_mode scan_mode = bus->conf.scan_mode;
- switch (bus->conf.scan_mode) {
- case RTE_BUS_SCAN_ALLOWLIST:
+ if (scan_mode == RTE_BUS_SCAN_UNDEFINED) {
+ if (internal_conf->no_auto_probing != 0)
+ scan_mode = RTE_BUS_SCAN_ALLOWLIST;
+ else
+ scan_mode = RTE_BUS_SCAN_BLOCKLIST;
+ }
+
+ if (scan_mode == RTE_BUS_SCAN_ALLOWLIST) {
if (devargs && devargs->policy == RTE_DEV_ALLOWED)
return false;
- break;
- case RTE_BUS_SCAN_UNDEFINED:
- case RTE_BUS_SCAN_BLOCKLIST:
+ } else {
if (devargs == NULL || devargs->policy != RTE_DEV_BLOCKED)
return false;
- break;
}
EAL_LOG(DEBUG, "device %s:%s is ignored", rte_bus_name(bus), dev_name);
diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c
index aad676a004..290386dc63 100644
--- a/lib/eal/common/eal_common_options.c
+++ b/lib/eal/common/eal_common_options.c
@@ -233,10 +233,15 @@ eal_collate_args(int argc, char **argv)
EAL_LOG(ERR, "Options allow (-a) and block (-b) can't be used at the same time");
return -1;
}
+ if (args.no_auto_probing && !TAILQ_EMPTY(&args.block)) {
+ EAL_LOG(ERR, "Options no-auto-probing and block (-b) can't be used at the same time");
+ return -1;
+ }
/* for non-list args, we can just check for zero/null values using macro */
if (CONFLICTING_OPTIONS(args, coremask, lcores) ||
CONFLICTING_OPTIONS(args, service_coremask, service_corelist) ||
+ CONFLICTING_OPTIONS(args, no_auto_probing, auto_probing) ||
CONFLICTING_OPTIONS(args, no_telemetry, telemetry) ||
CONFLICTING_OPTIONS(args, memory_size, numa_mem) ||
CONFLICTING_OPTIONS(args, no_huge, numa_mem) ||
@@ -518,6 +523,8 @@ eal_reset_internal_config(struct internal_config *internal_cfg)
memset(internal_cfg->vfio_vf_token, 0,
sizeof(internal_cfg->vfio_vf_token));
+ internal_cfg->no_auto_probing = 0;
+
#ifdef RTE_LIBEAL_USE_HPET
internal_cfg->no_hpet = 0;
#else
@@ -1972,6 +1979,9 @@ eal_parse_args(void)
}
}
+ if (args.no_auto_probing)
+ int_cfg->no_auto_probing = 1;
+
/* device -a/-b/-vdev options*/
TAILQ_FOREACH(arg, &args.allow, next)
if (eal_option_device_add(RTE_DEVTYPE_ALLOWED, arg->arg) < 0)
diff --git a/lib/eal/common/eal_internal_cfg.h b/lib/eal/common/eal_internal_cfg.h
index 95d327a613..fac45cbe66 100644
--- a/lib/eal/common/eal_internal_cfg.h
+++ b/lib/eal/common/eal_internal_cfg.h
@@ -104,6 +104,7 @@ struct internal_config {
struct simd_bitwidth max_simd_bitwidth;
/**< max simd bitwidth path to use */
size_t huge_worker_stack_size; /**< worker thread stack size */
+ unsigned int no_auto_probing; /**< true to switch from block-listing to allow-listing */
};
void eal_reset_internal_config(struct internal_config *internal_cfg);
diff --git a/lib/eal/common/eal_option_list.h b/lib/eal/common/eal_option_list.h
index abee16340b..6a5ddfd8d1 100644
--- a/lib/eal/common/eal_option_list.h
+++ b/lib/eal/common/eal_option_list.h
@@ -32,6 +32,7 @@
* Format of each entry: long name, short name, help string, struct member name.
*/
/* (Alphabetical) List of common options first */
+BOOL_ARG("--auto-probing", NULL, "Let EAL probe all available devices unless some -a/-b option is set.", auto_probing)
LIST_ARG("--allow", "-a", "Add device to allow-list, causing DPDK to only use specified devices", allow)
STR_ARG("--base-virtaddr", NULL, "Base virtual address to reserve memory", base_virtaddr)
LIST_ARG("--block", "-b", "Add device to block-list, preventing DPDK from using the device", block)
@@ -51,6 +52,7 @@ STR_ARG("--mbuf-pool-ops-name", NULL, "User defined mbuf default pool ops name",
STR_ARG("--memory-channels", "-n", "Number of memory channels per socket", memory_channels)
STR_ARG("--memory-ranks", "-r", "Force number of memory ranks (don't detect)", memory_ranks)
STR_ARG("--memory-size", "-m", "Total size of memory to allocate initially", memory_size)
+BOOL_ARG("--no-auto-probing", "-A", "Do not probe any devices unless some -a option is set", no_auto_probing)
BOOL_ARG("--no-hpet", NULL, "Disable HPET timer", no_hpet)
BOOL_ARG("--no-huge", NULL, "Disable hugetlbfs support", no_huge)
BOOL_ARG("--no-pci", NULL, "Disable all PCI devices", no_pci)
--
2.53.0
^ permalink raw reply related [flat|nested] 67+ messages in thread* Re: [PATCH v3 7/7] eal: configure initial device probing
2026-04-07 11:52 ` [PATCH v3 7/7] eal: configure initial device probing David Marchand
@ 2026-04-08 1:44 ` fengchengwen
0 siblings, 0 replies; 67+ messages in thread
From: fengchengwen @ 2026-04-08 1:44 UTC (permalink / raw)
To: David Marchand, dev
Cc: Bruce Richardson, Robin Jarry, Hemant Agrawal, Maxime Leroy,
Kevin Traynor, Thomas Monjalon, Andrew Rybchenko
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
On 4/7/2026 7:52 PM, David Marchand wrote:
> Some applications use port hotplug as their primary way for using DPDK
> resources.
> Having a systematic device probing is a problem when not all available
> resources will be used by the application, as such applications won't set
> an explicit allow list at startup.
>
> This is the case for OVS on systems with multiple mlx5 devices:
> one device can be used by the kernel while the other(s) are used by DPDK.
> In such a setup, the kernel used device may get reconfigured in
> unexpected ways and trigger issues like the one described by Kevin
> not so long ago in bugzilla 1873.
>
> Add an EAL option so that we can change the default behavior from
> block-listing to allow-listing which can be summed up as disabling
> automatic probing.
> In case some applications want to require automatic probing, add the
> opposite option.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Reviewed-by: Robin Jarry <rjarry@redhat.com>
> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> Tested-by: Maxime Leroy <maxime@leroys.fr>
> Acked-by: Kevin Traynor <ktraynor@redhat.com>
^ permalink raw reply [flat|nested] 67+ messages in thread
* Re: [PATCH v3 0/7] Rework device probing
2026-04-07 11:52 ` [PATCH v3 0/7] Rework " David Marchand
` (6 preceding siblings ...)
2026-04-07 11:52 ` [PATCH v3 7/7] eal: configure initial device probing David Marchand
@ 2026-04-07 11:58 ` David Marchand
2026-04-07 15:12 ` Stephen Hemminger
2026-04-10 14:34 ` Morten Brørup
9 siblings, 0 replies; 67+ messages in thread
From: David Marchand @ 2026-04-07 11:58 UTC (permalink / raw)
To: Maxime Leroy, Chengwen Feng; +Cc: dev
Hello,
On Tue, 7 Apr 2026 at 13:52, David Marchand <david.marchand@redhat.com> wrote:
>
> Applications relying on device hotplug don't work well with the default
> probing of all available resources.
> This series proposes to change this behavior via a new EAL option.
>
>
> --
> David Marchand
>
> Changes since v2:
> - rebased for late 26.03 fslmc bus changes,
> - fixed devargs lookup,
> - added debug logs,
Special heads up:
- Maxime, I had to rebase on top of 26.03 changes for the devargs
refresh on hotplug, I kept your tested-by tag,
- Chengwen, thanks for the reviews, I updated patch 5 for the issue on
devargs lookup you noticed,
--
David Marchand
^ permalink raw reply [flat|nested] 67+ messages in thread* Re: [PATCH v3 0/7] Rework device probing
2026-04-07 11:52 ` [PATCH v3 0/7] Rework " David Marchand
` (7 preceding siblings ...)
2026-04-07 11:58 ` [PATCH v3 0/7] Rework " David Marchand
@ 2026-04-07 15:12 ` Stephen Hemminger
2026-04-10 14:34 ` Morten Brørup
9 siblings, 0 replies; 67+ messages in thread
From: Stephen Hemminger @ 2026-04-07 15:12 UTC (permalink / raw)
To: David Marchand; +Cc: dev
On Tue, 7 Apr 2026 13:52:03 +0200
David Marchand <david.marchand@redhat.com> wrote:
> Applications relying on device hotplug don't work well with the default
> probing of all available resources.
> This series proposes to change this behavior via a new EAL option.
>
>
Series-acked-by: Stephen Hemminger <stephen@networkplumber.org>
AI spotted one minor nit.
Patch 1/7 (devtools: check packet forwarding in null test) - clean.
Minor style nit: the first grep uses $build/test-null.log while
the next two use $logfile — they're the same path but inconsistent.
^ permalink raw reply [flat|nested] 67+ messages in thread* RE: [PATCH v3 0/7] Rework device probing
2026-04-07 11:52 ` [PATCH v3 0/7] Rework " David Marchand
` (8 preceding siblings ...)
2026-04-07 15:12 ` Stephen Hemminger
@ 2026-04-10 14:34 ` Morten Brørup
2026-04-10 15:16 ` Kevin Traynor
` (2 more replies)
9 siblings, 3 replies; 67+ messages in thread
From: Morten Brørup @ 2026-04-10 14:34 UTC (permalink / raw)
To: David Marchand, Bruce Richardson, Robin Jarry, Hemant Agrawal,
Maxime Leroy, Kevin Traynor
Cc: dev
Is there a workaround until this patch is added, if I don't want rte_eal_init() to probe any devices, but I want my application to probe devices later by calling rte_bus_scan() followed by rte_bus_probe()?
It's not something we really need, so if you don't know it off the top of your head, don't spend time trying to figure it out.
Venlig hilsen / Kind regards,
-Morten Brørup
> -----Original Message-----
> From: David Marchand [mailto:david.marchand@redhat.com]
> Sent: Tuesday, 7 April 2026 13.52
> To: dev@dpdk.org
> Subject: [PATCH v3 0/7] Rework device probing
>
> Applications relying on device hotplug don't work well with the default
> probing of all available resources.
> This series proposes to change this behavior via a new EAL option.
>
>
> --
> David Marchand
>
> Changes since v2:
> - rebased for late 26.03 fslmc bus changes,
> - fixed devargs lookup,
> - added debug logs,
>
> Changes since v1:
> - restored per bus scan mode,
> - fixed logic in device selection for dma/idxd,
> - fixed raw/ifpga hotplug on ifpga bus,
> - fixed some doxygen,
>
> Changes since RFC v3:
> - removed per bus scan mode,
>
> Changes since RFC v2:
> - went one step further and reworked devargs lookup in buses following
> Bruce comment (see patch 4 which is cosmetic, and patch 5),
> - updated device selection helper accordingly and
> changed API to be device name based,
> - renamed option, added check on -b presence, updated doc in the last
> patch,
>
> Changes since RFC v1:
> - reviewed bus probe() and cleaned up NXP drivers,
> - changed approach following Bruce comment,
>
> David Marchand (7):
> devtools: check packet forwarding in null test
> bus/fslmc: fix bus cleanup
> drivers/bus: require probe function for NXP drivers
> drivers/bus: cleanup devargs lookup in scan
> bus: factorize devargs lookup
> bus: factorize device selection
> eal: configure initial device probing
>
> app/test/test_eal_flags.c | 63 ++++++++++++++++
> devtools/test-null.sh | 10 ++-
> doc/guides/linux_gsg/eal_args.include.rst | 13 ++++
> drivers/bus/auxiliary/auxiliary_common.c | 33 +--------
> drivers/bus/auxiliary/bus_auxiliary_driver.h | 2 -
> drivers/bus/auxiliary/linux/auxiliary.c | 2 +-
> drivers/bus/auxiliary/private.h | 6 --
> drivers/bus/cdx/cdx.c | 34 +--------
> drivers/bus/dpaa/dpaa_bus.c | 71 ++++++++----------
> drivers/bus/fslmc/fslmc_bus.c | 75 ++++++++------------
> drivers/bus/fslmc/fslmc_vfio.c | 21 ++----
> drivers/bus/ifpga/ifpga_bus.c | 8 ++-
> drivers/bus/pci/bsd/pci.c | 5 +-
> drivers/bus/pci/linux/pci.c | 2 +-
> drivers/bus/pci/pci_common.c | 51 ++++---------
> drivers/bus/pci/private.h | 11 ---
> drivers/bus/pci/windows/pci.c | 4 +-
> drivers/bus/platform/platform.c | 43 +----------
> drivers/bus/uacce/uacce.c | 39 +---------
> drivers/bus/vdev/vdev.c | 2 +-
> drivers/bus/vmbus/linux/vmbus_bus.c | 2 +-
> drivers/bus/vmbus/private.h | 3 -
> drivers/bus/vmbus/vmbus_common.c | 45 +++---------
> drivers/dma/idxd/idxd_bus.c | 18 +----
> lib/eal/common/eal_common_bus.c | 54 ++++++++++++++
> lib/eal/common/eal_common_options.c | 10 +++
> lib/eal/common/eal_internal_cfg.h | 1 +
> lib/eal/common/eal_option_list.h | 2 +
> lib/eal/include/bus_driver.h | 38 ++++++++++
> 29 files changed, 301 insertions(+), 367 deletions(-)
>
> --
> 2.53.0
^ permalink raw reply [flat|nested] 67+ messages in thread* Re: [PATCH v3 0/7] Rework device probing
2026-04-10 14:34 ` Morten Brørup
@ 2026-04-10 15:16 ` Kevin Traynor
2026-04-10 17:37 ` Stephen Hemminger
2026-04-11 10:10 ` David Marchand
2 siblings, 0 replies; 67+ messages in thread
From: Kevin Traynor @ 2026-04-10 15:16 UTC (permalink / raw)
To: Morten Brørup, David Marchand, Bruce Richardson, Robin Jarry,
Hemant Agrawal, Maxime Leroy
Cc: dev
On 4/10/26 3:34 PM, Morten Brørup wrote:
> Is there a workaround until this patch is added, if I don't want rte_eal_init() to probe any devices, but I want my application to probe devices later by calling rte_bus_scan() followed by rte_bus_probe()?
>
> It's not something we really need, so if you don't know it off the top of your head, don't spend time trying to figure it out.
>
The workaround we have used is '-a 0000:00:00.0' Only allowing a dummy
device, hence other devices are hotplugged as needed.
>
> Venlig hilsen / Kind regards,
> -Morten Brørup
>
>> -----Original Message-----
>> From: David Marchand [mailto:david.marchand@redhat.com]
>> Sent: Tuesday, 7 April 2026 13.52
>> To: dev@dpdk.org
>> Subject: [PATCH v3 0/7] Rework device probing
>>
>> Applications relying on device hotplug don't work well with the default
>> probing of all available resources.
>> This series proposes to change this behavior via a new EAL option.
>>
>>
>> --
>> David Marchand
>>
>> Changes since v2:
>> - rebased for late 26.03 fslmc bus changes,
>> - fixed devargs lookup,
>> - added debug logs,
>>
>> Changes since v1:
>> - restored per bus scan mode,
>> - fixed logic in device selection for dma/idxd,
>> - fixed raw/ifpga hotplug on ifpga bus,
>> - fixed some doxygen,
>>
>> Changes since RFC v3:
>> - removed per bus scan mode,
>>
>> Changes since RFC v2:
>> - went one step further and reworked devargs lookup in buses following
>> Bruce comment (see patch 4 which is cosmetic, and patch 5),
>> - updated device selection helper accordingly and
>> changed API to be device name based,
>> - renamed option, added check on -b presence, updated doc in the last
>> patch,
>>
>> Changes since RFC v1:
>> - reviewed bus probe() and cleaned up NXP drivers,
>> - changed approach following Bruce comment,
>>
>> David Marchand (7):
>> devtools: check packet forwarding in null test
>> bus/fslmc: fix bus cleanup
>> drivers/bus: require probe function for NXP drivers
>> drivers/bus: cleanup devargs lookup in scan
>> bus: factorize devargs lookup
>> bus: factorize device selection
>> eal: configure initial device probing
>>
>> app/test/test_eal_flags.c | 63 ++++++++++++++++
>> devtools/test-null.sh | 10 ++-
>> doc/guides/linux_gsg/eal_args.include.rst | 13 ++++
>> drivers/bus/auxiliary/auxiliary_common.c | 33 +--------
>> drivers/bus/auxiliary/bus_auxiliary_driver.h | 2 -
>> drivers/bus/auxiliary/linux/auxiliary.c | 2 +-
>> drivers/bus/auxiliary/private.h | 6 --
>> drivers/bus/cdx/cdx.c | 34 +--------
>> drivers/bus/dpaa/dpaa_bus.c | 71 ++++++++----------
>> drivers/bus/fslmc/fslmc_bus.c | 75 ++++++++------------
>> drivers/bus/fslmc/fslmc_vfio.c | 21 ++----
>> drivers/bus/ifpga/ifpga_bus.c | 8 ++-
>> drivers/bus/pci/bsd/pci.c | 5 +-
>> drivers/bus/pci/linux/pci.c | 2 +-
>> drivers/bus/pci/pci_common.c | 51 ++++---------
>> drivers/bus/pci/private.h | 11 ---
>> drivers/bus/pci/windows/pci.c | 4 +-
>> drivers/bus/platform/platform.c | 43 +----------
>> drivers/bus/uacce/uacce.c | 39 +---------
>> drivers/bus/vdev/vdev.c | 2 +-
>> drivers/bus/vmbus/linux/vmbus_bus.c | 2 +-
>> drivers/bus/vmbus/private.h | 3 -
>> drivers/bus/vmbus/vmbus_common.c | 45 +++---------
>> drivers/dma/idxd/idxd_bus.c | 18 +----
>> lib/eal/common/eal_common_bus.c | 54 ++++++++++++++
>> lib/eal/common/eal_common_options.c | 10 +++
>> lib/eal/common/eal_internal_cfg.h | 1 +
>> lib/eal/common/eal_option_list.h | 2 +
>> lib/eal/include/bus_driver.h | 38 ++++++++++
>> 29 files changed, 301 insertions(+), 367 deletions(-)
>>
>> --
>> 2.53.0
>
^ permalink raw reply [flat|nested] 67+ messages in thread
* Re: [PATCH v3 0/7] Rework device probing
2026-04-10 14:34 ` Morten Brørup
2026-04-10 15:16 ` Kevin Traynor
@ 2026-04-10 17:37 ` Stephen Hemminger
2026-04-10 21:13 ` [EXTERNAL] " Long Li
2026-04-11 10:10 ` David Marchand
2 siblings, 1 reply; 67+ messages in thread
From: Stephen Hemminger @ 2026-04-10 17:37 UTC (permalink / raw)
To: Morten Brørup
Cc: David Marchand, Bruce Richardson, Robin Jarry, Hemant Agrawal,
Maxime Leroy, Kevin Traynor, dev, matan, longli, weh
On Fri, 10 Apr 2026 16:34:56 +0200
Morten Brørup <mb@smartsharesystems.com> wrote:
> Is there a workaround until this patch is added, if I don't want rte_eal_init() to probe any devices, but I want my application to probe devices later by calling rte_bus_scan() followed by rte_bus_probe()?
>
> It's not something we really need, so if you don't know it off the top of your head, don't spend time trying to figure it out.
>
>
> Venlig hilsen / Kind regards,
> -Morten Brørup
We do need it because of the problems with vdev_netvsc.
The issue is that vdev_netvsc tries to setup failsafe on all netvsc
devices it sees, and it determines which ones are used by OS based on
somewhat fragile OS probes with netlink.
I would recommend getting rid of vdev_netvsc, or make the the auto
scanning there something that has to be forced by devargs.
But that really is up to the netvsc maintainers.
^ permalink raw reply [flat|nested] 67+ messages in thread
* RE: [EXTERNAL] Re: [PATCH v3 0/7] Rework device probing
2026-04-10 17:37 ` Stephen Hemminger
@ 2026-04-10 21:13 ` Long Li
2026-04-10 22:50 ` Stephen Hemminger
2026-04-11 7:30 ` Morten Brørup
0 siblings, 2 replies; 67+ messages in thread
From: Long Li @ 2026-04-10 21:13 UTC (permalink / raw)
To: Stephen Hemminger, Morten Brørup
Cc: David Marchand, Bruce Richardson, Robin Jarry, Hemant Agrawal,
Maxime Leroy, Kevin Traynor, dev@dpdk.org, matan@nvidia.com,
Wei Hu
> On Fri, 10 Apr 2026 16:34:56 +0200
> Morten Brørup <mb@smartsharesystems.com> wrote:
>
> > Is there a workaround until this patch is added, if I don't want rte_eal_init() to
> probe any devices, but I want my application to probe devices later by calling
> rte_bus_scan() followed by rte_bus_probe()?
> >
> > It's not something we really need, so if you don't know it off the top of your
> head, don't spend time trying to figure it out.
> >
> >
> > Venlig hilsen / Kind regards,
> > -Morten Brørup
>
> We do need it because of the problems with vdev_netvsc.
> The issue is that vdev_netvsc tries to setup failsafe on all netvsc devices it sees,
> and it determines which ones are used by OS based on somewhat fragile OS
> probes with netlink.
>
> I would recommend getting rid of vdev_netvsc, or make the the auto scanning
> there something that has to be forced by devargs.
> But that really is up to the netvsc maintainers.
Hi Morten,
Can you use --vdev=net_vdev_netvsc,ignore=1? The ignore devarg is already supported by the vdev_netvsc PMD — when set, the probe function skips all netvsc interface discovery and returns early.
Long
^ permalink raw reply [flat|nested] 67+ messages in thread
* Re: [EXTERNAL] Re: [PATCH v3 0/7] Rework device probing
2026-04-10 21:13 ` [EXTERNAL] " Long Li
@ 2026-04-10 22:50 ` Stephen Hemminger
2026-04-11 7:30 ` Morten Brørup
1 sibling, 0 replies; 67+ messages in thread
From: Stephen Hemminger @ 2026-04-10 22:50 UTC (permalink / raw)
To: Long Li
Cc: Morten Brørup, David Marchand, Bruce Richardson, Robin Jarry,
Hemant Agrawal, Maxime Leroy, Kevin Traynor, dev@dpdk.org,
matan@nvidia.com, Wei Hu
On Fri, 10 Apr 2026 21:13:36 +0000
Long Li <longli@microsoft.com> wrote:
> >
> > We do need it because of the problems with vdev_netvsc.
> > The issue is that vdev_netvsc tries to setup failsafe on all netvsc devices it sees,
> > and it determines which ones are used by OS based on somewhat fragile OS
> > probes with netlink.
> >
> > I would recommend getting rid of vdev_netvsc, or make the the auto scanning
> > there something that has to be forced by devargs.
> > But that really is up to the netvsc maintainers.
>
> Hi Morten,
>
> Can you use --vdev=net_vdev_netvsc,ignore=1? The ignore devarg is already supported by the vdev_netvsc PMD — when set, the probe function skips all netvsc interface discovery and returns early.
>
> Long
The issue is the CI runs on github (Azure) and therefore vdev_netvsc triggers.
Too much of a nuisance to change every test. The vdev_netvsc hack should be opt-in not opt-out
^ permalink raw reply [flat|nested] 67+ messages in thread
* RE: [EXTERNAL] Re: [PATCH v3 0/7] Rework device probing
2026-04-10 21:13 ` [EXTERNAL] " Long Li
2026-04-10 22:50 ` Stephen Hemminger
@ 2026-04-11 7:30 ` Morten Brørup
1 sibling, 0 replies; 67+ messages in thread
From: Morten Brørup @ 2026-04-11 7:30 UTC (permalink / raw)
To: Long Li, Stephen Hemminger
Cc: David Marchand, Bruce Richardson, Robin Jarry, Hemant Agrawal,
Maxime Leroy, Kevin Traynor, dev, matan, Wei Hu
> From: Long Li [mailto:longli@microsoft.com]
> Sent: Friday, 10 April 2026 23.14
>
> > On Fri, 10 Apr 2026 16:34:56 +0200
> > Morten Brørup <mb@smartsharesystems.com> wrote:
> >
> > > Is there a workaround until this patch is added, if I don't want
> rte_eal_init() to
> > probe any devices, but I want my application to probe devices later
> by calling
> > rte_bus_scan() followed by rte_bus_probe()?
> > >
> > > It's not something we really need, so if you don't know it off the
> top of your
> > head, don't spend time trying to figure it out.
> > >
> > >
> > > Venlig hilsen / Kind regards,
> > > -Morten Brørup
> >
> > We do need it because of the problems with vdev_netvsc.
> > The issue is that vdev_netvsc tries to setup failsafe on all netvsc
> devices it sees,
> > and it determines which ones are used by OS based on somewhat fragile
> OS
> > probes with netlink.
> >
> > I would recommend getting rid of vdev_netvsc, or make the the auto
> scanning
> > there something that has to be forced by devargs.
> > But that really is up to the netvsc maintainers.
>
> Hi Morten,
>
> Can you use --vdev=net_vdev_netvsc,ignore=1? The ignore devarg is
> already supported by the vdev_netvsc PMD — when set, the probe function
> skips all netvsc interface discovery and returns early.
>
> Long
Thanks for the suggestion, Long.
I'm not looking for a netvsc solution, I'm looking for a general solution to not probe any drivers at EAL initialization, but at a later stage, controlled by the application.
-Morten
^ permalink raw reply [flat|nested] 67+ messages in thread
* Re: [PATCH v3 0/7] Rework device probing
2026-04-10 14:34 ` Morten Brørup
2026-04-10 15:16 ` Kevin Traynor
2026-04-10 17:37 ` Stephen Hemminger
@ 2026-04-11 10:10 ` David Marchand
2026-04-11 10:23 ` David Marchand
2 siblings, 1 reply; 67+ messages in thread
From: David Marchand @ 2026-04-11 10:10 UTC (permalink / raw)
To: Morten Brørup
Cc: Bruce Richardson, Robin Jarry, Hemant Agrawal, Maxime Leroy,
Kevin Traynor, dev
On Fri, 10 Apr 2026 at 16:35, Morten Brørup <mb@smartsharesystems.com> wrote:
>
> Is there a workaround until this patch is added, if I don't want rte_eal_init() to probe any devices, but I want my application to probe devices later by calling rte_bus_scan() followed by rte_bus_probe()?
>
> It's not something we really need, so if you don't know it off the top of your head, don't spend time trying to figure it out.
Well, starting from the well known -a pci:0000:00:00.0 trick, I wrote
an incomplete workaround implemented for OVS.
https://patchwork.ozlabs.org/project/openvswitch/patch/20260226172429.212034-3-david.marchand@redhat.com/
Incomplete, because some buses make life harder with some additional
parsing restraints (bus/dpaa is the first one that comes to mind) or
requiring a driver handling the device exists (bus/platform which has
*no* in-tree driver, though this is a different story..).
+ if (!args_contains(&args, "-a") && !args_contains(&args, "-b")
+ && !smap_get_bool(ovs_other_config, "dpdk-probe-at-init", false)) {
+#ifdef RTE_BUS_AUXILIARY
+ svec_add(&args, "-a");
+ svec_add(&args, "auxiliary:");
+#endif
+#ifdef RTE_BUS_CDX
+ svec_add(&args, "-a");
+ svec_add(&args, "cdx:cdx-");
+#endif
+#ifdef RTE_BUS_FSLMC
+ svec_add(&args, "-a");
+ svec_add(&args, "fslmc:dpni.65535");
+#endif
+#ifdef RTE_BUS_PCI
+ svec_add(&args, "-a");
+ svec_add(&args, "pci:0000:00:00.0");
+#endif
+#ifdef RTE_BUS_UACCE
+ svec_add(&args, "-a");
+ svec_add(&args, "uacce:");
+#endif
+#ifdef RTE_BUS_VMBUS
+ svec_add(&args, "-a");
+ svec_add(&args, "vmbus:00000000-0000-0000-0000-000000000000");
+#endif
+ }
+
--
David Marchand
^ permalink raw reply [flat|nested] 67+ messages in thread* Re: [PATCH v3 0/7] Rework device probing
2026-04-11 10:10 ` David Marchand
@ 2026-04-11 10:23 ` David Marchand
0 siblings, 0 replies; 67+ messages in thread
From: David Marchand @ 2026-04-11 10:23 UTC (permalink / raw)
To: Morten Brørup
Cc: Bruce Richardson, Robin Jarry, Hemant Agrawal, Maxime Leroy,
Kevin Traynor, dev
On Sat, 11 Apr 2026 at 12:10, David Marchand <david.marchand@redhat.com> wrote:
>
> On Fri, 10 Apr 2026 at 16:35, Morten Brørup <mb@smartsharesystems.com> wrote:
> >
> > Is there a workaround until this patch is added, if I don't want rte_eal_init() to probe any devices, but I want my application to probe devices later by calling rte_bus_scan() followed by rte_bus_probe()?
> >
> > It's not something we really need, so if you don't know it off the top of your head, don't spend time trying to figure it out.
Some (untested) other idea... write some "plugin" loaded last (via
-d), that would list all buses, then unregister all of them (or a part
of the list, for buses known to be a problem..).
IOVA discovery would end up as DC, so probably fine (and we have an
option to force it if needed).
Then after call to rte_eal_init, the application would get a hold of
this list, re-register buses... ?
I think it could work, but clearly hacky...
--
David Marchand
^ permalink raw reply [flat|nested] 67+ messages in thread