From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <olivier.matz@6wind.com>
Received: from mail-we0-f180.google.com (mail-we0-f180.google.com
 [74.125.82.180]) by dpdk.org (Postfix) with ESMTP id 7075F234
 for <dev@dpdk.org>; Fri, 30 Jan 2015 14:16:34 +0100 (CET)
Received: by mail-we0-f180.google.com with SMTP id m14so27089216wev.11
 for <dev@dpdk.org>; Fri, 30 Jan 2015 05:16:34 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references;
 bh=io3gGQV/uRD2i1pVtV5PyumS1azPJyOR5Cky1opwAk0=;
 b=WMp2Pqxdt38wWsu83GVP67ipQPxTPt645/v6fiAlFb4DFecHP2pcF4NeQKFOe9MpTC
 wJNtUSsS6PXffIbsFFlF9+eXZSygG+AzMq8kmi7JJA0sfv4+XWo5tqpjVq9ez5ZYxV2K
 WhERPooZfLs/g8IQjOcz9SkUJOQqlYDn8D5XU8rmTWU5UaB5GV0UpURNPIPz6eV0HTJy
 NOnQVJ/fL/ZiKvvFoF5muEAGjXp8CjRI3/5IwtV+FeiEHPsCY+q8cHIiIDnZ43mDCdUU
 nOHFDRVvrTpycCyUu9PqAPyc4AEbDTV74QKpHVxXtwTKxoQpwphZC79mCqGi83fTiGjw
 5iBg==
X-Gm-Message-State: ALoCoQlQR6iwYrJtyaH0u96tCSL1G8otK7OLv+Hjs+umU/lKGnzoJ5dVfuV35+viXvo0Yva7y2t7
X-Received: by 10.194.2.34 with SMTP id 2mr12378066wjr.58.1422623794339;
 Fri, 30 Jan 2015 05:16:34 -0800 (PST)
Received: from glumotte.dev.6wind.com (6wind.net2.nerim.net. [213.41.180.237])
 by mx.google.com with ESMTPSA id
 li7sm6911300wic.4.2015.01.30.05.16.33
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
 Fri, 30 Jan 2015 05:16:33 -0800 (PST)
From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org
Date: Fri, 30 Jan 2015 14:15:59 +0100
Message-Id: <1422623775-8050-5-git-send-email-olivier.matz@6wind.com>
X-Mailer: git-send-email 2.1.4
In-Reply-To: <1422623775-8050-1-git-send-email-olivier.matz@6wind.com>
References: <1421883395-27235-1-git-send-email-olivier.matz@6wind.com>
 <1422623775-8050-1-git-send-email-olivier.matz@6wind.com>
Subject: [dpdk-dev] [PATCH 04/20] i40e: remove the use of
	PKT_TX_UDP_TUNNEL_PKT flag
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 30 Jan 2015 13:16:35 -0000

The definition of the flag in rte_mbuf.h was:
  TX packet is an UDP tunneled packet. It must be specified when using
  outer checksum offload (PKT_TX_OUTER_IP_CKSUM)

This flag was used to tell the NIC that the offload type is UDP
(I40E_TXD_CTX_UDP_TUNNELING flag). In the datasheet, it says it's
required to specify the tunnel type in the register. However, some tests
(see [1]) showed that it also works without this flag.

Moreover, it is not explained how the hardware use this
information. From a network perspective, this information is useless for
calculating the outer IP checksum as it does not depend on the payload.

Having this flag in the API would force the application to specify the
tunnel type for something that looks only useful for this PMD. It will
limit the number of possible tunnel types (we would need a flag for each
tunnel type) and therefore prevent to support outer IP checksum for
proprietary tunnels.

Finally, if a hardware advertises "I support outer IP checksum", it must
be supported for any payload types.

This has been validated by [2], knowing that the ipip test case was fixed
after this test report [3].

[1] http://dpdk.org/ml/archives/dev/2015-January/011380.html
[2] http://dpdk.org/ml/archives/dev/2015-January/011475.html
[3] http://dpdk.org/ml/archives/dev/2015-January/011610.html

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 lib/librte_pmd_i40e/i40e_rxtx.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/librte_pmd_i40e/i40e_rxtx.c b/lib/librte_pmd_i40e/i40e_rxtx.c
index 9acdeee..0786255 100644
--- a/lib/librte_pmd_i40e/i40e_rxtx.c
+++ b/lib/librte_pmd_i40e/i40e_rxtx.c
@@ -482,7 +482,7 @@ i40e_txd_enable_checksum(uint64_t ol_flags,
 	}
 
 	/* UDP tunneling packet TX checksum offload */
-	if (unlikely(ol_flags & PKT_TX_UDP_TUNNEL_PKT)) {
+	if (unlikely(ol_flags & PKT_TX_OUTER_IP_CKSUM)) {
 
 		*td_offset |= (outer_l2_len >> 1)
 				<< I40E_TX_DESC_LENGTH_MACLEN_SHIFT;
@@ -497,7 +497,6 @@ i40e_txd_enable_checksum(uint64_t ol_flags,
 		/* Now set the ctx descriptor fields */
 		*cd_tunneling |= (outer_l3_len >> 2) <<
 				I40E_TXD_CTX_QW0_EXT_IPLEN_SHIFT |
-				I40E_TXD_CTX_UDP_TUNNELING |
 				(l2_len >> 1) <<
 				I40E_TXD_CTX_QW0_NATLEN_SHIFT;
 
@@ -1165,8 +1164,7 @@ i40e_calc_context_desc(uint64_t flags)
 {
 	uint64_t mask = 0ULL;
 
-	if (flags | PKT_TX_UDP_TUNNEL_PKT)
-		mask |= PKT_TX_UDP_TUNNEL_PKT;
+	mask |= PKT_TX_OUTER_IP_CKSUM;
 
 #ifdef RTE_LIBRTE_IEEE1588
 	mask |= PKT_TX_IEEE1588_TMST;
-- 
2.1.4