When capturing on all queues, pdump walks nb_rx_queues and
nb_tx_queues, which include hairpin queues. Adding a Tx callback
to a hairpin queue fails, so capture could not be enabled on any
port with hairpin queues configured.

Skip hairpin queues when capturing all queues, and reject an
explicit request for a hairpin queue.

Fixes: cf5516696d77 ("ethdev: add hairpin queue")
Cc: [email protected]

Signed-off-by: Stephen Hemminger <[email protected]>
---
 lib/pdump/rte_pdump.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c
index 9c368bcfd7..3261876d29 100644
--- a/lib/pdump/rte_pdump.c
+++ b/lib/pdump/rte_pdump.c
@@ -8,6 +8,7 @@
 #include <rte_alarm.h>
 #include <rte_mbuf.h>
 #include <rte_ethdev.h>
+#include <ethdev_driver.h>
 #include <rte_lcore.h>
 #include <rte_log.h>
 #include <rte_memzone.h>
@@ -263,6 +264,16 @@ pdump_register_rx_callbacks(enum pdump_version ver,
        for (; qid < end_q; qid++) {
                struct pdump_rxtx_cbs *cbs = &rx_cbs[port][qid];
 
+               /* hairpin queues do not pass through rx burst */
+               if (rte_eth_dev_is_rx_hairpin_queue(&rte_eth_devices[port], 
qid)) {
+                       if (queue == RTE_PDUMP_ALL_QUEUES)
+                               continue;
+                       PDUMP_LOG_LINE(ERR,
+                               "cannot capture on hairpin rx queue port=%d 
queue=%d",
+                               port, qid);
+                       return -EINVAL;
+               }
+
                if (operation == ENABLE) {
                        if (cbs->cb) {
                                PDUMP_LOG_LINE(ERR,
@@ -325,6 +336,16 @@ pdump_register_tx_callbacks(enum pdump_version ver,
        for (; qid < end_q; qid++) {
                struct pdump_rxtx_cbs *cbs = &tx_cbs[port][qid];
 
+               /* hairpin queues do not pass through tx burst */
+               if (rte_eth_dev_is_tx_hairpin_queue(&rte_eth_devices[port], 
qid)) {
+                       if (queue == RTE_PDUMP_ALL_QUEUES)
+                               continue;
+                       PDUMP_LOG_LINE(ERR,
+                               "cannot capture on hairpin tx queue port=%d 
queue=%d",
+                               port, qid);
+                       return -EINVAL;
+               }
+
                if (operation == ENABLE) {
                        if (cbs->cb) {
                                PDUMP_LOG_LINE(ERR,
-- 
2.53.0

Reply via email to