diff options
author | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2013-04-16 11:54:53 +0200 |
---|---|---|
committer | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2013-04-16 11:54:53 +0200 |
commit | 5aca4fabc06a93cfd0c99025fb38e3594a5d048c (patch) | |
tree | b45cd6172e9b91f3d2ca39ad1df861ee58b81897 /drivers | |
parent | a170a2d4591a6c20db5f9156664402982d32556c (diff) |
net: asix: fix Ethernet MAC address assignment after suspend
Turns out after suspend an unbind and bind operation is executed upon
which we subsequently gave out the 2nd custom user MAC address followed
by the default ASIX MAC address.
This patch fixes it by checking for the custom user MAC address upon
unbinding and in this case properly releasing it for subsequent reuse.
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/usb/asix.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index 3218f52b3a3d..f2d5822338d7 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c @@ -1994,6 +1994,18 @@ static void ax88772b_unbind(struct usbnet *dev, struct usb_interface *intf) struct ax88772b_data *ax772b_data = (struct ax88772b_data *)dev->priv; if (ax772b_data) { + /* Check for user set MAC address */ + if (!memcmp(dev->net->dev_addr, g_mac_addr, ETH_ALEN)) { + /* Release user set MAC address */ + g_usr_mac--; + + if (g_usr_mac == 2) { + /* 0x100000 offset for 2nd Ethernet MAC */ + g_mac_addr[3] -= 0x10; + if (g_mac_addr[3] > 0xf0) + devwarn(dev, "MAC address byte 3 (0x%02x) wrap around", g_mac_addr[3]); + } + } flush_workqueue (ax772b_data->ax_work); destroy_workqueue (ax772b_data->ax_work); |