usbnet.c (5eeb3132eb4c5e9ca92e5247fe4575fe9f8c3efe) usbnet.c (65841fd5132c3941cdf5df09e70df3ed28323212)
1/*
2 * USB Network driver infrastructure
3 * Copyright (C) 2000-2005 by David Brownell
4 * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 1190 unchanged lines hidden (view full) ---

1199 "> tx, len %d, type 0x%x\n", length, skb->protocol);
1200#ifdef CONFIG_PM
1201deferred:
1202#endif
1203 return NETDEV_TX_OK;
1204}
1205EXPORT_SYMBOL_GPL(usbnet_start_xmit);
1206
1/*
2 * USB Network driver infrastructure
3 * Copyright (C) 2000-2005 by David Brownell
4 * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 1190 unchanged lines hidden (view full) ---

1199 "> tx, len %d, type 0x%x\n", length, skb->protocol);
1200#ifdef CONFIG_PM
1201deferred:
1202#endif
1203 return NETDEV_TX_OK;
1204}
1205EXPORT_SYMBOL_GPL(usbnet_start_xmit);
1206
1207static void rx_alloc_submit(struct usbnet *dev, gfp_t flags)
1208{
1209 struct urb *urb;
1210 int i;
1211
1212 /* don't refill the queue all at once */
1213 for (i = 0; i < 10 && dev->rxq.qlen < RX_QLEN(dev); i++) {
1214 urb = usb_alloc_urb(0, flags);
1215 if (urb != NULL) {
1216 if (rx_submit(dev, urb, flags) == -ENOLINK)
1217 return;
1218 }
1219 }
1220}
1221
1207/*-------------------------------------------------------------------------*/
1208
1209// tasklet (work deferred from completions, in_irq) or timer
1210
1211static void usbnet_bh (unsigned long param)
1212{
1213 struct usbnet *dev = (struct usbnet *) param;
1214 struct sk_buff *skb;

--- 23 unchanged lines hidden (view full) ---

1238 }
1239
1240 // or are we maybe short a few urbs?
1241 } else if (netif_running (dev->net) &&
1242 netif_device_present (dev->net) &&
1243 !timer_pending (&dev->delay) &&
1244 !test_bit (EVENT_RX_HALT, &dev->flags)) {
1245 int temp = dev->rxq.qlen;
1222/*-------------------------------------------------------------------------*/
1223
1224// tasklet (work deferred from completions, in_irq) or timer
1225
1226static void usbnet_bh (unsigned long param)
1227{
1228 struct usbnet *dev = (struct usbnet *) param;
1229 struct sk_buff *skb;

--- 23 unchanged lines hidden (view full) ---

1253 }
1254
1255 // or are we maybe short a few urbs?
1256 } else if (netif_running (dev->net) &&
1257 netif_device_present (dev->net) &&
1258 !timer_pending (&dev->delay) &&
1259 !test_bit (EVENT_RX_HALT, &dev->flags)) {
1260 int temp = dev->rxq.qlen;
1246 int qlen = RX_QLEN (dev);
1247
1261
1248 if (temp < qlen) {
1249 struct urb *urb;
1250 int i;
1251
1252 // don't refill the queue all at once
1253 for (i = 0; i < 10 && dev->rxq.qlen < qlen; i++) {
1254 urb = usb_alloc_urb (0, GFP_ATOMIC);
1255 if (urb != NULL) {
1256 if (rx_submit (dev, urb, GFP_ATOMIC) ==
1257 -ENOLINK)
1258 return;
1259 }
1260 }
1262 if (temp < RX_QLEN(dev)) {
1263 rx_alloc_submit(dev, GFP_ATOMIC);
1261 if (temp != dev->rxq.qlen)
1262 netif_dbg(dev, link, dev->net,
1263 "rxqlen %d --> %d\n",
1264 temp, dev->rxq.qlen);
1264 if (temp != dev->rxq.qlen)
1265 netif_dbg(dev, link, dev->net,
1266 "rxqlen %d --> %d\n",
1267 temp, dev->rxq.qlen);
1265 if (dev->rxq.qlen < qlen)
1268 if (dev->rxq.qlen < RX_QLEN(dev))
1266 tasklet_schedule (&dev->bh);
1267 }
1268 if (dev->txq.qlen < TX_QLEN (dev))
1269 netif_wake_queue (dev->net);
1270 }
1271}
1272
1273

--- 293 unchanged lines hidden (view full) ---

1567 }
1568 }
1569
1570 smp_mb();
1571 clear_bit(EVENT_DEV_ASLEEP, &dev->flags);
1572 spin_unlock_irq(&dev->txq.lock);
1573
1574 if (test_bit(EVENT_DEV_OPEN, &dev->flags)) {
1269 tasklet_schedule (&dev->bh);
1270 }
1271 if (dev->txq.qlen < TX_QLEN (dev))
1272 netif_wake_queue (dev->net);
1273 }
1274}
1275
1276

--- 293 unchanged lines hidden (view full) ---

1570 }
1571 }
1572
1573 smp_mb();
1574 clear_bit(EVENT_DEV_ASLEEP, &dev->flags);
1575 spin_unlock_irq(&dev->txq.lock);
1576
1577 if (test_bit(EVENT_DEV_OPEN, &dev->flags)) {
1578 /* handle remote wakeup ASAP */
1579 if (!dev->wait &&
1580 netif_device_present(dev->net) &&
1581 !timer_pending(&dev->delay) &&
1582 !test_bit(EVENT_RX_HALT, &dev->flags))
1583 rx_alloc_submit(dev, GFP_KERNEL);
1584
1575 if (!(dev->txq.qlen >= TX_QLEN(dev)))
1576 netif_tx_wake_all_queues(dev->net);
1577 tasklet_schedule (&dev->bh);
1578 }
1579 }
1580 return 0;
1581}
1582EXPORT_SYMBOL_GPL(usbnet_resume);

--- 23 unchanged lines hidden ---
1585 if (!(dev->txq.qlen >= TX_QLEN(dev)))
1586 netif_tx_wake_all_queues(dev->net);
1587 tasklet_schedule (&dev->bh);
1588 }
1589 }
1590 return 0;
1591}
1592EXPORT_SYMBOL_GPL(usbnet_resume);

--- 23 unchanged lines hidden ---