* [PATCH] usbnet: mcs7830: rework link state detection
@ 2013-12-23 17:06 Octavian Purdila
2013-12-31 21:54 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Octavian Purdila @ 2013-12-23 17:06 UTC (permalink / raw)
To: netdev
Cc: linux-usb, hunold, jeroen, Octavian Purdila, Ondrej Zary,
Michael Leun, Ming Lei
Even with the quirks in commit dabdaf0c (mcs7830: Fix link state
detection) there are still spurious link-down events for some chips
where the false link-down events count go over a few hundreds.
This patch takes a more conservative approach and only looks at
link-down events where the link-down state is not combined with other
states (e.g. half/full speed, pending frames in SRAM or TX status
information valid). In all other cases we assume the link is up.
Tested on MCS7830CV-DA (USB ID 9710:7830).
Cc: Ondrej Zary <linux@rainbow-software.org>
Cc: Michael Leun <lkml20120218@newton.leun.net>
Cc: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
---
drivers/net/usb/mcs7830.c | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c
index 03832d3..f546378 100644
--- a/drivers/net/usb/mcs7830.c
+++ b/drivers/net/usb/mcs7830.c
@@ -117,7 +117,6 @@ enum {
struct mcs7830_data {
u8 multi_filter[8];
u8 config;
- u8 link_counter;
};
static const char driver_name[] = "MOSCHIP usb-ethernet driver";
@@ -561,26 +560,16 @@ static void mcs7830_status(struct usbnet *dev, struct urb *urb)
{
u8 *buf = urb->transfer_buffer;
bool link, link_changed;
- struct mcs7830_data *data = mcs7830_get_data(dev);
if (urb->actual_length < 16)
return;
- link = !(buf[1] & 0x20);
+ link = !(buf[1] == 0x20);
link_changed = netif_carrier_ok(dev->net) != link;
if (link_changed) {
- data->link_counter++;
- /*
- track link state 20 times to guard against erroneous
- link state changes reported sometimes by the chip
- */
- if (data->link_counter > 20) {
- data->link_counter = 0;
- usbnet_link_change(dev, link, 0);
- netdev_dbg(dev->net, "Link Status is: %d\n", link);
- }
- } else
- data->link_counter = 0;
+ usbnet_link_change(dev, link, 0);
+ netdev_dbg(dev->net, "Link Status is: %d\n", link);
+ }
}
static const struct driver_info moschip_info = {
--
1.8.3.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] usbnet: mcs7830: rework link state detection
2013-12-23 17:06 [PATCH] usbnet: mcs7830: rework link state detection Octavian Purdila
@ 2013-12-31 21:54 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-12-31 21:54 UTC (permalink / raw)
To: octavian.purdila
Cc: netdev, linux-usb, hunold, jeroen, linux, lkml20120218, ming.lei
From: Octavian Purdila <octavian.purdila@intel.com>
Date: Mon, 23 Dec 2013 19:06:31 +0200
> Even with the quirks in commit dabdaf0c (mcs7830: Fix link state
> detection) there are still spurious link-down events for some chips
> where the false link-down events count go over a few hundreds.
>
> This patch takes a more conservative approach and only looks at
> link-down events where the link-down state is not combined with other
> states (e.g. half/full speed, pending frames in SRAM or TX status
> information valid). In all other cases we assume the link is up.
>
> Tested on MCS7830CV-DA (USB ID 9710:7830).
>
> Cc: Ondrej Zary <linux@rainbow-software.org>
> Cc: Michael Leun <lkml20120218@newton.leun.net>
> Cc: Ming Lei <ming.lei@canonical.com>
> Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-31 21:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-23 17:06 [PATCH] usbnet: mcs7830: rework link state detection Octavian Purdila
2013-12-31 21:54 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).