* [PATCH net 1/2] ice: fix wrong fallback logic for FDIR
2023-04-04 17:23 [PATCH net 0/2][pull request] Intel Wired LAN Driver Updates 2023-04-04 (ice) Tony Nguyen
@ 2023-04-04 17:23 ` Tony Nguyen
2023-04-04 17:23 ` [PATCH net 2/2] ice: Reset FDIR counter in FDIR init stage Tony Nguyen
2023-04-06 0:30 ` [PATCH net 0/2][pull request] Intel Wired LAN Driver Updates 2023-04-04 (ice) patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Tony Nguyen @ 2023-04-04 17:23 UTC (permalink / raw)
To: davem, kuba, pabeni, edumazet, netdev
Cc: Simei Su, anthony.l.nguyen, Rafal Romanowski
From: Simei Su <simei.su@intel•com>
When adding a FDIR filter, if ice_vc_fdir_set_irq_ctx returns failure,
the inserted fdir entry will not be removed and if ice_vc_fdir_write_fltr
returns failure, the fdir context info for irq handler will not be cleared
which may lead to inconsistent or memory leak issue. This patch refines
failure cases to resolve this issue.
Fixes: 1f7ea1cd6a37 ("ice: Enable FDIR Configure for AVF")
Signed-off-by: Simei Su <simei.su@intel•com>
Tested-by: Rafal Romanowski <rafal.romanowski@intel•com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel•com>
---
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
index 5fd75e75772e..4d007d8c2540 100644
--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
@@ -1871,7 +1871,7 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg)
v_ret = VIRTCHNL_STATUS_SUCCESS;
stat->status = VIRTCHNL_FDIR_FAILURE_RULE_NORESOURCE;
dev_dbg(dev, "VF %d: set FDIR context failed\n", vf->vf_id);
- goto err_free_conf;
+ goto err_rem_entry;
}
ret = ice_vc_fdir_write_fltr(vf, conf, true, is_tun);
@@ -1880,15 +1880,16 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg)
stat->status = VIRTCHNL_FDIR_FAILURE_RULE_NORESOURCE;
dev_err(dev, "VF %d: writing FDIR rule failed, ret:%d\n",
vf->vf_id, ret);
- goto err_rem_entry;
+ goto err_clr_irq;
}
exit:
kfree(stat);
return ret;
-err_rem_entry:
+err_clr_irq:
ice_vc_fdir_clear_irq_ctx(vf);
+err_rem_entry:
ice_vc_fdir_remove_entry(vf, conf, conf->flow_id);
err_free_conf:
devm_kfree(dev, conf);
--
2.38.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH net 2/2] ice: Reset FDIR counter in FDIR init stage
2023-04-04 17:23 [PATCH net 0/2][pull request] Intel Wired LAN Driver Updates 2023-04-04 (ice) Tony Nguyen
2023-04-04 17:23 ` [PATCH net 1/2] ice: fix wrong fallback logic for FDIR Tony Nguyen
@ 2023-04-04 17:23 ` Tony Nguyen
2023-04-06 0:30 ` [PATCH net 0/2][pull request] Intel Wired LAN Driver Updates 2023-04-04 (ice) patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Tony Nguyen @ 2023-04-04 17:23 UTC (permalink / raw)
To: davem, kuba, pabeni, edumazet, netdev
Cc: Lingyu Liu, anthony.l.nguyen, Junfeng Guo, Rafal Romanowski
From: Lingyu Liu <lingyu.liu@intel•com>
Reset the FDIR counters when FDIR inits. Without this patch,
when VF initializes or resets, all the FDIR counters are not
cleaned, which may cause unexpected behaviors for future FDIR
rule create (e.g., rule conflict).
Fixes: 1f7ea1cd6a37 ("ice: Enable FDIR Configure for AVF")
Signed-off-by: Junfeng Guo <junfeng.guo@intel•com>
Signed-off-by: Lingyu Liu <lingyu.liu@intel•com>
Tested-by: Rafal Romanowski <rafal.romanowski@intel•com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel•com>
---
.../net/ethernet/intel/ice/ice_virtchnl_fdir.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
index 4d007d8c2540..daa6a1e894cf 100644
--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
@@ -541,6 +541,21 @@ static void ice_vc_fdir_rem_prof_all(struct ice_vf *vf)
}
}
+/**
+ * ice_vc_fdir_reset_cnt_all - reset all FDIR counters for this VF FDIR
+ * @fdir: pointer to the VF FDIR structure
+ */
+static void ice_vc_fdir_reset_cnt_all(struct ice_vf_fdir *fdir)
+{
+ enum ice_fltr_ptype flow;
+
+ for (flow = ICE_FLTR_PTYPE_NONF_NONE;
+ flow < ICE_FLTR_PTYPE_MAX; flow++) {
+ fdir->fdir_fltr_cnt[flow][0] = 0;
+ fdir->fdir_fltr_cnt[flow][1] = 0;
+ }
+}
+
/**
* ice_vc_fdir_has_prof_conflict
* @vf: pointer to the VF structure
@@ -1998,6 +2013,7 @@ void ice_vf_fdir_init(struct ice_vf *vf)
spin_lock_init(&fdir->ctx_lock);
fdir->ctx_irq.flags = 0;
fdir->ctx_done.flags = 0;
+ ice_vc_fdir_reset_cnt_all(fdir);
}
/**
--
2.38.1
^ permalink raw reply related [flat|nested] 4+ messages in thread