DPDK patches and discussions
 help / color / mirror / Atom feed
From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org, pablo.de.lara.guarch@intel.com
Cc: thomas.monjalon@6wind.com
Subject: [dpdk-dev] [PATCH v6 5/8] app/testpmd: do not change ip addrs in csum engine
Date: Wed, 12 Oct 2016 17:39:47 +0200	[thread overview]
Message-ID: <1476286790-26271-6-git-send-email-olivier.matz@6wind.com> (raw)
In-Reply-To: <1476286790-26271-1-git-send-email-olivier.matz@6wind.com>

The csum forward engine was updated to change the IP addresses in the
packet data in
commit 51f694dd40f5 ("app/testpmd: rework checksum forward engine")

This was done to ensure that the checksum is correctly reprocessed when
using hardware checksum offload. But the functions
process_inner_cksums() and process_outer_cksums() already reset the
checksum field to 0, so this is not necessary.

Moreover, this makes the engine more complex than needed, and prevents
to easily use it to forward traffic (like iperf) as it modifies the
packets.

This patch drops this behavior.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 app/test-pmd/csumonly.c | 27 ++-------------------------
 1 file changed, 2 insertions(+), 25 deletions(-)

diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index 42974d5..34d4b11 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -318,21 +318,6 @@ parse_encap_ip(void *encap_ip, struct testpmd_offload_info *info)
 	info->l2_len = 0;
 }
 
-/* modify the IPv4 or IPv4 source address of a packet */
-static void
-change_ip_addresses(void *l3_hdr, uint16_t ethertype)
-{
-	struct ipv4_hdr *ipv4_hdr = l3_hdr;
-	struct ipv6_hdr *ipv6_hdr = l3_hdr;
-
-	if (ethertype == _htons(ETHER_TYPE_IPv4)) {
-		ipv4_hdr->src_addr =
-			rte_cpu_to_be_32(rte_be_to_cpu_32(ipv4_hdr->src_addr) + 1);
-	} else if (ethertype == _htons(ETHER_TYPE_IPv6)) {
-		ipv6_hdr->src_addr[15] = ipv6_hdr->src_addr[15] + 1;
-	}
-}
-
 /* if possible, calculate the checksum of a packet in hw or sw,
  * depending on the testpmd command line configuration */
 static uint64_t
@@ -620,7 +605,6 @@ pkt_copy_split(const struct rte_mbuf *pkt)
  * Receive a burst of packets, and for each packet:
  *  - parse packet, and try to recognize a supported packet type (1)
  *  - if it's not a supported packet type, don't touch the packet, else:
- *  - modify the IPs in inner headers and in outer headers if any
  *  - reprocess the checksum of all supported layers. This is done in SW
  *    or HW, depending on testpmd command line configuration
  *  - if TSO is enabled in testpmd command line, also flag the mbuf for TCP
@@ -747,14 +731,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 			l3_hdr = (char *)l3_hdr + info.outer_l3_len + info.l2_len;
 		}
 
-		/* step 2: change all source IPs (v4 or v6) so we need
-		 * to recompute the chksums even if they were correct */
-
-		change_ip_addresses(l3_hdr, info.ethertype);
-		if (info.is_tunnel == 1)
-			change_ip_addresses(outer_l3_hdr, info.outer_ethertype);
-
-		/* step 3: depending on user command line configuration,
+		/* step 2: depending on user command line configuration,
 		 * recompute checksum either in software or flag the
 		 * mbuf to offload the calculation to the NIC. If TSO
 		 * is configured, prepare the mbuf for TCP segmentation. */
@@ -772,7 +749,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 					!!(tx_ol_flags & PKT_TX_TCP_SEG));
 		}
 
