Re: [linux-usb-devel] [linux-2.6.5] oops when plugging CDC USB networkdevice...
From: David Brownell
Date: Tue May 11 2004 - 09:59:00 EST
Daniel Blueman wrote:
Alan, David,
Thanks for your response - the problem observed in linux-2.6.5 is fixed in
2.6.6. Now I get a status code of -75 [1] and see no additional networking
devices.
In drivers/usb/core/message.c::usb_string(), try making the retry
cases consider not just -EPIPE faults but also -EOVERFLOW. Likewise
in the get_descriptor() logic. (Some devices seem to have firmware
bugs that cause those failures, and are often amenable to retries.)
Also, this patch should help correct the "missing diagnostics with
CONFIG_USB_DEBUG during CDC Ethernet probe()" issue ... and help
show more precisely where the problem is.
- Dave
--- linux-2.5/drivers/usb/net/usbnet.c 2004-04-23 19:19:49.000000000 -0700
+++ gadget-2.6/drivers/usb/net/usbnet.c 2004-05-09 13:10:23.000000000 -0700
@@ -107,7 +107,13 @@
*
*-------------------------------------------------------------------------*/
+// #define DEBUG // error path messages, extra info
+// #define VERBOSE // more; success messages
+
#include <linux/config.h>
+#ifdef CONFIG_USB_DEBUG
+# define DEBUG
+#endif
#include <linux/module.h>
#include <linux/kmod.h>
#include <linux/sched.h>
@@ -120,25 +126,15 @@
#include <linux/mii.h>
#include <asm/uaccess.h>
#include <asm/unaligned.h>
-
-
-// #define DEBUG // error path messages, extra info
-// #define VERBOSE // more; success messages
-#define REALLY_QUEUE
-
-#if !defined (DEBUG) && defined (CONFIG_USB_DEBUG)
-# define DEBUG
-#endif
#include <linux/usb.h>
-
#include <asm/io.h>
#include <asm/scatterlist.h>
#include <linux/mm.h>
#include <linux/dma-mapping.h>
-
#define DRIVER_VERSION "25-Aug-2003"
+
/*-------------------------------------------------------------------------*/
/*
@@ -148,13 +144,8 @@
* For high speed, each frame comfortably fits almost 36 max size
* Ethernet packets (so queues should be bigger).
*/
-#ifdef REALLY_QUEUE
#define RX_QLEN(dev) (((dev)->udev->speed == USB_SPEED_HIGH) ? 60 : 4)
#define TX_QLEN(dev) (((dev)->udev->speed == USB_SPEED_HIGH) ? 60 : 4)
-#else
-#define RX_QLEN(dev) 1
-#define TX_QLEN(dev) 1
-#endif
// packets are always ethernet inside
// ... except they can be bigger (limit of 64K with NetChip framing)
@@ -1006,7 +997,7 @@
if (!info->control || !info->data) {
dev_dbg (&intf->dev,
"master #%u/%p slave #%u/%p\n",
- info->u->bMasterInterface0
+ info->u->bMasterInterface0,
info->control,
info->u->bSlaveInterface0,
info->data);
@@ -1142,10 +1133,13 @@
unsigned char buf [13];
tmp = usb_string (dev->udev, e->iMACAddress, buf, sizeof buf);
- if (tmp < 0)
+ if (tmp != 12) {
+ dev_dbg (&dev->udev->dev,
+ "bad MAC string %d fetch, %d\n", e->iMACAddress, tmp);
+ if (tmp >= 0)
+ tmp = -EINVAL;
return tmp;
- else if (tmp != 12)
- return -EINVAL;
+ }
for (i = tmp = 0; i < 6; i++, tmp += 2)
dev->net->dev_addr [i] =
(nibble (buf [tmp]) << 4) + nibble (buf [tmp + 1]);