diff options
author | David S. Miller <davem@davemloft.net> | 2012-06-25 18:50:32 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-25 18:50:32 -0400 |
commit | e486463e82e4dca9e8f4413649088b21c9ff87e5 (patch) | |
tree | 3fb17b54454a101416c2b22e6b4ea5a027b3c02b /drivers/net/usb/usbnet.c | |
parent | ed3b856b69a7f3748d6917e42d462c962aaa39b8 (diff) | |
parent | fa809e2fd6e317226c046202a88520962672eac0 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
drivers/net/usb/qmi_wwan.c
net/batman-adv/translation-table.c
net/ipv6/route.c
qmi_wwan.c resolution provided by Bjørn Mork.
batman-adv conflict is dealing merely with the changes
of global function names to have a proper subsystem
prefix.
ipv6's route.c conflict is merely two side-by-side additions
of network namespace methods.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb/usbnet.c')
-rw-r--r-- | drivers/net/usb/usbnet.c | 53 |
1 files changed, 33 insertions, 20 deletions
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index ac2e4936b421..e92c057f794a 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -793,11 +793,13 @@ int usbnet_open (struct net_device *net) | |||
793 | if (info->manage_power) { | 793 | if (info->manage_power) { |
794 | retval = info->manage_power(dev, 1); | 794 | retval = info->manage_power(dev, 1); |
795 | if (retval < 0) | 795 | if (retval < 0) |
796 | goto done; | 796 | goto done_manage_power_error; |
797 | usb_autopm_put_interface(dev->intf); | 797 | usb_autopm_put_interface(dev->intf); |
798 | } | 798 | } |
799 | return retval; | 799 | return retval; |
800 | 800 | ||
801 | done_manage_power_error: | ||
802 | clear_bit(EVENT_DEV_OPEN, &dev->flags); | ||
801 | done: | 803 | done: |
802 | usb_autopm_put_interface(dev->intf); | 804 | usb_autopm_put_interface(dev->intf); |
803 | done_nopm: | 805 | done_nopm: |
@@ -873,9 +875,9 @@ void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info) | |||
873 | { | 875 | { |
874 | struct usbnet *dev = netdev_priv(net); | 876 | struct usbnet *dev = netdev_priv(net); |
875 | 877 | ||
876 | strncpy (info->driver, dev->driver_name, sizeof info->driver); | 878 | strlcpy (info->driver, dev->driver_name, sizeof info->driver); |
877 | strncpy (info->version, DRIVER_VERSION, sizeof info->version); | 879 | strlcpy (info->version, DRIVER_VERSION, sizeof info->version); |
878 | strncpy (info->fw_version, dev->driver_info->description, | 880 | strlcpy (info->fw_version, dev->driver_info->description, |
879 | sizeof info->fw_version); | 881 | sizeof info->fw_version); |
880 | usb_make_path (dev->udev, info->bus_info, sizeof info->bus_info); | 882 | usb_make_path (dev->udev, info->bus_info, sizeof info->bus_info); |
881 | } | 883 | } |
@@ -1199,6 +1201,21 @@ deferred: | |||
1199 | } | 1201 | } |
1200 | EXPORT_SYMBOL_GPL(usbnet_start_xmit); | 1202 | EXPORT_SYMBOL_GPL(usbnet_start_xmit); |
1201 | 1203 | ||
1204 | static void rx_alloc_submit(struct usbnet *dev, gfp_t flags) | ||
1205 | { | ||
1206 | struct urb *urb; | ||
1207 | int i; | ||
1208 | |||
1209 | /* don't refill the queue all at once */ | ||
1210 | for (i = 0; i < 10 && dev->rxq.qlen < RX_QLEN(dev); i++) { | ||
1211 | urb = usb_alloc_urb(0, flags); | ||
1212 | if (urb != NULL) { | ||
1213 | if (rx_submit(dev, urb, flags) == -ENOLINK) | ||
1214 | return; | ||
1215 | } | ||
1216 | } | ||
1217 | } | ||
1218 | |||
1202 | /*-------------------------------------------------------------------------*/ | 1219 | /*-------------------------------------------------------------------------*/ |
1203 | 1220 | ||
1204 | // tasklet (work deferred from completions, in_irq) or timer | 1221 | // tasklet (work deferred from completions, in_irq) or timer |
@@ -1238,26 +1255,14 @@ static void usbnet_bh (unsigned long param) | |||
1238 | !timer_pending (&dev->delay) && | 1255 | !timer_pending (&dev->delay) && |
1239 | !test_bit (EVENT_RX_HALT, &dev->flags)) { | 1256 | !test_bit (EVENT_RX_HALT, &dev->flags)) { |
1240 | int temp = dev->rxq.qlen; | 1257 | int temp = dev->rxq.qlen; |
1241 | int qlen = RX_QLEN (dev); | 1258 | |
1242 | 1259 | if (temp < RX_QLEN(dev)) { | |
1243 | if (temp < qlen) { | 1260 | rx_alloc_submit(dev, GFP_ATOMIC); |
1244 | struct urb *urb; | ||
1245 | int i; | ||
1246 | |||
1247 | // don't refill the queue all at once | ||
1248 | for (i = 0; i < 10 && dev->rxq.qlen < qlen; i++) { | ||
1249 | urb = usb_alloc_urb (0, GFP_ATOMIC); | ||
1250 | if (urb != NULL) { | ||
1251 | if (rx_submit (dev, urb, GFP_ATOMIC) == | ||
1252 | -ENOLINK) | ||
1253 | return; | ||
1254 | } | ||
1255 | } | ||
1256 | if (temp != dev->rxq.qlen) | 1261 | if (temp != dev->rxq.qlen) |
1257 | netif_dbg(dev, link, dev->net, | 1262 | netif_dbg(dev, link, dev->net, |
1258 | "rxqlen %d --> %d\n", | 1263 | "rxqlen %d --> %d\n", |
1259 | temp, dev->rxq.qlen); | 1264 | temp, dev->rxq.qlen); |
1260 | if (dev->rxq.qlen < qlen) | 1265 | if (dev->rxq.qlen < RX_QLEN(dev)) |
1261 | tasklet_schedule (&dev->bh); | 1266 | tasklet_schedule (&dev->bh); |
1262 | } | 1267 | } |
1263 | if (dev->txq.qlen < TX_QLEN (dev)) | 1268 | if (dev->txq.qlen < TX_QLEN (dev)) |
@@ -1506,6 +1511,7 @@ int usbnet_suspend (struct usb_interface *intf, pm_message_t message) | |||
1506 | spin_lock_irq(&dev->txq.lock); | 1511 | spin_lock_irq(&dev->txq.lock); |
1507 | /* don't autosuspend while transmitting */ | 1512 | /* don't autosuspend while transmitting */ |
1508 | if (dev->txq.qlen && PMSG_IS_AUTO(message)) { | 1513 | if (dev->txq.qlen && PMSG_IS_AUTO(message)) { |
1514 | dev->suspend_count--; | ||
1509 | spin_unlock_irq(&dev->txq.lock); | 1515 | spin_unlock_irq(&dev->txq.lock); |
1510 | return -EBUSY; | 1516 | return -EBUSY; |
1511 | } else { | 1517 | } else { |
@@ -1562,6 +1568,13 @@ int usbnet_resume (struct usb_interface *intf) | |||
1562 | spin_unlock_irq(&dev->txq.lock); | 1568 | spin_unlock_irq(&dev->txq.lock); |
1563 | 1569 | ||
1564 | if (test_bit(EVENT_DEV_OPEN, &dev->flags)) { | 1570 | if (test_bit(EVENT_DEV_OPEN, &dev->flags)) { |
1571 | /* handle remote wakeup ASAP */ | ||
1572 | if (!dev->wait && | ||
1573 | netif_device_present(dev->net) && | ||
1574 | !timer_pending(&dev->delay) && | ||
1575 | !test_bit(EVENT_RX_HALT, &dev->flags)) | ||
1576 | rx_alloc_submit(dev, GFP_KERNEL); | ||
1577 | |||
1565 | if (!(dev->txq.qlen >= TX_QLEN(dev))) | 1578 | if (!(dev->txq.qlen >= TX_QLEN(dev))) |
1566 | netif_tx_wake_all_queues(dev->net); | 1579 | netif_tx_wake_all_queues(dev->net); |
1567 | tasklet_schedule (&dev->bh); | 1580 | tasklet_schedule (&dev->bh); |