[PATCH 6/7] net/ice: fix stale profile after L2TPv2 subtype change

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


After a rule is destroyed, the HW profile for that ptype persists.
If a new rule with the same ptype but a different L2TPv2 subtype is
created (e.g. data then data_l), the old profile is reused via -EEXIST
with stale field extraction offsets.  Since data and data_l have
session_id at different byte offsets, the NIC matches on the wrong
field and packets with mismatched session_id incorrectly hit the rule.

Remove the HW profile in ice_fdir_destroy_filter when the last
filter for a given ptype is destroyed so the next rule creates a fresh
profile with the correct offsets.

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 | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/intel/ice/ice_fdir_filter.c b/drivers/net/intel/ice/ice_fdir_filter.c
index 0531208066..5ea74a4a5c 100644
--- a/drivers/net/intel/ice/ice_fdir_filter.c
+++ b/drivers/net/intel/ice/ice_fdir_filter.c
@@ -1777,6 +1777,17 @@ ice_fdir_destroy_filter(struct ice_adapter *ad,
 
 	ice_fdir_cnt_update(pf, filter->input.flow_type, is_tun, false);
 
+	/* Remove the FDIR HW profile when no filters of this ptype
+	 * remain.  The profile encodes field extraction offsets that
+	 * vary between L2TPv2 subtypes (e.g. data vs data_l).  If the
+	 * profile is not removed, a subsequent rule with a different
+	 * subtype but the same ptype reuses the stale profile via
+	 * -EEXIST and the NIC extracts session_id from the wrong
+	 * offset, causing mismatched packets to hit the rule.
+	 */
+	if (pf->fdir_fltr_cnt[filter->input.flow_type][is_tun] == 0)
+		ice_fdir_prof_rm(pf, filter->input.flow_type, is_tun);
+
 	if (filter->mark_flag == 1)
 		ice_fdir_rx_parsing_enable(ad, 0);
 
-- 
2.43.0



More information about the dev mailing list