patch 'net/txgbe: fix tunnel packet parsing' has been queued to stable release 21.11.8
Kevin Traynor
ktraynor at redhat.com
Fri Aug 23 18:18:42 CEST 2024
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 <jiawenwu at trustnetic.com>
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 <jiawenwu at trustnetic.com>
---
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 at 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,
More information about the stable
mailing list