From patchwork Thu Apr 13 05:34:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhichao Zeng X-Patchwork-Id: 125976 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 6BF4E4292D; Thu, 13 Apr 2023 07:28:50 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 58F04410F9; Thu, 13 Apr 2023 07:28:50 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id E939541138 for ; Thu, 13 Apr 2023 07:28:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681363729; x=1712899729; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=aAZ0hSZcRdhXB5GYGEwWYmWnEFzg/16oR/iwOv1yHik=; b=GXKQKbehSupZKDiEUD2R+1/YFeWVYysrkBsmUa4MtJIlPx9yvDEPOnj9 QwEiWCRVdjeME+wcTwGSTTrr00FcMIzuTWYn3ujCqw4eDoZkYXDozTSqL /bVEUcFpjlKou4oPJ/kCQSzA3HvRuw3nFXKi29hNG+ESS/qzFsHKNp/XQ 5ADYEJ/mP1j2oxsp1hdlafyN15tSC09iVbYodyHMoqZB/EkT9Ix3N8lGo 8Er2qCLJjAEd2Y4BiY6yq5TYWL9R5zcmlhZ2gTWfONHEZT78FyeijIcXg c5pGPOYA0Ew0mknEQAOoXCYUpDS+SnYM4Y5oxblnVqybaC38kbm39EKgK g==; X-IronPort-AV: E=McAfee;i="6600,9927,10678"; a="406929372" X-IronPort-AV: E=Sophos;i="5.98,339,1673942400"; d="scan'208";a="406929372" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2023 22:28:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10678"; a="691793578" X-IronPort-AV: E=Sophos;i="5.98,339,1673942400"; d="scan'208";a="691793578" Received: from unknown (HELO localhost.localdomain) ([10.239.252.103]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2023 22:28:43 -0700 From: Zhichao Zeng To: dev@dpdk.org Cc: qi.z.zhang@intel.com, ke1.xu@intel.com, Zhichao Zeng , Olivier Matz Subject: [PATCH 1/4] net: calculate correct UDP pseudo header for UFO Date: Thu, 13 Apr 2023 13:34:00 +0800 Message-Id: <20230413053401.4190743-1-zhichaox.zeng@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 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 This commit calculates the correct pseudo header for the UDP fragmentation offload by adding UDP_SEG flag. Signed-off-by: Zhichao Zeng Acked-by: Olivier Matz --- lib/net/rte_ip.h | 4 ++-- lib/net/rte_net.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h index a310e9d498..8073c8e889 100644 --- a/lib/net/rte_ip.h +++ b/lib/net/rte_ip.h @@ -345,7 +345,7 @@ rte_ipv4_phdr_cksum(const struct rte_ipv4_hdr *ipv4_hdr, uint64_t ol_flags) psd_hdr.dst_addr = ipv4_hdr->dst_addr; psd_hdr.zero = 0; psd_hdr.proto = ipv4_hdr->next_proto_id; - if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) { + if (ol_flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG)) { psd_hdr.len = 0; } else { l3_len = rte_be_to_cpu_16(ipv4_hdr->total_length); @@ -596,7 +596,7 @@ rte_ipv6_phdr_cksum(const struct rte_ipv6_hdr *ipv6_hdr, uint64_t ol_flags) } psd_hdr; psd_hdr.proto = (uint32_t)(ipv6_hdr->proto << 24); - if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) { + if (ol_flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG)) { psd_hdr.len = 0; } else { psd_hdr.len = ipv6_hdr->payload_len; diff --git a/lib/net/rte_net.h b/lib/net/rte_net.h index 56611fc8f9..ef3ff4c6fd 100644 --- a/lib/net/rte_net.h +++ b/lib/net/rte_net.h @@ -121,7 +121,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) * no offloads are requested. */ if (!(ol_flags & (RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_L4_MASK | RTE_MBUF_F_TX_TCP_SEG | - RTE_MBUF_F_TX_OUTER_IP_CKSUM))) + RTE_MBUF_F_TX_UDP_SEG | RTE_MBUF_F_TX_OUTER_IP_CKSUM))) return 0; if (ol_flags & (RTE_MBUF_F_TX_OUTER_IPV4 | RTE_MBUF_F_TX_OUTER_IPV6)) { @@ -154,7 +154,8 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) ipv4_hdr->hdr_checksum = 0; } - if ((ol_flags & RTE_MBUF_F_TX_L4_MASK) == RTE_MBUF_F_TX_UDP_CKSUM) { + if ((ol_flags & RTE_MBUF_F_TX_L4_MASK) == RTE_MBUF_F_TX_UDP_CKSUM || + (ol_flags & RTE_MBUF_F_TX_UDP_SEG)) { if (ol_flags & RTE_MBUF_F_TX_IPV4) { udp_hdr = (struct rte_udp_hdr *)((char *)ipv4_hdr + m->l3_len);