aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb
diff options
context:
space:
mode:
authorOndrej Zary <linux@rainbow-software.org>2012-06-01 06:29:08 -0400
committerDavid S. Miller <davem@davemloft.net>2012-06-02 17:09:08 -0400
commitb1ff4f96fd1c63890d78d8939c6e0f2b44ce3113 (patch)
tree2163e7e43c6f67a6a14087f6f6e39d4aea361de8 /drivers/net/usb
parent6d7407bfba0b4eb21d843ff1f9e9c86156e502b2 (diff)
mcs7830: Implement link state detection
Add .status callback that detects link state changes. Tested with MCS7832CV-AA chip (9710:7830, identified as rev.C by the driver). Fixes https://bugzilla.kernel.org/show_bug.cgi?id=28532 Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r--drivers/net/usb/mcs7830.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c
index add1064f755..03c2d8d653d 100644
--- a/drivers/net/usb/mcs7830.c
+++ b/drivers/net/usb/mcs7830.c
@@ -629,11 +629,31 @@ static int mcs7830_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
629 return skb->len > 0; 629 return skb->len > 0;
630} 630}
631 631
632static void mcs7830_status(struct usbnet *dev, struct urb *urb)
633{
634 u8 *buf = urb->transfer_buffer;
635 bool link;
636
637 if (urb->actual_length < 16)
638 return;
639
640 link = !(buf[1] & 0x20);
641 if (netif_carrier_ok(dev->net) != link) {
642 if (link) {
643 netif_carrier_on(dev->net);
644 usbnet_defer_kevent(dev, EVENT_LINK_RESET);
645 } else
646 netif_carrier_off(dev->net);
647 netdev_dbg(dev->net, "Link Status is: %d\n", link);
648 }
649}
650
632static const struct driver_info moschip_info = { 651static const struct driver_info moschip_info = {
633 .description = "MOSCHIP 7830/7832/7730 usb-NET adapter", 652 .description = "MOSCHIP 7830/7832/7730 usb-NET adapter",
634 .bind = mcs7830_bind, 653 .bind = mcs7830_bind,
635 .rx_fixup = mcs7830_rx_fixup, 654 .rx_fixup = mcs7830_rx_fixup,
636 .flags = FLAG_ETHER, 655 .flags = FLAG_ETHER | FLAG_LINK_INTR,
656 .status = mcs7830_status,
637 .in = 1, 657 .in = 1,
638 .out = 2, 658 .out = 2,
639}; 659};
@@ -642,7 +662,8 @@ static const struct driver_info sitecom_info = {
642 .description = "Sitecom LN-30 usb-NET adapter", 662 .description = "Sitecom LN-30 usb-NET adapter",
643 .bind = mcs7830_bind, 663 .bind = mcs7830_bind,
644 .rx_fixup = mcs7830_rx_fixup, 664 .rx_fixup = mcs7830_rx_fixup,
645 .flags = FLAG_ETHER, 665 .flags = FLAG_ETHER | FLAG_LINK_INTR,
666 .status = mcs7830_status,
646 .in = 1, 667 .in = 1,
647 .out = 2, 668 .out = 2,
648}; 669};