diff options
Diffstat (limited to 'drivers/net/usb/asix.c')
-rw-r--r-- | drivers/net/usb/asix.c | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index e95f0e60a9bc..d6da5eed5453 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #include <linux/usb/usbnet.h> | 36 | #include <linux/usb/usbnet.h> |
37 | #include <linux/slab.h> | 37 | #include <linux/slab.h> |
38 | 38 | ||
39 | #define DRIVER_VERSION "08-Nov-2011" | 39 | #define DRIVER_VERSION "22-Dec-2011" |
40 | #define DRIVER_NAME "asix" | 40 | #define DRIVER_NAME "asix" |
41 | 41 | ||
42 | /* ASIX AX8817X based USB 2.0 Ethernet Devices */ | 42 | /* ASIX AX8817X based USB 2.0 Ethernet Devices */ |
@@ -376,7 +376,7 @@ static int asix_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
376 | 376 | ||
377 | skb_pull(skb, (size + 1) & 0xfffe); | 377 | skb_pull(skb, (size + 1) & 0xfffe); |
378 | 378 | ||
379 | if (skb->len == 0) | 379 | if (skb->len < sizeof(header)) |
380 | break; | 380 | break; |
381 | 381 | ||
382 | head = (u8 *) skb->data; | 382 | head = (u8 *) skb->data; |
@@ -689,6 +689,10 @@ asix_get_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo) | |||
689 | } | 689 | } |
690 | wolinfo->supported = WAKE_PHY | WAKE_MAGIC; | 690 | wolinfo->supported = WAKE_PHY | WAKE_MAGIC; |
691 | wolinfo->wolopts = 0; | 691 | wolinfo->wolopts = 0; |
692 | if (opt & AX_MONITOR_LINK) | ||
693 | wolinfo->wolopts |= WAKE_PHY; | ||
694 | if (opt & AX_MONITOR_MAGIC) | ||
695 | wolinfo->wolopts |= WAKE_MAGIC; | ||
692 | } | 696 | } |
693 | 697 | ||
694 | static int | 698 | static int |
@@ -974,6 +978,7 @@ static int ax88772_link_reset(struct usbnet *dev) | |||
974 | 978 | ||
975 | static int ax88772_reset(struct usbnet *dev) | 979 | static int ax88772_reset(struct usbnet *dev) |
976 | { | 980 | { |
981 | struct asix_data *data = (struct asix_data *)&dev->data; | ||
977 | int ret, embd_phy; | 982 | int ret, embd_phy; |
978 | u16 rx_ctl; | 983 | u16 rx_ctl; |
979 | 984 | ||
@@ -1051,6 +1056,13 @@ static int ax88772_reset(struct usbnet *dev) | |||
1051 | goto out; | 1056 | goto out; |
1052 | } | 1057 | } |
1053 | 1058 | ||
1059 | /* Rewrite MAC address */ | ||
1060 | memcpy(data->mac_addr, dev->net->dev_addr, ETH_ALEN); | ||
1061 | ret = asix_write_cmd(dev, AX_CMD_WRITE_NODE_ID, 0, 0, ETH_ALEN, | ||
1062 | data->mac_addr); | ||
1063 | if (ret < 0) | ||
1064 | goto out; | ||
1065 | |||
1054 | /* Set RX_CTL to default values with 2k buffer, and enable cactus */ | 1066 | /* Set RX_CTL to default values with 2k buffer, and enable cactus */ |
1055 | ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL); | 1067 | ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL); |
1056 | if (ret < 0) | 1068 | if (ret < 0) |
@@ -1148,7 +1160,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1148 | return 0; | 1160 | return 0; |
1149 | } | 1161 | } |
1150 | 1162 | ||
1151 | static struct ethtool_ops ax88178_ethtool_ops = { | 1163 | static const struct ethtool_ops ax88178_ethtool_ops = { |
1152 | .get_drvinfo = asix_get_drvinfo, | 1164 | .get_drvinfo = asix_get_drvinfo, |
1153 | .get_link = asix_get_link, | 1165 | .get_link = asix_get_link, |
1154 | .get_msglevel = usbnet_get_msglevel, | 1166 | .get_msglevel = usbnet_get_msglevel, |
@@ -1316,6 +1328,13 @@ static int ax88178_reset(struct usbnet *dev) | |||
1316 | if (ret < 0) | 1328 | if (ret < 0) |
1317 | return ret; | 1329 | return ret; |
1318 | 1330 | ||
1331 | /* Rewrite MAC address */ | ||
1332 | memcpy(data->mac_addr, dev->net->dev_addr, ETH_ALEN); | ||
1333 | ret = asix_write_cmd(dev, AX_CMD_WRITE_NODE_ID, 0, 0, ETH_ALEN, | ||
1334 | data->mac_addr); | ||
1335 | if (ret < 0) | ||
1336 | return ret; | ||
1337 | |||
1319 | ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL); | 1338 | ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL); |
1320 | if (ret < 0) | 1339 | if (ret < 0) |
1321 | return ret; | 1340 | return ret; |
@@ -1580,6 +1599,10 @@ static const struct usb_device_id products [] = { | |||
1580 | USB_DEVICE (0x6189, 0x182d), | 1599 | USB_DEVICE (0x6189, 0x182d), |
1581 | .driver_info = (unsigned long) &ax8817x_info, | 1600 | .driver_info = (unsigned long) &ax8817x_info, |
1582 | }, { | 1601 | }, { |
1602 | // Sitecom LN-031 "USB 2.0 10/100/1000 Ethernet adapter" | ||
1603 | USB_DEVICE (0x0df6, 0x0056), | ||
1604 | .driver_info = (unsigned long) &ax88178_info, | ||
1605 | }, { | ||
1583 | // corega FEther USB2-TX | 1606 | // corega FEther USB2-TX |
1584 | USB_DEVICE (0x07aa, 0x0017), | 1607 | USB_DEVICE (0x07aa, 0x0017), |
1585 | .driver_info = (unsigned long) &ax8817x_info, | 1608 | .driver_info = (unsigned long) &ax8817x_info, |
@@ -1674,17 +1697,7 @@ static struct usb_driver asix_driver = { | |||
1674 | .supports_autosuspend = 1, | 1697 | .supports_autosuspend = 1, |
1675 | }; | 1698 | }; |
1676 | 1699 | ||
1677 | static int __init asix_init(void) | 1700 | module_usb_driver(asix_driver); |
1678 | { | ||
1679 | return usb_register(&asix_driver); | ||
1680 | } | ||
1681 | module_init(asix_init); | ||
1682 | |||
1683 | static void __exit asix_exit(void) | ||
1684 | { | ||
1685 | usb_deregister(&asix_driver); | ||
1686 | } | ||
1687 | module_exit(asix_exit); | ||
1688 | 1701 | ||
1689 | MODULE_AUTHOR("David Hollis"); | 1702 | MODULE_AUTHOR("David Hollis"); |
1690 | MODULE_VERSION(DRIVER_VERSION); | 1703 | MODULE_VERSION(DRIVER_VERSION); |