From: Xiaoyu Min <jack...@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 in stream basis.

Signed-off-by: Xiaoyu Min <jack...@nvidia.com>
---
 app/test-pmd/icmpecho.c | 33 +++++++++++++--------------------
 1 file changed, 13 insertions(+), 20 deletions(-)

diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c
index 8948f28eb5..d6d11a2efb 100644
--- a/app/test-pmd/icmpecho.c
+++ b/app/test-pmd/icmpecho.c
@@ -267,13 +267,13 @@ ipv4_hdr_cksum(struct rte_ipv4_hdr *ip_h)
        (((rte_be_to_cpu_32((ipv4_addr)) >> 24) & 0x000000FF) == 0xE0)
 
 /*
- * Receive a burst of packets, lookup for ICMP echo requests, and, if any,
- * send back ICMP echo replies.
+ * Lookup for ICMP echo requests in received mbuf and, if any,
+ * send back ICMP echo replies to corresponding Tx port.
  */
 static void
-reply_to_icmp_echo_rqsts(struct fwd_stream *fs)
+reply_to_icmp_echo_rqsts_stream(struct fwd_stream *fs, uint16_t nb_rx,
+               struct rte_mbuf **pkts_burst)
 {
-       struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
        struct rte_mbuf *pkt;
        struct rte_ether_hdr *eth_h;
        struct rte_vlan_hdr *vlan_h;
@@ -283,7 +283,6 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs)
        struct rte_ether_addr eth_addr;
        uint32_t retry;
        uint32_t ip_addr;
-       uint16_t nb_rx;
        uint16_t nb_tx;
        uint16_t nb_replies;
        uint16_t eth_type;
@@ -291,22 +290,9 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs)
        uint16_t arp_op;
        uint16_t arp_pro;
        uint32_t cksum;
-       uint8_t  i;
+       uint16_t  i;
        int l2_len;
-       uint64_t start_tsc = 0;
-
-       get_start_cycles(&start_tsc);
-
-       /*
-        * First, receive a burst of packets.
-        */
-       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;
        nb_replies = 0;
        for (i = 0; i < nb_rx; i++) {
                if (likely(i < nb_rx - 1))
@@ -509,8 +495,15 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs)
                        } while (++nb_tx < nb_replies);
                }
        }
+}
 
-       get_end_cycles(fs, start_tsc);
+/*
+ * Wrapper of real fwd engine.
+ */
+static void
+reply_to_icmp_echo_rqsts(struct fwd_stream *fs)
+{
+       return do_burst_fwd(fs, reply_to_icmp_echo_rqsts_stream);
 }
 
 struct fwd_engine icmp_echo_engine = {
-- 
2.25.1

Reply via email to