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 8A55445804 for ; Fri, 23 Aug 2024 18:23:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8390943394; Fri, 23 Aug 2024 18:23:05 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id EE44D4336F for ; Fri, 23 Aug 2024 18:23:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724430183; 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=Oy63QacW/0Q4X3iOrzufsVs/S5ZFGI3rmtmeaZJfcO4=; b=CxkWmWoa5Qjh1bUdh+XFYlTsUDYmPCXKJ4dd9LNpUIBN5LTGIVbV+AWTPXi2Z1msCG1vjK FOo+ao51qEUZk5HKJPwfCirNbkn/vP+kXTU3SnkeSt8ohkmctgM1NAJlh+sFkgdVuUXSFJ EdcnBfK7jLwHdfRCGOicfx7TXvbRWYs= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-689-0Q8ZCLiZPkC8BlohX3IrdA-1; Fri, 23 Aug 2024 12:23:00 -0400 X-MC-Unique: 0Q8ZCLiZPkC8BlohX3IrdA-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1DEE51955F28; Fri, 23 Aug 2024 16:22:59 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.193.224]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 96B0C1956053; Fri, 23 Aug 2024 16:22:57 +0000 (UTC) From: Kevin Traynor To: Jiawen Wu Cc: dpdk stable Subject: patch 'net/txgbe: fix tunnel packet parsing' has been queued to stable release 21.11.8 Date: Fri, 23 Aug 2024 17:18:42 +0100 Message-ID: <20240823161929.1004778-94-ktraynor@redhat.com> In-Reply-To: <20240823161929.1004778-1-ktraynor@redhat.com> References: <20240823161929.1004778-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 21.11.8 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/28/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/e0fffeebc2b0e9776a5f60539935efc4867f189f Thanks. Kevin --- >From e0fffeebc2b0e9776a5f60539935efc4867f189f Mon Sep 17 00:00:00 2001 From: Jiawen Wu Date: Tue, 18 Jun 2024 15:11:32 +0800 Subject: [PATCH] net/txgbe: fix tunnel packet parsing [ upstream commit 60847e50b5280effa6e92a452bbb36fa7051db28 ] The outer-ipv6 tunnel packet was parsed to the wrong packet type, remove the default RTE_PTYPE_L2_ETHER and RTE_PTYPE_L3_IPV4 flags for tunnel packets. And correct the calculation of tunnel length for GRE and GENEVE packets. Fixes: ca46fcd753b1 ("net/txgbe: support Tx with hardware offload") Fixes: e5ece1f467aa ("net/txgbe: fix VXLAN-GPE packet checksum") Fixes: 0e32d6edd479 ("net/txgbe: fix packet type to parse from offload flags") Fixes: 5bbaf75ed6df ("net/txgbe: fix GRE tunnel packet checksum") Signed-off-by: Jiawen Wu --- drivers/net/txgbe/txgbe_rxtx.c | 71 ++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 33 deletions(-) diff --git a/drivers/net/txgbe/txgbe_rxtx.c b/drivers/net/txgbe/txgbe_rxtx.c index f85ec77dd5..a1f26ae3f9 100644 --- a/drivers/net/txgbe/txgbe_rxtx.c +++ b/drivers/net/txgbe/txgbe_rxtx.c @@ -565,24 +565,15 @@ tx_desc_ol_flags_to_ptype(uint64_t oflags) case RTE_MBUF_F_TX_TUNNEL_VXLAN: case RTE_MBUF_F_TX_TUNNEL_VXLAN_GPE: - ptype |= RTE_PTYPE_L2_ETHER | - RTE_PTYPE_L3_IPV4 | - RTE_PTYPE_TUNNEL_GRENAT; + ptype |= RTE_PTYPE_TUNNEL_GRENAT; break; case RTE_MBUF_F_TX_TUNNEL_GRE: - ptype |= RTE_PTYPE_L2_ETHER | - RTE_PTYPE_L3_IPV4 | - RTE_PTYPE_TUNNEL_GRE; + ptype |= RTE_PTYPE_TUNNEL_GRE; break; case RTE_MBUF_F_TX_TUNNEL_GENEVE: - ptype |= RTE_PTYPE_L2_ETHER | - RTE_PTYPE_L3_IPV4 | - RTE_PTYPE_TUNNEL_GENEVE; - ptype |= RTE_PTYPE_INNER_L2_ETHER; + ptype |= RTE_PTYPE_TUNNEL_GENEVE; break; case RTE_MBUF_F_TX_TUNNEL_IPIP: case RTE_MBUF_F_TX_TUNNEL_IP: - ptype |= RTE_PTYPE_L2_ETHER | - RTE_PTYPE_L3_IPV4 | - RTE_PTYPE_TUNNEL_IP; + ptype |= RTE_PTYPE_TUNNEL_IP; break; } @@ -668,4 +659,11 @@ txgbe_xmit_cleanup(struct txgbe_tx_queue *txq) } +#define GRE_CHECKSUM_PRESENT 0x8000 +#define GRE_KEY_PRESENT 0x2000 +#define GRE_SEQUENCE_PRESENT 0x1000 +#define GRE_EXT_LEN 4 +#define GRE_SUPPORTED_FIELDS (GRE_CHECKSUM_PRESENT | GRE_KEY_PRESENT |\ + GRE_SEQUENCE_PRESENT) + static inline uint8_t txgbe_get_tun_len(struct rte_mbuf *mbuf) @@ -673,4 +671,6 @@ txgbe_get_tun_len(struct rte_mbuf *mbuf) struct txgbe_genevehdr genevehdr; const struct txgbe_genevehdr *gh; + const struct txgbe_grehdr *grh; + struct txgbe_grehdr grehdr; uint8_t tun_len; @@ -685,9 +685,14 @@ txgbe_get_tun_len(struct rte_mbuf *mbuf) break; case RTE_MBUF_F_TX_TUNNEL_GRE: - tun_len = sizeof(struct txgbe_nvgrehdr); - break; - case RTE_MBUF_F_TX_TUNNEL_GENEVE: - gh = rte_pktmbuf_read(mbuf, + tun_len = sizeof(struct txgbe_grehdr); + grh = rte_pktmbuf_read(mbuf, mbuf->outer_l2_len + mbuf->outer_l3_len, + sizeof(grehdr), &grehdr); + if (grh->flags & rte_cpu_to_be_16(GRE_SUPPORTED_FIELDS)) + tun_len += GRE_EXT_LEN; + break; + case RTE_MBUF_F_TX_TUNNEL_GENEVE: + gh = rte_pktmbuf_read(mbuf, mbuf->outer_l2_len + + mbuf->outer_l3_len + sizeof(struct txgbe_udphdr), sizeof(genevehdr), &genevehdr); tun_len = sizeof(struct txgbe_udphdr) @@ -703,25 +708,24 @@ txgbe_get_tun_len(struct rte_mbuf *mbuf) static inline uint8_t -txgbe_parse_tun_ptid(struct rte_mbuf *tx_pkt) +txgbe_parse_tun_ptid(struct rte_mbuf *tx_pkt, uint8_t tun_len) { - uint64_t l2_vxlan, l2_vxlan_mac, l2_vxlan_mac_vlan; - uint64_t l2_gre, l2_gre_mac, l2_gre_mac_vlan; + uint64_t inner_l2_len; uint8_t ptid = 0; - l2_vxlan = sizeof(struct txgbe_udphdr) + sizeof(struct txgbe_vxlanhdr); - l2_vxlan_mac = l2_vxlan + sizeof(struct rte_ether_hdr); - l2_vxlan_mac_vlan = l2_vxlan_mac + sizeof(struct rte_vlan_hdr); + inner_l2_len = tx_pkt->l2_len - tun_len; - l2_gre = sizeof(struct txgbe_grehdr); - l2_gre_mac = l2_gre + sizeof(struct rte_ether_hdr); - l2_gre_mac_vlan = l2_gre_mac + sizeof(struct rte_vlan_hdr); - - if (tx_pkt->l2_len == l2_vxlan || tx_pkt->l2_len == l2_gre) + switch (inner_l2_len) { + case 0: ptid = TXGBE_PTID_TUN_EIG; - else if (tx_pkt->l2_len == l2_vxlan_mac || tx_pkt->l2_len == l2_gre_mac) + break; + case sizeof(struct rte_ether_hdr): ptid = TXGBE_PTID_TUN_EIGM; - else if (tx_pkt->l2_len == l2_vxlan_mac_vlan || - tx_pkt->l2_len == l2_gre_mac_vlan) + break; + case sizeof(struct rte_ether_hdr) + sizeof(struct rte_vlan_hdr): ptid = TXGBE_PTID_TUN_EIGMV; + break; + default: + ptid = TXGBE_PTID_TUN_EI; + } return ptid; @@ -790,6 +794,4 @@ txgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, if (tx_ol_req) { tx_offload.ptid = tx_desc_ol_flags_to_ptid(tx_ol_req); - if (tx_offload.ptid & TXGBE_PTID_PKT_TUN) - tx_offload.ptid |= txgbe_parse_tun_ptid(tx_pkt); tx_offload.l2_len = tx_pkt->l2_len; tx_offload.l3_len = tx_pkt->l3_len; @@ -800,4 +802,7 @@ txgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, tx_offload.outer_l3_len = tx_pkt->outer_l3_len; tx_offload.outer_tun_len = txgbe_get_tun_len(tx_pkt); + if (tx_offload.ptid & TXGBE_PTID_PKT_TUN) + tx_offload.ptid |= txgbe_parse_tun_ptid(tx_pkt, + tx_offload.outer_tun_len); #ifdef RTE_LIB_SECURITY -- 2.46.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-08-23 17:18:12.492152146 +0100 +++ 0094-net-txgbe-fix-tunnel-packet-parsing.patch 2024-08-23 17:18:09.800430385 +0100 @@ -1 +1 @@ -From 60847e50b5280effa6e92a452bbb36fa7051db28 Mon Sep 17 00:00:00 2001 +From e0fffeebc2b0e9776a5f60539935efc4867f189f Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 60847e50b5280effa6e92a452bbb36fa7051db28 ] + @@ -15 +16,0 @@ -Cc: stable@dpdk.org @@ -23 +24 @@ -index 4b78e68a40..7731ad8491 100644 +index f85ec77dd5..a1f26ae3f9 100644 @@ -26 +27 @@ -@@ -587,24 +587,15 @@ tx_desc_ol_flags_to_ptype(uint64_t oflags) +@@ -565,24 +565,15 @@ tx_desc_ol_flags_to_ptype(uint64_t oflags) @@ -55 +56 @@ -@@ -690,4 +681,11 @@ txgbe_xmit_cleanup(struct txgbe_tx_queue *txq) +@@ -668,4 +659,11 @@ txgbe_xmit_cleanup(struct txgbe_tx_queue *txq) @@ -67 +68 @@ -@@ -695,4 +693,6 @@ txgbe_get_tun_len(struct rte_mbuf *mbuf) +@@ -673,4 +671,6 @@ txgbe_get_tun_len(struct rte_mbuf *mbuf) @@ -74 +75 @@ -@@ -707,9 +707,14 @@ txgbe_get_tun_len(struct rte_mbuf *mbuf) +@@ -685,9 +685,14 @@ txgbe_get_tun_len(struct rte_mbuf *mbuf) @@ -93 +94 @@ -@@ -725,25 +730,24 @@ txgbe_get_tun_len(struct rte_mbuf *mbuf) +@@ -703,25 +708,24 @@ txgbe_get_tun_len(struct rte_mbuf *mbuf) @@ -132 +133 @@ -@@ -812,6 +816,4 @@ txgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, +@@ -790,6 +794,4 @@ txgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, @@ -139 +140 @@ -@@ -822,4 +824,7 @@ txgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, +@@ -800,4 +802,7 @@ txgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,