ixgbe: Ensure MAC filter was added before setting MACVLAN
authorTony Nguyen <anthony.l.nguyen@intel.com>
Wed, 19 Jul 2017 22:00:26 +0000 (15:00 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 25 Jul 2017 23:27:12 +0000 (16:27 -0700)
This patch adds a check to ensure that adding the MAC filter was
successful before setting the MACVLAN.  If it was unsuccessful, propagate
the error.

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>
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c

index 0760bd7eeb01a4a5a90898645ce80f02f775d338..112d24c6c9cea336d6db06d2b92f509cabb5dcb3 100644 (file)
@@ -679,8 +679,9 @@ update_vlvfb:
 static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *adapter,
                                int vf, int index, unsigned char *mac_addr)
 {
-       struct list_head *pos;
        struct vf_macvlans *entry;
+       struct list_head *pos;
+       int retval = 0;
 
        if (index <= 1) {
                list_for_each(pos, &adapter->vf_mvs.l) {
@@ -721,13 +722,15 @@ static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *adapter,
        if (!entry || !entry->free)
                return -ENOSPC;
 
+       retval = ixgbe_add_mac_filter(adapter, mac_addr, vf);
+       if (retval < 0)
+               return retval;
+
        entry->free = false;
        entry->is_macvlan = true;
        entry->vf = vf;
        memcpy(entry->vf_macvlan, mac_addr, ETH_ALEN);
 
-       ixgbe_add_mac_filter(adapter, mac_addr, vf);
-
        return 0;
 }