From patchwork Thu Apr 18 08:20:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 139485 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 185C243E9E; Thu, 18 Apr 2024 10:21:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2086240ED2; Thu, 18 Apr 2024 10:20:55 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 9F37140ECF for ; Thu, 18 Apr 2024 10:20:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713428453; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AbY1bjB/FNwTyGqJGT/MAqOZTsm6Hg/hwgrAb+x1vcM=; b=BTL7Da/q0W9makn7SyBe4Ypyz1pXNpDNu9LT2UKNf777vA+KPjvyFuz4yePI5HNU7NJhFd vtyFi5AARG3v+3+K8/81vbC5ZxFgCTuavovvsQg7LAho7nAUQishHTvLdaSCyd3HVlYcKW i6wbAYMW6WxM6fvTQBceZK/5zaoQoCI= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-448-m0NgL3DIPja7W0gUM487qw-1; Thu, 18 Apr 2024 04:20:49 -0400 X-MC-Unique: m0NgL3DIPja7W0gUM487qw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 797E83C1015E; Thu, 18 Apr 2024 08:20:49 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.225.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id 65E4D35430; Thu, 18 Apr 2024 08:20:47 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, ferruh.yigit@amd.com, stable@dpdk.org, Jun Wang , Yuying Zhang , Jie Wang , Beilei Xing Subject: [PATCH v3 5/7] net/i40e: fix outer UDP checksum offload for X710 Date: Thu, 18 Apr 2024 10:20:19 +0200 Message-ID: <20240418082023.1767998-6-david.marchand@redhat.com> In-Reply-To: <20240418082023.1767998-1-david.marchand@redhat.com> References: <20240405125039.897933-1-david.marchand@redhat.com> <20240418082023.1767998-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org According to the X710 datasheet (and confirmed on the field..), X710 devices do not support outer checksum offload. """ 8.4.4.2 Transmit L3 and L4 Integrity Offload Tunneling UDP headers and GRE header are not offloaded while the X710/XXV710/XL710 leaves their checksum field as is. If a checksum is required, software should provide it as well as the inner checksum value(s) that are required for the outer checksum. """ Fix Tx offload capabilities according to the hardware. X722 may support such offload by setting I40E_TXD_CTX_QW0_L4T_CS_MASK. Bugzilla ID: 1406 Fixes: 8cc79a1636cd ("net/i40e: fix forward outer IPv6 VXLAN") Cc: stable@dpdk.org Reported-by: Jun Wang Signed-off-by: David Marchand --- Note: I do not have X722 nic. Please Intel devs, check for both X710 and X722 series. Changes since v1: - fix inverted check, --- .mailmap | 1 + drivers/net/i40e/i40e_ethdev.c | 6 +++++- drivers/net/i40e/i40e_rxtx.c | 9 +++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index 3843868716..091766eca7 100644 --- a/.mailmap +++ b/.mailmap @@ -719,6 +719,7 @@ Junjie Wan Jun Qiu Jun W Zhou Junxiao Shi +Jun Wang Jun Yang Junyu Jiang Juraj Linkeš diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 380ce1a720..6535c7c178 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -3862,8 +3862,12 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO | RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO | RTE_ETH_TX_OFFLOAD_MULTI_SEGS | - RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM | dev_info->tx_queue_offload_capa; + if (hw->mac.type == I40E_MAC_X722) { + dev_info->tx_offload_capa |= + RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM; + } + dev_info->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP | RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP; diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 5d25ab4d3a..b4f7599cfc 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -295,6 +295,15 @@ i40e_parse_tunneling_params(uint64_t ol_flags, */ *cd_tunneling |= (tx_offload.l2_len >> 1) << I40E_TXD_CTX_QW0_NATLEN_SHIFT; + + /** + * Calculate the tunneling UDP checksum (only supported with X722). + * Shall be set only if L4TUNT = 01b and EIPT is not zero + */ + if ((*cd_tunneling & I40E_TXD_CTX_QW0_EXT_IP_MASK) && + (*cd_tunneling & I40E_TXD_CTX_UDP_TUNNELING) && + (ol_flags & RTE_MBUF_F_TX_OUTER_UDP_CKSUM)) + *cd_tunneling |= I40E_TXD_CTX_QW0_L4T_CS_MASK; } static inline void