From: Shani Peretz <[email protected]>

Mark the Rx/Tx steps in mbufs for debugging.
It has no performance impact if mbuf history is disabled (by default).

Signed-off-by: Shani Peretz <[email protected]>
---
 lib/ethdev/rte_ethdev.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index d23c143eed..5e250e5083 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -6336,6 +6336,8 @@ rte_eth_rx_burst(uint16_t port_id, uint16_t queue_id,
 
        nb_rx = p->rx_pkt_burst(qd, rx_pkts, nb_pkts);
 
+       rte_mbuf_history_mark_bulk(rx_pkts, nb_rx, RTE_MBUF_HISTORY_OP_RX);
+
 #ifdef RTE_ETHDEV_RXTX_CALLBACKS
        {
                void *cb;
@@ -6688,8 +6690,15 @@ rte_eth_tx_burst(uint16_t port_id, uint16_t queue_id,
        }
 #endif
 
+       uint16_t requested_pkts = nb_pkts;
+       rte_mbuf_history_mark_bulk(tx_pkts, nb_pkts, RTE_MBUF_HISTORY_OP_TX);
+
        nb_pkts = p->tx_pkt_burst(qd, tx_pkts, nb_pkts);
 
+       if (requested_pkts > nb_pkts)
+               rte_mbuf_history_mark_bulk(tx_pkts + nb_pkts,
+                               requested_pkts - nb_pkts, 
RTE_MBUF_HISTORY_OP_TX_BUSY);
+
        rte_ethdev_trace_tx_burst(port_id, queue_id, (void **)tx_pkts, nb_pkts);
        return nb_pkts;
 }
@@ -6785,6 +6794,8 @@ rte_eth_tx_prepare(uint16_t port_id, uint16_t queue_id,
        }
 #endif
 
+       rte_mbuf_history_mark_bulk(tx_pkts, nb_pkts, 
RTE_MBUF_HISTORY_OP_TX_PREP);
+
        return p->tx_pkt_prepare(qd, tx_pkts, nb_pkts);
 }
 
-- 
2.51.0

Reply via email to