From: Shaiq Wani <shaiq.wani@intel.com>
To: dev@dpdk.org, bruce.richardson@intel.com, aman.deep.singh@intel.com
Subject: [PATCH] net/ice: fix L2TPv2 outer MAC address in training packet
Date: Mon, 6 Apr 2026 13:43:55 +0530 [thread overview]
Message-ID: <20260406081355.3241393-1-shaiq.wani@intel.com> (raw)
flow rules with eth + l2tpv2 patterns fail to match because outer MACs
are written to the wrong location in the training packet.
The pre-scan loop does not detect L2TPV2, so tunnel_type is still 0
when the ETH item is parsed and MACs land in ext_data (inner) instead
of ext_data_outer. Also, ice_fdir_get_gen_prgm_pkt() uses the 'loc'
pointer (past the L2TPv2 header) instead of 'pkt' (Ethernet offset 0).
Detect L2TPV2 in pre-scan, and use 'pkt' for MAC insertion in all
four L2TPv2 training-packet cases.
Fixes: 733640dae75e ("net/ice: support L2TPv2 flow pattern matching")
Fixes: bf662653976e ("net/ice/base: support L2TPv2 flow rule")
Signed-off-by: Shaiq Wani <shaiq.wani@intel.com>
---
drivers/net/intel/ice/base/ice_fdir.c | 16 ++++++++--------
drivers/net/intel/ice/ice_fdir_filter.c | 2 ++
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/net/intel/ice/base/ice_fdir.c b/drivers/net/intel/ice/base/ice_fdir.c
index 2c0cb99854..e1d8b65972 100644
--- a/drivers/net/intel/ice/base/ice_fdir.c
+++ b/drivers/net/intel/ice/base/ice_fdir.c
@@ -4599,16 +4599,16 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
input->ip.v6.tc);
break;
case ICE_FLTR_PTYPE_NONF_IPV4_L2TPV2_CONTROL:
- ice_pkt_insert_mac_addr(loc, input->ext_data_outer.dst_mac);
- ice_pkt_insert_mac_addr(loc + ETH_ALEN,
+ ice_pkt_insert_mac_addr(pkt, input->ext_data_outer.dst_mac);
+ ice_pkt_insert_mac_addr(pkt + ETH_ALEN,
input->ext_data_outer.src_mac);
ice_pkt_insert_u16(loc, ICE_IPV4_L2TPV2_LEN_SESS_ID_OFFSET,
input->l2tpv2_data.session_id);
break;
case ICE_FLTR_PTYPE_NONF_IPV4_L2TPV2:
case ICE_FLTR_PTYPE_NONF_IPV4_L2TPV2_PPP:
- ice_pkt_insert_mac_addr(loc, input->ext_data_outer.dst_mac);
- ice_pkt_insert_mac_addr(loc + ETH_ALEN,
+ ice_pkt_insert_mac_addr(pkt, input->ext_data_outer.dst_mac);
+ ice_pkt_insert_mac_addr(pkt + ETH_ALEN,
input->ext_data_outer.src_mac);
flags_version = BE16_TO_CPU(input->l2tpv2_data.flags_version);
if (flags_version & ICE_L2TPV2_FLAGS_LEN) {
@@ -4622,16 +4622,16 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
}
break;
case ICE_FLTR_PTYPE_NONF_IPV6_L2TPV2_CONTROL:
- ice_pkt_insert_mac_addr(loc, input->ext_data_outer.dst_mac);
- ice_pkt_insert_mac_addr(loc + ETH_ALEN,
+ ice_pkt_insert_mac_addr(pkt, input->ext_data_outer.dst_mac);
+ ice_pkt_insert_mac_addr(pkt + ETH_ALEN,
input->ext_data_outer.src_mac);
ice_pkt_insert_u16(loc, ICE_IPV6_L2TPV2_LEN_SESS_ID_OFFSET,
input->l2tpv2_data.session_id);
break;
case ICE_FLTR_PTYPE_NONF_IPV6_L2TPV2:
case ICE_FLTR_PTYPE_NONF_IPV6_L2TPV2_PPP:
- ice_pkt_insert_mac_addr(loc, input->ext_data_outer.dst_mac);
- ice_pkt_insert_mac_addr(loc + ETH_ALEN,
+ ice_pkt_insert_mac_addr(pkt, input->ext_data_outer.dst_mac);
+ ice_pkt_insert_mac_addr(pkt + ETH_ALEN,
input->ext_data_outer.src_mac);
flags_version = BE16_TO_CPU(input->l2tpv2_data.flags_version);
if (flags_version & ICE_L2TPV2_FLAGS_LEN) {
diff --git a/drivers/net/intel/ice/ice_fdir_filter.c b/drivers/net/intel/ice/ice_fdir_filter.c
index 3522d77123..1cbc613020 100644
--- a/drivers/net/intel/ice/ice_fdir_filter.c
+++ b/drivers/net/intel/ice/ice_fdir_filter.c
@@ -1911,6 +1911,8 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
if (item->type == RTE_FLOW_ITEM_TYPE_VXLAN)
tunnel_type = ICE_FDIR_TUNNEL_TYPE_VXLAN;
+ if (item->type == RTE_FLOW_ITEM_TYPE_L2TPV2)
+ tunnel_type = ICE_FDIR_TUNNEL_TYPE_L2TPV2;
/* To align with shared code behavior, save gtpu outer
* fields in inner struct.
*/
--
2.43.0
next reply other threads:[~2026-04-06 8:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-06 8:13 Shaiq Wani [this message]
2026-04-08 15:55 ` [PATCH] net/ice: fix L2TPv2 outer MAC address in training packet Bruce Richardson
2026-04-08 16:12 ` Bruce Richardson
2026-04-09 7:44 ` [PATCH v3] net/ice: detect L2TPv2 tunnel type in pre-scan loop Shaiq Wani
2026-04-09 7:44 ` [PATCH v3] net/ice: fix L2TPv2 outer MAC in training packet Shaiq Wani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260406081355.3241393-1-shaiq.wani@intel.com \
--to=shaiq.wani@intel.com \
--cc=aman.deep.singh@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox