public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
From: Shaiq Wani <shaiq.wani@intel.com>
To: dev@dpdk.org, bruce.richardson@intel.com, aman.deep.singh@intel.com
Subject: [PATCH 1/6] net/ice: fix FDIR session_id offset for L-bit L2TPv2 types
Date: Mon, 30 Mar 2026 09:06:15 +0530	[thread overview]
Message-ID: <20260330033615.2565620-1-shaiq.wani@intel.com> (raw)

L2TPv2 types with the Length bit set have a 2-byte Length field before
Tunnel ID, placing session_id at UDP payload offset 14, not 12. The
driver always used offset 12, causing FDIR to match on wrong bytes.

Wire up ICE_FLOW_FIELD_IDX_L2TPV2_LEN_SESS_ID which was defined but
never used, and select it based on the L-bit in flags_version.

Fixes: 733640dae75e ("net/ice: support L2TPv2 flow pattern matching")
Signed-off-by: Shaiq Wani <shaiq.wani@intel.com>
---
 drivers/net/intel/ice/ice_fdir_filter.c  | 13 +++++++++++--
 drivers/net/intel/ice/ice_generic_flow.h |  3 +++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/net/intel/ice/ice_fdir_filter.c b/drivers/net/intel/ice/ice_fdir_filter.c
index 5b27f5a077..afa7a7d1dd 100644
--- a/drivers/net/intel/ice/ice_fdir_filter.c
+++ b/drivers/net/intel/ice/ice_fdir_filter.c
@@ -110,7 +110,8 @@
 	ICE_INSET_NAT_T_ESP_SPI)
 
 #define ICE_FDIR_INSET_L2TPV2 (\
-	ICE_INSET_SMAC | ICE_INSET_DMAC | ICE_INSET_L2TPV2OIP_SESSION_ID)
+	ICE_INSET_SMAC | ICE_INSET_DMAC | ICE_INSET_L2TPV2OIP_SESSION_ID | \
+	ICE_INSET_L2TPV2OIP_LEN_SESSION_ID)
 
 #define ICE_FDIR_INSET_L2TPV2_PPP_IPV4 (\
 	ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST)
@@ -1001,6 +1002,7 @@ ice_fdir_input_set_parse(uint64_t inset, enum ice_flow_field *field)
 		{ICE_INSET_ESP_SPI, ICE_FLOW_FIELD_IDX_ESP_SPI},
 		{ICE_INSET_NAT_T_ESP_SPI, ICE_FLOW_FIELD_IDX_NAT_T_ESP_SPI},
 		{ICE_INSET_L2TPV2OIP_SESSION_ID, ICE_FLOW_FIELD_IDX_L2TPV2_SESS_ID},
+		{ICE_INSET_L2TPV2OIP_LEN_SESSION_ID, ICE_FLOW_FIELD_IDX_L2TPV2_LEN_SESS_ID},
 	};
 
 	for (i = 0, j = 0; i < RTE_DIM(ice_inset_map); i++) {
@@ -2600,7 +2602,14 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 			     l2tpv2_mask->hdr.type1.session_id == UINT16_MAX) ||
 			    (flags_version == RTE_L2TPV2_MSG_TYPE_DATA_L_S_O &&
 			     l2tpv2_mask->hdr.type0.session_id == UINT16_MAX)) {
-				input_set_o |= ICE_INSET_L2TPV2OIP_SESSION_ID;
+				if (flags_version == RTE_L2TPV2_MSG_TYPE_CONTROL ||
+				    flags_version == RTE_L2TPV2_MSG_TYPE_DATA_L ||
+				    flags_version == RTE_L2TPV2_MSG_TYPE_DATA_L_S ||
+				    flags_version == RTE_L2TPV2_MSG_TYPE_DATA_L_O ||
+				    flags_version == RTE_L2TPV2_MSG_TYPE_DATA_L_S_O)
+					input_set_o |= ICE_INSET_L2TPV2OIP_LEN_SESSION_ID;
+				else
+					input_set_o |= ICE_INSET_L2TPV2OIP_SESSION_ID;
 			}
 
 			tunnel_type = ICE_FDIR_TUNNEL_TYPE_L2TPV2;
diff --git a/drivers/net/intel/ice/ice_generic_flow.h b/drivers/net/intel/ice/ice_generic_flow.h
index 1b5514d5df..c0eed84610 100644
--- a/drivers/net/intel/ice/ice_generic_flow.h
+++ b/drivers/net/intel/ice/ice_generic_flow.h
@@ -66,6 +66,7 @@
 #define ICE_IP_PK_ID			BIT_ULL(40)
 #define ICE_IP_FRAG_OFS			BIT_ULL(39)
 #define ICE_L2TPV2OIP_SESSION_ID	BIT_ULL(38)
+#define ICE_L2TPV2OIP_LEN_SESSION_ID	BIT_ULL(37)
 
 /* input set */
 
@@ -135,6 +136,8 @@
 	(ICE_PROT_NAT_T_ESP | ICE_ESP_SPI)
 #define ICE_INSET_L2TPV2OIP_SESSION_ID \
 	(ICE_PROT_L2TPV2OIP | ICE_L2TPV2OIP_SESSION_ID)
+#define ICE_INSET_L2TPV2OIP_LEN_SESSION_ID \
+	(ICE_PROT_L2TPV2OIP | ICE_L2TPV2OIP_LEN_SESSION_ID)
 #define ICE_INSET_TUN_IPV4_SRC \
 	(ICE_PROT_IPV4_INNER | ICE_IP_SRC)
 #define ICE_INSET_TUN_IPV4_DST \
-- 
2.43.0


                 reply	other threads:[~2026-03-30  3:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260330033615.2565620-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