From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from m15-50.126.com (m15-50.126.com [220.181.15.50]) by dpdk.org (Postfix) with ESMTP id BA9162EDA for ; Mon, 25 May 2015 12:50:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=Date:From:Subject:MIME-Version:Message-ID; bh=/xfaV Hw0djsQt8b9wKoygUHYxUORznsKBgbGGD5wzLg=; b=Z/83nHjrhgXfl2Rlq8Zo/ Vu/6xwglxB6f2lnG5+3gzyH2sAXiJ4jnhclmnZyG+F94nuS+slCU0WOAEuw9SemZ ZgAfyyFFIOYlbeOhlWzT8+hd/lRPcTr3Ug81EBIbWD29YnTK3oL+4T1DHp1ENyfo Q3MQ+zrg45i+2uLTVtzaWc= Received: from dpdkdev$126.com ( [60.10.97.110] ) by ajax-webmail-wmsvr50 (Coremail) ; Mon, 25 May 2015 18:50:49 +0800 (CST) X-Originating-IP: [60.10.97.110] Date: Mon, 25 May 2015 18:50:49 +0800 (CST) From: "Tim Deng" To: "Bruce Richardson" X-Priority: 3 X-Mailer: Coremail Webmail Server Version SP_ntes V3.5 build 20150119(59087.7062) Copyright (c) 2002-2015 www.mailtech.cn 126com In-Reply-To: <20150525102848.GA8820@bricha3-MOBL3> References: <7b3bcfdc.ee97.14d8a91d9e4.Coremail.dpdkdev@126.com> <20150525102848.GA8820@bricha3-MOBL3> X-CM-CTRLDATA: T8u1BWZvb3Rlcl9odG09MTQzMDo4MQ== MIME-Version: 1.0 Message-ID: <6846b5e9.f47c.14d8ab24a93.Coremail.dpdkdev@126.com> X-CM-TRANSID: MsqowABXZmaK_mJVBiDrAA--.3860W X-CM-SenderInfo: pgsgyvlhy6ij2wof0z/1tbiwQoFolUwz5J4-gAAsS X-Coremail-Antispam: 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU== Content-Type: text/plain; charset=GBK Content-Transfer-Encoding: base64 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] ixgbe tcp cksum offload X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2015 10:50:53 -0000 VGhhbmtzIEJydWNlIHNvIG11Y2ghIFRoYXQgcGVyZmVjdGx5IHNvbHZlcyBteSBwcm9ibGVtLgpU aW0KCgpBdCAyMDE1LTA1LTI1IDE4OjI4OjQ4LCAiQnJ1Y2UgUmljaGFyZHNvbiIgPGJydWNlLnJp Y2hhcmRzb25AaW50ZWwuY29tPiB3cm90ZToKPk9uIE1vbiwgTWF5IDI1LCAyMDE1IGF0IDA2OjE1 OjIzUE0gKzA4MDAsIFRpbSBEZW5nIHdyb3RlOgo+PiBIaSwKPj4gCj4+IAo+PiBJIGFtIHRyeWlu ZyB0byB1c2UgaXhnYmUgdGNwIGNrc3VtIGgvdyBvZmZsb2FkIGJ5IGZvbGxvd2luZyBzdGVwczoK Pj4gLSBwb3B1bGF0ZSBwc2V1ZG8gY2tzdW0KPj4gLSBzZXQgbDJfbGVuLCBsM19sZW4sIGw0X2xl bgo+PiAtIHNldCBvbF9mbGFncwo+PiAKPj4gCj4+IEJ1dCBJIGZvdW5kIHRoZSBwa3QgZG9lc24n dCBnZXQgcmlnaHQgaC93IGNoZWNrc3VtIGJ5IHNuaWZmaW5nIG9uIHJlY3Ygc2lkZSwgYW5kIFRD UCBja3N1bSBzdGlsbCBsZWF2ZSB3aXRoIHRoZSBvcmlnaW5hbCBwc2V1ZG8gY2tzdW0uIAo+PiBB bmQgSSB2ZXJpZmllZCB0aG9zZSBtZXRhIGFyZSBjb3JyZWN0bHkgc2V0LCBlLmcuIGEgVENQIHN5 biBwa3Q6Cj4+IGwyX2xlbiA9IDE0LCBsM19sZW4gPSAyMCwgbDRfbGVuID0gNDAgKHdpdGggc29t ZSB0Y3Agb3B0aW9ucyksCj4+IGFuZCBvbF9mbGFncyA9IDB4OTAwMDAwMDAwMDAwMDAgd2hpY2gg bWVhbnMgUEtUX1RYX0lQVjQgfCBQS1RfVFhfVENQX0NLU1VNCj4+IAo+PiAKPj4gRGlkIEkgbWlz cyBhbnkgc3RlcD8KPj4gCj4+IAo+PiBUaGFua3MgaW4gYWR2YW5jZSwKPj4gVGltCj4+IAo+Q2hl Y2sgdGhhdCB5b3UgaGF2ZSBub3QgZ290IFRYIG9mZmxvYWRzIGRpc2FibGVkIGluIHlvdXIgcG9y dCBjb25maWd1cmF0aW9uLiBJZgo+eW91IHBhc3MgaW4gTlVMTCBmb3IgdGhlIHJ0ZV9ldGhfdHhj b25mIHBvaW50ZXIgb24gdHggcXVldWUgc2V0dXAsIHRoZW4gb2ZmbG9hZHMKPndpbGwgYmUgZGlz YWJsZWQuIFRvIGdldCBvZmZsb2FkcyBzdWNoIGFzIGNoZWNrc3VtcyB0byB3b3JrLCB5b3UgbmVl ZCB0byBleHBsaWNpdGx5Cj5zZXQgdGhlIGZsYWdzIHRvIGFsbG93IHRoZW0uIChHZW5lcmFsbHks IHRoaXMgbWVhbnMganVzdCBzZXR0aW5nIHR4cWZsYWdzIHRvIDApCj4KPlJlZ2FyZHMsCj4vQnJ1 Y2UKPgo= >From olivier.matz@6wind.com Mon May 25 13:40:30 2015 Return-Path: Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67]) by dpdk.org (Postfix) with ESMTP id A0A42C316 for ; Mon, 25 May 2015 13:40:30 +0200 (CEST) Received: from was59-1-82-226-113-214.fbx.proxad.net ([82.226.113.214] helo=[192.168.0.10]) by mail.droids-corp.org with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1YwqoY-0007Lw-9m; Mon, 25 May 2015 13:45:06 +0200 Message-ID: <55630A3E.5080708@6wind.com> Date: Mon, 25 May 2015 13:40:46 +0200 From: Olivier MATZ User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.6.0 MIME-Version: 1.0 To: Adrien Mazarguil , dev@dpdk.org References: <1432292852-15701-2-git-send-email-adrien.mazarguil@6wind.com> <1432314192-17828-1-git-send-email-adrien.mazarguil@6wind.com> In-Reply-To: <1432314192-17828-1-git-send-email-adrien.mazarguil@6wind.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2] app/testpmd: compute checksum in icmpecho replies X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2015 11:40:30 -0000 Hi Adrien, On 05/22/2015 07:03 PM, Adrien Mazarguil wrote: > ICMP echo replies with invalid checksums may be dropped by network nodes or > ignored by the ping utility. > > Signed-off-by: Adrien Mazarguil > Acked-by: Ivan Boule Acked-by: Olivier Matz > --- > > v2: > - Compute correct checksum value by taking overflow into account. > > app/test-pmd/icmpecho.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c > index c5933f4..e249e71 100644 > --- a/app/test-pmd/icmpecho.c > +++ b/app/test-pmd/icmpecho.c > @@ -295,6 +295,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) > uint16_t vlan_id; > uint16_t arp_op; > uint16_t arp_pro; > + uint32_t cksum; > uint8_t i; > int l2_len; > #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES > @@ -445,7 +446,8 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) > * - switch IPv4 source and destinations addresses, > * - set IP_ICMP_ECHO_REPLY in ICMP header. > * No need to re-compute the IP header checksum. > - * Reset ICMP checksum. > + * ICMP checksum is computed by assuming it is valid in the > + * echo request and not verified. > */ > ether_addr_copy(ð_h->s_addr, ð_addr); > ether_addr_copy(ð_h->d_addr, ð_h->s_addr); > @@ -454,7 +456,12 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) > ip_h->src_addr = ip_h->dst_addr; > ip_h->dst_addr = ip_addr; > icmp_h->icmp_type = IP_ICMP_ECHO_REPLY; > - icmp_h->icmp_cksum = 0; > + cksum = ~icmp_h->icmp_cksum & 0xffff; > + cksum += ~htons(IP_ICMP_ECHO_REQUEST << 8) & 0xffff; > + cksum += htons(IP_ICMP_ECHO_REPLY << 8); > + cksum = (cksum & 0xffff) + (cksum >> 16); > + cksum = (cksum & 0xffff) + (cksum >> 16); > + icmp_h->icmp_cksum = ~cksum; > pkts_burst[nb_replies++] = pkt; > } > >