From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, stephen@networkplumber.org,
bruce.richardson@intel.com,
Hemant Agrawal <hemant.agrawal@nxp.com>,
Sachin Saxena <sachin.saxena@nxp.com>
Subject: [PATCH 20/23] drivers/bus: separate specific bus metadata for NXP drivers
Date: Wed, 29 Apr 2026 13:44:53 +0200 [thread overview]
Message-ID: <20260429114503.932575-21-david.marchand@redhat.com> (raw)
In-Reply-To: <20260429114503.932575-1-david.marchand@redhat.com>
As a preparation for the next commit, split the specific bus types and
move specific fields to a private structure/singleton variable.
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
drivers/bus/dpaa/dpaa_bus.c | 55 ++++++++++++++++++++---------------
drivers/bus/fslmc/fslmc_bus.c | 6 ++--
drivers/bus/fslmc/private.h | 2 --
3 files changed, 34 insertions(+), 29 deletions(-)
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index ade093cd13..08c1607647 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -59,6 +59,9 @@
struct rte_dpaa_bus {
struct rte_bus bus;
+};
+
+struct rte_dpaa_bus_private {
int device_count;
int detected;
uint32_t svr_ver;
@@ -67,6 +70,7 @@ struct rte_dpaa_bus {
};
static struct rte_dpaa_bus rte_dpaa_bus;
+static struct rte_dpaa_bus_private dpaa_bus;
static struct netcfg_info *dpaa_netcfg;
/* define a variable to hold the portal_key, once created.*/
@@ -87,7 +91,7 @@ RTE_EXPORT_INTERNAL_SYMBOL(dpaa_get_eth_port_cfg)
RTE_EXPORT_INTERNAL_SYMBOL(dpaa_soc_ver)
uint32_t dpaa_soc_ver(void)
{
- return rte_dpaa_bus.svr_ver;
+ return dpaa_bus.svr_ver;
}
struct fm_eth_port_cfg *
@@ -103,11 +107,11 @@ dpaa_push_queue_num_update(void)
int ret = false;
uint16_t current, new_val;
- current = rte_atomic_load_explicit(&rte_dpaa_bus.push_rxq_num,
+ current = rte_atomic_load_explicit(&dpaa_bus.push_rxq_num,
rte_memory_order_acquire);
- if (current < rte_dpaa_bus.max_push_rxq_num) {
+ if (current < dpaa_bus.max_push_rxq_num) {
new_val = current + 1;
- if (rte_atomic_compare_exchange_strong_explicit(&rte_dpaa_bus.push_rxq_num,
+ if (rte_atomic_compare_exchange_strong_explicit(&dpaa_bus.push_rxq_num,
¤t, new_val,
rte_memory_order_release,
rte_memory_order_acquire))
@@ -121,7 +125,7 @@ RTE_EXPORT_INTERNAL_SYMBOL(dpaa_push_queue_max_num)
uint16_t
dpaa_push_queue_max_num(void)
{
- return rte_dpaa_bus.max_push_rxq_num;
+ return dpaa_bus.max_push_rxq_num;
}
static int
@@ -204,7 +208,7 @@ dpaa_create_device_list(void)
struct fm_eth_port_cfg *cfg;
struct fman_if *fman_intf;
- rte_dpaa_bus.device_count = 0;
+ dpaa_bus.device_count = 0;
/* Creating Ethernet Devices */
for (i = 0; dpaa_netcfg && (i < dpaa_netcfg->num_ethports); i++) {
@@ -256,7 +260,7 @@ dpaa_create_device_list(void)
dpaa_add_to_device_list(dev);
}
- rte_dpaa_bus.device_count += i;
+ dpaa_bus.device_count += i;
/* Unlike case of ETH, RTE_LIBRTE_DPAA_MAX_CRYPTODEV SEC devices are
* constantly created only if "sec" property is found in the device
@@ -289,7 +293,7 @@ dpaa_create_device_list(void)
}
dev->device_type = FSL_DPAA_CRYPTO;
- dev->id.dev_id = rte_dpaa_bus.device_count + i;
+ dev->id.dev_id = dpaa_bus.device_count + i;
/* Even though RTE_CRYPTODEV_NAME_MAX_LEN is valid length of
* crypto PMD, using RTE_ETH_NAME_MAX_LEN as that is the size
@@ -306,7 +310,7 @@ dpaa_create_device_list(void)
dpaa_add_to_device_list(dev);
}
- rte_dpaa_bus.device_count += i;
+ dpaa_bus.device_count += i;
qdma_dpaa:
/* Creating QDMA Device */
@@ -319,7 +323,7 @@ dpaa_create_device_list(void)
}
dev->device_type = FSL_DPAA_QDMA;
- dev->id.dev_id = rte_dpaa_bus.device_count + i;
+ dev->id.dev_id = dpaa_bus.device_count + i;
memset(dev->name, 0, RTE_ETH_NAME_MAX_LEN);
sprintf(dev->name, "dpaa_qdma-%d", i+1);
@@ -331,7 +335,7 @@ dpaa_create_device_list(void)
dpaa_add_to_device_list(dev);
}
- rte_dpaa_bus.device_count += i;
+ dpaa_bus.device_count += i;
return 0;
@@ -688,10 +692,10 @@ rte_dpaa_bus_scan(void)
return 0;
}
- if (rte_dpaa_bus.detected)
+ if (dpaa_bus.detected)
return 0;
- rte_dpaa_bus.detected = 1;
+ dpaa_bus.detected = 1;
/* create the key, supplying a function that'll be invoked
* when a portal affined thread will be deleted.
@@ -707,34 +711,34 @@ rte_dpaa_bus_scan(void)
svr_file = fopen(DPAA_SOC_ID_FILE, "r");
if (svr_file) {
if (fscanf(svr_file, "svr:%x", &svr_ver) > 0)
- rte_dpaa_bus.svr_ver = svr_ver & DPAA_SVR_MASK;
+ dpaa_bus.svr_ver = svr_ver & DPAA_SVR_MASK;
else
- rte_dpaa_bus.svr_ver = 0;
+ dpaa_bus.svr_ver = 0;
fclose(svr_file);
} else {
- rte_dpaa_bus.svr_ver = 0;
+ dpaa_bus.svr_ver = 0;
}
- if (rte_dpaa_bus.svr_ver == SVR_LS1046A_FAMILY) {
+ if (dpaa_bus.svr_ver == SVR_LS1046A_FAMILY) {
DPAA_BUS_LOG(INFO, "This is LS1046A family SoC.");
- } else if (rte_dpaa_bus.svr_ver == SVR_LS1043A_FAMILY) {
+ } else if (dpaa_bus.svr_ver == SVR_LS1043A_FAMILY) {
DPAA_BUS_LOG(INFO, "This is LS1043A family SoC.");
} else {
DPAA_BUS_LOG(WARNING,
"This is Unknown(%08x) DPAA1 family SoC.",
- rte_dpaa_bus.svr_ver);
+ dpaa_bus.svr_ver);
}
/* Disabling the default push mode for LS1043A */
- if (rte_dpaa_bus.svr_ver == SVR_LS1043A_FAMILY) {
- rte_dpaa_bus.max_push_rxq_num = 0;
+ if (dpaa_bus.svr_ver == SVR_LS1043A_FAMILY) {
+ dpaa_bus.max_push_rxq_num = 0;
return 0;
}
penv = getenv("DPAA_PUSH_QUEUES_NUMBER");
if (penv)
- rte_dpaa_bus.max_push_rxq_num = atoi(penv);
- if (rte_dpaa_bus.max_push_rxq_num > DPAA_MAX_PUSH_MODE_QUEUE)
- rte_dpaa_bus.max_push_rxq_num = DPAA_MAX_PUSH_MODE_QUEUE;
+ dpaa_bus.max_push_rxq_num = atoi(penv);
+ if (dpaa_bus.max_push_rxq_num > DPAA_MAX_PUSH_MODE_QUEUE)
+ dpaa_bus.max_push_rxq_num = DPAA_MAX_PUSH_MODE_QUEUE;
/* Device list creation is only done once */
if (!process_once) {
@@ -868,6 +872,9 @@ static struct rte_dpaa_bus rte_dpaa_bus = {
.dev_iterate = rte_bus_generic_dev_iterate,
.cleanup = dpaa_bus_cleanup,
},
+};
+
+static struct rte_dpaa_bus_private dpaa_bus = {
.max_push_rxq_num = DPAA_DEFAULT_PUSH_MODE_QUEUE,
.device_count = 0,
};
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index d855d6b36b..821fe63955 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -28,6 +28,7 @@
#define VFIO_IOMMU_GROUP_PATH "/sys/kernel/iommu_groups"
struct rte_fslmc_bus rte_fslmc_bus;
+static int fslmc_bus_device_count[DPAA2_DEVTYPE_MAX];
#define DPAA2_SEQN_DYNFIELD_NAME "dpaa2_seqn_dynfield"
RTE_EXPORT_INTERNAL_SYMBOL(dpaa2_seqn_dynfield_offset)
@@ -39,7 +40,7 @@ rte_fslmc_get_device_count(enum rte_dpaa2_dev_type device_type)
{
if (device_type >= DPAA2_DEVTYPE_MAX)
return 0;
- return rte_fslmc_bus.device_count[device_type];
+ return fslmc_bus_device_count[device_type];
}
static void
@@ -200,7 +201,7 @@ scan_one_fslmc_device(char *dev_name)
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]++;
+ fslmc_bus_device_count[dev->dev_type]++;
/* Add device in the fslmc device list */
insert_in_device_list(dev);
@@ -559,7 +560,6 @@ struct rte_fslmc_bus rte_fslmc_bus = {
.unplug = fslmc_bus_unplug,
.dev_iterate = rte_bus_generic_dev_iterate,
},
- .device_count = {0},
};
RTE_REGISTER_BUS(fslmc, rte_fslmc_bus.bus);
diff --git a/drivers/bus/fslmc/private.h b/drivers/bus/fslmc/private.h
index 2fe592f24d..a0dda4f9d6 100644
--- a/drivers/bus/fslmc/private.h
+++ b/drivers/bus/fslmc/private.h
@@ -14,8 +14,6 @@
*/
struct rte_fslmc_bus {
struct rte_bus bus; /**< Generic Bus object */
- int device_count[DPAA2_DEVTYPE_MAX];
- /**< Count of all devices scanned */
};
extern struct rte_fslmc_bus rte_fslmc_bus;
--
2.53.0
next prev parent reply other threads:[~2026-04-29 11:48 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-29 11:44 [PATCH 00/23] Consolidate bus driver infrastructure David Marchand
2026-04-29 11:44 ` [PATCH 01/23] bus/ifpga: remove unused AFU lookup helper David Marchand
2026-04-29 11:44 ` [PATCH 02/23] crypto/octeontx: remove check on driver in remove David Marchand
2026-04-29 11:59 ` [EXTERNAL] " Anoob Joseph
2026-04-29 11:44 ` [PATCH 03/23] bus: remove device and driver checks in DMA map/unmap David Marchand
2026-04-29 11:44 ` [PATCH 04/23] drivers/bus: remove device and driver checks in unplug David Marchand
2026-04-29 11:44 ` [PATCH 05/23] drivers/bus: remove device and driver checks in plug David Marchand
2026-04-29 11:44 ` [PATCH 06/23] bus: add bus conversion macros David Marchand
2026-04-29 11:44 ` [PATCH 07/23] bus: factorize driver list David Marchand
2026-04-29 11:44 ` [PATCH 08/23] bus: factorize device list David Marchand
2026-04-29 11:44 ` [PATCH 09/23] bus: consolidate device lookup David Marchand
2026-04-29 11:44 ` [PATCH 10/23] bus: consolidate device iteration David Marchand
2026-04-29 11:44 ` [PATCH 11/23] bus: factorize driver lookup David Marchand
2026-04-29 11:44 ` [PATCH 12/23] bus: refactor device probe David Marchand
2026-04-29 11:44 ` [PATCH 13/23] bus: support multiple probe David Marchand
2026-04-29 11:44 ` [PATCH 14/23] drivers/bus: initialize NXP bus specifics in scan David Marchand
2026-04-29 11:44 ` [PATCH 15/23] bus: implement probe in EAL David Marchand
2026-04-29 11:44 ` [PATCH 16/23] bus: factorize driver reference David Marchand
2026-04-29 11:44 ` [PATCH 17/23] drivers: rely on generic driver David Marchand
2026-04-29 11:44 ` [PATCH 18/23] drivers/bus: remove bus-specific driver references David Marchand
2026-04-29 11:44 ` [PATCH 19/23] dma/idxd: remove specific bus type David Marchand
2026-04-29 11:44 ` David Marchand [this message]
2026-04-29 11:44 ` [PATCH 21/23] drivers/bus: remove specific bus types David Marchand
2026-04-29 11:44 ` [PATCH 22/23] eventdev: rename dev field to device David Marchand
2026-04-29 11:44 ` [PATCH 23/23] bus: add class device conversion macro David Marchand
2026-05-06 15:51 ` [PATCH v2 00/23] Consolidate bus driver infrastructure David Marchand
2026-05-06 15:51 ` [PATCH v2 01/23] bus/ifpga: remove unused AFU lookup helper David Marchand
2026-05-06 15:51 ` [PATCH v2 02/23] crypto/octeontx: remove check on driver in remove David Marchand
2026-05-06 15:51 ` [PATCH v2 03/23] bus: remove device and driver checks in DMA map/unmap David Marchand
2026-05-06 15:51 ` [PATCH v2 04/23] drivers/bus: remove device and driver checks in unplug David Marchand
2026-05-06 15:51 ` [PATCH v2 05/23] drivers/bus: remove device and driver checks in plug David Marchand
2026-05-06 15:51 ` [PATCH v2 06/23] bus: add bus conversion macros David Marchand
2026-05-06 15:51 ` [PATCH v2 07/23] bus: factorize driver list David Marchand
2026-05-06 15:51 ` [PATCH v2 08/23] bus: factorize device list David Marchand
2026-05-06 15:51 ` [PATCH v2 09/23] bus: consolidate device lookup David Marchand
2026-05-06 15:51 ` [PATCH v2 10/23] bus: consolidate device iteration David Marchand
2026-05-06 15:51 ` [PATCH v2 11/23] bus: factorize driver lookup David Marchand
2026-05-06 15:51 ` [PATCH v2 12/23] bus: refactor device probe David Marchand
2026-05-06 15:51 ` [PATCH v2 13/23] bus: support multiple probe David Marchand
2026-05-06 15:51 ` [PATCH v2 14/23] drivers/bus: initialize NXP bus specifics in scan David Marchand
2026-05-06 15:51 ` [PATCH v2 15/23] bus: implement probe in EAL David Marchand
2026-05-06 15:51 ` [PATCH v2 16/23] bus: factorize driver reference David Marchand
2026-05-06 15:51 ` [PATCH v2 17/23] drivers: rely on generic driver David Marchand
2026-05-06 15:51 ` [PATCH v2 18/23] drivers/bus: remove bus-specific driver references David Marchand
2026-05-06 15:51 ` [PATCH v2 19/23] dma/idxd: remove specific bus type David Marchand
2026-05-06 15:51 ` [PATCH v2 20/23] drivers/bus: separate specific bus metadata for NXP drivers David Marchand
2026-05-06 15:51 ` [PATCH v2 21/23] drivers/bus: remove specific bus types David Marchand
2026-05-06 15:51 ` [PATCH v2 22/23] eventdev: rename dev field to device David Marchand
2026-05-06 15:51 ` [PATCH v2 23/23] bus: add class device conversion macro 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=20260429114503.932575-21-david.marchand@redhat.com \
--to=david.marchand@redhat.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=hemant.agrawal@nxp.com \
--cc=sachin.saxena@nxp.com \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
/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