DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shahaf Shuler <shahafs@mellanox.com>
To: jingjing.wu@intel.com, thomas@monjalon.net, ferruh.yigit@intel.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v4 06/11] app/testpmd: cleanup internal Tx offloads flags field
Date: Wed, 10 Jan 2018 11:09:14 +0200	[thread overview]
Message-ID: <73e30c58e430a803963c6a50a42c7d8d3b9a534e.1515575134.git.shahafs@mellanox.com> (raw)
In-Reply-To: <cover.1515575134.git.shahafs@mellanox.com>

The tx_ol_flags field was used in order to control the different
Tx offloads set. After the conversion to the new Ethdev Tx offloads API
it is not needed anymore as the offloads configuration is stored in
ethdev structs.

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 app/test-pmd/cmdline.c  | 49 ++++++++++++++++----------------------------
 app/test-pmd/config.c   |  4 ----
 app/test-pmd/csumonly.c | 40 ++++++++++++++++++------------------
 app/test-pmd/flowgen.c  |  8 +++++---
 app/test-pmd/macfwd.c   |  8 +++++---
 app/test-pmd/macswap.c  |  8 +++++---
 app/test-pmd/testpmd.h  | 22 +-------------------
 app/test-pmd/txonly.c   |  8 +++++---
 8 files changed, 59 insertions(+), 88 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 58125839a..858482174 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -3653,45 +3653,45 @@ static void
 csum_show(int port_id)
 {
 	struct rte_eth_dev_info dev_info;
-	uint16_t ol_flags;
+	uint64_t tx_offloads;
 
-	ol_flags = ports[port_id].tx_ol_flags;
+	tx_offloads = ports[port_id].dev_conf.txmode.offloads;
 	printf("Parse tunnel is %s\n",
-		(ol_flags & TESTPMD_TX_OFFLOAD_PARSE_TUNNEL) ? "on" : "off");
+		(ports[port_id].parse_tunnel) ? "on" : "off");
 	printf("IP checksum offload is %s\n",
-		(ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) ? "hw" : "sw");
+		(tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) ? "hw" : "sw");
 	printf("UDP checksum offload is %s\n",
-		(ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) ? "hw" : "sw");
+		(tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM) ? "hw" : "sw");
 	printf("TCP checksum offload is %s\n",
-		(ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) ? "hw" : "sw");
+		(tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) ? "hw" : "sw");
 	printf("SCTP checksum offload is %s\n",
-		(ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) ? "hw" : "sw");
+		(tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) ? "hw" : "sw");
 	printf("Outer-Ip checksum offload is %s\n",
-		(ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) ? "hw" : "sw");
+		(tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) ? "hw" : "sw");
 
 	/* display warnings if configuration is not supported by the NIC */
 	rte_eth_dev_info_get(port_id, &dev_info);
