[v2,11/15] app/testpmd: support shared Rx queue for flowgen
Checks
Commit Message
From: Xiaoyu Min <jackmin@nvidia.com>
Add support of shared rxq.
If shared rxq is enabled, filter packet by stream according
to mbuf->port value and then do stats in stream basis (as before).
If shared rxq is not enabled, just as usual in stream basis.
Signed-off-by: Xiaoyu Min <jackmin@nvidia.com>
---
app/test-pmd/flowgen.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
@@ -83,10 +83,10 @@ ip_sum(const alias_int16_t *hdr, int hdr_len)
* still do so in order to maintain traffic statistics.
*/
static void
-pkt_burst_flow_gen(struct fwd_stream *fs)
+flow_gen_stream(struct fwd_stream *fs, uint16_t nb_rx,
+ struct rte_mbuf **pkts_burst)
{
unsigned pkt_size = tx_pkt_length - 4; /* Adjust FCS */
- struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
struct rte_mempool *mbp;
struct rte_mbuf *pkt = NULL;
struct rte_ether_hdr *eth_hdr;
@@ -94,23 +94,14 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
struct rte_udp_hdr *udp_hdr;
uint16_t vlan_tci, vlan_tci_outer;
uint64_t ol_flags = 0;
- uint16_t nb_rx;
uint16_t nb_tx;
uint16_t nb_pkt;
uint16_t nb_clones = nb_pkt_flowgen_clones;
uint16_t i;
uint32_t retry;
uint64_t tx_offloads;
- uint64_t start_tsc = 0;
static int next_flow = 0;
- get_start_cycles(&start_tsc);
-
- /* Receive a burst of packets and discard them. */
- nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, pkts_burst,
- nb_pkt_per_burst);
- fs->rx_packets += nb_rx;
-
for (i = 0; i < nb_rx; i++)
rte_pktmbuf_free(pkts_burst[i]);
@@ -213,8 +204,15 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
rte_pktmbuf_free(pkts_burst[nb_tx]);
} while (++nb_tx < nb_pkt);
}
+}
- get_end_cycles(fs, start_tsc);
+/*
+ * Wrapper of real fwd engine
+ */
+static void
+pkt_burst_flow_gen(struct fwd_stream *fs)
+{
+ return do_burst_fwd(fs, flow_gen_stream);
}
struct fwd_engine flow_gen_engine = {