diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/usb/usbnet.c | 76 | ||||
-rw-r--r-- | drivers/net/usb/usbnet.h | 10 |
2 files changed, 44 insertions, 42 deletions
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index a12f576391cf..86b690843362 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -192,7 +192,7 @@ static int init_status (struct usbnet *dev, struct usb_interface *intf) | |||
192 | usb_pipeendpoint(pipe), maxp, period); | 192 | usb_pipeendpoint(pipe), maxp, period); |
193 | } | 193 | } |
194 | } | 194 | } |
195 | return 0; | 195 | return 0; |
196 | } | 196 | } |
197 | 197 | ||
198 | /* Passes this packet up the stack, updating its accounting. | 198 | /* Passes this packet up the stack, updating its accounting. |
@@ -326,7 +326,7 @@ static void rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags) | |||
326 | if (netif_running (dev->net) | 326 | if (netif_running (dev->net) |
327 | && netif_device_present (dev->net) | 327 | && netif_device_present (dev->net) |
328 | && !test_bit (EVENT_RX_HALT, &dev->flags)) { | 328 | && !test_bit (EVENT_RX_HALT, &dev->flags)) { |
329 | switch (retval = usb_submit_urb (urb, GFP_ATOMIC)){ | 329 | switch (retval = usb_submit_urb (urb, GFP_ATOMIC)) { |
330 | case -EPIPE: | 330 | case -EPIPE: |
331 | usbnet_defer_kevent (dev, EVENT_RX_HALT); | 331 | usbnet_defer_kevent (dev, EVENT_RX_HALT); |
332 | break; | 332 | break; |
@@ -393,8 +393,8 @@ static void rx_complete (struct urb *urb) | |||
393 | entry->urb = NULL; | 393 | entry->urb = NULL; |
394 | 394 | ||
395 | switch (urb_status) { | 395 | switch (urb_status) { |
396 | // success | 396 | /* success */ |
397 | case 0: | 397 | case 0: |
398 | if (skb->len < dev->net->hard_header_len) { | 398 | if (skb->len < dev->net->hard_header_len) { |
399 | entry->state = rx_cleanup; | 399 | entry->state = rx_cleanup; |
400 | dev->stats.rx_errors++; | 400 | dev->stats.rx_errors++; |
@@ -404,28 +404,30 @@ static void rx_complete (struct urb *urb) | |||
404 | } | 404 | } |
405 | break; | 405 | break; |
406 | 406 | ||
407 | // stalls need manual reset. this is rare ... except that | 407 | /* stalls need manual reset. this is rare ... except that |
408 | // when going through USB 2.0 TTs, unplug appears this way. | 408 | * when going through USB 2.0 TTs, unplug appears this way. |
409 | // we avoid the highspeed version of the ETIMEOUT/EILSEQ | 409 | * we avoid the highspeed version of the ETIMEOUT/EILSEQ |
410 | // storm, recovering as needed. | 410 | * storm, recovering as needed. |
411 | case -EPIPE: | 411 | */ |
412 | case -EPIPE: | ||
412 | dev->stats.rx_errors++; | 413 | dev->stats.rx_errors++; |
413 | usbnet_defer_kevent (dev, EVENT_RX_HALT); | 414 | usbnet_defer_kevent (dev, EVENT_RX_HALT); |
414 | // FALLTHROUGH | 415 | // FALLTHROUGH |
415 | 416 | ||
416 | // software-driven interface shutdown | 417 | /* software-driven interface shutdown */ |
417 | case -ECONNRESET: // async unlink | 418 | case -ECONNRESET: /* async unlink */ |
418 | case -ESHUTDOWN: // hardware gone | 419 | case -ESHUTDOWN: /* hardware gone */ |
419 | if (netif_msg_ifdown (dev)) | 420 | if (netif_msg_ifdown (dev)) |
420 | devdbg (dev, "rx shutdown, code %d", urb_status); | 421 | devdbg (dev, "rx shutdown, code %d", urb_status); |
421 | goto block; | 422 | goto block; |
422 | 423 | ||
423 | // we get controller i/o faults during khubd disconnect() delays. | 424 | /* we get controller i/o faults during khubd disconnect() delays. |
424 | // throttle down resubmits, to avoid log floods; just temporarily, | 425 | * throttle down resubmits, to avoid log floods; just temporarily, |
425 | // so we still recover when the fault isn't a khubd delay. | 426 | * so we still recover when the fault isn't a khubd delay. |
426 | case -EPROTO: | 427 | */ |
427 | case -ETIME: | 428 | case -EPROTO: |
428 | case -EILSEQ: | 429 | case -ETIME: |
430 | case -EILSEQ: | ||
429 | dev->stats.rx_errors++; | 431 | dev->stats.rx_errors++; |
430 | if (!timer_pending (&dev->delay)) { | 432 | if (!timer_pending (&dev->delay)) { |
431 | mod_timer (&dev->delay, jiffies + THROTTLE_JIFFIES); | 433 | mod_timer (&dev->delay, jiffies + THROTTLE_JIFFIES); |
@@ -438,12 +440,12 @@ block: | |||
438 | urb = NULL; | 440 | urb = NULL; |
439 | break; | 441 | break; |
440 | 442 | ||
441 | // data overrun ... flush fifo? | 443 | /* data overrun ... flush fifo? */ |
442 | case -EOVERFLOW: | 444 | case -EOVERFLOW: |
443 | dev->stats.rx_over_errors++; | 445 | dev->stats.rx_over_errors++; |
444 | // FALLTHROUGH | 446 | // FALLTHROUGH |
445 | 447 | ||
446 | default: | 448 | default: |
447 | entry->state = rx_cleanup; | 449 | entry->state = rx_cleanup; |
448 | dev->stats.rx_errors++; | 450 | dev->stats.rx_errors++; |
449 | if (netif_msg_rx_err (dev)) | 451 | if (netif_msg_rx_err (dev)) |
@@ -471,22 +473,22 @@ static void intr_complete (struct urb *urb) | |||
471 | int status = urb->status; | 473 | int status = urb->status; |
472 | 474 | ||
473 | switch (status) { | 475 | switch (status) { |
474 | /* success */ | 476 | /* success */ |
475 | case 0: | 477 | case 0: |
476 | dev->driver_info->status(dev, urb); | 478 | dev->driver_info->status(dev, urb); |
477 | break; | 479 | break; |
478 | 480 | ||
479 | /* software-driven interface shutdown */ | 481 | /* software-driven interface shutdown */ |
480 | case -ENOENT: // urb killed | 482 | case -ENOENT: /* urb killed */ |
481 | case -ESHUTDOWN: // hardware gone | 483 | case -ESHUTDOWN: /* hardware gone */ |
482 | if (netif_msg_ifdown (dev)) | 484 | if (netif_msg_ifdown (dev)) |
483 | devdbg (dev, "intr shutdown, code %d", status); | 485 | devdbg (dev, "intr shutdown, code %d", status); |
484 | return; | 486 | return; |
485 | 487 | ||
486 | /* NOTE: not throttling like RX/TX, since this endpoint | 488 | /* NOTE: not throttling like RX/TX, since this endpoint |
487 | * already polls infrequently | 489 | * already polls infrequently |
488 | */ | 490 | */ |
489 | default: | 491 | default: |
490 | devdbg (dev, "intr status %d", status); | 492 | devdbg (dev, "intr status %d", status); |
491 | break; | 493 | break; |
492 | } | 494 | } |
@@ -569,9 +571,9 @@ static int usbnet_stop (struct net_device *net) | |||
569 | temp = unlink_urbs (dev, &dev->txq) + unlink_urbs (dev, &dev->rxq); | 571 | temp = unlink_urbs (dev, &dev->txq) + unlink_urbs (dev, &dev->rxq); |
570 | 572 | ||
571 | // maybe wait for deletions to finish. | 573 | // maybe wait for deletions to finish. |
572 | while (!skb_queue_empty(&dev->rxq) && | 574 | while (!skb_queue_empty(&dev->rxq) |
573 | !skb_queue_empty(&dev->txq) && | 575 | && !skb_queue_empty(&dev->txq) |
574 | !skb_queue_empty(&dev->done)) { | 576 | && !skb_queue_empty(&dev->done)) { |
575 | msleep(UNLINK_TIMEOUT_MS); | 577 | msleep(UNLINK_TIMEOUT_MS); |
576 | if (netif_msg_ifdown (dev)) | 578 | if (netif_msg_ifdown (dev)) |
577 | devdbg (dev, "waited for %d urb completions", temp); | 579 | devdbg (dev, "waited for %d urb completions", temp); |
@@ -1011,16 +1013,16 @@ static void usbnet_bh (unsigned long param) | |||
1011 | while ((skb = skb_dequeue (&dev->done))) { | 1013 | while ((skb = skb_dequeue (&dev->done))) { |
1012 | entry = (struct skb_data *) skb->cb; | 1014 | entry = (struct skb_data *) skb->cb; |
1013 | switch (entry->state) { | 1015 | switch (entry->state) { |
1014 | case rx_done: | 1016 | case rx_done: |
1015 | entry->state = rx_cleanup; | 1017 | entry->state = rx_cleanup; |
1016 | rx_process (dev, skb); | 1018 | rx_process (dev, skb); |
1017 | continue; | 1019 | continue; |
1018 | case tx_done: | 1020 | case tx_done: |
1019 | case rx_cleanup: | 1021 | case rx_cleanup: |
1020 | usb_free_urb (entry->urb); | 1022 | usb_free_urb (entry->urb); |
1021 | dev_kfree_skb (skb); | 1023 | dev_kfree_skb (skb); |
1022 | continue; | 1024 | continue; |
1023 | default: | 1025 | default: |
1024 | devdbg (dev, "bogus skb state %d", entry->state); | 1026 | devdbg (dev, "bogus skb state %d", entry->state); |
1025 | } | 1027 | } |
1026 | } | 1028 | } |
diff --git a/drivers/net/usb/usbnet.h b/drivers/net/usb/usbnet.h index a3f8b9e7bc00..a6c5820767de 100644 --- a/drivers/net/usb/usbnet.h +++ b/drivers/net/usb/usbnet.h | |||
@@ -47,7 +47,7 @@ struct usbnet { | |||
47 | unsigned long data [5]; | 47 | unsigned long data [5]; |
48 | u32 xid; | 48 | u32 xid; |
49 | u32 hard_mtu; /* count any extra framing */ | 49 | u32 hard_mtu; /* count any extra framing */ |
50 | size_t rx_urb_size; /* size for rx urbs */ | 50 | size_t rx_urb_size; /* size for rx urbs */ |
51 | struct mii_if_info mii; | 51 | struct mii_if_info mii; |
52 | 52 | ||
53 | /* various kinds of pending driver work */ | 53 | /* various kinds of pending driver work */ |
@@ -85,7 +85,7 @@ struct driver_info { | |||
85 | #define FLAG_NO_SETINT 0x0010 /* device can't set_interface() */ | 85 | #define FLAG_NO_SETINT 0x0010 /* device can't set_interface() */ |
86 | #define FLAG_ETHER 0x0020 /* maybe use "eth%d" names */ | 86 | #define FLAG_ETHER 0x0020 /* maybe use "eth%d" names */ |
87 | 87 | ||
88 | #define FLAG_FRAMING_AX 0x0040 /* AX88772/178 packets */ | 88 | #define FLAG_FRAMING_AX 0x0040 /* AX88772/178 packets */ |
89 | 89 | ||
90 | /* init device ... can sleep, or cause probe() failure */ | 90 | /* init device ... can sleep, or cause probe() failure */ |
91 | int (*bind)(struct usbnet *, struct usb_interface *); | 91 | int (*bind)(struct usbnet *, struct usb_interface *); |
@@ -146,9 +146,9 @@ extern void usbnet_cdc_unbind (struct usbnet *, struct usb_interface *); | |||
146 | 146 | ||
147 | /* CDC and RNDIS support the same host-chosen packet filters for IN transfers */ | 147 | /* CDC and RNDIS support the same host-chosen packet filters for IN transfers */ |
148 | #define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \ | 148 | #define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \ |
149 | |USB_CDC_PACKET_TYPE_ALL_MULTICAST \ | 149 | |USB_CDC_PACKET_TYPE_ALL_MULTICAST \ |
150 | |USB_CDC_PACKET_TYPE_PROMISCUOUS \ | 150 | |USB_CDC_PACKET_TYPE_PROMISCUOUS \ |
151 | |USB_CDC_PACKET_TYPE_DIRECTED) | 151 | |USB_CDC_PACKET_TYPE_DIRECTED) |
152 | 152 | ||
153 | 153 | ||
154 | /* we record the state for each of our queued skbs */ | 154 | /* we record the state for each of our queued skbs */ |