[PATCH v5 1/6] net/nfb: use constant values for max Rx/Tx queues count

spinler
2026-02-02T19:33:43Z

The nb_xx_queues values in the dev->data structure can be modified
dynamically by some apps. Use runtime-constant values from hardware
directly for max_rx_queues/max_tx_queues.

Fixes: 6435f9a0ac22 ("net/nfb: add new netcope driver")
Cc: stable@dpdk.org

Signed-off-by: Martin Spinler <spinler@cesnet.cz>
---
drivers/net/nfb/nfb.h | 3 +++
drivers/net/nfb/nfb_ethdev.c | 12 +++++++-----
2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/net/nfb/nfb.h b/drivers/net/nfb/nfb.h
index a8b24ff822..917b830283 100644
--- a/drivers/net/nfb/nfb.h
+++ b/drivers/net/nfb/nfb.h
@@ -48,6 +48,9 @@ struct pmd_internals {
struct nc_rxmac *rxmac[RTE_MAX_NC_RXMAC];
struct nc_txmac *txmac[RTE_MAX_NC_TXMAC];
struct nfb_device *nfb;
+
+ uint16_t max_rx_queues;
+ uint16_t max_tx_queues;
};

#endif /* _NFB_H_ */
diff --git a/drivers/net/nfb/nfb_ethdev.c b/drivers/net/nfb/nfb_ethdev.c
index 98119d70fd..5b1df83b7f 100644
--- a/drivers/net/nfb/nfb_ethdev.c
+++ b/drivers/net/nfb/nfb_ethdev.c
@@ -237,11 +237,13 @@ static int
nfb_eth_dev_info(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info)
{
+ struct pmd_internals *internals = dev->data->dev_private;
+
dev_info->max_mac_addrs = nfb_eth_get_max_mac_address_count(dev);

dev_info->max_rx_pktlen = (uint32_t)-1;
- dev_info->max_rx_queues = dev->data->nb_rx_queues;
- dev_info->max_tx_queues = dev->data->nb_tx_queues;
+ dev_info->max_rx_queues = internals->max_rx_queues;
+ dev_info->max_tx_queues = internals->max_tx_queues;
dev_info->speed_capa = RTE_ETH_LINK_SPEED_100G;
dev_info->rx_offload_capa =
RTE_ETH_RX_OFFLOAD_TIMESTAMP;
@@ -538,11 +540,11 @@ nfb_eth_dev_init(struct rte_eth_dev *dev)
NFB_LOG(ERR, "nfb_open(): failed to open %s", nfb_dev);
return -EINVAL;
}
- data->nb_rx_queues = ndp_get_rx_queue_available_count(internals->nfb);
- data->nb_tx_queues = ndp_get_tx_queue_available_count(internals->nfb);
+ internals->max_rx_queues = ndp_get_rx_queue_available_count(internals->nfb);
+ internals->max_tx_queues = ndp_get_tx_queue_available_count(internals->nfb);

NFB_LOG(INFO, "Available NDP queues RX: %u TX: %u",
- data->nb_rx_queues, data->nb_tx_queues);
+ internals->max_rx_queues, internals->max_tx_queues);

nfb_nc_rxmac_init(internals->nfb,
internals->rxmac,
--
2.52.0