From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 4C18B2C63 for ; Mon, 26 Sep 2016 15:28:31 +0200 (CEST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP; 26 Sep 2016 06:28:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,399,1470726000"; d="scan'208";a="13788901" Received: from smonroyx-mobl.ger.corp.intel.com (HELO [10.237.220.54]) ([10.237.220.54]) by orsmga004.jf.intel.com with ESMTP; 26 Sep 2016 06:28:29 -0700 To: akhil.goyal@nxp.com, dev@dpdk.org References: <20160926163300.22990-1-akhil.goyal@nxp.com> From: Sergio Gonzalez Monroy Message-ID: Date: Mon, 26 Sep 2016 14:28:28 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <20160926163300.22990-1-akhil.goyal@nxp.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] examples/ipsec-secgw: Update checksum while decrementing ttl 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, 26 Sep 2016 13:28:31 -0000 Hi Akhil, This application relies on checksum offload in both outbound and inbound paths (PKT_TX_IP_CKSUM flag). Because we assume that we always forward the packet in both paths, we decrement the ttl in both inbound and outbound. You seem to only increment (recalculate) the checksum of the inner IP header in the outbound path but not the inbound path. Also, in the inbound path you have to consider a possible ECN value update. Sergio On 26/09/2016 17:32, akhil.goyal@nxp.com wrote: > From: Akhil Goyal > > In IPsec-secgw application when TTL is decremented in IP header > before forwarding the packet, checksum needs to be updated. > > In this patch an incremental checksum is added. > Other applications(like l3fwd) are also doing so. > > Signed-off-by: Akhil Goyal > --- > examples/ipsec-secgw/ipip.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/examples/ipsec-secgw/ipip.h b/examples/ipsec-secgw/ipip.h > index ff1dccd..ef059a9 100644 > --- a/examples/ipsec-secgw/ipip.h > +++ b/examples/ipsec-secgw/ipip.h > @@ -56,6 +56,7 @@ ipip_outbound(struct rte_mbuf *m, uint32_t offset, uint32_t is_ipv6, > if (inip4->ip_v == IPVERSION) { > /* XXX This should be done by the forwarding engine instead */ > inip4->ip_ttl -= 1; > + inip4->ip_sum += 1; > ds_ecn = inip4->ip_tos; > } else { > inip6 = (struct ip6_hdr *)inip4;