-		/* step 4: fill the mbuf meta data (flags and header lengths) */
+		/* step 3: fill the mbuf meta data (flags and header lengths) */
 
 		if (info.is_tunnel == 1) {
 			if (info.tunnel_tso_segsz ||
-- 
2.8.1

  parent reply	other threads:[~2016-10-12 15:40 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-09  7:55 [dpdk-dev] [PATCH v2 0/8] Misc enhancements in testpmd Olivier Matz
2016-09-09  7:55 ` [dpdk-dev] [PATCH v2 1/8] mbuf: add function to dump ol flag list Olivier Matz
2016-10-05  6:45   ` De Lara Guarch, Pablo
2016-10-05 14:19     ` Olivier Matz
2016-10-06  8:42   ` [dpdk-dev] [PATCH v3] " Olivier Matz
2016-10-07  3:51     ` De Lara Guarch, Pablo
2016-10-07 15:39       ` Olivier Matz
2016-09-09  7:55 ` [dpdk-dev] [PATCH v2 2/8] app/testpmd: use new function to dump offload flags Olivier Matz
2016-09-09  7:55 ` [dpdk-dev] [PATCH v2 3/8] app/testpmd: dump rx flags in csum engine Olivier Matz
2016-09-09  7:55 ` [dpdk-dev] [PATCH v2 4/8] app/testpmd: add option to enable lro Olivier Matz
2016-10-05  6:26   ` De Lara Guarch, Pablo
2016-10-05 14:18     ` Olivier Matz
2016-10-06  8:44   ` [dpdk-dev] [PATCH v3] " Olivier Matz
2016-10-06  8:47     ` [dpdk-dev] [PATCH v4] " Olivier Matz
2016-09-09  7:55 ` [dpdk-dev] [PATCH v2 5/8] app/testpmd: do not change ip addrs in csum engine Olivier Matz
2016-09-09  7:55 ` [dpdk-dev] [PATCH v2 6/8] app/testpmd: display rx port " Olivier Matz
2016-09-09  7:55 ` [dpdk-dev] [PATCH v2 7/8] app/testpmd: don't use tso if packet is too small Olivier Matz
2016-09-09  7:55 ` [dpdk-dev] [PATCH v2 8/8] app/testpmd: hide segsize when unrelevant in csum engine Olivier Matz
2016-10-03  9:02 ` [dpdk-dev] [PATCH v2 0/8] Misc enhancements in testpmd Olivier Matz
2016-10-07 16:05 ` [dpdk-dev] [PATCH v5 " Olivier Matz
2016-10-07 16:05   ` [dpdk-dev] [PATCH v5 1/8] mbuf: add function to dump ol flag list Olivier Matz
2016-10-11 20:42     ` Thomas Monjalon
2016-10-07 16:05   ` [dpdk-dev] [PATCH v5 2/8] app/testpmd: use new function to dump offload flags Olivier Matz
2016-10-07 16:05   ` [dpdk-dev] [PATCH v5 3/8] app/testpmd: dump Rx flags in csum engine Olivier Matz
2016-10-07 16:05   ` [dpdk-dev] [PATCH v5 4/8] app/testpmd: add option to enable lro Olivier Matz
2016-10-07 16:05   ` [dpdk-dev] [PATCH v5 5/8] app/testpmd: do not change ip addrs in csum engine Olivier Matz
2016-10-07 16:05   ` [dpdk-dev] [PATCH v5 6/8] app/testpmd: display Rx port " Olivier Matz
2016-10-07 16:05   ` [dpdk-dev] [PATCH v5 7/8] app/testpmd: don't use tso if packet is too small Olivier Matz
2016-10-07 16:05   ` [dpdk-dev] [PATCH v5 8/8] app/testpmd: hide segsize when unrelevant in csum engine Olivier Matz
2016-10-11 18:13   ` [dpdk-dev] [PATCH v5 0/8] Misc enhancements in testpmd De Lara Guarch, Pablo
2016-10-12 15:39   ` [dpdk-dev] [PATCH v6 " Olivier Matz
2016-10-12 15:39     ` [dpdk-dev] [PATCH v6 1/8] mbuf: add function to dump ol flag list Olivier Matz
2016-10-12 15:39     ` [dpdk-dev] [PATCH v6 2/8] app/testpmd: use new function to dump offload flags Olivier Matz
2016-10-12 15:39     ` [dpdk-dev] [PATCH v6 3/8] app/testpmd: dump Rx flags in csum engine Olivier Matz
2016-10-12 15:39     ` [dpdk-dev] [PATCH v6 4/8] app/testpmd: add option to enable lro Olivier Matz
2016-10-12 15:39     ` Olivier Matz [this message]
2016-10-12 15:39     ` [dpdk-dev] [PATCH v6 6/8] app/testpmd: display Rx port in csum engine Olivier Matz
2016-10-12 15:39     ` [dpdk-dev] [PATCH v6 7/8] app/testpmd: don't use tso if packet is too small Olivier Matz
2016-10-12 15:39     ` [dpdk-dev] [PATCH v6 8/8] app/testpmd: hide segsize when unrelevant in csum engine Olivier Matz
2016-10-12 16:41     ` [dpdk-dev] [PATCH v6 0/8] Misc enhancements in testpmd 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=1476286790-26271-6-git-send-email-olivier.matz@6wind.com \
    --to=olivier.matz@6wind.com \
    --cc=dev@dpdk.org \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=thomas.monjalon@6wind.com \
    /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).