Skip to contentSkip to conversation

i40e: fix the calculation of VFs mac addresses

Intel-wired-lan Jeff Kirsher 2 participants 2 messages Nov 7, 2017 – Nov 9, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

From: Zijie Pan <[email protected]>

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 <[email protected]>
CC Andrew Bowers <[email protected]>
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +11 -10
index 4d1e670f490e..2d1f3dbe67f1 100644
@@ -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);
Tested-by Andrew Bowers
#1 lore raw
Quoted 20 lines

-----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 <[email protected]>; Singhai, Anjali <[email protected]>; Bowers, AndrewX <[email protected]>; Nicolas Dichtel <[email protected]>
Subject: [net] i40e: fix the calculation of VFs mac addresses

From: Zijie Pan <[email protected]>

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

Quoted 4 lines
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 21 +++++++++++--------
--
 1 file changed, 11 insertions(+), 10 deletions(-)