All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [net] i40e: fix the calculation of VFs mac addresses
@ 2017-11-07 20:06 Jeff Kirsher
  2017-11-09 22:38 ` Bowers, AndrewX
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Kirsher @ 2017-11-07 20:06 UTC (permalink / raw)
  To: intel-wired-lan

From: Zijie Pan <zijie.pan@6wind.com>

num_mac should be increased only after the call to i40e_add_mac_filter().

Fixes: 5f527ba962e2 ("i40e: Limit the number of MAC and VLAN addresses that can be added for VFs")
CC: Anjali Singhai Jain <anjali.singhai@intel.com>
CC: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Zijie Pan <zijie.pan@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Reviewed-by: Tushar Dave <tushar.n.dave@oracle.com>
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 4d1e670f490e..2d1f3dbe67f1 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -2115,18 +2115,19 @@ static int i40e_vc_add_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
 		struct i40e_mac_filter *f;
 
 		f = i40e_find_mac(vsi, al->list[i].addr);
-		if (!f)
+		if (!f) {
 			f = i40e_add_mac_filter(vsi, al->list[i].addr);
 
-		if (!f) {
-			dev_err(&pf->pdev->dev,
-				"Unable to add MAC filter %pM for VF %d\n",
-				 al->list[i].addr, vf->vf_id);
-			ret = I40E_ERR_PARAM;
-			spin_unlock_bh(&vsi->mac_filter_hash_lock);
-			goto error_param;
-		} else {
-			vf->num_mac++;
+			if (!f) {
+				dev_err(&pf->pdev->dev,
+					"Unable to add MAC filter %pM for VF %d\n",
+					al->list[i].addr, vf->vf_id);
+				ret = I40E_ERR_PARAM;
+				spin_unlock_bh(&vsi->mac_filter_hash_lock);
+				goto error_param;
+			} else {
+				vf->num_mac++;
+			}
 		}
 	}
 	spin_unlock_bh(&vsi->mac_filter_hash_lock);

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

* [Intel-wired-lan] [net] i40e: fix the calculation of VFs mac addresses
  2017-11-07 20:06 [Intel-wired-lan] [net] i40e: fix the calculation of VFs mac addresses Jeff Kirsher
@ 2017-11-09 22:38 ` Bowers, AndrewX
  0 siblings, 0 replies; 2+ messages in thread
From: Bowers, AndrewX @ 2017-11-09 22:38 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Kirsher, Jeffrey T
> Sent: Tuesday, November 7, 2017 12:06 PM
> To: intel-wired-lan at lists.osuosl.org
> Cc: Zijie Pan <zijie.pan@6wind.com>; Singhai, Anjali
> <anjali.singhai@intel.com>; Bowers, AndrewX
> <andrewx.bowers@intel.com>; Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Subject: [net] i40e: fix the calculation of VFs mac addresses
> 
> From: Zijie Pan <zijie.pan@6wind.com>
> 
> num_mac should be increased only after the call to i40e_add_mac_filter().
> 
> Fixes: 5f527ba962e2 ("i40e: Limit the number of MAC and VLAN addresses
> that can be added for VFs")
> CC: Anjali Singhai Jain <anjali.singhai@intel.com>
> CC: Andrew Bowers <andrewx.bowers@intel.com>
> Signed-off-by: Zijie Pan <zijie.pan@6wind.com>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Reviewed-by: Tushar Dave <tushar.n.dave@oracle.com>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 21 +++++++++++--------
> --
>  1 file changed, 11 insertions(+), 10 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



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

end of thread, other threads:[~2017-11-09 22:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-07 20:06 [Intel-wired-lan] [net] i40e: fix the calculation of VFs mac addresses Jeff Kirsher
2017-11-09 22:38 ` Bowers, AndrewX

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.