aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-06-25 18:50:32 -0400
committerDavid S. Miller <davem@davemloft.net>2012-06-25 18:50:32 -0400
commite486463e82e4dca9e8f4413649088b21c9ff87e5 (patch)
tree3fb17b54454a101416c2b22e6b4ea5a027b3c02b /drivers/net/usb
parented3b856b69a7f3748d6917e42d462c962aaa39b8 (diff)
parentfa809e2fd6e317226c046202a88520962672eac0 (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')
-rw-r--r--drivers/net/usb/qmi_wwan.c83
-rw-r--r--drivers/net/usb/usbnet.c53
2 files changed, 73 insertions, 63 deletions
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index f1e779135899..68ca6769210f 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -269,29 +269,6 @@ err:
269 return rv; 269 return rv;
270} 270}
271 271
272/* Gobi devices uses identical class/protocol codes for all interfaces regardless
273 * of function. Some of these are CDC ACM like and have the exact same endpoints
274 * we are looking for. This leaves two possible strategies for identifying the
275 * correct interface:
276 * a) hardcoding interface number, or
277 * b) use the fact that the wwan interface is the only one lacking additional
278 * (CDC functional) descriptors
279 *
280 * Let's see if we can get away with the generic b) solution.
281 */
282static int qmi_wwan_bind_gobi(struct usbnet *dev, struct usb_interface *intf)
283{
284 int rv = -EINVAL;
285
286 /* ignore any interface with additional descriptors */
287 if (intf->cur_altsetting->extralen)
288 goto err;
289
290 rv = qmi_wwan_bind_shared(dev, intf);
291err:
292 return rv;
293}
294
295static void qmi_wwan_unbind(struct usbnet *dev, struct usb_interface *intf) 272static void qmi_wwan_unbind(struct usbnet *dev, struct usb_interface *intf)
296{ 273{
297 struct qmi_wwan_state *info = (void *)&dev->data; 274 struct qmi_wwan_state *info = (void *)&dev->data;
@@ -375,15 +352,15 @@ static const struct driver_info qmi_wwan_shared = {
375 .manage_power = qmi_wwan_manage_power, 352 .manage_power = qmi_wwan_manage_power,
376}; 353};
377 354
378static const struct driver_info qmi_wwan_gobi = { 355static const struct driver_info qmi_wwan_force_int0 = {
379 .description = "Qualcomm Gobi wwan/QMI device", 356 .description = "Qualcomm WWAN/QMI device",
380 .flags = FLAG_WWAN, 357 .flags = FLAG_WWAN,
381 .bind = qmi_wwan_bind_gobi, 358 .bind = qmi_wwan_bind_shared,
382 .unbind = qmi_wwan_unbind, 359 .unbind = qmi_wwan_unbind,
383 .manage_power = qmi_wwan_manage_power, 360 .manage_power = qmi_wwan_manage_power,
361 .data = BIT(0), /* interface whitelist bitmap */
384}; 362};
385 363
386/* ZTE suck at making USB descriptors */
387static const struct driver_info qmi_wwan_force_int1 = { 364static const struct driver_info qmi_wwan_force_int1 = {
388 .description = "Qualcomm WWAN/QMI device", 365 .description = "Qualcomm WWAN/QMI device",
389 .flags = FLAG_WWAN, 366 .flags = FLAG_WWAN,
@@ -393,6 +370,15 @@ static const struct driver_info qmi_wwan_force_int1 = {
393 .data = BIT(1), /* interface whitelist bitmap */ 370 .data = BIT(1), /* interface whitelist bitmap */
394}; 371};
395 372
373static const struct driver_info qmi_wwan_force_int3 = {
374 .description = "Qualcomm WWAN/QMI device",
375 .flags = FLAG_WWAN,
376 .bind = qmi_wwan_bind_shared,
377 .unbind = qmi_wwan_unbind,
378 .manage_power = qmi_wwan_manage_power,
379 .data = BIT(3), /* interface whitelist bitmap */
380};
381
396static const struct driver_info qmi_wwan_force_int4 = { 382static const struct driver_info qmi_wwan_force_int4 = {
397 .description = "Qualcomm WWAN/QMI device", 383 .description = "Qualcomm WWAN/QMI device",
398 .flags = FLAG_WWAN, 384 .flags = FLAG_WWAN,
@@ -418,16 +404,23 @@ static const struct driver_info qmi_wwan_force_int4 = {
418static const struct driver_info qmi_wwan_sierra = { 404static const struct driver_info qmi_wwan_sierra = {
419 .description = "Sierra Wireless wwan/QMI device", 405 .description = "Sierra Wireless wwan/QMI device",
420 .flags = FLAG_WWAN, 406 .flags = FLAG_WWAN,
421 .bind = qmi_wwan_bind_gobi, 407 .bind = qmi_wwan_bind_shared,
422 .unbind = qmi_wwan_unbind, 408 .unbind = qmi_wwan_unbind,
423 .manage_power = qmi_wwan_manage_power, 409 .manage_power = qmi_wwan_manage_power,
424 .data = BIT(8) | BIT(19), /* interface whitelist bitmap */ 410 .data = BIT(8) | BIT(19), /* interface whitelist bitmap */
425}; 411};
426 412
427#define HUAWEI_VENDOR_ID 0x12D1 413#define HUAWEI_VENDOR_ID 0x12D1
414
415/* Gobi 1000 QMI/wwan interface number is 3 according to qcserial */
416#define QMI_GOBI1K_DEVICE(vend, prod) \
417 USB_DEVICE(vend, prod), \
418 .driver_info = (unsigned long)&qmi_wwan_force_int3
419
420/* Gobi 2000 and Gobi 3000 QMI/wwan interface number is 0 according to qcserial */
428#define QMI_GOBI_DEVICE(vend, prod) \ 421#define QMI_GOBI_DEVICE(vend, prod) \
429 USB_DEVICE(vend, prod), \ 422 USB_DEVICE(vend, prod), \
430 .driver_info = (unsigned long)&qmi_wwan_gobi 423 .driver_info = (unsigned long)&qmi_wwan_force_int0
431 424
432static const struct usb_device_id products[] = { 425static const struct usb_device_id products[] = {
433 { /* Huawei E392, E398 and possibly others sharing both device id and more... */ 426 { /* Huawei E392, E398 and possibly others sharing both device id and more... */
@@ -538,20 +531,24 @@ static const struct usb_device_id products[] = {
538 .bInterfaceProtocol = 0xff, 531 .bInterfaceProtocol = 0xff,
539 .driver_info = (unsigned long)&qmi_wwan_sierra, 532 .driver_info = (unsigned long)&qmi_wwan_sierra,
540 }, 533 },
541 {QMI_GOBI_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ 534
542 {QMI_GOBI_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ 535 /* Gobi 1000 devices */
543 {QMI_GOBI_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */ 536 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
544 {QMI_GOBI_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */ 537 {QMI_GOBI1K_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */
545 {QMI_GOBI_DEVICE(0x413c, 0x8172)}, /* Dell Gobi Modem device */ 538 {QMI_GOBI1K_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */
546 {QMI_GOBI_DEVICE(0x1410, 0xa001)}, /* Novatel Gobi Modem device */ 539 {QMI_GOBI1K_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */
547 {QMI_GOBI_DEVICE(0x0b05, 0x1776)}, /* Asus Gobi Modem device */ 540 {QMI_GOBI1K_DEVICE(0x413c, 0x8172)}, /* Dell Gobi Modem device */
548 {QMI_GOBI_DEVICE(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */ 541 {QMI_GOBI1K_DEVICE(0x1410, 0xa001)}, /* Novatel Gobi Modem device */
549 {QMI_GOBI_DEVICE(0x05c6, 0x9001)}, /* Generic Gobi Modem device */ 542 {QMI_GOBI1K_DEVICE(0x0b05, 0x1776)}, /* Asus Gobi Modem device */
550 {QMI_GOBI_DEVICE(0x05c6, 0x9002)}, /* Generic Gobi Modem device */ 543 {QMI_GOBI1K_DEVICE(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */
551 {QMI_GOBI_DEVICE(0x05c6, 0x9202)}, /* Generic Gobi Modem device */ 544 {QMI_GOBI1K_DEVICE(0x05c6, 0x9001)}, /* Generic Gobi Modem device */
552 {QMI_GOBI_DEVICE(0x05c6, 0x9203)}, /* Generic Gobi Modem device */ 545 {QMI_GOBI1K_DEVICE(0x05c6, 0x9002)}, /* Generic Gobi Modem device */
553 {QMI_GOBI_DEVICE(0x05c6, 0x9222)}, /* Generic Gobi Modem device */ 546 {QMI_GOBI1K_DEVICE(0x05c6, 0x9202)}, /* Generic Gobi Modem device */
554 {QMI_GOBI_DEVICE(0x05c6, 0x9009)}, /* Generic Gobi Modem device */ 547 {QMI_GOBI1K_DEVICE(0x05c6, 0x9203)}, /* Generic Gobi Modem device */
548 {QMI_GOBI1K_DEVICE(0x05c6, 0x9222)}, /* Generic Gobi Modem device */
549 {QMI_GOBI1K_DEVICE(0x05c6, 0x9009)}, /* Generic Gobi Modem device */
550
551 /* Gobi 2000 and 3000 devices */
555 {QMI_GOBI_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */ 552 {QMI_GOBI_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */
556 {QMI_GOBI_DEVICE(0x05c6, 0x920b)}, /* Generic Gobi 2000 Modem device */ 553 {QMI_GOBI_DEVICE(0x05c6, 0x920b)}, /* Generic Gobi 2000 Modem device */
557 {QMI_GOBI_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */ 554 {QMI_GOBI_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */
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
801done_manage_power_error:
802 clear_bit(EVENT_DEV_OPEN, &dev->flags);
801done: 803done:
802 usb_autopm_put_interface(dev->intf); 804 usb_autopm_put_interface(dev->intf);
803done_nopm: 805done_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}
1200EXPORT_SYMBOL_GPL(usbnet_start_xmit); 1202EXPORT_SYMBOL_GPL(usbnet_start_xmit);
1201 1203
1204static 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);