Commit b6f23d38 authored by Stefan Assmann's avatar Stefan Assmann Committed by Tony Nguyen

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 propagate 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 temporarily 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: 37d318d7 (i40e: Remove scheduling while atomic possibility)
Reported-by: default avatarMichal Schmidt <mschmidt@redhat.com>
Signed-off-by: default avatarStefan Assmann <sassmann@kpanic.de>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent e1e1b535
...@@ -1171,9 +1171,9 @@ static i40e_status ...@@ -1171,9 +1171,9 @@ static i40e_status
i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable, i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable,
bool unicast_enable, s16 *vl, u16 num_vlans) bool unicast_enable, s16 *vl, u16 num_vlans)
{ {
i40e_status aq_ret, aq_tmp = 0;
struct i40e_pf *pf = vf->pf; struct i40e_pf *pf = vf->pf;
struct i40e_hw *hw = &pf->hw; struct i40e_hw *hw = &pf->hw;
i40e_status aq_ret;
int i; int i;
/* No VLAN to set promisc on, set on VSI */ /* 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, ...@@ -1222,6 +1222,9 @@ i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable,
vf->vf_id, vf->vf_id,
i40e_stat_str(&pf->hw, aq_ret), i40e_stat_str(&pf->hw, aq_ret),
i40e_aq_str(&pf->hw, aq_err)); 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, 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, ...@@ -1235,8 +1238,15 @@ i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable,
vf->vf_id, vf->vf_id,
i40e_stat_str(&pf->hw, aq_ret), i40e_stat_str(&pf->hw, aq_ret),
i40e_aq_str(&pf->hw, aq_err)); i40e_aq_str(&pf->hw, aq_err));
if (!aq_tmp)
aq_tmp = aq_ret;
} }
} }
if (aq_tmp)
aq_ret = aq_tmp;
return aq_ret; return aq_ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment