netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i40e: always propagate error value in i40e_set_vsi_promisc()
@ 2020-08-20 11:53 Stefan Assmann
  2020-09-04 18:10 ` [Intel-wired-lan] " Brown, Aaron F
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Assmann @ 2020-08-20 11:53 UTC (permalink / raw)
  To: intel-wired-lan
  Cc: netdev, davem, jeffrey.t.kirsher, lihong.yang,
	aleksandr.loktionov, sassmann

The for loop in i40e_set_vsi_promisc() reports errors via dev_err() but
does not propage the error up the call chain. Instead it continues the
loop and potentially overwrites the reported error value.
This results in the error being recorded in the log buffer, but the
caller might never know anything went the wrong way.

To avoid this situation i40e_set_vsi_promisc() needs to temporary store
the error after reporting it. This is still not optimal as multiple
different errors may occur, so store the first error and hope that's
the main issue.

Fixes: 37d318d7805f (i40e: Remove scheduling while atomic possibility)
Reported-by: Michal Schmidt <mschmidt@redhat.com>
Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 8e133d6545bd..526ce89b0ba5 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -1173,7 +1173,7 @@ i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable,
 {
 	struct i40e_pf *pf = vf->pf;
 	struct i40e_hw *hw = &pf->hw;
-	i40e_status aq_ret;
+	i40e_status aq_ret, aq_tmp = 0;
 	int i;
 
 	/* No VLAN to set promisc on, set on VSI */
@@ -1222,6 +1222,9 @@ i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable,
 				vf->vf_id,
 				i40e_stat_str(&pf->hw, aq_ret),
 				i40e_aq_str(&pf->hw, aq_err));
+
+			if (!aq_tmp)
+				aq_tmp = aq_ret;
 		}
 
 		aq_ret = i40e_aq_set_vsi_uc_promisc_on_vlan(hw, seid,
@@ -1235,8 +1238,15 @@ i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable,
 				vf->vf_id,
 				i40e_stat_str(&pf->hw, aq_ret),
 				i40e_aq_str(&pf->hw, aq_err));
+
+			if (!aq_tmp)
+				aq_tmp = aq_ret;
 		}
 	}
+
+	if (aq_tmp)
+		aq_ret = aq_tmp;
+
 	return aq_ret;
 }
 
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [Intel-wired-lan] [PATCH] i40e: always propagate error value in i40e_set_vsi_promisc()
  2020-08-20 11:53 [PATCH] i40e: always propagate error value in i40e_set_vsi_promisc() Stefan Assmann
@ 2020-09-04 18:10 ` Brown, Aaron F
  0 siblings, 0 replies; 2+ messages in thread
From: Brown, Aaron F @ 2020-09-04 18:10 UTC (permalink / raw)
  To: Stefan Assmann, intel-wired-lan; +Cc: netdev, Loktionov, Aleksandr, davem

> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Stefan Assmann
> Sent: Thursday, August 20, 2020 4:53 AM
> To: intel-wired-lan@lists.osuosl.org
> Cc: netdev@vger.kernel.org; Loktionov, Aleksandr
> <aleksandr.loktionov@intel.com>; sassmann@kpanic.de;
> davem@davemloft.net
> Subject: [Intel-wired-lan] [PATCH] i40e: always propagate error value in
> i40e_set_vsi_promisc()
> 
> The for loop in i40e_set_vsi_promisc() reports errors via dev_err() but
> does not propage the error up the call chain. Instead it continues the
> loop and potentially overwrites the reported error value.
> This results in the error being recorded in the log buffer, but the
> caller might never know anything went the wrong way.
> 
> To avoid this situation i40e_set_vsi_promisc() needs to temporary store
> the error after reporting it. This is still not optimal as multiple
> different errors may occur, so store the first error and hope that's
> the main issue.
> 
> Fixes: 37d318d7805f (i40e: Remove scheduling while atomic possibility)
> Reported-by: Michal Schmidt <mschmidt@redhat.com>
> Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)

In the summary text:
%s/ propage/propagate/
%s/ temporary/temporarily/

I suspect Tony can fix that up before pushing.  Aside from that,
Tested-by: Aaron Brown <aaron.f.brown@intel.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-04 18:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-20 11:53 [PATCH] i40e: always propagate error value in i40e_set_vsi_promisc() Stefan Assmann
2020-09-04 18:10 ` [Intel-wired-lan] " Brown, Aaron F

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).