net/ice: fix removal of FDIR profile

Message ID 20191105030553.9323-1-shougangx.wang@intel.com (mailing list archive)
State Superseded, archived
Delegated to: xiaolong ye
Headers
Series net/ice: fix removal of FDIR profile |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-compilation success Compile Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Shougang Wang Nov. 5, 2019, 3:05 a.m. UTC
  The removal of FDIR profile should start from ICE_FLTR_PTYPE_NONF_IPV4_UDP.

Fixes: 109e8e06249e ("net/ice: configure HW flow director rule")
Cc: stable@dpdk.org

Signed-off-by: Wang ShougangX <shougangx.wang@intel.com>
---
 drivers/net/ice/ice_fdir_filter.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
  

Comments

Xiaolong Ye Nov. 7, 2019, 3:29 a.m. UTC | #1
On 11/05, Wang ShougangX wrote:
>The removal of FDIR profile should start from ICE_FLTR_PTYPE_NONF_IPV4_UDP.
>
>Fixes: 109e8e06249e ("net/ice: configure HW flow director rule")
>Cc: stable@dpdk.org
>
>Signed-off-by: Wang ShougangX <shougangx.wang@intel.com>
>---
> drivers/net/ice/ice_fdir_filter.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
>index 736ccd54e..e426c1431 100644
>--- a/drivers/net/ice/ice_fdir_filter.c
>+++ b/drivers/net/ice/ice_fdir_filter.c
>@@ -159,6 +159,10 @@ ice_fdir_prof_alloc(struct ice_hw *hw)
> 		if (!hw->fdir_prof)
> 			return -ENOMEM;
> 	}
>+
>+	/* To avoid wild pointer, unused field pointer should be NULL */
>+	hw->fdir_prof[ICE_FLTR_PTYPE_NONF_NONE] = NULL;
>+
> 	for (ptype = ICE_FLTR_PTYPE_NONF_IPV4_UDP;
> 	     ptype < ICE_FLTR_PTYPE_MAX;
> 	     ptype++) {
>@@ -177,6 +181,7 @@ ice_fdir_prof_alloc(struct ice_hw *hw)
> 	     fltr_ptype++)
> 		rte_free(hw->fdir_prof[fltr_ptype]);
> 	rte_free(hw->fdir_prof);
>+	hw->fdir_prof = NULL;

Above two changes are irrelevant to this commit, you should add them into 
your wild pointer fix.

Besides, I'd suggest to submit your related fixes in a patchset with a cover
letter for the convenience of review.

Thanks,
Xiaolong

> 	return -ENOMEM;
> }
> 
>@@ -573,7 +578,7 @@ ice_fdir_prof_rm_all(struct ice_pf *pf)
> {
> 	enum ice_fltr_ptype ptype;
> 
>-	for (ptype = ICE_FLTR_PTYPE_NONF_NONE;
>+	for (ptype = ICE_FLTR_PTYPE_NONF_IPV4_UDP;
> 	     ptype < ICE_FLTR_PTYPE_MAX;
> 	     ptype++) {
> 		ice_fdir_prof_rm(pf, ptype, false);
>-- 
>2.17.1
>
  

Patch

diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 736ccd54e..e426c1431 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -159,6 +159,10 @@  ice_fdir_prof_alloc(struct ice_hw *hw)
 		if (!hw->fdir_prof)
 			return -ENOMEM;
 	}
+
+	/* To avoid wild pointer, unused field pointer should be NULL */
+	hw->fdir_prof[ICE_FLTR_PTYPE_NONF_NONE] = NULL;
+
 	for (ptype = ICE_FLTR_PTYPE_NONF_IPV4_UDP;
 	     ptype < ICE_FLTR_PTYPE_MAX;
 	     ptype++) {
@@ -177,6 +181,7 @@  ice_fdir_prof_alloc(struct ice_hw *hw)
 	     fltr_ptype++)
 		rte_free(hw->fdir_prof[fltr_ptype]);
 	rte_free(hw->fdir_prof);
+	hw->fdir_prof = NULL;
 	return -ENOMEM;
 }
 
@@ -573,7 +578,7 @@  ice_fdir_prof_rm_all(struct ice_pf *pf)
 {
 	enum ice_fltr_ptype ptype;
 
-	for (ptype = ICE_FLTR_PTYPE_NONF_NONE;
+	for (ptype = ICE_FLTR_PTYPE_NONF_IPV4_UDP;
 	     ptype < ICE_FLTR_PTYPE_MAX;
 	     ptype++) {
 		ice_fdir_prof_rm(pf, ptype, false);