Skip to contentSkip to conversation

app/testpmd: fix io fwd mode to forward VLAN packets

PATCH In review Ajit Khaparde 2 participants 2 messages Jun 29, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/testpmd: fix io fwd mode to forward VLAN packets

In io fwd mode, while the received VLAN packets are forwarded for transmit, the ol_flags are not updated appropriately to indicate presence of VLAN tags in the Tx path. This patch fixes that.

---
 app/test-pmd/iofwd.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
app/test-pmd/iofwd.c +15 -0
index 15cb4a2..997d3c3 100644
@@ -91,6 +91,7 @@ pkt_burst_io_forward(struct fwd_stream *fs)
 #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
 	start_tsc = rte_rdtsc();
 #endif
+	int i;
 
 	/*
 	 * Receive a burst of packets and forward them.
@@ -104,6 +105,20 @@ pkt_burst_io_forward(struct fwd_stream *fs)
 #ifdef RTE_TEST_PMD_RECORD_BURST_STATS
 	fs->rx_burst_stats.pkt_burst_spread[nb_rx]++;
 #endif
+
+	for (i = 0; i < nb_rx; i++) {
+		uint64_t tx_ol_flags = 0, rx_ol_flags = pkts_burst[i]->ol_flags;
+
+		if (rx_ol_flags & PKT_RX_VLAN_PKT)
+			tx_ol_flags |= PKT_TX_VLAN_PKT;
+		else if (rx_ol_flags & PKT_RX_QINQ_PKT)
+			tx_ol_flags |= PKT_TX_QINQ_PKT;
+
+		pkts_burst[i]->ol_flags = 0;
+		pkts_burst[i]->ol_flags = tx_ol_flags;
+
+	}
+
 	nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue,
 			pkts_burst, nb_rx);
 	/*
Signature · 1 line
2.10.1 (Apple Git-78)
#1 lore raw
Quoted 38 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Ajit Khaparde
Sent: Thursday, June 29, 2017 11:06 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH] app/testpmd: fix io fwd mode to forward VLAN packets

In io fwd mode, while the received VLAN packets are forwarded for transmit, the ol_flags are not updated appropriately to indicate presence of VLAN tags in the Tx path. This patch fixes that.

---
 app/test-pmd/iofwd.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
app/test-pmd/iofwd.c index renamed from app/test-pmd/iofwd.c +0 -0

15cb4a2..997d3c3 100644

app/test-pmd/iofwd.c +0 -0
@@ -91,6 +91,7 @@ pkt_burst_io_forward(struct fwd_stream *fs)  #ifdef

RTE_TEST_PMD_RECORD_CORE_CYCLES

app/test-pmd/iofwd.c +1 -0
 	start_tsc = rte_rdtsc();
 #endif
+	int i;
 
 	/*
 	 * Receive a burst of packets and forward them.
@@ -104,6 +105,20 @@ pkt_burst_io_forward(struct fwd_stream *fs)  #ifdef

RTE_TEST_PMD_RECORD_BURST_STATS

app/test-pmd/iofwd.c +4 -0
 	fs->rx_burst_stats.pkt_burst_spread[nb_rx]++;
 #endif
+
+	for (i = 0; i < nb_rx; i++) {
+		uint64_t tx_ol_flags = 0, rx_ol_flags = pkts_burst[i]->ol_flags;
+

app/test-pmd/iofwd.c pkt_burst_io_forward(struct fwd_stream *fs) · line 121

Quoted 10 lines
app/test-pmd/iofwd.c +10 -0
+		if (rx_ol_flags & PKT_RX_VLAN_PKT)
+			tx_ol_flags |= PKT_TX_VLAN_PKT;
+		else if (rx_ol_flags & PKT_RX_QINQ_PKT)
+			tx_ol_flags |= PKT_TX_QINQ_PKT;
+
+		pkts_burst[i]->ol_flags = 0;
+		pkts_burst[i]->ol_flags = tx_ol_flags;
+
+	}
+

The iofwd engine is an fwd engine what just calls tx_burst and rx_burst, it is purely fwd without carrying any offload features.
If you'd like to demonstrate the vlan offload feature, you can other fwd engine Such as txonly, macfwd......

Thanks
Jingjing