From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>,
Hemant Agrawal <hemant.agrawal@nxp.com>,
Kevin Traynor <ktraynor@redhat.com>,
Maxime Leroy <maxime@leroys.fr>,
Chengwen Feng <fengchengwen@huawei.com>,
Parav Pandit <parav@nvidia.com>, Xueming Li <xuemingl@nvidia.com>,
Nipun Gupta <nipun.gupta@amd.com>,
Nikhil Agarwal <nikhil.agarwal@amd.com>,
Sachin Saxena <sachin.saxena@nxp.com>,
Rosen Xu <rosen.xu@altera.com>, Chenbo Xia <chenbox@nvidia.com>,
Tomasz Duszynski <tduszynski@marvell.com>,
Long Li <longli@microsoft.com>, Wei Hu <weh@microsoft.com>
Subject: [PATCH v3 4/7] drivers/bus: cleanup devargs lookup in scan
Date: Tue, 7 Apr 2026 13:52:07 +0200 [thread overview]
Message-ID: <20260407115211.1903623-5-david.marchand@redhat.com> (raw)
In-Reply-To: <20260407115211.1903623-1-david.marchand@redhat.com>
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
next prev parent reply other threads:[~2026-04-07 11:52 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
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 16:59 ` Kevin Traynor
2026-03-26 8:22 ` David Marchand
2026-03-26 8:49 ` Kevin Traynor
2026-03-24 5:15 ` Hemant Agrawal
2026-03-24 5:15 ` Hemant Agrawal
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
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
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
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
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
2026-03-23 10:53 ` [PATCH 8/8] eal: configure initial device probing David Marchand
2026-03-25 10:57 ` Kevin Traynor
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-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 11:50 ` Kevin Traynor
2026-03-26 10:24 ` [PATCH v2 3/7] drivers/bus: require probe function for NXP drivers David Marchand
2026-03-26 10:24 ` [PATCH v2 4/7] drivers: cleanup devargs lookup in bus scan David Marchand
2026-03-28 3:13 ` fengchengwen
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
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
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
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 ` [PATCH v3 3/7] drivers/bus: require probe function for NXP drivers David Marchand
2026-04-07 11:52 ` David Marchand [this message]
2026-04-07 11:52 ` [PATCH v3 5/7] bus: factorize devargs lookup David Marchand
2026-04-08 1:18 ` fengchengwen
2026-04-07 11:52 ` [PATCH v3 6/7] bus: factorize device selection David Marchand
2026-04-07 11:52 ` [PATCH v3 7/7] eal: configure initial device probing David Marchand
2026-04-08 1:44 ` fengchengwen
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
2026-04-10 15:16 ` Kevin Traynor
2026-04-10 17:37 ` Stephen Hemminger
2026-04-10 21:13 ` [EXTERNAL] " Long Li
2026-04-10 22:50 ` Stephen Hemminger
2026-04-11 7:30 ` Morten Brørup
2026-04-11 10:10 ` David Marchand
2026-04-11 10:23 ` David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260407115211.1903623-5-david.marchand@redhat.com \
--to=david.marchand@redhat.com \
--cc=bruce.richardson@intel.com \
--cc=chenbox@nvidia.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=hemant.agrawal@nxp.com \
--cc=ktraynor@redhat.com \
--cc=longli@microsoft.com \
--cc=maxime@leroys.fr \
--cc=nikhil.agarwal@amd.com \
--cc=nipun.gupta@amd.com \
--cc=parav@nvidia.com \
--cc=rosen.xu@altera.com \
--cc=sachin.saxena@nxp.com \
--cc=tduszynski@marvell.com \
--cc=weh@microsoft.com \
--cc=xuemingl@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox