]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
be2net: Fix mac address collision in some configurations
authorSuresh Reddy <Suresh.Reddy@broadcom.com>
Wed, 7 Sep 2016 14:27:53 +0000 (19:57 +0530)
committerDhaval Giani <dhaval.giani@oracle.com>
Wed, 8 Mar 2017 01:05:35 +0000 (20:05 -0500)
Orabug: 25570957

If the device mac address is updated using ndo_set_mac_address(),
while the same mac address is already programmed, the driver does not
detect this condition if its netdev->dev_addr has been changed. The
driver tries to add the same mac address resulting in mac address
collision error. This has been observed in bonding mode-5 configuration.

To fix this, store the mac address configured in HW in the adapter
structure. Use this to compare against the new address being updated
to avoid collision.

Signed-off-by: Suresh Reddy <Suresh.Reddy@broadcom.com>
Signed-off-by: Sathya Perla <sathya.perla@broadcom.com>
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit c27ebf58517536c0006813007680b24db17def47)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/ethernet/emulex/benet/be.h
drivers/net/ethernet/emulex/benet/be_main.c

Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
drivers/net/ethernet/emulex/benet/be.h
drivers/net/ethernet/emulex/benet/be_main.c

index 9f4e831bc8c3b03dd2798ac3785060c1220f13a5..c6452bb9ccf42fe6f50258706729fb8c85a613a5 100644 (file)
@@ -625,6 +625,7 @@ struct be_adapter {
        u32 fat_dump_len;
        u16 serial_num[CNTL_SERIAL_NUM_WORDS];
        u8 phy_state; /* state of sfp optics (functional, faulted, etc.,) */
+       u8 dev_mac[ETH_ALEN];
 };
 
 #define be_physfn(adapter)             (!adapter->virtfn)
index fde31d72eda0d71469c2c99e6b9ffee3c9667421..bf3372c51fd323740faa43394e9f5dc3f801a542 100644 (file)
@@ -275,7 +275,7 @@ static int be_mac_addr_set(struct net_device *netdev, void *p)
        /* Proceed further only if, User provided MAC is different
         * from active MAC
         */
-       if (ether_addr_equal(addr->sa_data, netdev->dev_addr))
+       if (ether_addr_equal(addr->sa_data, adapter->dev_mac))
                return 0;
 
        /* if device is not running, copy MAC to netdev->dev_addr */
@@ -317,6 +317,7 @@ static int be_mac_addr_set(struct net_device *netdev, void *p)
                goto err;
        }
 done:
+       ether_addr_copy(adapter->dev_mac, addr->sa_data);
        ether_addr_copy(netdev->dev_addr, addr->sa_data);
        dev_info(dev, "MAC address changed to %pM\n", addr->sa_data);
        return 0;
@@ -3661,6 +3662,7 @@ static int be_enable_if_filters(struct be_adapter *adapter)
                                         &adapter->pmac_id[0], 0);
                if (status)
                        return status;
+               ether_addr_copy(adapter->dev_mac, adapter->netdev->dev_addr);
        }
 
        if (adapter->vlans_added)