aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb
diff options
context:
space:
mode:
authorAndreas Mohr <andi@lisas.de>2010-01-30 21:58:19 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-03 21:28:57 -0500
commit76802851b6e1b78b614ba611d6b5d27a83f60ded (patch)
treeba7dd5815926b0dbd6dde7e42a79c15cce0b564c /drivers/net/usb
parentcdaff1854f32ac9ddb4733530f617d32188665ed (diff)
MCS7830 USB-Ether: add Rx error support
ChangeLog: - evaluate Rx error statistics from trailing Rx status byte - add driver TODO list - add myself to authors Quilt series run-tested, based on 2.6.33-rc4 (net-2.6.git mcs7830 has idle history, should be good to go). Signed-off-by: Andreas Mohr <andi@lisas.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r--drivers/net/usb/mcs7830.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c
index 87374317f480..22cccda33366 100644
--- a/drivers/net/usb/mcs7830.c
+++ b/drivers/net/usb/mcs7830.c
@@ -3,11 +3,27 @@
3 * 3 *
4 * based on usbnet.c, asix.c and the vendor provided mcs7830 driver 4 * based on usbnet.c, asix.c and the vendor provided mcs7830 driver
5 * 5 *
6 * Copyright (C) 2010 Andreas Mohr <andi@lisas.de>
6 * Copyright (C) 2006 Arnd Bergmann <arnd@arndb.de> 7 * Copyright (C) 2006 Arnd Bergmann <arnd@arndb.de>
7 * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com> 8 * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com>
8 * Copyright (C) 2005 Phil Chang <pchang23@sbcglobal.net> 9 * Copyright (C) 2005 Phil Chang <pchang23@sbcglobal.net>
9 * Copyright (c) 2002-2003 TiVo Inc. 10 * Copyright (c) 2002-2003 TiVo Inc.
10 * 11 *
12 * Definitions gathered from MOSCHIP, Data Sheet_7830DA.pdf (thanks!).
13 *
14 * TODO:
15 * - add .reset_resume support (iface is _gone_ after resume w/ power loss)
16 * - verify that mcs7830_get_regs() does have same output pre-/post-suspend
17 * - support HIF_REG_CONFIG_SLEEPMODE/HIF_REG_CONFIG_TXENABLE (via autopm?)
18 * - implement ethtool_ops get_pauseparam/set_pauseparam
19 * via HIF_REG_PAUSE_THRESHOLD (>= revision C only!)
20 * - implement get_eeprom/[set_eeprom]
21 * - switch PHY on/off on ifup/ifdown (perhaps in usbnet.c, via MII)
22 * - mcs7830_get_regs() handling is weird: for rev 2 we return 32 regs,
23 * can access only ~ 24, remaining user buffer is uninitialized garbage
24 * - anything else?
25 *
26 *
11 * This program is free software; you can redistribute it and/or modify 27 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by 28 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or 29 * the Free Software Foundation; either version 2 of the License, or
@@ -83,6 +99,17 @@ enum {
83 HIF_REG_PAUSE_THRESHOLD_DEFAULT = 0, 99 HIF_REG_PAUSE_THRESHOLD_DEFAULT = 0,
84}; 100};
85 101
102/* Trailing status byte in Ethernet Rx frame */
103enum {
104 MCS7830_RX_SHORT_FRAME = 0x01, /* < 64 bytes */
105 MCS7830_RX_LENGTH_ERROR = 0x02, /* framelen != Ethernet length field */
106 MCS7830_RX_ALIGNMENT_ERROR = 0x04, /* non-even number of nibbles */
107 MCS7830_RX_CRC_ERROR = 0x08,
108 MCS7830_RX_LARGE_FRAME = 0x10, /* > 1518 bytes */
109 MCS7830_RX_FRAME_CORRECT = 0x20, /* frame is correct */
110 /* [7:6] reserved */
111};
112
86struct mcs7830_data { 113struct mcs7830_data {
87 u8 multi_filter[8]; 114 u8 multi_filter[8];
88 u8 config; 115 u8 config;
@@ -539,9 +566,23 @@ static int mcs7830_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
539 skb_trim(skb, skb->len - 1); 566 skb_trim(skb, skb->len - 1);
540 status = skb->data[skb->len]; 567 status = skb->data[skb->len];
541 568
542 if (status != 0x20) 569 if (status != MCS7830_RX_FRAME_CORRECT) {
543 dev_dbg(&dev->udev->dev, "rx fixup status %x\n", status); 570 dev_dbg(&dev->udev->dev, "rx fixup status %x\n", status);
544 571
572 /* hmm, perhaps usbnet.c already sees a globally visible
573 frame error and increments rx_errors on its own already? */
574 dev->net->stats.rx_errors++;
575
576 if (status & (MCS7830_RX_SHORT_FRAME
577 |MCS7830_RX_LENGTH_ERROR
578 |MCS7830_RX_LARGE_FRAME))
579 dev->net->stats.rx_length_errors++;
580 if (status & MCS7830_RX_ALIGNMENT_ERROR)
581 dev->net->stats.rx_frame_errors++;
582 if (status & MCS7830_RX_CRC_ERROR)
583 dev->net->stats.rx_crc_errors++;
584 }
585
545 return skb->len > 0; 586 return skb->len > 0;
546} 587}
547 588