[dpdk-dev] [PATCH v2 13/15] app/testpmd: support shared Rx queue for macswap fwd
From: Xueming Li <hidden>
Date: 2021-08-11 14:06:29
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Xiaoyu Min <redacted> 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 <redacted> --- app/test-pmd/macswap.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-)
diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c
index 310bca06af..daf7170092 100644
--- a/app/test-pmd/macswap.c
+++ b/app/test-pmd/macswap.c@@ -50,27 +50,13 @@ * addresses of packets before forwarding them. */ static void -pkt_burst_mac_swap(struct fwd_stream *fs) +mac_swap_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; - uint16_t nb_rx; uint16_t nb_tx; uint32_t retry; - 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]; do_macswap(pkts_burst, nb_rx, txp);
@@ -95,7 +81,15 @@ pkt_burst_mac_swap(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_swap(struct fwd_stream *fs) +{ + return do_burst_fwd(fs, mac_swap_stream); } struct fwd_engine mac_swap_engine = {
--
2.25.1