aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/net/usbnet.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/net/usbnet.c')
-rw-r--r--drivers/usb/net/usbnet.c44
1 files changed, 34 insertions, 10 deletions
diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c
index 54183e173a6d..98a522f1e264 100644
--- a/drivers/usb/net/usbnet.c
+++ b/drivers/usb/net/usbnet.c
@@ -61,8 +61,11 @@
61 * let the USB host controller be busy for 5msec or more before an irq 61 * let the USB host controller be busy for 5msec or more before an irq
62 * is required, under load. Jumbograms change the equation. 62 * is required, under load. Jumbograms change the equation.
63 */ 63 */
64#define RX_QLEN(dev) (((dev)->udev->speed == USB_SPEED_HIGH) ? 60 : 4) 64#define RX_MAX_QUEUE_MEMORY (60 * 1518)
65#define TX_QLEN(dev) (((dev)->udev->speed == USB_SPEED_HIGH) ? 60 : 4) 65#define RX_QLEN(dev) (((dev)->udev->speed == USB_SPEED_HIGH) ? \
66 (RX_MAX_QUEUE_MEMORY/(dev)->rx_urb_size) : 4)
67#define TX_QLEN(dev) (((dev)->udev->speed == USB_SPEED_HIGH) ? \
68 (RX_MAX_QUEUE_MEMORY/(dev)->hard_mtu) : 4)
66 69
67// reawaken network queue this soon after stopping; else watchdog barks 70// reawaken network queue this soon after stopping; else watchdog barks
68#define TX_TIMEOUT_JIFFIES (5*HZ) 71#define TX_TIMEOUT_JIFFIES (5*HZ)
@@ -227,13 +230,23 @@ static int usbnet_change_mtu (struct net_device *net, int new_mtu)
227{ 230{
228 struct usbnet *dev = netdev_priv(net); 231 struct usbnet *dev = netdev_priv(net);
229 int ll_mtu = new_mtu + net->hard_header_len; 232 int ll_mtu = new_mtu + net->hard_header_len;
233 int old_hard_mtu = dev->hard_mtu;
234 int old_rx_urb_size = dev->rx_urb_size;
230 235
231 if (new_mtu <= 0 || ll_mtu > dev->hard_mtu) 236 if (new_mtu <= 0)
232 return -EINVAL; 237 return -EINVAL;
233 // no second zero-length packet read wanted after mtu-sized packets 238 // no second zero-length packet read wanted after mtu-sized packets
234 if ((ll_mtu % dev->maxpacket) == 0) 239 if ((ll_mtu % dev->maxpacket) == 0)
235 return -EDOM; 240 return -EDOM;
236 net->mtu = new_mtu; 241 net->mtu = new_mtu;
242
243 dev->hard_mtu = net->mtu + net->hard_header_len;
244 if (dev->rx_urb_size == old_hard_mtu) {
245 dev->rx_urb_size = dev->hard_mtu;
246 if (dev->rx_urb_size > old_rx_urb_size)
247 usbnet_unlink_rx_urbs(dev);
248 }
249
237 return 0; 250 return 0;
238} 251}
239 252
@@ -412,9 +425,9 @@ static void rx_complete (struct urb *urb, struct pt_regs *regs)
412 // we get controller i/o faults during khubd disconnect() delays. 425 // we get controller i/o faults during khubd disconnect() delays.
413 // throttle down resubmits, to avoid log floods; just temporarily, 426 // throttle down resubmits, to avoid log floods; just temporarily,
414 // so we still recover when the fault isn't a khubd delay. 427 // so we still recover when the fault isn't a khubd delay.
415 case -EPROTO: // ehci 428 case -EPROTO:
416 case -ETIMEDOUT: // ohci 429 case -ETIME:
417 case -EILSEQ: // uhci 430 case -EILSEQ:
418 dev->stats.rx_errors++; 431 dev->stats.rx_errors++;
419 if (!timer_pending (&dev->delay)) { 432 if (!timer_pending (&dev->delay)) {
420 mod_timer (&dev->delay, jiffies + THROTTLE_JIFFIES); 433 mod_timer (&dev->delay, jiffies + THROTTLE_JIFFIES);
@@ -521,6 +534,17 @@ static int unlink_urbs (struct usbnet *dev, struct sk_buff_head *q)
521 return count; 534 return count;
522} 535}
523 536
537// Flush all pending rx urbs
538// minidrivers may need to do this when the MTU changes
539
540void usbnet_unlink_rx_urbs(struct usbnet *dev)
541{
542 if (netif_running(dev->net)) {
543 (void) unlink_urbs (dev, &dev->rxq);
544 tasklet_schedule(&dev->bh);
545 }
546}
547EXPORT_SYMBOL_GPL(usbnet_unlink_rx_urbs);
524 548
525/*-------------------------------------------------------------------------*/ 549/*-------------------------------------------------------------------------*/
526 550
@@ -629,7 +653,7 @@ static int usbnet_open (struct net_device *net)
629 653
630 devinfo (dev, "open: enable queueing " 654 devinfo (dev, "open: enable queueing "
631 "(rx %d, tx %d) mtu %d %s framing", 655 "(rx %d, tx %d) mtu %d %s framing",
632 RX_QLEN (dev), TX_QLEN (dev), dev->net->mtu, 656 (int)RX_QLEN (dev), (int)TX_QLEN (dev), dev->net->mtu,
633 framing); 657 framing);
634 } 658 }
635 659
@@ -797,9 +821,9 @@ static void tx_complete (struct urb *urb, struct pt_regs *regs)
797 821
798 // like rx, tx gets controller i/o faults during khubd delays 822 // like rx, tx gets controller i/o faults during khubd delays
799 // and so it uses the same throttling mechanism. 823 // and so it uses the same throttling mechanism.
800 case -EPROTO: // ehci 824 case -EPROTO:
801 case -ETIMEDOUT: // ohci 825 case -ETIME:
802 case -EILSEQ: // uhci 826 case -EILSEQ:
803 if (!timer_pending (&dev->delay)) { 827 if (!timer_pending (&dev->delay)) {
804 mod_timer (&dev->delay, 828 mod_timer (&dev->delay,
805 jiffies + THROTTLE_JIFFIES); 829 jiffies + THROTTLE_JIFFIES);