[dpdk-dev] [PATCH v2 12/15] app/testpmd: support shared Rx queue for MAC fwd
Xueming Li
xuemingl at nvidia.com
Wed Aug 11 16:04:14 CEST 2021
From: Xiaoyu Min <jackmin at nvidia.com>
Add support of shared rxq.
If shared rxq is enabled, filter packet by stream according
to mbuf->port value and then fwd it in stream basis (as before).
If shared rxq is not enabled, just fwd it as usual in stream basis.
Signed-off-by: Xiaoyu Min <jackmin at nvidia.com>
---
app/test-pmd/macfwd.c | 27 ++++++++++-----------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c
index 0568ea794d..75fbea16d4 100644
--- a/app/test-pmd/macfwd.c
+++ b/app/test-pmd/macfwd.c
@@ -44,32 +44,18 @@
* before forwarding them.
*/
static void
-pkt_burst_mac_forward(struct fwd_stream *fs)
+mac_forward_stream(struct fwd_stream *fs, uint16_t nb_rx,
+ struct rte_mbuf **pkts_burst)
{
- struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
struct rte_port *txp;
struct rte_mbuf *mb;
struct rte_ether_hdr *eth_hdr;
uint32_t retry;
- uint16_t nb_rx;
uint16_t nb_tx;
uint16_t i;
uint64_t ol_flags = 0;
uint64_t tx_offloads;
- uint64_t start_tsc = 0;
-
- get_start_cycles(&start_tsc);
-
- /*
- * Receive a burst of packets and forward them.
- */
- nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, pkts_burst,
- nb_pkt_per_burst);
- inc_rx_burst_stats(fs, nb_rx);
- if (unlikely(nb_rx == 0))
- return;
- fs->rx_packets += nb_rx;
txp = &ports[fs->tx_port];
tx_offloads = txp->dev_conf.txmode.offloads;
if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT)
@@ -116,8 +102,15 @@ pkt_burst_mac_forward(struct fwd_stream *fs)
rte_pktmbuf_free(pkts_burst[nb_tx]);
} while (++nb_tx < nb_rx);
}
+}
- get_end_cycles(fs, start_tsc);
+/*
+ * Wrapper of real fwd engine.
+ */
+static void
+pkt_burst_mac_forward(struct fwd_stream *fs)
+{
+ return do_burst_fwd(fs, mac_forward_stream);
}
struct fwd_engine mac_fwd_engine = {
--
2.25.1
More information about the dev
mailing list