On 16-10-2025 04:37, Stephen Hemminger wrote: > The limit on number of receive descriptors should be per-device. > Discovered while looking at globally exported symbols. > > Fixes: 35dc25d12792 ("net/dpaa2: warn on high Rx descriptor number") > Cc:rohit.raj@nxp.com > > Signed-off-by: Stephen Hemminger > --- > drivers/net/dpaa2/dpaa2_ethdev.c | 9 ++++----- > drivers/net/dpaa2/dpaa2_ethdev.h | 1 + > 2 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c > index 41678ce09b..32edff0554 100644 > --- a/drivers/net/dpaa2/dpaa2_ethdev.c > +++ b/drivers/net/dpaa2/dpaa2_ethdev.c > @@ -79,7 +79,6 @@ bool dpaa2_enable_err_queue; > bool dpaa2_print_parser_result; > > #define MAX_NB_RX_DESC 11264 > -int total_nb_rx_desc; NACK,  However, we can change it to static variable. DPAA2 supports two methods for allocating the RX descriptors. 1. Fast memory - low-latency PEB memory - The size is limited, so we globally track the number of buffers across devices. 2. Normal memory - no limit as they are from DDR. This variable help in tracking that overall rx descriptor across devices are not crossing the memory limit of MAX_NB_RX_DESC > > int dpaa2_valid_dev; > struct rte_mempool *dpaa2_tx_sg_pool; > @@ -720,9 +719,9 @@ dpaa2_dev_rx_queue_setup(struct rte_eth_dev *dev, > DPAA2_PMD_DEBUG("dev =%p, queue =%d, pool = %p, conf =%p", > dev, rx_queue_id, mb_pool, rx_conf); > > - total_nb_rx_desc += nb_rx_desc; > - if (total_nb_rx_desc > MAX_NB_RX_DESC) { > - DPAA2_PMD_WARN("Total nb_rx_desc exceeds %d limit. Please use Normal buffers", > + priv->nb_rx_desc += nb_rx_desc; > + if (priv->nb_rx_desc > MAX_NB_RX_DESC) { > + DPAA2_PMD_WARN("Total nb_rx_desc exceeds %u limit. Please use Normal buffers", > MAX_NB_RX_DESC); > DPAA2_PMD_WARN("To use Normal buffers, run 'export DPNI_NORMAL_BUF=1' before running dynamic_dpl.sh script"); > } > @@ -1029,7 +1028,7 @@ dpaa2_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t rx_queue_id) > memset(&cfg, 0, sizeof(struct dpni_queue)); > PMD_INIT_FUNC_TRACE(); > > - total_nb_rx_desc -= dpaa2_q->nb_desc; > + priv->nb_rx_desc -= dpaa2_q->nb_desc; > > if (dpaa2_q->cgid != DPAA2_INVALID_CGID) { > options = DPNI_QUEUE_OPT_CLEAR_CGID; > diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h > index ffc9ebadb8..aa3fcb9af0 100644 > --- a/drivers/net/dpaa2/dpaa2_ethdev.h > +++ b/drivers/net/dpaa2/dpaa2_ethdev.h > @@ -385,6 +385,7 @@ struct dpaa2_dev_priv { > uint8_t num_tx_tc; > uint16_t qos_entries; > uint16_t fs_entries; > + uint16_t nb_rx_desc; > uint8_t dist_queues; > uint8_t num_channels; > uint8_t en_ordered;