-	if ((ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) &&
+	if ((tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) &&
 		(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) == 0) {
 		printf("Warning: hardware IP checksum enabled but not "
 			"supported by port %d\n", port_id);
 	}
-	if ((ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) &&
+	if ((tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM) &&
 		(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM) == 0) {
 		printf("Warning: hardware UDP checksum enabled but not "
 			"supported by port %d\n", port_id);
 	}
-	if ((ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) &&
+	if ((tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) &&
 		(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) == 0) {
 		printf("Warning: hardware TCP checksum enabled but not "
 			"supported by port %d\n", port_id);
 	}
-	if ((ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) &&
+	if ((tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) &&
 		(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_SCTP_CKSUM) == 0) {
 		printf("Warning: hardware SCTP checksum enabled but not "
 			"supported by port %d\n", port_id);
 	}
-	if ((ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) &&
+	if ((tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) &&
 		(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) == 0) {
 		printf("Warning: hardware outer IP checksum enabled but not "
 			"supported by port %d\n", port_id);
@@ -3705,7 +3705,6 @@ cmd_csum_parsed(void *parsed_result,
 {
 	struct cmd_csum_result *res = parsed_result;
 	int hw = 0;
-	uint16_t mask = 0;
 	uint64_t csum_offloads = 0;
 
 	if (port_id_is_invalid(res->port_id, ENABLED_WARN)) {
@@ -3723,28 +3722,21 @@ cmd_csum_parsed(void *parsed_result,
 			hw = 1;
 
 		if (!strcmp(res->proto, "ip")) {
-			mask = TESTPMD_TX_OFFLOAD_IP_CKSUM;
 			csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM;
 		} else if (!strcmp(res->proto, "udp")) {
-			mask = TESTPMD_TX_OFFLOAD_UDP_CKSUM;
 			csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM;
 		} else if (!strcmp(res->proto, "tcp")) {
-			mask = TESTPMD_TX_OFFLOAD_TCP_CKSUM;
 			csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM;
 		} else if (!strcmp(res->proto, "sctp")) {
-			mask = TESTPMD_TX_OFFLOAD_SCTP_CKSUM;
 			csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM;
 		} else if (!strcmp(res->proto, "outer-ip")) {
-			mask = TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM;
 			csum_offloads |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM;
 		}
 
 		if (hw) {
-			ports[res->port_id].tx_ol_flags |= mask;
 			ports[res->port_id].dev_conf.txmode.offloads |=
 							csum_offloads;
 		} else {
-			ports[res->port_id].tx_ol_flags &= (~mask);
 			ports[res->port_id].dev_conf.txmode.offloads &=
 							(~csum_offloads);
 		}
@@ -3821,11 +3813,9 @@ cmd_csum_tunnel_parsed(void *parsed_result,
 		return;
 
 	if (!strcmp(res->onoff, "on"))
-		ports[res->port_id].tx_ol_flags |=
-			TESTPMD_TX_OFFLOAD_PARSE_TUNNEL;
+		ports[res->port_id].parse_tunnel = 1;
 	else
-		ports[res->port_id].tx_ol_flags &=
-			(~TESTPMD_TX_OFFLOAD_PARSE_TUNNEL);
+		ports[res->port_id].parse_tunnel = 0;
 
 	csum_show(res->port_id);
 }
@@ -4025,12 +4015,11 @@ cmd_tunnel_tso_set_parsed(void *parsed_result,
 		 */
 		check_tunnel_tso_nic_support(res->port_id);
 
-		if (!(ports[res->port_id].tx_ol_flags &
-		      TESTPMD_TX_OFFLOAD_PARSE_TUNNEL))
+		if (!ports[res->port_id].parse_tunnel)
 			printf("Warning: csum parse_tunnel must be set "
 				"so that tunneled packets are recognized\n");
-		if (!(ports[res->port_id].tx_ol_flags &
-		      TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM))
+		if (!(ports[res->port_id].dev_conf.txmode.offloads &
+		      DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM))
 			printf("Warning: csum set outer-ip must be set to hw "
 				"if outer L3 is IPv4; not necessary for IPv6\n");
 	}
@@ -13082,7 +13071,6 @@ cmd_set_macsec_offload_on_parsed(
 		return;
 	}
 
-	ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_MACSEC;
 	ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_MACSEC_INSERT;
 #ifdef RTE_LIBRTE_IXGBE_PMD
 	ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp);
@@ -13172,7 +13160,6 @@ cmd_set_macsec_offload_off_parsed(
 		return;
 	}
 
-	ports[port_id].tx_ol_flags &= ~TESTPMD_TX_OFFLOAD_MACSEC;
 	ports[port_id].dev_conf.txmode.offloads &=
 					~DEV_TX_OFFLOAD_MACSEC_INSERT;
 #ifdef RTE_LIBRTE_IXGBE_PMD
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index d0056fa69..29115e255 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -2808,7 +2808,6 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id)
 	}
 
 	tx_vlan_reset(port_id);
-	ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_VLAN;
 	ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_VLAN_INSERT;
 	ports[port_id].tx_vlan_id = vlan_id;
 }
@@ -2832,7 +2831,6 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer)
 	}
 
 	tx_vlan_reset(port_id);
-	ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_QINQ;
 	ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_QINQ_INSERT;
 	ports[port_id].tx_vlan_id = vlan_id;
 	ports[port_id].tx_vlan_id_outer = vlan_id_outer;
@@ -2843,8 +2841,6 @@ tx_vlan_reset(portid_t port_id)
 {
 	if (port_id_is_invalid(port_id, ENABLED_WARN))
 		return;
-	ports[port_id].tx_ol_flags &= ~(TESTPMD_TX_OFFLOAD_INSERT_VLAN |
-				TESTPMD_TX_OFFLOAD_INSERT_QINQ);
 	ports[port_id].dev_conf.txmode.offloads &=
 				~(DEV_TX_OFFLOAD_VLAN_INSERT |
 				  DEV_TX_OFFLOAD_QINQ_INSERT);
diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index aa29f5fc1..dbd2f9842 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -316,7 +316,7 @@ parse_encap_ip(void *encap_ip, struct testpmd_offload_info *info)
  * depending on the testpmd command line configuration */
 static uint64_t
 process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
-	uint16_t testpmd_ol_flags)
+	uint64_t tx_offloads)
 {
 	struct ipv4_hdr *ipv4_hdr = l3_hdr;
 	struct udp_hdr *udp_hdr;
@@ -347,7 +347,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
 		if (info->l4_proto == IPPROTO_TCP && tso_segsz) {
 			ol_flags |= PKT_TX_IP_CKSUM;
 		} else {
-			if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM)
+			if (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM)
 				ol_flags |= PKT_TX_IP_CKSUM;
 			else
 				ipv4_hdr->hdr_checksum =
@@ -363,7 +363,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
 		/* do not recalculate udp cksum if it was 0 */
 		if (udp_hdr->dgram_cksum != 0) {
 			udp_hdr->dgram_cksum = 0;
-			if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM)
+			if (tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM)
 				ol_flags |= PKT_TX_UDP_CKSUM;
 			else {
 				udp_hdr->dgram_cksum =
@@ -376,7 +376,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
 		tcp_hdr->cksum = 0;
 		if (tso_segsz)
 			ol_flags |= PKT_TX_TCP_SEG;
-		else if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM)
+		else if (tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM)
 			ol_flags |= PKT_TX_TCP_CKSUM;
 		else {
 			tcp_hdr->cksum =
@@ -390,7 +390,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
 		sctp_hdr->cksum = 0;
 		/* sctp payload must be a multiple of 4 to be
 		 * offloaded */
-		if ((testpmd_ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) &&
+		if ((tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) &&
 			((ipv4_hdr->total_length & 0x3) == 0)) {
 			ol_flags |= PKT_TX_SCTP_CKSUM;
 		} else {
@@ -405,7 +405,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
 /* Calculate the checksum of outer header */
 static uint64_t
 process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info,
-	uint16_t testpmd_ol_flags, int tso_enabled)
+	uint64_t tx_offloads, int tso_enabled)
 {
 	struct ipv4_hdr *ipv4_hdr = outer_l3_hdr;
 	struct ipv6_hdr *ipv6_hdr = outer_l3_hdr;
@@ -416,7 +416,7 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info,
 		ipv4_hdr->hdr_checksum = 0;
 		ol_flags |= PKT_TX_OUTER_IPV4;
 
-		if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM)
+		if (tx_offloads	& DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM)
 			ol_flags |= PKT_TX_OUTER_IP_CKSUM;
 		else
 			ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr);
@@ -646,7 +646,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 	uint16_t nb_prep;
 	uint16_t i;
 	uint64_t rx_ol_flags, tx_ol_flags;
-	uint16_t testpmd_ol_flags;
+	uint64_t tx_offloads;
 	uint32_t retry;
 	uint32_t rx_bad_ip_csum;
 	uint32_t rx_bad_l4_csum;
@@ -678,7 +678,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 	gro_enable = gro_ports[fs->rx_port].enable;
 
 	txp = &ports[fs->tx_port];
-	testpmd_ol_flags = txp->tx_ol_flags;
+	tx_offloads = txp->dev_conf.txmode.offloads;
 	memset(&info, 0, sizeof(info));
 	info.tso_segsz = txp->tso_segsz;
 	info.tunnel_tso_segsz = txp->tunnel_tso_segsz;
@@ -714,7 +714,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 		l3_hdr = (char *)eth_hdr + info.l2_len;
 
 		/* check if it's a supported tunnel */
-		if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_PARSE_TUNNEL) {
+		if (txp->parse_tunnel) {
 			if (info.l4_proto == IPPROTO_UDP) {
 				struct udp_hdr *udp_hdr;
 
@@ -754,14 +754,14 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 
 		/* process checksums of inner headers first */
 		tx_ol_flags |= process_inner_cksums(l3_hdr, &info,
-			testpmd_ol_flags);
+			tx_offloads);
 
 		/* Then process outer headers if any. Note that the software
 		 * checksum will be wrong if one of the inner checksums is
 		 * processed in hardware. */
 		if (info.is_tunnel == 1) {
 			tx_ol_flags |= process_outer_cksums(outer_l3_hdr, &info,
-					testpmd_ol_flags,
+					tx_offloads,
 					!!(tx_ol_flags & PKT_TX_TCP_SEG));
 		}
 
@@ -769,8 +769,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 
 		if (info.is_tunnel == 1) {
 			if (info.tunnel_tso_segsz ||
-			    (testpmd_ol_flags &
-			    TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) ||
+			    (tx_offloads &
+			     DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) ||
 			    (tx_ol_flags & PKT_TX_OUTER_IPV6)) {
 				m->outer_l2_len = info.outer_l2_len;
 				m->outer_l3_len = info.outer_l3_len;
@@ -832,17 +832,17 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 					rte_be_to_cpu_16(info.outer_ethertype),
 					info.outer_l3_len);
 			/* dump tx packet info */
-			if ((testpmd_ol_flags & (TESTPMD_TX_OFFLOAD_IP_CKSUM |
-						TESTPMD_TX_OFFLOAD_UDP_CKSUM |
-						TESTPMD_TX_OFFLOAD_TCP_CKSUM |
-						TESTPMD_TX_OFFLOAD_SCTP_CKSUM)) ||
+			if ((tx_offloads & (DEV_TX_OFFLOAD_IPV4_CKSUM |
+					    DEV_TX_OFFLOAD_UDP_CKSUM |
+					    DEV_TX_OFFLOAD_TCP_CKSUM |
+					    DEV_TX_OFFLOAD_SCTP_CKSUM)) ||
 				info.tso_segsz != 0)
 				printf("tx: m->l2_len=%d m->l3_len=%d "
 					"m->l4_len=%d\n",
 					m->l2_len, m->l3_len, m->l4_len);
 			if (info.is_tunnel == 1) {
-				if ((testpmd_ol_flags &
-				    TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) ||
+				if ((tx_offloads &
+				    DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) ||
 				    (tx_ol_flags & PKT_TX_OUTER_IPV6))
 					printf("tx: m->outer_l2_len=%d "
 						"m->outer_l3_len=%d\n",
diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c
index 46478fc3a..0531b5d27 100644
--- a/app/test-pmd/flowgen.c
+++ b/app/test-pmd/flowgen.c
@@ -129,6 +129,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
 	uint16_t nb_pkt;
 	uint16_t i;
 	uint32_t retry;
+	uint64_t tx_offloads;
 #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
 	uint64_t start_tsc;
 	uint64_t end_tsc;
@@ -152,11 +153,12 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
 	vlan_tci = ports[fs->tx_port].tx_vlan_id;
 	vlan_tci_outer = ports[fs->tx_port].tx_vlan_id_outer;
 
-	if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN)
+	tx_offloads = ports[fs->tx_port].dev_conf.txmode.offloads;
+	if (tx_offloads	& DEV_TX_OFFLOAD_VLAN_INSERT)
 		ol_flags = PKT_TX_VLAN_PKT;
-	if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ)
+	if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT)
 		ol_flags |= PKT_TX_QINQ_PKT;
-	if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC)
+	if (tx_offloads	& DEV_TX_OFFLOAD_MACSEC_INSERT)
 		ol_flags |= PKT_TX_MACSEC;
 
 	for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) {
diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c
index f4a4bf29a..56ee3cc0b 100644
--- a/app/test-pmd/macfwd.c
+++ b/app/test-pmd/macfwd.c
@@ -84,6 +84,7 @@ pkt_burst_mac_forward(struct fwd_stream *fs)
 	uint16_t nb_tx;
 	uint16_t i;
 	uint64_t ol_flags = 0;
+	uint64_t tx_offloads;
 #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
 	uint64_t start_tsc;
 	uint64_t end_tsc;
@@ -107,11 +108,12 @@ pkt_burst_mac_forward(struct fwd_stream *fs)
 #endif
 	fs->rx_packets += nb_rx;
 	txp = &ports[fs->tx_port];
-	if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN)
+	tx_offloads = txp->dev_conf.txmode.offloads;
+	if (tx_offloads	& DEV_TX_OFFLOAD_VLAN_INSERT)
 		ol_flags = PKT_TX_VLAN_PKT;
-	if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ)
+	if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT)
 		ol_flags |= PKT_TX_QINQ_PKT;
-	if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC)
+	if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT)
 		ol_flags |= PKT_TX_MACSEC;
 	for (i = 0; i < nb_rx; i++) {
 		if (likely(i < nb_rx - 1))
diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c
index 721865c96..e2cc4812c 100644
--- a/app/test-pmd/macswap.c
+++ b/app/test-pmd/macswap.c
@@ -84,6 +84,7 @@ pkt_burst_mac_swap(struct fwd_stream *fs)
 	uint16_t i;
 	uint32_t retry;
 	uint64_t ol_flags = 0;
+	uint64_t tx_offloads;
 #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
 	uint64_t start_tsc;
 	uint64_t end_tsc;
@@ -107,11 +108,12 @@ pkt_burst_mac_swap(struct fwd_stream *fs)
 #endif
 	fs->rx_packets += nb_rx;
 	txp = &ports[fs->tx_port];
-	if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN)
+	tx_offloads = txp->dev_conf.txmode.offloads;
+	if (tx_offloads	& DEV_TX_OFFLOAD_VLAN_INSERT)
 		ol_flags = PKT_TX_VLAN_PKT;
-	if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ)
+	if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT)
 		ol_flags |= PKT_TX_QINQ_PKT;
