Skip to contentSkip to conversation

ice: fix wrong fallback logic for FDIR

PATCH Superseded Su, Simei 3 participants 5 messages Mar 21, 2023 – Mar 29, 2023

Subsystems (2)
lore
Share & tools
lore

Su, Simei

author
#0 lore raw

PATCH 1/1 ice: fix wrong fallback logic for FDIR

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")
---
 drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +4 -3
index 60c9da4aac1d..c03e4a7ae80b 100644
@@ -1812,7 +1812,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);
@@ -1821,15 +1821,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);
Signature · 6 lines
2.25.1

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
maintainer
#1 lore raw
Quoted 8 lines · Simei

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")

I believe your git configuration/author needs to be updated.

WARNING: From:/Signed-off-by: email name mismatch: 'From: "Su, Simei" <[email protected]>' != 'Signed-off-by: Simei Su <[email protected]>'

Quoted 26 lines
---
  drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +2 -2
index 60c9da4aac1d..c03e4a7ae80b 100644
@@ -1812,7 +1812,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);
@@ -1821,15 +1821,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:

drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg) · line 1836

Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +2 -1
  	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);

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

author
#2 lore raw
Quoted 17 lines

-----Original Message-----
From: Nguyen, Anthony L <[email protected]>
Sent: Wednesday, March 22, 2023 4:16 AM
To: Su, Simei <[email protected]>; [email protected]
Subject: Re: [Intel-wired-lan] [PATCH net] ice: fix wrong fallback logic for FDIR

Quoted 6 lines · Simei

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.

Quoted 7 lines
Quoted 2 lines
Fixes 1f7ea1cd6a37 ("ice: Enable FDIR Configure for AVF")

I believe your git configuration/author needs to be updated.

WARNING: From:/Signed-off-by: email name mismatch: 'From: "Su, Simei" <[email protected]>' != 'Signed-off-by: Simei Su <[email protected]>'

OK, I will update it in patch v2. Thanks.

Br
Simei

Quoted 32 lines

drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8

Quoted 11 lines
---
  drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +0 -0
index 60c9da4aac1d..c03e4a7ae80b 100644
@@ -1812,7 +1812,7 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8

*msg)

Quoted 20 lines
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +3 -2
  		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); @@ -1821,15
+1821,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;
Quoted 7 lines

drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg) · line 1836

Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +2 -1
-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);

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

author
#3 lore raw

PATCH v2 1/1 ice: fix wrong fallback logic for FDIR

In reply to Su, Simei

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")
---
 drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +4 -3
index 60c9da4aac1d..c03e4a7ae80b 100644
@@ -1812,7 +1812,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);
@@ -1821,15 +1821,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);
Signature · 6 lines
2.25.1

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Tested-by on v2 1/1
#4 lore raw

drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg)

Quoted 27 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Simei Su
Sent: środa, 22 marca 2023 03:24
To: [email protected]
Cc: Su, Simei <[email protected]>
Subject: [Intel-wired-lan] [PATCH net, v2] ice: fix wrong fallback logic for FDIR

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")
---
 drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +0 -0
index 60c9da4aac1d..c03e4a7ae80b 100644
@@ -1812,7 +1812,7 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg)

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan