]>
Commit | Line | Data |
---|---|---|
da6424d9 AF |
1 | From 4e9792dc8ab29175295c79c35f9f6fbd2d453b35 Mon Sep 17 00:00:00 2001 |
2 | From: Octavian Purdila <octavian.purdila@intel.com> | |
3 | Date: Mon, 23 Dec 2013 19:06:31 +0200 | |
4 | Subject: [PATCH] usbnet: mcs7830: rework link state detection | |
5 | ||
6 | Even with the quirks in commit dabdaf0c (mcs7830: Fix link state | |
7 | detection) there are still spurious link-down events for some chips | |
8 | where the false link-down events count go over a few hundreds. | |
9 | ||
10 | This patch takes a more conservative approach and only looks at | |
11 | link-down events where the link-down state is not combined with other | |
12 | states (e.g. half/full speed, pending frames in SRAM or TX status | |
13 | information valid). In all other cases we assume the link is up. | |
14 | ||
15 | Tested on MCS7830CV-DA (USB ID 9710:7830). | |
16 | ||
17 | Cc: Ondrej Zary <linux@rainbow-software.org> | |
18 | Cc: Michael Leun <lkml20120218@newton.leun.net> | |
19 | Cc: Ming Lei <ming.lei@canonical.com> | |
20 | Signed-off-by: Octavian Purdila <octavian.purdila@intel.com> | |
21 | Signed-off-by: David S. Miller <davem@davemloft.net> | |
22 | --- | |
23 | drivers/net/usb/mcs7830.c | 19 ++++--------------- | |
24 | 1 file changed, 4 insertions(+), 15 deletions(-) | |
25 | ||
26 | diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c | |
27 | index 9237c45..8dd48b5 100644 | |
28 | --- a/drivers/net/usb/mcs7830.c | |
29 | +++ b/drivers/net/usb/mcs7830.c | |
30 | @@ -117,7 +117,6 @@ enum { | |
31 | struct mcs7830_data { | |
32 | u8 multi_filter[8]; | |
33 | u8 config; | |
34 | - u8 link_counter; | |
35 | }; | |
36 | ||
37 | static const char driver_name[] = "MOSCHIP usb-ethernet driver"; | |
38 | @@ -562,26 +561,16 @@ static void mcs7830_status(struct usbnet *dev, struct urb *urb) | |
39 | { | |
40 | u8 *buf = urb->transfer_buffer; | |
41 | bool link, link_changed; | |
42 | - struct mcs7830_data *data = mcs7830_get_data(dev); | |
43 | ||
44 | if (urb->actual_length < 16) | |
45 | return; | |
46 | ||
47 | - link = !(buf[1] & 0x20); | |
48 | + link = !(buf[1] == 0x20); | |
49 | link_changed = netif_carrier_ok(dev->net) != link; | |
50 | if (link_changed) { | |
51 | - data->link_counter++; | |
52 | - /* | |
53 | - track link state 20 times to guard against erroneous | |
54 | - link state changes reported sometimes by the chip | |
55 | - */ | |
56 | - if (data->link_counter > 20) { | |
57 | - data->link_counter = 0; | |
58 | - usbnet_link_change(dev, link, 0); | |
59 | - netdev_dbg(dev->net, "Link Status is: %d\n", link); | |
60 | - } | |
61 | - } else | |
62 | - data->link_counter = 0; | |
63 | + usbnet_link_change(dev, link, 0); | |
64 | + netdev_dbg(dev->net, "Link Status is: %d\n", link); | |
65 | + } | |
66 | } | |
67 | ||
68 | static const struct driver_info moschip_info = { | |
69 | -- | |
70 | 2.0.0 | |
71 |