From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 93372A0A0C;
	Thu, 22 Jul 2021 21:56:12 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 200054014D;
	Thu, 22 Jul 2021 21:56:12 +0200 (CEST)
Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com
 [64.147.123.21])
 by mails.dpdk.org (Postfix) with ESMTP id D7D9C40040;
 Thu, 22 Jul 2021 21:56:10 +0200 (CEST)
Received: from compute6.internal (compute6.nyi.internal [10.202.2.46])
 by mailout.west.internal (Postfix) with ESMTP id 6349A3200970;
 Thu, 22 Jul 2021 15:56:09 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute6.internal (MEProxy); Thu, 22 Jul 2021 15:56:10 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding:content-type; s=fm1; bh=
 JeqcNzLBqTmQPqv6hF0ylFKkL5/GfbfHeeZJep/SX4s=; b=SLF8vyZWYeTiOkp2
 2iGIKyktMp3yyAbm53nnVjT7Bvy0FZXgBkCbtXqnp5hMiNqdwMktzPO+dLoiOWPe
 5Jit3RXgosdwwrpEavIJpEvpaT4hU3epGjL/MWdUIqAy1NcpqzcUjRU501r3tpBX
 oWGyPaANVR7CAkb5WGBg53CErnO0W9LYXFcSed6puw54IkPHoSPjv/OrtJ13K8FX
 kIJ+gFbQ8cCj/lo1oJ3DyfyRBcwBc/mvwbQQkqgTYmY3SRBIY7pODsV38XXzmf++
 mLCeQxNTiLaJXizdwznuLRFTURrqGk5PLaxwtpvhxfkJjI7EA3Jkp4ZzWxmzv7iE
 HduKpw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :date:from:in-reply-to:message-id:mime-version:references
 :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender
 :x-sasl-enc; s=fm3; bh=JeqcNzLBqTmQPqv6hF0ylFKkL5/GfbfHeeZJep/SX
 4s=; b=H8/Dx3BDoRMOGBu4Is2Q14EE8ifzjVrBoExAIxVaf2RBQ9GocIqxWtdJt
 eiAE6NtxsGj4uNe0bXI90uP/YCPd6DEdCufNMw1QO39sZMeKqAziE5Bnb0TPsFoh
 SlU+46I/SuQqBx6sMQsR23AVf8xkd0w5el6EWynTfiVbdII3qiYGlnNL37Dd/z4H
 FGB3T3tE5UwgkiTqIWADWgAnuHcvdEb1m0B/nTA+ntj+oP3/BEyK0tnV3DO6qJ5d
 TXOvV0ulfxYSd04RSNA+o2vorfSwVmm9bPy8EpwrpBWmWJDewIo0Xa+ragUrhSKN
 cFfBDLO0CM45X2o1+s8iAzyxmXorA==
X-ME-Sender: <xms:V835YNfQn1_qd9AgwQa9KOr_dtsZvhzHBJSHZsQJZeWK141Axs2D_Q>
 <xme:V835YLMx14xQbP0BUIsF3-s7jaiJBC2apv2qtS0852wXKglj56MoZRfmkRWNp7VgU
 ndCsf5mFUho63pc5w>
X-ME-Received: <xmr:V835YGhTq1CkjUphfTZSJKyzelS2UhqfxUeBRk6-ESyhCFEjLcWy6v84xhzDFcZVnOIe-GXhpmYnTMnJuSdRlrFOWw>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrfeeigddufeefucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr
 shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg
 ftrfgrthhtvghrnhepudeggfdvfeduffdtfeeglefghfeukefgfffhueejtdetuedtjeeu
 ieeivdffgeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh
 homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth
X-ME-Proxy: <xmx:V835YG9fpZ7F8Y7-7AWt8RVeHRLmgm_4-SN30d3eOxYdZnE40WJe0Q>
 <xmx:V835YJsgv5h1W8t1NyXa5te6AgeJvS19A7ZVBqL2p0B-isn2y6gDUQ>
 <xmx:V835YFHAdrpuiB9C1xBdl63ygFwvmg2nlBLlNvjeOlM5-FrEafiYfw>
 <xmx:Wc35YNgZD3Qpt3QggBCap2-3SM2-ymqShdKaHOHMV0fek5ZMVuBSGQ>
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu,
 22 Jul 2021 15:56:07 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: Mohsin Kazmi <mohsin.kazmi14@gmail.com>
Cc: dev@dpdk.org, stable@dpdk.org, olivier.matz@6wind.com,
 david.marchand@redhat.com, maxime.coquelin@redhat.com,
 andrew.rybchenko@oktetlabs.ru, ferruh.yigit@intel.com
Date: Thu, 22 Jul 2021 21:56:25 +0200
Message-ID: <7265315.64hUE0sMR9@thomas>
In-Reply-To: <20210707094019.40945-1-mohsin.kazmi14@gmail.com>
References: <20210630110404.21209-1-mohsin.kazmi14@gmail.com>
 <20210707094019.40945-1-mohsin.kazmi14@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH v3] net: fix Intel-specific
 Prepare the outer ipv4 hdr for checksum
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

+Cc more people for reviews.

07/07/2021 11:40, Mohsin Kazmi:
> Preparation the headers for the hardware offload
> misses the outer ipv4 checksum offload.
> It results in bad checksum computed by hardware NIC.
> 
> This patch fixes the issue by setting the outer ipv4
> checksum field to 0.

nit: please write "IPv4" here and below.

> Fixes: 4fb7e803eb1a ("ethdev: add Tx preparation")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Mohsin Kazmi <mohsin.kazmi14@gmail.com>
> Acked-by: Qi Zhang <qi.z.zhang@intel.com>
[...]
> @@ -125,11 +125,22 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags)
>  	 * Mainly it is required to avoid fragmented headers check if
>  	 * no offloads are requested.
>  	 */
> -	if (!(ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_L4_MASK | PKT_TX_TCP_SEG)))
> +	if (!(ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_L4_MASK | PKT_TX_TCP_SEG |
> +			  PKT_TX_OUTER_IP_CKSUM)))
>  		return 0;
>  
> -	if (ol_flags & (PKT_TX_OUTER_IPV4 | PKT_TX_OUTER_IPV6))
> +	if (ol_flags & (PKT_TX_OUTER_IPV4 | PKT_TX_OUTER_IPV6)) {
>  		inner_l3_offset += m->outer_l2_len + m->outer_l3_len;
> +		/*
> +		 * prepare outer ipv4 header checksum by setting it to 0,
> +		 * in order to be computed by hardware NICs.
> +		 */
> +		if (ol_flags & PKT_TX_OUTER_IP_CKSUM) {
> +			ipv4_hdr = rte_pktmbuf_mtod_offset(m,
> +					struct rte_ipv4_hdr *, m->outer_l2_len);
> +			ipv4_hdr->hdr_checksum = 0;
> +		}
> +	}