-	if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC)
+	if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT)
 		ol_flags |= PKT_TX_MACSEC;
 	for (i = 0; i < nb_rx; i++) {
 		if (likely(i < nb_rx - 1))
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index ab74d39ce..c6baa1066 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -138,26 +138,6 @@ struct fwd_stream {
 #endif
 };
 
-/** Offload IP checksum in csum forward engine */
-#define TESTPMD_TX_OFFLOAD_IP_CKSUM          0x0001
-/** Offload UDP checksum in csum forward engine */
-#define TESTPMD_TX_OFFLOAD_UDP_CKSUM         0x0002
-/** Offload TCP checksum in csum forward engine */
-#define TESTPMD_TX_OFFLOAD_TCP_CKSUM         0x0004
-/** Offload SCTP checksum in csum forward engine */
-#define TESTPMD_TX_OFFLOAD_SCTP_CKSUM        0x0008
-/** Offload outer IP checksum in csum forward engine for recognized tunnels */
-#define TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM    0x0010
-/** Parse tunnel in csum forward engine. If set, dissect tunnel headers
- * of rx packets. If not set, treat inner headers as payload. */
-#define TESTPMD_TX_OFFLOAD_PARSE_TUNNEL      0x0020
-/** Insert VLAN header in forward engine */
-#define TESTPMD_TX_OFFLOAD_INSERT_VLAN       0x0040
-/** Insert double VLAN header in forward engine */
-#define TESTPMD_TX_OFFLOAD_INSERT_QINQ       0x0080
-/** Offload MACsec in forward engine */
-#define TESTPMD_TX_OFFLOAD_MACSEC            0x0100
-
 /** Descriptor for a single flow. */
 struct port_flow {
 	size_t size; /**< Allocated space including data[]. */
@@ -215,7 +195,7 @@ struct rte_port {
 	struct fwd_stream       *rx_stream; /**< Port RX stream, if unique */
 	struct fwd_stream       *tx_stream; /**< Port TX stream, if unique */
 	unsigned int            socket_id;  /**< For NUMA support */
-	uint16_t                tx_ol_flags;/**< TX Offload Flags (TESTPMD_TX_OFFLOAD...). */
+	uint16_t		parse_tunnel:1; /**< Parse internal headers */
 	uint16_t                tso_segsz;  /**< Segmentation offload MSS for non-tunneled packets. */
 	uint16_t                tunnel_tso_segsz; /**< Segmentation offload MSS for tunneled pkts. */
 	uint16_t                tx_vlan_id;/**< The tag ID */
diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c
index 309c73893..418901c0c 100644
--- a/app/test-pmd/txonly.c
+++ b/app/test-pmd/txonly.c
@@ -193,6 +193,7 @@ pkt_burst_transmit(struct fwd_stream *fs)
 	uint32_t retry;
 	uint64_t ol_flags = 0;
 	uint8_t  i;
+	uint64_t tx_offloads;
 #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
 	uint64_t start_tsc;
 	uint64_t end_tsc;
@@ -206,13 +207,14 @@ pkt_burst_transmit(struct fwd_stream *fs)
 
 	mbp = current_fwd_lcore()->mbp;
 	txp = &ports[fs->tx_port];
+	tx_offloads = txp->dev_conf.txmode.offloads;
 	vlan_tci = txp->tx_vlan_id;
 	vlan_tci_outer = txp->tx_vlan_id_outer;
-	if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN)
+	if (tx_offloads	& DEV_TX_OFFLOAD_VLAN_INSERT)
 		ol_flags = PKT_TX_VLAN_PKT;
-	if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ)
+	if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT)
 		ol_flags |= PKT_TX_QINQ_PKT;
