From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1EE36A0350; Mon, 28 Feb 2022 04:27:39 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0EABC4115A; Mon, 28 Feb 2022 04:27:39 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 51D7341159; Mon, 28 Feb 2022 04:27:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646018856; x=1677554856; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=648svn+Or4XAv6jeyNME5B9Bp21RaG3ok0dJJMVD1iM=; b=gVoq4N2XzZevUnWh2IU4z2dj7ntW/tdV0KEHeI7icUTdrhREeENpqd1U 0P10WQ5WxkBbioOp+cTiyXCWCryfVhvVpWsguxW57pS4EsUvgl4w59RL+ Zh+hSz83OfcK8CxGUseKyI3rlp3JeJzy1uLg9kY1T6t/wpoC/RLbm5dM9 lWsFeJVz0IKHyrH20n5AbjPW22Ngx3c0sIJnI0KUGRHhku/URYNoluZ7i GQXOJxZSBmPY8S3AVjbM4rt0kjyN5UwpY4KArEHyTgIjghqs1q+S7W3fB nr/D/X3QwYTfOW7PBJv2AI6evdWDiVkBYxTCI6Pavq0qVL0dqWewqSLK6 A==; X-IronPort-AV: E=McAfee;i="6200,9189,10271"; a="240203517" X-IronPort-AV: E=Sophos;i="5.90,142,1643702400"; d="scan'208";a="240203517" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2022 19:27:35 -0800 X-IronPort-AV: E=Sophos;i="5.90,142,1643702400"; d="scan'208";a="550057536" Received: from intel-cd-odc-kevin.cd.intel.com ([10.240.178.191]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2022 19:27:33 -0800 From: Kevin Liu To: dev@dpdk.org Cc: qiming.yang@intel.com, qi.z.zhang@intel.com, stevex.yang@intel.com, ferruh.yigit@intel.com, Kevin Liu , stable@dpdk.org Subject: [PATCH v2 1/2] net/ice: fix Tx offload path choice Date: Wed, 29 Dec 2021 09:37:01 +0000 Message-Id: <20211229093702.1930214-2-kevinx.liu@intel.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211229093702.1930214-1-kevinx.liu@intel.com> References: <20211224150925.3296471-1-kevinx.liu@intel.com> <20211229093702.1930214-1-kevinx.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Testpmd forwards packets in checksum mode that it needs to calculate the checksum of each layer's protocol. When setting the hardware calculates the outer UDP checksum and the software calculates the outer IP checksum, the dev->tx_pkt_burst in ice_set_tx_function is set to ice_xmit_pkts_vec_avx2. The inner and outer UDP checksum of the tunnel packet after forwarding is wrong.The dev->tx_pkt_burst should be set to ice_xmit_pkts. The patch adds RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM to ICE_TX_NO_VECTOR_FLAGS,set dev->tx_pkt_burst to ice_xmit_pkts.After the tunnel packet is forwarded, the inner and outer UDP checksum is correct. At the same time, the patch of "net/ice: fix Tx Checksum offload" will cause interrupt errors in a special case that only inner IP and inner UDP checksum are set for hardware calculation.The patch is updating ICE_TX_NO_VECTOR_FLAGS, the problem can be solved, so I will restore the code modification of that patch. Fixes: 28f9002ab67f ("net/ice: add Tx AVX512 offload path") Fixes: 295968d17407 ("ethdev: add namespace") Fixes: 17c7d0f9d6a4 ("net/ice: support basic Rx/Tx") Cc: stable@dpdk.org Signed-off-by: Kevin Liu --- drivers/net/ice/ice_rxtx.c | 41 ++++++------------- drivers/net/ice/ice_rxtx_vec_common.h | 59 +++++++++------------------ 2 files changed, 31 insertions(+), 69 deletions(-) diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 4f218bcd0d..041f4bc91f 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -2501,35 +2501,18 @@ ice_txd_enable_checksum(uint64_t ol_flags, << ICE_TX_DESC_LEN_MACLEN_S; /* Enable L3 checksum offloads */ - /*Tunnel package usage outer len enable L3 checksum offload*/ - if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) { - if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) { - *td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM; - *td_offset |= (tx_offload.outer_l3_len >> 2) << - ICE_TX_DESC_LEN_IPLEN_S; - } else if (ol_flags & RTE_MBUF_F_TX_IPV4) { - *td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4; - *td_offset |= (tx_offload.outer_l3_len >> 2) << - ICE_TX_DESC_LEN_IPLEN_S; - } else if (ol_flags & RTE_MBUF_F_TX_IPV6) { - *td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6; - *td_offset |= (tx_offload.outer_l3_len >> 2) << - ICE_TX_DESC_LEN_IPLEN_S; - } - } else { - if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) { - *td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM; - *td_offset |= (tx_offload.l3_len >> 2) << - ICE_TX_DESC_LEN_IPLEN_S; - } else if (ol_flags & RTE_MBUF_F_TX_IPV4) { - *td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4; - *td_offset |= (tx_offload.l3_len >> 2) << - ICE_TX_DESC_LEN_IPLEN_S; - } else if (ol_flags & RTE_MBUF_F_TX_IPV6) { - *td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6; - *td_offset |= (tx_offload.l3_len >> 2) << - ICE_TX_DESC_LEN_IPLEN_S; - } + if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) { + *td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM; + *td_offset |= (tx_offload.l3_len >> 2) << + ICE_TX_DESC_LEN_IPLEN_S; + } else if (ol_flags & RTE_MBUF_F_TX_IPV4) { + *td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4; + *td_offset |= (tx_offload.l3_len >> 2) << + ICE_TX_DESC_LEN_IPLEN_S; + } else if (ol_flags & RTE_MBUF_F_TX_IPV6) { + *td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6; + *td_offset |= (tx_offload.l3_len >> 2) << + ICE_TX_DESC_LEN_IPLEN_S; } if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) { diff --git a/drivers/net/ice/ice_rxtx_vec_common.h b/drivers/net/ice/ice_rxtx_vec_common.h index 8ff01046e1..2dd2d83650 100644 --- a/drivers/net/ice/ice_rxtx_vec_common.h +++ b/drivers/net/ice/ice_rxtx_vec_common.h @@ -250,7 +250,8 @@ ice_rxq_vec_setup_default(struct ice_rx_queue *rxq) #define ICE_TX_NO_VECTOR_FLAGS ( \ RTE_ETH_TX_OFFLOAD_MULTI_SEGS | \ RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM | \ - RTE_ETH_TX_OFFLOAD_TCP_TSO) + RTE_ETH_TX_OFFLOAD_TCP_TSO | \ + RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM) #define ICE_TX_VECTOR_OFFLOAD ( \ RTE_ETH_TX_OFFLOAD_VLAN_INSERT | \ @@ -364,45 +365,23 @@ ice_txd_enable_offload(struct rte_mbuf *tx_pkt, uint32_t td_offset = 0; /* Tx Checksum Offload */ - /*Tunnel package usage outer len enable L2/L3 checksum offload*/ - if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) { - /* SET MACLEN */ - td_offset |= (tx_pkt->outer_l2_len >> 1) << - ICE_TX_DESC_LEN_MACLEN_S; - - /* Enable L3 checksum offload */ - if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) { - td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM; - td_offset |= (tx_pkt->outer_l3_len >> 2) << - ICE_TX_DESC_LEN_IPLEN_S; - } else if (ol_flags & RTE_MBUF_F_TX_IPV4) { - td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4; - td_offset |= (tx_pkt->outer_l3_len >> 2) << - ICE_TX_DESC_LEN_IPLEN_S; - } else if (ol_flags & RTE_MBUF_F_TX_IPV6) { - td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6; - td_offset |= (tx_pkt->outer_l3_len >> 2) << - ICE_TX_DESC_LEN_IPLEN_S; - } - } else { - /* SET MACLEN */ - td_offset |= (tx_pkt->l2_len >> 1) << - ICE_TX_DESC_LEN_MACLEN_S; - - /* Enable L3 checksum offload */ - if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) { - td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM; - td_offset |= (tx_pkt->l3_len >> 2) << - ICE_TX_DESC_LEN_IPLEN_S; - } else if (ol_flags & RTE_MBUF_F_TX_IPV4) { - td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4; - td_offset |= (tx_pkt->l3_len >> 2) << - ICE_TX_DESC_LEN_IPLEN_S; - } else if (ol_flags & RTE_MBUF_F_TX_IPV6) { - td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6; - td_offset |= (tx_pkt->l3_len >> 2) << - ICE_TX_DESC_LEN_IPLEN_S; - } + /* SET MACLEN */ + td_offset |= (tx_pkt->l2_len >> 1) << + ICE_TX_DESC_LEN_MACLEN_S; + + /* Enable L3 checksum offload */ + if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) { + td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM; + td_offset |= (tx_pkt->l3_len >> 2) << + ICE_TX_DESC_LEN_IPLEN_S; + } else if (ol_flags & RTE_MBUF_F_TX_IPV4) { + td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4; + td_offset |= (tx_pkt->l3_len >> 2) << + ICE_TX_DESC_LEN_IPLEN_S; + } else if (ol_flags & RTE_MBUF_F_TX_IPV6) { + td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6; + td_offset |= (tx_pkt->l3_len >> 2) << + ICE_TX_DESC_LEN_IPLEN_S; } /* Enable L4 checksum offloads */ -- 2.33.1