[dpdk-dev,v4,05/11] app/testpmd: fix flowgen forwarding ol flags

Message ID 48a1b699d939ec9ce93b2f39defbfab86884b5d7.1515575134.git.shahafs@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Shahaf Shuler Jan. 10, 2018, 9:09 a.m. UTC
  The mbuf ol_flags were taken directly from testpmd internal enumeration
leading to incorrect values.

addressing only insertion offload flags as the checksum flags by
the application design are only with csum forwarding.

Fixes: e9e23a617eb8 ("app/testpmd: add flowgen forwarding engine")
Cc: cchemparathy@tilera.com
Cc: stable@dpdk.org

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 app/test-pmd/flowgen.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
  

Patch

diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c
index acf9af941..46478fc3a 100644
--- a/app/test-pmd/flowgen.c
+++ b/app/test-pmd/flowgen.c
@@ -123,7 +123,7 @@  pkt_burst_flow_gen(struct fwd_stream *fs)
 	struct ipv4_hdr *ip_hdr;
 	struct udp_hdr *udp_hdr;
 	uint16_t vlan_tci, vlan_tci_outer;
-	uint16_t ol_flags;
+	uint64_t ol_flags;
 	uint16_t nb_rx;
 	uint16_t nb_tx;
 	uint16_t nb_pkt;
@@ -151,7 +151,13 @@  pkt_burst_flow_gen(struct fwd_stream *fs)
 	mbp = current_fwd_lcore()->mbp;
 	vlan_tci = ports[fs->tx_port].tx_vlan_id;
 	vlan_tci_outer = ports[fs->tx_port].tx_vlan_id_outer;
-	ol_flags = ports[fs->tx_port].tx_ol_flags;
+
+	if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN)
+		ol_flags = PKT_TX_VLAN_PKT;
+	if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ)
+		ol_flags |= PKT_TX_QINQ_PKT;
+	if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC)
+		ol_flags |= PKT_TX_MACSEC;
 
 	for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) {
 		pkt = rte_mbuf_raw_alloc(mbp);