]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ixgbe: Allow setting zero MAC address for VF
authorTony Nguyen <anthony.l.nguyen@intel.com>
Wed, 12 Apr 2017 20:35:22 +0000 (13:35 -0700)
committerJack Vogel <jack.vogel@oracle.com>
Fri, 16 Jun 2017 06:01:24 +0000 (23:01 -0700)
Currently, there is no logic that allows a VF's MAC address to be removed
from the RAR table.

Allow the user to specify a zero MAC address in order to clear the VF's
MAC address from the RAR table.  This functionality is also utilized by
libvirt when removing VFs.

Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Orabug: 26242766
(cherry picked from commit 27bdc44cdb2a8d96322d5978895eaae881fb8c2d)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
Reviewed-by: Ethan Zhao <ethan.zhao@oracle.com>
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c

index 3632112cd3d5cefce5221dc50eff4d30440e687a..7a715cff48a54cbf934dc1829edbd9d94dbf2469 100644 (file)
@@ -1336,18 +1336,26 @@ void ixgbe_ping_all_vfs(struct ixgbe_adapter *adapter)
 int ixgbe_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac)
 {
        struct ixgbe_adapter *adapter = netdev_priv(netdev);
-       if (!is_valid_ether_addr(mac) || (vf >= adapter->num_vfs))
+
+       if (vf >= adapter->num_vfs)
+               return -EINVAL;
+
+       if (is_zero_ether_addr(mac)) {
+               adapter->vfinfo[vf].pf_set_mac = false;
+               dev_info(&adapter->pdev->dev, "removing MAC on VF %d\n", vf);
+       } else if (is_valid_ether_addr(mac)) {
+               adapter->vfinfo[vf].pf_set_mac = true;
+               dev_info(&adapter->pdev->dev, "setting MAC %pM on VF %d\n",
+                        mac, vf);
+               dev_info(&adapter->pdev->dev, "Reload the VF driver to make this change effective.");
+               if (test_bit(__IXGBE_DOWN, &adapter->state)) {
+                       dev_warn(&adapter->pdev->dev, "The VF MAC address has been set, but the PF device is not up.\n");
+                       dev_warn(&adapter->pdev->dev, "Bring the PF device up before attempting to use the VF device.\n");
+               }
+       } else {
                return -EINVAL;
-       adapter->vfinfo[vf].pf_set_mac = true;
-       dev_info(&adapter->pdev->dev, "setting MAC %pM on VF %d\n", mac, vf);
-       dev_info(&adapter->pdev->dev, "Reload the VF driver to make this"
-                                     " change effective.");
-       if (test_bit(__IXGBE_DOWN, &adapter->state)) {
-               dev_warn(&adapter->pdev->dev, "The VF MAC address has been set,"
-                        " but the PF device is not up.\n");
-               dev_warn(&adapter->pdev->dev, "Bring the PF device up before"
-                        " attempting to use the VF device.\n");
        }
+
        return ixgbe_set_vf_mac(adapter, vf, mac);
 }