When using DCB mode with VT disabled and requesting more queues than
traffic classes (e.g., rxq=64 with 8 TCs), testpmd crashes with null
pointer errors because it artificially limits queue allocation to
num_tcs.

For VMDq devices, use device-specific queue count (nb_rx_queues/
nb_tx_queues) instead of limiting to num_tcs. This allows VMDq devices
to utilize their full queue capacity while maintaining compatibility
with non VMDq devices.

Fixes null pointer dereference when queue structures are accessed
beyond the allocated range.

Fixes: 2169699b15fc ("app/testpmd: add queue restriction in DCB command")
Cc: [email protected]

Signed-off-by: KAVYA AV <[email protected]>
---

v2: Moved the comment inside the else block.
---
 app/test-pmd/testpmd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index fbacee89ea..7e50689f23 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -4445,8 +4445,9 @@ init_port_dcb_config(portid_t pid,
                                nb_rxq = rte_port->dev_info.max_rx_queues;
                                nb_txq = rte_port->dev_info.max_tx_queues;
                        } else {
-                               nb_rxq = (queueid_t)num_tcs;
-                               nb_txq = (queueid_t)num_tcs;
+                               /* Use device queue counts to prevent null 
pointer errors. */
+                               nb_rxq = 
(queueid_t)rte_port->dev_info.nb_rx_queues;
+                               nb_txq = 
(queueid_t)rte_port->dev_info.nb_tx_queues;
                        }
                }
        }
-- 
2.43.0

Reply via email to