-	if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC)
+	if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT)
 		ol_flags |= PKT_TX_MACSEC;
 	for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) {
 		pkt = rte_mbuf_raw_alloc(mbp);
-- 
2.12.0

  parent reply	other threads:[~2018-01-10  9:10 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-23 12:07 [dpdk-dev] [PATCH 0/5] convert testpmd to new ethdev offloads API Shahaf Shuler
2017-11-23 12:08 ` [dpdk-dev] [PATCH 1/5] app/testpmd: convert to new Ethdev " Shahaf Shuler
2017-12-04 22:31   ` Ferruh Yigit
2017-12-05  6:39     ` Shahaf Shuler
2017-12-06 22:57       ` Ferruh Yigit
2017-12-07  7:55         ` Shahaf Shuler
2017-11-23 12:08 ` [dpdk-dev] [PATCH 2/5] app/testpmd: remove txqflags Shahaf Shuler
2017-12-04 22:31   ` Ferruh Yigit
2017-12-05  6:48     ` Shahaf Shuler
2017-12-06 23:04       ` Ferruh Yigit
2017-12-07  7:56         ` Shahaf Shuler
2017-12-12 12:45           ` Maciej Czekaj
2017-12-13  7:25             ` Shahaf Shuler
2017-11-23 12:08 ` [dpdk-dev] [PATCH 3/5] app/testpmd: add command line option for multiseg Shahaf Shuler
2017-11-23 12:08 ` [dpdk-dev] [PATCH 4/5] app/testpmd: add command line option for mbuf fast free Shahaf Shuler
2017-11-23 12:08 ` [dpdk-dev] [PATCH 5/5] app/testpmd: enforce offloads caps Shahaf Shuler
2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler
2017-12-12 12:52   ` [dpdk-dev] [PATCH v2 01/10] app/testpmd: fix port configuration print Shahaf Shuler
2017-12-12 12:52   ` [dpdk-dev] [PATCH v2 02/10] app/testpmd: convert to new Ethdev Rx offloads API Shahaf Shuler
2017-12-12 12:52   ` [dpdk-dev] [PATCH v2 03/10] app/testpmd: support check of single port stop Shahaf Shuler
2017-12-12 12:52   ` [dpdk-dev] [PATCH v2 04/10] app/testpmd: convert to new Ethdev Tx offloads API Shahaf Shuler
2018-01-05 18:11     ` Maciej Czekaj
2018-01-07 15:24       ` Shahaf Shuler
2017-12-12 12:52   ` [dpdk-dev] [PATCH v2 05/10] app/testpmd: fix flowgen forwarding ol flags Shahaf Shuler
2018-01-09  5:32     ` Lu, Wenzhuo
2017-12-12 12:52   ` [dpdk-dev] [PATCH v2 06/10] app/testpmd: cleanup internal Tx offloads flags field Shahaf Shuler
2017-12-12 12:52   ` [dpdk-dev] [PATCH v2 07/10] app/testpmd: add command line option for Tx offloads Shahaf Shuler
2017-12-12 12:52   ` [dpdk-dev] [PATCH v2 08/10] app/testpmd: remove txqflags Shahaf Shuler
2017-12-12 12:52   ` [dpdk-dev] [PATCH v2 09/10] app/testpmd: enforce offloads caps Shahaf Shuler
2017-12-12 12:52   ` [dpdk-dev] [PATCH v2 10/10] app/testpmd: fix on the flight VLAN configuration Shahaf Shuler
2017-12-26  9:44   ` [dpdk-dev] [PATCH v3 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler
2017-12-26  9:44     ` [dpdk-dev] [PATCH v3 01/10] app/testpmd: fix port configuration print Shahaf Shuler
2018-01-05  3:33       ` Lu, Wenzhuo
2017-12-26  9:44     ` [dpdk-dev] [PATCH v3 02/10] app/testpmd: convert to new Ethdev Rx offloads API Shahaf Shuler
2018-01-09  3:05       ` Lu, Wenzhuo
2018-01-19 19:30       ` Patil, Harish
2018-01-20 19:29         ` Shahaf Shuler
2017-12-26  9:44     ` [dpdk-dev] [PATCH v3 03/10] app/testpmd: support check of single port stop Shahaf Shuler
2018-01-09  3:20       ` Lu, Wenzhuo
2017-12-26  9:44     ` [dpdk-dev] [PATCH v3 04/10] app/testpmd: convert to new Ethdev Tx offloads API Shahaf Shuler
2018-01-09  5:27       ` Lu, Wenzhuo
2018-01-09  6:47         ` Shahaf Shuler
2018-01-09  7:13           ` Lu, Wenzhuo
2018-01-09 10:02             ` Shahaf Shuler
2018-01-09 11:37               ` Lu, Wenzhuo
2018-01-09 12:14                 ` Ananyev, Konstantin
2018-01-10  0:37                   ` Lu, Wenzhuo
2017-12-26  9:44     ` [dpdk-dev] [PATCH v3 05/10] app/testpmd: fix flowgen forwarding ol flags Shahaf Shuler
2018-01-09  5:35       ` Lu, Wenzhuo
2017-12-26  9:44     ` [dpdk-dev] [PATCH v3 06/10] app/testpmd: cleanup internal Tx offloads flags field Shahaf Shuler
2018-01-09  6:30       ` Lu, Wenzhuo
2017-12-26  9:44     ` [dpdk-dev] [PATCH v3 07/10] app/testpmd: add command line option for Tx offloads Shahaf Shuler
2017-12-26  9:44     ` [dpdk-dev] [PATCH v3 08/10] app/testpmd: remove txqflags Shahaf Shuler
2018-01-09  7:17       ` Lu, Wenzhuo
2018-01-09 10:07         ` Shahaf Shuler
2018-01-09 11:51           ` Lu, Wenzhuo
2017-12-26  9:44     ` [dpdk-dev] [PATCH v3 09/10] app/testpmd: enforce offloads caps Shahaf Shuler
2018-01-09  7:48       ` Lu, Wenzhuo
2017-12-26  9:44     ` [dpdk-dev] [PATCH v3 10/10] app/testpmd: fix on the flight VLAN configuration Shahaf Shuler
2018-01-09  8:05       ` Lu, Wenzhuo
2018-01-09 10:03         ` Shahaf Shuler
2018-01-09 11:44           ` Lu, Wenzhuo
2018-01-10  9:09 ` [dpdk-dev] [PATCH v4 00/11] convert testpmd to new ethdev offloads API Shahaf Shuler
2018-01-10  9:09   ` [dpdk-dev] [PATCH v4 01/11] app/testpmd: fix port configuration print Shahaf Shuler
2018-01-10  9:09   ` [dpdk-dev] [PATCH v4 02/11] app/testpmd: convert to new Ethdev Rx offloads API Shahaf Shuler
2018-01-10  9:09   ` [dpdk-dev] [PATCH v4 03/11] app/testpmd: support check of single port stop Shahaf Shuler
2018-01-10  9:09   ` [dpdk-dev] [PATCH v4 04/11] app/testpmd: convert to new Ethdev Tx offloads API Shahaf Shuler
2018-01-10  9:09   ` [dpdk-dev] [PATCH v4 05/11] app/testpmd: fix flowgen forwarding ol flags Shahaf Shuler
2018-01-10  9:09   ` Shahaf Shuler [this message]
2018-01-10  9:09   ` [dpdk-dev] [PATCH v4 07/11] app/testpmd: add command line option for Tx offloads Shahaf Shuler
2018-01-15  3:06     ` Lu, Wenzhuo
2018-01-10  9:09   ` [dpdk-dev] [PATCH v4 08/11] app/testpmd: remove txqflags Shahaf Shuler
2018-01-10  9:09   ` [dpdk-dev] [PATCH v4 09/11] app/testpmd: enforce offloads caps Shahaf Shuler
2018-01-10  9:09   ` [dpdk-dev] [PATCH v4 10/11] app/testpmd: adjust on the flight VLAN configuration Shahaf Shuler
2018-01-15  3:30     ` Lu, Wenzhuo
2018-01-10  9:09   ` [dpdk-dev] [PATCH v4 11/11] app/testpmd: enable fast free Tx offload by default Shahaf Shuler
2018-01-15  3:33     ` Lu, Wenzhuo
2018-01-15 10:00   ` [dpdk-dev] [PATCH v4 00/11] convert testpmd to new ethdev offloads API Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=73e30c58e430a803963c6a50a42c7d8d3b9a534e.1515575134.git.shahafs@mellanox.com \
    --to=shahafs@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jingjing.wu@intel.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).