diff options
Diffstat (limited to 'drivers/net/usb/usbnet.c')
-rw-r--r-- | drivers/net/usb/usbnet.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 8531c1caac28..fc9f578a1e25 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -1201,19 +1201,26 @@ deferred: | |||
1201 | } | 1201 | } |
1202 | EXPORT_SYMBOL_GPL(usbnet_start_xmit); | 1202 | EXPORT_SYMBOL_GPL(usbnet_start_xmit); |
1203 | 1203 | ||
1204 | static void rx_alloc_submit(struct usbnet *dev, gfp_t flags) | 1204 | static int rx_alloc_submit(struct usbnet *dev, gfp_t flags) |
1205 | { | 1205 | { |
1206 | struct urb *urb; | 1206 | struct urb *urb; |
1207 | int i; | 1207 | int i; |
1208 | int ret = 0; | ||
1208 | 1209 | ||
1209 | /* don't refill the queue all at once */ | 1210 | /* don't refill the queue all at once */ |
1210 | for (i = 0; i < 10 && dev->rxq.qlen < RX_QLEN(dev); i++) { | 1211 | for (i = 0; i < 10 && dev->rxq.qlen < RX_QLEN(dev); i++) { |
1211 | urb = usb_alloc_urb(0, flags); | 1212 | urb = usb_alloc_urb(0, flags); |
1212 | if (urb != NULL) { | 1213 | if (urb != NULL) { |
1213 | if (rx_submit(dev, urb, flags) == -ENOLINK) | 1214 | ret = rx_submit(dev, urb, flags); |
1214 | return; | 1215 | if (ret) |
1216 | goto err; | ||
1217 | } else { | ||
1218 | ret = -ENOMEM; | ||
1219 | goto err; | ||
1215 | } | 1220 | } |
1216 | } | 1221 | } |
1222 | err: | ||
1223 | return ret; | ||
1217 | } | 1224 | } |
1218 | 1225 | ||
1219 | /*-------------------------------------------------------------------------*/ | 1226 | /*-------------------------------------------------------------------------*/ |
@@ -1257,7 +1264,8 @@ static void usbnet_bh (unsigned long param) | |||
1257 | int temp = dev->rxq.qlen; | 1264 | int temp = dev->rxq.qlen; |
1258 | 1265 | ||
1259 | if (temp < RX_QLEN(dev)) { | 1266 | if (temp < RX_QLEN(dev)) { |
1260 | rx_alloc_submit(dev, GFP_ATOMIC); | 1267 | if (rx_alloc_submit(dev, GFP_ATOMIC) == -ENOLINK) |
1268 | return; | ||
1261 | if (temp != dev->rxq.qlen) | 1269 | if (temp != dev->rxq.qlen) |
1262 | netif_dbg(dev, link, dev->net, | 1270 | netif_dbg(dev, link, dev->net, |
1263 | "rxqlen %d --> %d\n", | 1271 | "rxqlen %d --> %d\n", |
@@ -1573,7 +1581,7 @@ int usbnet_resume (struct usb_interface *intf) | |||
1573 | netif_device_present(dev->net) && | 1581 | netif_device_present(dev->net) && |
1574 | !timer_pending(&dev->delay) && | 1582 | !timer_pending(&dev->delay) && |
1575 | !test_bit(EVENT_RX_HALT, &dev->flags)) | 1583 | !test_bit(EVENT_RX_HALT, &dev->flags)) |
1576 | rx_alloc_submit(dev, GFP_KERNEL); | 1584 | rx_alloc_submit(dev, GFP_NOIO); |
1577 | 1585 | ||
1578 | if (!(dev->txq.qlen >= TX_QLEN(dev))) | 1586 | if (!(dev->txq.qlen >= TX_QLEN(dev))) |
1579 | netif_tx_wake_all_queues(dev->net); | 1587 | netif_tx_wake_all_queues(dev->net); |