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 actual VMDq queue layout (vmdq_queue_num) 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]>
---

v3:
* Replaced configured queue count with actual VMDQ queue layout.
* Changed comment accordingly.
* Revised commit message.

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

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index aad880aa34..abe40a3428 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -4448,8 +4448,11 @@ 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;
+                               /* if vt disabled and vmdq_pool_base greater 
than 0,
+                                * use vmdq queue layout
+                                */
+                               nb_rxq = rte_port->dev_info.vmdq_queue_num;
+                               nb_txq = rte_port->dev_info.vmdq_queue_num;
                        }
                }
        }
-- 
2.43.0

Reply via email to