aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/usb')
-rw-r--r--drivers/net/usb/asix.c16
-rw-r--r--drivers/net/usb/catc.c6
-rw-r--r--drivers/net/usb/cdc_ether.c113
-rw-r--r--drivers/net/usb/dm9601.c6
-rw-r--r--drivers/net/usb/mcs7830.c6
-rw-r--r--drivers/net/usb/smsc75xx.c6
-rw-r--r--drivers/net/usb/smsc95xx.c6
-rw-r--r--drivers/net/usb/usbnet.c15
8 files changed, 69 insertions, 105 deletions
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index 35f56fc82803..8e7d2374558b 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -558,16 +558,14 @@ static void asix_set_multicast(struct net_device *net)
558 * for our 8 byte filter buffer 558 * for our 8 byte filter buffer
559 * to avoid allocating memory that 559 * to avoid allocating memory that
560 * is tricky to free later */ 560 * is tricky to free later */
561 struct dev_mc_list *mc_list; 561 struct netdev_hw_addr *ha;
562 u32 crc_bits; 562 u32 crc_bits;
563 563
564 memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE); 564 memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE);
565 565
566 /* Build the multicast hash filter. */ 566 /* Build the multicast hash filter. */
567 netdev_for_each_mc_addr(mc_list, net) { 567 netdev_for_each_mc_addr(ha, net) {
568 crc_bits = 568 crc_bits = ether_crc(ETH_ALEN, ha->addr) >> 26;
569 ether_crc(ETH_ALEN,
570 mc_list->dmi_addr) >> 26;
571 data->multi_filter[crc_bits >> 3] |= 569 data->multi_filter[crc_bits >> 3] |=
572 1 << (crc_bits & 7); 570 1 << (crc_bits & 7);
573 } 571 }
@@ -794,16 +792,14 @@ static void ax88172_set_multicast(struct net_device *net)
794 * for our 8 byte filter buffer 792 * for our 8 byte filter buffer
795 * to avoid allocating memory that 793 * to avoid allocating memory that
796 * is tricky to free later */ 794 * is tricky to free later */
797 struct dev_mc_list *mc_list; 795 struct netdev_hw_addr *ha;
798 u32 crc_bits; 796 u32 crc_bits;
799 797
800 memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE); 798 memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE);
801 799
802 /* Build the multicast hash filter. */ 800 /* Build the multicast hash filter. */
803 netdev_for_each_mc_addr(mc_list, net) { 801 netdev_for_each_mc_addr(ha, net) {
804 crc_bits = 802 crc_bits = ether_crc(ETH_ALEN, ha->addr) >> 26;
805 ether_crc(ETH_ALEN,
806 mc_list->dmi_addr) >> 26;
807 data->multi_filter[crc_bits >> 3] |= 803 data->multi_filter[crc_bits >> 3] |=
808 1 << (crc_bits & 7); 804 1 << (crc_bits & 7);
809 } 805 }
diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c
index 602e123b2741..97687d335903 100644
--- a/drivers/net/usb/catc.c
+++ b/drivers/net/usb/catc.c
@@ -629,7 +629,7 @@ static void catc_multicast(unsigned char *addr, u8 *multicast)
629static void catc_set_multicast_list(struct net_device *netdev) 629static void catc_set_multicast_list(struct net_device *netdev)
630{ 630{
631 struct catc *catc = netdev_priv(netdev); 631 struct catc *catc = netdev_priv(netdev);
632 struct dev_mc_list *mc; 632 struct netdev_hw_addr *ha;
633 u8 broadcast[6]; 633 u8 broadcast[6];
634 u8 rx = RxEnable | RxPolarity | RxMultiCast; 634 u8 rx = RxEnable | RxPolarity | RxMultiCast;
635 635
@@ -647,8 +647,8 @@ static void catc_set_multicast_list(struct net_device *netdev)
647 if (netdev->flags & IFF_ALLMULTI) { 647 if (netdev->flags & IFF_ALLMULTI) {
648 memset(catc->multicast, 0xff, 64); 648 memset(catc->multicast, 0xff, 64);
649 } else { 649 } else {
650 netdev_for_each_mc_addr(mc, netdev) { 650 netdev_for_each_mc_addr(ha, netdev) {
651 u32 crc = ether_crc_le(6, mc->dmi_addr); 651 u32 crc = ether_crc_le(6, ha->addr);
652 if (!catc->is_f5u011) { 652 if (!catc->is_f5u011) {
653 catc->multicast[(crc >> 3) & 0x3f] |= 1 << (crc & 7); 653 catc->multicast[(crc >> 3) & 0x3f] |= 1 << (crc & 7);
654 } else { 654 } else {
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 3547cf13d219..b3fe0de40469 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -64,6 +64,11 @@ static int is_wireless_rndis(struct usb_interface_descriptor *desc)
64 64
65#endif 65#endif
66 66
67static const u8 mbm_guid[16] = {
68 0xa3, 0x17, 0xa8, 0x8b, 0x04, 0x5e, 0x4f, 0x01,
69 0xa6, 0x07, 0xc0, 0xff, 0xcb, 0x7e, 0x39, 0x2a,
70};
71
67/* 72/*
68 * probes control interface, claims data interface, collects the bulk 73 * probes control interface, claims data interface, collects the bulk
69 * endpoints, activates data interface (if needed), maybe sets MTU. 74 * endpoints, activates data interface (if needed), maybe sets MTU.
@@ -79,6 +84,8 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
79 int status; 84 int status;
80 int rndis; 85 int rndis;
81 struct usb_driver *driver = driver_of(intf); 86 struct usb_driver *driver = driver_of(intf);
87 struct usb_cdc_mdlm_desc *desc = NULL;
88 struct usb_cdc_mdlm_detail_desc *detail = NULL;
82 89
83 if (sizeof dev->data < sizeof *info) 90 if (sizeof dev->data < sizeof *info)
84 return -EDOM; 91 return -EDOM;
@@ -229,6 +236,34 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
229 * side link address we were given. 236 * side link address we were given.
230 */ 237 */
231 break; 238 break;
239 case USB_CDC_MDLM_TYPE:
240 if (desc) {
241 dev_dbg(&intf->dev, "extra MDLM descriptor\n");
242 goto bad_desc;
243 }
244
245 desc = (void *)buf;
246
247 if (desc->bLength != sizeof(*desc))
248 goto bad_desc;
249
250 if (memcmp(&desc->bGUID, mbm_guid, 16))
251 goto bad_desc;
252 break;
253 case USB_CDC_MDLM_DETAIL_TYPE:
254 if (detail) {
255 dev_dbg(&intf->dev, "extra MDLM detail descriptor\n");
256 goto bad_desc;
257 }
258
259 detail = (void *)buf;
260
261 if (detail->bGuidDescriptorType == 0) {
262 if (detail->bLength < (sizeof(*detail) + 1))
263 goto bad_desc;
264 } else
265 goto bad_desc;
266 break;
232 } 267 }
233next_desc: 268next_desc:
234 len -= buf [0]; /* bLength */ 269 len -= buf [0]; /* bLength */
@@ -543,80 +578,10 @@ static const struct usb_device_id products [] = {
543 USB_CDC_PROTO_NONE), 578 USB_CDC_PROTO_NONE),
544 .driver_info = (unsigned long) &cdc_info, 579 .driver_info = (unsigned long) &cdc_info,
545}, { 580}, {
546 /* Ericsson F3507g */ 581 USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MDLM,
547 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1900, USB_CLASS_COMM, 582 USB_CDC_PROTO_NONE),
548 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), 583 .driver_info = (unsigned long)&mbm_info,
549 .driver_info = (unsigned long) &mbm_info, 584
550}, {
551 /* Ericsson F3507g ver. 2 */
552 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1902, USB_CLASS_COMM,
553 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
554 .driver_info = (unsigned long) &mbm_info,
555}, {
556 /* Ericsson F3607gw */
557 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1904, USB_CLASS_COMM,
558 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
559 .driver_info = (unsigned long) &mbm_info,
560}, {
561 /* Ericsson F3607gw ver 2 */
562 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1905, USB_CLASS_COMM,
563 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
564 .driver_info = (unsigned long) &mbm_info,
565}, {
566 /* Ericsson F3607gw ver 3 */
567 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1906, USB_CLASS_COMM,
568 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
569 .driver_info = (unsigned long) &mbm_info,
570}, {
571 /* Ericsson F3307 */
572 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x190a, USB_CLASS_COMM,
573 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
574 .driver_info = (unsigned long) &mbm_info,
575}, {
576 /* Ericsson F3307 ver 2 */
577 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1909, USB_CLASS_COMM,
578 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
579 .driver_info = (unsigned long) &mbm_info,
580}, {
581 /* Ericsson C3607w */
582 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1049, USB_CLASS_COMM,
583 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
584 .driver_info = (unsigned long) &mbm_info,
585}, {
586 /* Ericsson C3607w ver 2 */
587 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x190b, USB_CLASS_COMM,
588 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
589 .driver_info = (unsigned long) &mbm_info,
590}, {
591 /* Toshiba F3507g */
592 USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x130b, USB_CLASS_COMM,
593 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
594 .driver_info = (unsigned long) &mbm_info,
595}, {
596 /* Toshiba F3607gw */
597 USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x130c, USB_CLASS_COMM,
598 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
599 .driver_info = (unsigned long) &mbm_info,
600}, {
601 /* Toshiba F3607gw ver 2 */
602 USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x1311, USB_CLASS_COMM,
603 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
604 .driver_info = (unsigned long) &mbm_info,
605}, {
606 /* Dell F3507g */
607 USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8147, USB_CLASS_COMM,
608 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
609 .driver_info = (unsigned long) &mbm_info,
610}, {
611 /* Dell F3607gw */
612 USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8183, USB_CLASS_COMM,
613 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
614 .driver_info = (unsigned long) &mbm_info,
615}, {
616 /* Dell F3607gw ver 2 */
617 USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8184, USB_CLASS_COMM,
618 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
619 .driver_info = (unsigned long) &mbm_info,
620}, 585},
621 { }, // END 586 { }, // END
622}; 587};
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
index 04b281002a76..291add255246 100644
--- a/drivers/net/usb/dm9601.c
+++ b/drivers/net/usb/dm9601.c
@@ -387,10 +387,10 @@ static void dm9601_set_multicast(struct net_device *net)
387 netdev_mc_count(net) > DM_MAX_MCAST) { 387 netdev_mc_count(net) > DM_MAX_MCAST) {
388 rx_ctl |= 0x04; 388 rx_ctl |= 0x04;
389 } else if (!netdev_mc_empty(net)) { 389 } else if (!netdev_mc_empty(net)) {
390 struct dev_mc_list *mc_list; 390 struct netdev_hw_addr *ha;
391 391
392 netdev_for_each_mc_addr(mc_list, net) { 392 netdev_for_each_mc_addr(ha, net) {
393 u32 crc = ether_crc(ETH_ALEN, mc_list->dmi_addr) >> 26; 393 u32 crc = ether_crc(ETH_ALEN, ha->addr) >> 26;
394 hashes[crc >> 3] |= 1 << (crc & 0x7); 394 hashes[crc >> 3] |= 1 << (crc & 0x7);
395 } 395 }
396 } 396 }
diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c
index 9f24e3f871e1..834d8cd3005d 100644
--- a/drivers/net/usb/mcs7830.c
+++ b/drivers/net/usb/mcs7830.c
@@ -453,12 +453,12 @@ static void mcs7830_data_set_multicast(struct net_device *net)
453 * for our 8 byte filter buffer 453 * for our 8 byte filter buffer
454 * to avoid allocating memory that 454 * to avoid allocating memory that
455 * is tricky to free later */ 455 * is tricky to free later */
456 struct dev_mc_list *mc_list; 456 struct netdev_hw_addr *ha;
457 u32 crc_bits; 457 u32 crc_bits;
458 458
459 /* Build the multicast hash filter. */ 459 /* Build the multicast hash filter. */
460 netdev_for_each_mc_addr(mc_list, net) { 460 netdev_for_each_mc_addr(ha, net) {
461 crc_bits = ether_crc(ETH_ALEN, mc_list->dmi_addr) >> 26; 461 crc_bits = ether_crc(ETH_ALEN, ha->addr) >> 26;
462 data->multi_filter[crc_bits >> 3] |= 1 << (crc_bits & 7); 462 data->multi_filter[crc_bits >> 3] |= 1 << (crc_bits & 7);
463 } 463 }
464 } 464 }
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index 35b98b1b79e4..753ee6eb7edd 100644
--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -445,14 +445,14 @@ static void smsc75xx_set_multicast(struct net_device *netdev)
445 netif_dbg(dev, drv, dev->net, "receive all multicast enabled"); 445 netif_dbg(dev, drv, dev->net, "receive all multicast enabled");
446 pdata->rfe_ctl |= RFE_CTL_AM | RFE_CTL_DPF; 446 pdata->rfe_ctl |= RFE_CTL_AM | RFE_CTL_DPF;
447 } else if (!netdev_mc_empty(dev->net)) { 447 } else if (!netdev_mc_empty(dev->net)) {
448 struct dev_mc_list *mc_list; 448 struct netdev_hw_addr *ha;
449 449
450 netif_dbg(dev, drv, dev->net, "receive multicast hash filter"); 450 netif_dbg(dev, drv, dev->net, "receive multicast hash filter");
451 451
452 pdata->rfe_ctl |= RFE_CTL_MHF | RFE_CTL_DPF; 452 pdata->rfe_ctl |= RFE_CTL_MHF | RFE_CTL_DPF;
453 453
454 netdev_for_each_mc_addr(mc_list, netdev) { 454 netdev_for_each_mc_addr(ha, netdev) {
455 u32 bitnum = smsc75xx_hash(mc_list->dmi_addr); 455 u32 bitnum = smsc75xx_hash(ha->addr);
456 pdata->multicast_hash_table[bitnum / 32] |= 456 pdata->multicast_hash_table[bitnum / 32] |=
457 (1 << (bitnum % 32)); 457 (1 << (bitnum % 32));
458 } 458 }
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 3135af63d378..12a3c88c5282 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -385,13 +385,13 @@ static void smsc95xx_set_multicast(struct net_device *netdev)
385 pdata->mac_cr |= MAC_CR_MCPAS_; 385 pdata->mac_cr |= MAC_CR_MCPAS_;
386 pdata->mac_cr &= ~(MAC_CR_PRMS_ | MAC_CR_HPFILT_); 386 pdata->mac_cr &= ~(MAC_CR_PRMS_ | MAC_CR_HPFILT_);
387 } else if (!netdev_mc_empty(dev->net)) { 387 } else if (!netdev_mc_empty(dev->net)) {
388 struct dev_mc_list *mc_list; 388 struct netdev_hw_addr *ha;
389 389
390 pdata->mac_cr |= MAC_CR_HPFILT_; 390 pdata->mac_cr |= MAC_CR_HPFILT_;
391 pdata->mac_cr &= ~(MAC_CR_PRMS_ | MAC_CR_MCPAS_); 391 pdata->mac_cr &= ~(MAC_CR_PRMS_ | MAC_CR_MCPAS_);
392 392
393 netdev_for_each_mc_addr(mc_list, netdev) { 393 netdev_for_each_mc_addr(ha, netdev) {
394 u32 bitnum = smsc95xx_hash(mc_list->dmi_addr); 394 u32 bitnum = smsc95xx_hash(ha->addr);
395 u32 mask = 0x01 << (bitnum & 0x1F); 395 u32 mask = 0x01 << (bitnum & 0x1F);
396 if (bitnum & 0x20) 396 if (bitnum & 0x20)
397 hash_hi |= mask; 397 hash_hi |= mask;
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 7177abc78dc6..a95c73de5824 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1069,12 +1069,15 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
1069 * NOTE: strictly conforming cdc-ether devices should expect 1069 * NOTE: strictly conforming cdc-ether devices should expect
1070 * the ZLP here, but ignore the one-byte packet. 1070 * the ZLP here, but ignore the one-byte packet.
1071 */ 1071 */
1072 if (!(info->flags & FLAG_SEND_ZLP) && (length % dev->maxpacket) == 0) { 1072 if (length % dev->maxpacket == 0) {
1073 urb->transfer_buffer_length++; 1073 if (!(info->flags & FLAG_SEND_ZLP)) {
1074 if (skb_tailroom(skb)) { 1074 urb->transfer_buffer_length++;
1075 skb->data[skb->len] = 0; 1075 if (skb_tailroom(skb)) {
1076 __skb_put(skb, 1); 1076 skb->data[skb->len] = 0;
1077 } 1077 __skb_put(skb, 1);
1078 }
1079 } else
1080 urb->transfer_flags |= URB_ZERO_PACKET;
1078 } 1081 }
1079 1082
1080 spin_lock_irqsave(&dev->txq.lock, flags); 1083 spin_lock_irqsave(&dev->txq.lock, flags);