i40e: fold the i40e_is_vsi_in_vlan check into i40e_put_mac_in_vlan
authorJacob Keller <jacob.e.keller@intel.com>
Fri, 11 Nov 2016 20:39:33 +0000 (12:39 -0800)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Fri, 3 Feb 2017 06:37:09 +0000 (22:37 -0800)
Fold the check for determining when to call i40e_put_mac_in_vlan directly
into the function so that we don't need to decide which function to use
ahead of time. This allows us to just call i40e_put_mac_in_vlan directly
without having to check ahead of time.

Change-ID: Ifff526940748ac14b8418be5df5a149502eed137
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_main.c
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c

index 0b4adcc..7a11d2b 100644 (file)
@@ -1498,6 +1498,9 @@ struct i40e_mac_filter *i40e_put_mac_in_vlan(struct i40e_vsi *vsi,
                return i40e_add_filter(vsi, macaddr,
                                       le16_to_cpu(vsi->info.pvid));
 
+       if (!i40e_is_vsi_in_vlan(vsi))
+               return i40e_add_filter(vsi, macaddr, I40E_VLAN_ANY);
+
        hash_for_each_safe(vsi->mac_filter_hash, bkt, h, f, hlist) {
                if (f->state == I40E_FILTER_REMOVE)
                        continue;
@@ -1756,14 +1759,8 @@ static int i40e_addr_sync(struct net_device *netdev, const u8 *addr)
 {
        struct i40e_netdev_priv *np = netdev_priv(netdev);
        struct i40e_vsi *vsi = np->vsi;
-       struct i40e_mac_filter *f;
-
-       if (i40e_is_vsi_in_vlan(vsi))
-               f = i40e_put_mac_in_vlan(vsi, addr);
-       else
-               f = i40e_add_filter(vsi, addr, I40E_VLAN_ANY);
 
-       if (f)
+       if (i40e_put_mac_in_vlan(vsi, addr))
                return 0;
        else
                return -ENOMEM;
index a6198b7..0cdbdd3 100644 (file)
@@ -1942,12 +1942,8 @@ 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 (i40e_is_vsi_in_vlan(vsi))
-                               f = i40e_put_mac_in_vlan(vsi, al->list[i].addr);
-                       else
-                               f = i40e_add_filter(vsi, al->list[i].addr, -1);
-               }
+               if (!f)
+                       f = i40e_put_mac_in_vlan(vsi, al->list[i].addr);
 
                if (!f) {
                        dev_err(&pf->pdev->dev,