[PATCH 4/7] net/ice: fix bare L2TPv2 flow rule deletion

Shaiq Wani shaiq.wani at intel.com
Mon Apr 27 04:31:12 CEST 2026


Bare L2TPv2 flow rules (no inner PPP) fail on deletion because
ice_fdir_is_tunnel_profile() forces a 2-segment profile with an empty
inner segment the NIC cannot remove. Reset tunnel_type to NONE when
no inner fields are present so a single-segment profile is used.

Also normalize L2TPv2 flags_version in the SW hash key to only the
CTRL/LEN/VER bits, preventing delete lookup mismatches when S/O/P
bits differ from the create path.

Fixes: 733640dae75e ("net/ice: support L2TPv2 flow pattern matching")
Signed-off-by: Shaiq Wani <shaiq.wani at intel.com>
---
 drivers/net/intel/ice/ice_fdir_filter.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/net/intel/ice/ice_fdir_filter.c b/drivers/net/intel/ice/ice_fdir_filter.c
index a0cddaeaef..c2fd07e527 100644
--- a/drivers/net/intel/ice/ice_fdir_filter.c
+++ b/drivers/net/intel/ice/ice_fdir_filter.c
@@ -1467,6 +1467,17 @@ ice_fdir_extract_fltr_key(struct ice_fdir_fltr_pattern *key,
 	rte_memcpy(&key->l2tpv2_data, &input->l2tpv2_data, sizeof(key->l2tpv2_data));
 	rte_memcpy(&key->l2tpv2_mask, &input->l2tpv2_mask, sizeof(key->l2tpv2_mask));
 
+	/* Normalize flags: keep only CTRL/LEN/VER bits that affect
+	 * FDIR extraction offsets. Subtypes differing only in S/O/P
+	 * share the same HW entry; masking prevents spurious SW hash
+	 * mismatches and delete failures.
+	 */
+	uint16_t fv_norm = rte_cpu_to_be_16(ICE_L2TPV2_FLAGS_CTRL |
+					     ICE_L2TPV2_FLAGS_LEN |
+					     ICE_L2TPV2_FLAGS_VER);
+	key->l2tpv2_data.flags_version &= fv_norm;
+	key->l2tpv2_mask.flags_version &= fv_norm;
+
 	key->tunnel_type = filter->tunnel_type;
 }
 
@@ -2930,6 +2941,14 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 			flow_type = ICE_FLTR_PTYPE_NONF_IPV6_L2TPV2_PPP;
 	}
 
+	/* Bare L2TPv2 (no inner fields) must use single-segment profile.
+	 * PPPoL2TPv2 rules must keep the tunnel profile even without
+	 * inner field values, so only reset when PPP is not present.
+	 */
+	if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_L2TPV2 &&
+	    input_set_i == 0 && !ppp_present)
+		tunnel_type = ICE_FDIR_TUNNEL_TYPE_NONE;
+
 	filter->tunnel_type = tunnel_type;
 	filter->input.flow_type = flow_type;
 	filter->input_set_o = input_set_o;
-- 
2.43.0



More information about the dev mailing list