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 2EC984292D; Thu, 13 Apr 2023 07:29:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1F3C740A84; Thu, 13 Apr 2023 07:29:14 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 771F04021F for ; Thu, 13 Apr 2023 07:29:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681363752; x=1712899752; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=0v2NOwzsmh3xEp9n1wmsiAA3IbkAYWCXwfEa6D0800Y=; b=Agb9OK7kHIhIcBh1h8O4AnT/DDFw4Xd24RdnXdNjuVfhcLmZGv85e3zI sfgIYZb90EmnUyqNYvL9vKUgAPBFSVBRXOiabNjlCvcTWUUtnCRYkDpiV C2YgQL3L7aJ2z05zbJ7qsQOaV3CNQdbS8T2CbcyMjK2wXXLvylLRRshUL FiwW9LxQ9wFWagKnPws5wa52ufq0WusT6ryyDoH88Z7fcEc8gwiRBiL0t Gi2Uctdi+N9MfZxNJ5Ry3dYswDMhcMsQZFK6nWZutfNFCM3xh+a532F2P ryIUlgteIxqzx004lKDzgDyd0/xdpaujpQshhfJnz+chjRapNkjXRhGu8 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10678"; a="328205319" X-IronPort-AV: E=Sophos;i="5.98,339,1673942400"; d="scan'208";a="328205319" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2023 22:29:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10678"; a="753832947" X-IronPort-AV: E=Sophos;i="5.98,339,1673942400"; d="scan'208";a="753832947" Received: from unknown (HELO localhost.localdomain) ([10.239.252.103]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2023 22:29:08 -0700 From: Zhichao Zeng To: dev@dpdk.org Cc: qi.z.zhang@intel.com, ke1.xu@intel.com, Zhichao Zeng , Aman Singh , Yuying Zhang Subject: [PATCH 2/4] app/testpmd: support UFO in checksum engine Date: Thu, 13 Apr 2023 13:34:26 +0800 Message-Id: <20230413053426.4190965-1-zhichaox.zeng@intel.com> X-Mailer: git-send-email 2.25.1 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 This commit supports UFO for both non-tunnel and tunneled packets. Similar to TSO, the command "tso set " or "tunnel_tso set " is used to enable UFO, and the following conditions need to be met: a. The NIC supports UFO; b. For enabling UFO in tunnel packets, "csum parse_tunnel" must be set to recognize tunnel packets; c. For IPv4 tunnel packets, "csum set outer-ip" must be set to hw, because UFO changes the total_len of the external IP header and the checksum calculated by SW becomes incorrect; This is not necessary for IPv6 tunnel packets since there's no checksum field to fill in. Signed-off-by: Zhichao Zeng --- app/test-pmd/csumonly.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index fc85c22a77..062eb09b36 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -505,7 +505,9 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, udp_hdr = (struct rte_udp_hdr *)((char *)l3_hdr + info->l3_len); /* do not recalculate udp cksum if it was 0 */ if (udp_hdr->dgram_cksum != 0) { - if (tx_offloads & RTE_ETH_TX_OFFLOAD_UDP_CKSUM) { + if (tso_segsz) + ol_flags |= RTE_MBUF_F_TX_UDP_SEG; + else if (tx_offloads & RTE_ETH_TX_OFFLOAD_UDP_CKSUM) { ol_flags |= RTE_MBUF_F_TX_UDP_CKSUM; } else { if (info->is_tunnel) @@ -590,8 +592,10 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, udp_hdr = (struct rte_udp_hdr *) ((char *)outer_l3_hdr + info->outer_l3_len); - if (tso_enabled) + if (tso_enabled && info->l4_proto == IPPROTO_TCP) ol_flags |= RTE_MBUF_F_TX_TCP_SEG; + else if (tso_enabled && info->l4_proto == IPPROTO_UDP) + ol_flags |= RTE_MBUF_F_TX_UDP_SEG; /* Skip SW outer UDP checksum generation if HW supports it */ if (tx_offloads & RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM) { @@ -991,7 +995,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) if (info.is_tunnel == 1) { tx_ol_flags |= process_outer_cksums(outer_l3_hdr, &info, tx_offloads, - !!(tx_ol_flags & RTE_MBUF_F_TX_TCP_SEG), + !!(tx_ol_flags & (RTE_MBUF_F_TX_TCP_SEG | + RTE_MBUF_F_TX_UDP_SEG)), m); } @@ -1083,11 +1088,13 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) m->outer_l2_len, m->outer_l3_len); if (info.tunnel_tso_segsz != 0 && - (m->ol_flags & RTE_MBUF_F_TX_TCP_SEG)) + (m->ol_flags & (RTE_MBUF_F_TX_TCP_SEG | + RTE_MBUF_F_TX_UDP_SEG))) printf("tx: m->tso_segsz=%d\n", m->tso_segsz); } else if (info.tso_segsz != 0 && - (m->ol_flags & RTE_MBUF_F_TX_TCP_SEG)) + (m->ol_flags & (RTE_MBUF_F_TX_TCP_SEG | + RTE_MBUF_F_TX_UDP_SEG))) printf("tx: m->tso_segsz=%d\n", m->tso_segsz); rte_get_tx_ol_flag_list(m->ol_flags, buf, sizeof(buf)); printf("tx: flags=%s", buf); -- 2.25.1