diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/usb/asix.c | 12 | ||||
-rw-r--r-- | drivers/net/usb/catc.c | 5 | ||||
-rw-r--r-- | drivers/net/usb/mcs7830.c | 6 | ||||
-rw-r--r-- | drivers/net/usb/smsc95xx.c | 26 |
4 files changed, 15 insertions, 34 deletions
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index f605204de3e5..20e34608fa4a 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c | |||
@@ -555,20 +555,18 @@ static void asix_set_multicast(struct net_device *net) | |||
555 | * for our 8 byte filter buffer | 555 | * for our 8 byte filter buffer |
556 | * to avoid allocating memory that | 556 | * to avoid allocating memory that |
557 | * is tricky to free later */ | 557 | * is tricky to free later */ |
558 | struct dev_mc_list *mc_list = net->mc_list; | 558 | struct dev_mc_list *mc_list; |
559 | u32 crc_bits; | 559 | u32 crc_bits; |
560 | int i; | ||
561 | 560 | ||
562 | memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE); | 561 | memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE); |
563 | 562 | ||
564 | /* Build the multicast hash filter. */ | 563 | /* Build the multicast hash filter. */ |
565 | for (i = 0; i < netdev_mc_count(net); i++) { | 564 | netdev_for_each_mc_addr(mc_list, net) { |
566 | crc_bits = | 565 | crc_bits = |
567 | ether_crc(ETH_ALEN, | 566 | ether_crc(ETH_ALEN, |
568 | mc_list->dmi_addr) >> 26; | 567 | mc_list->dmi_addr) >> 26; |
569 | data->multi_filter[crc_bits >> 3] |= | 568 | data->multi_filter[crc_bits >> 3] |= |
570 | 1 << (crc_bits & 7); | 569 | 1 << (crc_bits & 7); |
571 | mc_list = mc_list->next; | ||
572 | } | 570 | } |
573 | 571 | ||
574 | asix_write_cmd_async(dev, AX_CMD_WRITE_MULTI_FILTER, 0, 0, | 572 | asix_write_cmd_async(dev, AX_CMD_WRITE_MULTI_FILTER, 0, 0, |
@@ -769,20 +767,18 @@ static void ax88172_set_multicast(struct net_device *net) | |||
769 | * for our 8 byte filter buffer | 767 | * for our 8 byte filter buffer |
770 | * to avoid allocating memory that | 768 | * to avoid allocating memory that |
771 | * is tricky to free later */ | 769 | * is tricky to free later */ |
772 | struct dev_mc_list *mc_list = net->mc_list; | 770 | struct dev_mc_list *mc_list; |
773 | u32 crc_bits; | 771 | u32 crc_bits; |
774 | int i; | ||
775 | 772 | ||
776 | memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE); | 773 | memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE); |
777 | 774 | ||
778 | /* Build the multicast hash filter. */ | 775 | /* Build the multicast hash filter. */ |
779 | for (i = 0; i < netdev_mc_count(net); i++) { | 776 | netdev_for_each_mc_addr(mc_list, net) { |
780 | crc_bits = | 777 | crc_bits = |
781 | ether_crc(ETH_ALEN, | 778 | ether_crc(ETH_ALEN, |
782 | mc_list->dmi_addr) >> 26; | 779 | mc_list->dmi_addr) >> 26; |
783 | data->multi_filter[crc_bits >> 3] |= | 780 | data->multi_filter[crc_bits >> 3] |= |
784 | 1 << (crc_bits & 7); | 781 | 1 << (crc_bits & 7); |
785 | mc_list = mc_list->next; | ||
786 | } | 782 | } |
787 | 783 | ||
788 | asix_write_cmd_async(dev, AX_CMD_WRITE_MULTI_FILTER, 0, 0, | 784 | asix_write_cmd_async(dev, AX_CMD_WRITE_MULTI_FILTER, 0, 0, |
diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c index 5a13660ebd17..96f1ebe0d348 100644 --- a/drivers/net/usb/catc.c +++ b/drivers/net/usb/catc.c | |||
@@ -632,7 +632,6 @@ static void catc_set_multicast_list(struct net_device *netdev) | |||
632 | struct dev_mc_list *mc; | 632 | struct dev_mc_list *mc; |
633 | u8 broadcast[6]; | 633 | u8 broadcast[6]; |
634 | u8 rx = RxEnable | RxPolarity | RxMultiCast; | 634 | u8 rx = RxEnable | RxPolarity | RxMultiCast; |
635 | int i; | ||
636 | 635 | ||
637 | memset(broadcast, 0xff, 6); | 636 | memset(broadcast, 0xff, 6); |
638 | memset(catc->multicast, 0, 64); | 637 | memset(catc->multicast, 0, 64); |
@@ -648,9 +647,7 @@ static void catc_set_multicast_list(struct net_device *netdev) | |||
648 | if (netdev->flags & IFF_ALLMULTI) { | 647 | if (netdev->flags & IFF_ALLMULTI) { |
649 | memset(catc->multicast, 0xff, 64); | 648 | memset(catc->multicast, 0xff, 64); |
650 | } else { | 649 | } else { |
651 | for (i = 0, mc = netdev->mc_list; | 650 | netdev_for_each_mc_addr(mc, netdev) { |
652 | mc && i < netdev_mc_count(netdev); | ||
653 | i++, mc = mc->next) { | ||
654 | u32 crc = ether_crc_le(6, mc->dmi_addr); | 651 | u32 crc = ether_crc_le(6, mc->dmi_addr); |
655 | if (!catc->is_f5u011) { | 652 | if (!catc->is_f5u011) { |
656 | catc->multicast[(crc >> 3) & 0x3f] |= 1 << (crc & 7); | 653 | catc->multicast[(crc >> 3) & 0x3f] |= 1 << (crc & 7); |
diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c index 34665137f2c3..70978219e98a 100644 --- a/drivers/net/usb/mcs7830.c +++ b/drivers/net/usb/mcs7830.c | |||
@@ -452,15 +452,13 @@ static void mcs7830_data_set_multicast(struct net_device *net) | |||
452 | * for our 8 byte filter buffer | 452 | * for our 8 byte filter buffer |
453 | * to avoid allocating memory that | 453 | * to avoid allocating memory that |
454 | * is tricky to free later */ | 454 | * is tricky to free later */ |
455 | struct dev_mc_list *mc_list = net->mc_list; | 455 | struct dev_mc_list *mc_list; |
456 | u32 crc_bits; | 456 | u32 crc_bits; |
457 | int i; | ||
458 | 457 | ||
459 | /* Build the multicast hash filter. */ | 458 | /* Build the multicast hash filter. */ |
460 | for (i = 0; i < netdev_mc_count(net); i++) { | 459 | netdev_for_each_mc_addr(mc_list, net) { |
461 | crc_bits = ether_crc(ETH_ALEN, mc_list->dmi_addr) >> 26; | 460 | crc_bits = ether_crc(ETH_ALEN, mc_list->dmi_addr) >> 26; |
462 | data->multi_filter[crc_bits >> 3] |= 1 << (crc_bits & 7); | 461 | data->multi_filter[crc_bits >> 3] |= 1 << (crc_bits & 7); |
463 | mc_list = mc_list->next; | ||
464 | } | 462 | } |
465 | } | 463 | } |
466 | } | 464 | } |
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 1ada51eb71f7..df9179a1c93b 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c | |||
@@ -384,30 +384,20 @@ static void smsc95xx_set_multicast(struct net_device *netdev) | |||
384 | pdata->mac_cr |= MAC_CR_MCPAS_; | 384 | pdata->mac_cr |= MAC_CR_MCPAS_; |
385 | pdata->mac_cr &= ~(MAC_CR_PRMS_ | MAC_CR_HPFILT_); | 385 | pdata->mac_cr &= ~(MAC_CR_PRMS_ | MAC_CR_HPFILT_); |
386 | } else if (!netdev_mc_empty(dev->net)) { | 386 | } else if (!netdev_mc_empty(dev->net)) { |
387 | struct dev_mc_list *mc_list = dev->net->mc_list; | 387 | struct dev_mc_list *mc_list; |
388 | int count = 0; | ||
389 | 388 | ||
390 | pdata->mac_cr |= MAC_CR_HPFILT_; | 389 | pdata->mac_cr |= MAC_CR_HPFILT_; |
391 | pdata->mac_cr &= ~(MAC_CR_PRMS_ | MAC_CR_MCPAS_); | 390 | pdata->mac_cr &= ~(MAC_CR_PRMS_ | MAC_CR_MCPAS_); |
392 | 391 | ||
393 | while (mc_list) { | 392 | netdev_for_each_mc_addr(mc_list, netdev) { |
394 | count++; | 393 | u32 bitnum = smsc95xx_hash(mc_list->dmi_addr); |
395 | if (mc_list->dmi_addrlen == ETH_ALEN) { | 394 | u32 mask = 0x01 << (bitnum & 0x1F); |
396 | u32 bitnum = smsc95xx_hash(mc_list->dmi_addr); | 395 | if (bitnum & 0x20) |
397 | u32 mask = 0x01 << (bitnum & 0x1F); | 396 | hash_hi |= mask; |
398 | if (bitnum & 0x20) | 397 | else |
399 | hash_hi |= mask; | 398 | hash_lo |= mask; |
400 | else | ||
401 | hash_lo |= mask; | ||
402 | } else { | ||
403 | netdev_warn(dev->net, "dmi_addrlen != 6\n"); | ||
404 | } | ||
405 | mc_list = mc_list->next; | ||
406 | } | 399 | } |
407 | 400 | ||
408 | if (count != ((u32) netdev_mc_count(dev->net))) | ||
409 | netdev_warn(dev->net, "mc_count != dev->mc_count\n"); | ||
410 | |||
411 | netif_dbg(dev, drv, dev->net, "HASHH=0x%08X, HASHL=0x%08X\n", | 401 | netif_dbg(dev, drv, dev->net, "HASHH=0x%08X, HASHL=0x%08X\n", |
412 | hash_hi, hash_lo); | 402 | hash_hi, hash_lo); |
413 | } else { | 403 | } else { |