diff options
29 files changed, 69 insertions, 98 deletions
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index d1e03b5984c0..3f5db83c7cbb 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c | |||
@@ -965,10 +965,9 @@ static void emac_dev_mcast_set(struct net_device *ndev) | |||
965 | mbp_enable = (mbp_enable | EMAC_MBP_RXMCAST); | 965 | mbp_enable = (mbp_enable | EMAC_MBP_RXMCAST); |
966 | emac_add_mcast(priv, EMAC_ALL_MULTI_CLR, NULL); | 966 | emac_add_mcast(priv, EMAC_ALL_MULTI_CLR, NULL); |
967 | /* program multicast address list into EMAC hardware */ | 967 | /* program multicast address list into EMAC hardware */ |
968 | for (mc_ptr = ndev->mc_list; mc_ptr; | 968 | netdev_for_each_mc_addr(mc_ptr, ndev) { |
969 | mc_ptr = mc_ptr->next) { | ||
970 | emac_add_mcast(priv, EMAC_MULTICAST_ADD, | 969 | emac_add_mcast(priv, EMAC_MULTICAST_ADD, |
971 | (u8 *)mc_ptr->dmi_addr); | 970 | (u8 *) mc_ptr->dmi_addr); |
972 | } | 971 | } |
973 | } else { | 972 | } else { |
974 | mbp_enable = (mbp_enable & ~EMAC_MBP_RXMCAST); | 973 | mbp_enable = (mbp_enable & ~EMAC_MBP_RXMCAST); |
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index e8c0e823a06f..a26ccab057d5 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -1537,14 +1537,18 @@ static int e100_hw_init(struct nic *nic) | |||
1537 | static void e100_multi(struct nic *nic, struct cb *cb, struct sk_buff *skb) | 1537 | static void e100_multi(struct nic *nic, struct cb *cb, struct sk_buff *skb) |
1538 | { | 1538 | { |
1539 | struct net_device *netdev = nic->netdev; | 1539 | struct net_device *netdev = nic->netdev; |
1540 | struct dev_mc_list *list = netdev->mc_list; | 1540 | struct dev_mc_list *list; |
1541 | u16 i, count = min(netdev_mc_count(netdev), E100_MAX_MULTICAST_ADDRS); | 1541 | u16 i, count = min(netdev_mc_count(netdev), E100_MAX_MULTICAST_ADDRS); |
1542 | 1542 | ||
1543 | cb->command = cpu_to_le16(cb_multi); | 1543 | cb->command = cpu_to_le16(cb_multi); |
1544 | cb->u.multi.count = cpu_to_le16(count * ETH_ALEN); | 1544 | cb->u.multi.count = cpu_to_le16(count * ETH_ALEN); |
1545 | for (i = 0; list && i < count; i++, list = list->next) | 1545 | i = 0; |
1546 | memcpy(&cb->u.multi.addr[i*ETH_ALEN], &list->dmi_addr, | 1546 | netdev_for_each_mc_addr(list, netdev) { |
1547 | if (i == count) | ||
1548 | break; | ||
1549 | memcpy(&cb->u.multi.addr[i++ * ETH_ALEN], &list->dmi_addr, | ||
1547 | ETH_ALEN); | 1550 | ETH_ALEN); |
1551 | } | ||
1548 | } | 1552 | } |
1549 | 1553 | ||
1550 | static void e100_set_multicast_list(struct net_device *netdev) | 1554 | static void e100_set_multicast_list(struct net_device *netdev) |
diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c index 5f73ab22db16..1b05bdf62c3c 100644 --- a/drivers/net/eepro.c +++ b/drivers/net/eepro.c | |||
@@ -1287,7 +1287,7 @@ set_multicast_list(struct net_device *dev) | |||
1287 | struct eepro_local *lp = netdev_priv(dev); | 1287 | struct eepro_local *lp = netdev_priv(dev); |
1288 | short ioaddr = dev->base_addr; | 1288 | short ioaddr = dev->base_addr; |
1289 | unsigned short mode; | 1289 | unsigned short mode; |
1290 | struct dev_mc_list *dmi=dev->mc_list; | 1290 | struct dev_mc_list *dmi; |
1291 | int mc_count = netdev_mc_count(dev); | 1291 | int mc_count = netdev_mc_count(dev); |
1292 | 1292 | ||
1293 | if (dev->flags&(IFF_ALLMULTI|IFF_PROMISC) || mc_count > 63) | 1293 | if (dev->flags&(IFF_ALLMULTI|IFF_PROMISC) || mc_count > 63) |
@@ -1332,10 +1332,8 @@ set_multicast_list(struct net_device *dev) | |||
1332 | outw(0, ioaddr + IO_PORT); | 1332 | outw(0, ioaddr + IO_PORT); |
1333 | outw(6 * (mc_count + 1), ioaddr + IO_PORT); | 1333 | outw(6 * (mc_count + 1), ioaddr + IO_PORT); |
1334 | 1334 | ||
1335 | for (i = 0; i < mc_count; i++) | 1335 | netdev_for_each_mc_addr(dmi, dev) { |
1336 | { | 1336 | eaddrs = (unsigned short *) dmi->dmi_addr; |
1337 | eaddrs=(unsigned short *)dmi->dmi_addr; | ||
1338 | dmi=dmi->next; | ||
1339 | outw(*eaddrs++, ioaddr + IO_PORT); | 1337 | outw(*eaddrs++, ioaddr + IO_PORT); |
1340 | outw(*eaddrs++, ioaddr + IO_PORT); | 1338 | outw(*eaddrs++, ioaddr + IO_PORT); |
1341 | outw(*eaddrs++, ioaddr + IO_PORT); | 1339 | outw(*eaddrs++, ioaddr + IO_PORT); |
diff --git a/drivers/net/eexpress.c b/drivers/net/eexpress.c index d804ff18eda8..7013dc8a6cbc 100644 --- a/drivers/net/eexpress.c +++ b/drivers/net/eexpress.c | |||
@@ -1588,23 +1588,19 @@ static void eexp_setup_filter(struct net_device *dev) | |||
1588 | 1588 | ||
1589 | outw(CONF_NR_MULTICAST & ~31, ioaddr+SM_PTR); | 1589 | outw(CONF_NR_MULTICAST & ~31, ioaddr+SM_PTR); |
1590 | outw(6*count, ioaddr+SHADOW(CONF_NR_MULTICAST)); | 1590 | outw(6*count, ioaddr+SHADOW(CONF_NR_MULTICAST)); |
1591 | for (i = 0, dmi = dev->mc_list; i < count; i++, dmi = dmi->next) { | 1591 | i = 0; |
1592 | unsigned short *data; | 1592 | netdev_for_each_mc_addr(dmi, dev) { |
1593 | if (!dmi) { | 1593 | unsigned short *data = (unsigned short *) dmi->dmi_addr; |
1594 | printk(KERN_INFO "%s: too few multicast addresses\n", dev->name); | 1594 | |
1595 | if (i == count) | ||
1595 | break; | 1596 | break; |
1596 | } | ||
1597 | if (dmi->dmi_addrlen != ETH_ALEN) { | ||
1598 | printk(KERN_INFO "%s: invalid multicast address length given.\n", dev->name); | ||
1599 | continue; | ||
1600 | } | ||
1601 | data = (unsigned short *)dmi->dmi_addr; | ||
1602 | outw((CONF_MULTICAST+(6*i)) & ~31, ioaddr+SM_PTR); | 1597 | outw((CONF_MULTICAST+(6*i)) & ~31, ioaddr+SM_PTR); |
1603 | outw(data[0], ioaddr+SHADOW(CONF_MULTICAST+(6*i))); | 1598 | outw(data[0], ioaddr+SHADOW(CONF_MULTICAST+(6*i))); |
1604 | outw((CONF_MULTICAST+(6*i)+2) & ~31, ioaddr+SM_PTR); | 1599 | outw((CONF_MULTICAST+(6*i)+2) & ~31, ioaddr+SM_PTR); |
1605 | outw(data[1], ioaddr+SHADOW(CONF_MULTICAST+(6*i)+2)); | 1600 | outw(data[1], ioaddr+SHADOW(CONF_MULTICAST+(6*i)+2)); |
1606 | outw((CONF_MULTICAST+(6*i)+4) & ~31, ioaddr+SM_PTR); | 1601 | outw((CONF_MULTICAST+(6*i)+4) & ~31, ioaddr+SM_PTR); |
1607 | outw(data[2], ioaddr+SHADOW(CONF_MULTICAST+(6*i)+4)); | 1602 | outw(data[2], ioaddr+SHADOW(CONF_MULTICAST+(6*i)+4)); |
1603 | i++; | ||
1608 | } | 1604 | } |
1609 | } | 1605 | } |
1610 | 1606 | ||
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 99e4f8360d2f..b004eaba3d7b 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -1967,7 +1967,7 @@ static void ehea_set_multicast_list(struct net_device *dev) | |||
1967 | { | 1967 | { |
1968 | struct ehea_port *port = netdev_priv(dev); | 1968 | struct ehea_port *port = netdev_priv(dev); |
1969 | struct dev_mc_list *k_mcl_entry; | 1969 | struct dev_mc_list *k_mcl_entry; |
1970 | int ret, i; | 1970 | int ret; |
1971 | 1971 | ||
1972 | if (dev->flags & IFF_PROMISC) { | 1972 | if (dev->flags & IFF_PROMISC) { |
1973 | ehea_promiscuous(dev, 1); | 1973 | ehea_promiscuous(dev, 1); |
@@ -1997,8 +1997,7 @@ static void ehea_set_multicast_list(struct net_device *dev) | |||
1997 | goto out; | 1997 | goto out; |
1998 | } | 1998 | } |
1999 | 1999 | ||
2000 | for (i = 0, k_mcl_entry = dev->mc_list; i < netdev_mc_count(dev); i++, | 2000 | netdev_for_each_mc_addr(k_mcl_entry, dev) |
2001 | k_mcl_entry = k_mcl_entry->next) | ||
2002 | ehea_add_multicast_entry(port, k_mcl_entry->dmi_addr); | 2001 | ehea_add_multicast_entry(port, k_mcl_entry->dmi_addr); |
2003 | 2002 | ||
2004 | } | 2003 | } |
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index 94749ebaaea8..cf098bb636b8 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c | |||
@@ -822,7 +822,7 @@ static int enic_set_mac_addr(struct net_device *netdev, char *addr) | |||
822 | static void enic_set_multicast_list(struct net_device *netdev) | 822 | static void enic_set_multicast_list(struct net_device *netdev) |
823 | { | 823 | { |
824 | struct enic *enic = netdev_priv(netdev); | 824 | struct enic *enic = netdev_priv(netdev); |
825 | struct dev_mc_list *list = netdev->mc_list; | 825 | struct dev_mc_list *list; |
826 | int directed = 1; | 826 | int directed = 1; |
827 | int multicast = (netdev->flags & IFF_MULTICAST) ? 1 : 0; | 827 | int multicast = (netdev->flags & IFF_MULTICAST) ? 1 : 0; |
828 | int broadcast = (netdev->flags & IFF_BROADCAST) ? 1 : 0; | 828 | int broadcast = (netdev->flags & IFF_BROADCAST) ? 1 : 0; |
@@ -851,9 +851,11 @@ static void enic_set_multicast_list(struct net_device *netdev) | |||
851 | * look for changes to add/del. | 851 | * look for changes to add/del. |
852 | */ | 852 | */ |
853 | 853 | ||
854 | for (i = 0; list && i < mc_count; i++) { | 854 | i = 0; |
855 | memcpy(mc_addr[i], list->dmi_addr, ETH_ALEN); | 855 | netdev_for_each_mc_addr(list, netdev) { |
856 | list = list->next; | 856 | if (i == mc_count) |
857 | break; | ||
858 | memcpy(mc_addr[i++], list->dmi_addr, ETH_ALEN); | ||
857 | } | 859 | } |
858 | 860 | ||
859 | for (i = 0; i < enic->mc_count; i++) { | 861 | for (i = 0; i < enic->mc_count; i++) { |
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c index 31a3adb65566..39c271b6be44 100644 --- a/drivers/net/epic100.c +++ b/drivers/net/epic100.c | |||
@@ -1403,8 +1403,7 @@ static void set_rx_mode(struct net_device *dev) | |||
1403 | struct dev_mc_list *mclist; | 1403 | struct dev_mc_list *mclist; |
1404 | 1404 | ||
1405 | memset(mc_filter, 0, sizeof(mc_filter)); | 1405 | memset(mc_filter, 0, sizeof(mc_filter)); |
1406 | for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev); | 1406 | netdev_for_each_mc_addr(mclist, dev) { |
1407 | i++, mclist = mclist->next) { | ||
1408 | unsigned int bit_nr = | 1407 | unsigned int bit_nr = |
1409 | ether_crc_le(ETH_ALEN, mclist->dmi_addr) & 0x3f; | 1408 | ether_crc_le(ETH_ALEN, mclist->dmi_addr) & 0x3f; |
1410 | mc_filter[bit_nr >> 3] |= (1 << bit_nr); | 1409 | mc_filter[bit_nr >> 3] |= (1 << bit_nr); |
diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c index f9d5ca078743..209742304e20 100644 --- a/drivers/net/ethoc.c +++ b/drivers/net/ethoc.c | |||
@@ -755,7 +755,7 @@ static void ethoc_set_multicast_list(struct net_device *dev) | |||
755 | { | 755 | { |
756 | struct ethoc *priv = netdev_priv(dev); | 756 | struct ethoc *priv = netdev_priv(dev); |
757 | u32 mode = ethoc_read(priv, MODER); | 757 | u32 mode = ethoc_read(priv, MODER); |
758 | struct dev_mc_list *mc = NULL; | 758 | struct dev_mc_list *mc; |
759 | u32 hash[2] = { 0, 0 }; | 759 | u32 hash[2] = { 0, 0 }; |
760 | 760 | ||
761 | /* set loopback mode if requested */ | 761 | /* set loopback mode if requested */ |
@@ -783,8 +783,8 @@ static void ethoc_set_multicast_list(struct net_device *dev) | |||
783 | hash[0] = 0xffffffff; | 783 | hash[0] = 0xffffffff; |
784 | hash[1] = 0xffffffff; | 784 | hash[1] = 0xffffffff; |
785 | } else { | 785 | } else { |
786 | for (mc = dev->mc_list; mc; mc = mc->next) { | 786 | netdev_for_each_mc_addr(mc, dev) { |
787 | u32 crc = ether_crc(mc->dmi_addrlen, mc->dmi_addr); | 787 | u32 crc = ether_crc(ETH_ALEN, mc->dmi_addr); |
788 | int bit = (crc >> 26) & 0x3f; | 788 | int bit = (crc >> 26) & 0x3f; |
789 | hash[bit >> 5] |= 1 << (bit & 0x1f); | 789 | hash[bit >> 5] |= 1 << (bit & 0x1f); |
790 | } | 790 | } |
diff --git a/drivers/net/ewrk3.c b/drivers/net/ewrk3.c index 96817a872f47..91e59f3a9d6d 100644 --- a/drivers/net/ewrk3.c +++ b/drivers/net/ewrk3.c | |||
@@ -1169,7 +1169,7 @@ static void set_multicast_list(struct net_device *dev) | |||
1169 | static void SetMulticastFilter(struct net_device *dev) | 1169 | static void SetMulticastFilter(struct net_device *dev) |
1170 | { | 1170 | { |
1171 | struct ewrk3_private *lp = netdev_priv(dev); | 1171 | struct ewrk3_private *lp = netdev_priv(dev); |
1172 | struct dev_mc_list *dmi = dev->mc_list; | 1172 | struct dev_mc_list *dmi; |
1173 | u_long iobase = dev->base_addr; | 1173 | u_long iobase = dev->base_addr; |
1174 | int i; | 1174 | int i; |
1175 | char *addrs, bit, byte; | 1175 | char *addrs, bit, byte; |
@@ -1213,9 +1213,8 @@ static void SetMulticastFilter(struct net_device *dev) | |||
1213 | } | 1213 | } |
1214 | 1214 | ||
1215 | /* Update table */ | 1215 | /* Update table */ |
1216 | for (i = 0; i < netdev_mc_count(dev); i++) { /* for each address in the list */ | 1216 | netdev_for_each_mc_addr(dmi, dev) { |
1217 | addrs = dmi->dmi_addr; | 1217 | addrs = dmi->dmi_addr; |
1218 | dmi = dmi->next; | ||
1219 | if ((*addrs & 0x01) == 1) { /* multicast address? */ | 1218 | if ((*addrs & 0x01) == 1) { /* multicast address? */ |
1220 | crc = ether_crc_le(ETH_ALEN, addrs); | 1219 | crc = ether_crc_le(ETH_ALEN, addrs); |
1221 | hashcode = crc & ((1 << 9) - 1); /* hashcode is 9 LSb of CRC */ | 1220 | hashcode = crc & ((1 << 9) - 1); /* hashcode is 9 LSb of CRC */ |
diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c index f95b5ff0587d..9d5ad08a119f 100644 --- a/drivers/net/fealnx.c +++ b/drivers/net/fealnx.c | |||
@@ -1793,11 +1793,9 @@ static void __set_rx_mode(struct net_device *dev) | |||
1793 | rx_mode = CR_W_AB | CR_W_AM; | 1793 | rx_mode = CR_W_AB | CR_W_AM; |
1794 | } else { | 1794 | } else { |
1795 | struct dev_mc_list *mclist; | 1795 | struct dev_mc_list *mclist; |
1796 | int i; | ||
1797 | 1796 | ||
1798 | memset(mc_filter, 0, sizeof(mc_filter)); | 1797 | memset(mc_filter, 0, sizeof(mc_filter)); |
1799 | for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev); | 1798 | netdev_for_each_mc_addr(mclist, dev) { |
1800 | i++, mclist = mclist->next) { | ||
1801 | unsigned int bit; | 1799 | unsigned int bit; |
1802 | bit = (ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26) ^ 0x3F; | 1800 | bit = (ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26) ^ 0x3F; |
1803 | mc_filter[bit >> 5] |= (1 << bit); | 1801 | mc_filter[bit >> 5] |= (1 << bit); |
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index d9d14c83f51c..9f98c1c4a344 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c | |||
@@ -1575,7 +1575,7 @@ static void set_multicast_list(struct net_device *dev) | |||
1575 | { | 1575 | { |
1576 | struct fec_enet_private *fep = netdev_priv(dev); | 1576 | struct fec_enet_private *fep = netdev_priv(dev); |
1577 | struct dev_mc_list *dmi; | 1577 | struct dev_mc_list *dmi; |
1578 | unsigned int i, j, bit, data, crc, tmp; | 1578 | unsigned int i, bit, data, crc, tmp; |
1579 | unsigned char hash; | 1579 | unsigned char hash; |
1580 | 1580 | ||
1581 | if (dev->flags & IFF_PROMISC) { | 1581 | if (dev->flags & IFF_PROMISC) { |
@@ -1604,9 +1604,7 @@ static void set_multicast_list(struct net_device *dev) | |||
1604 | writel(0, fep->hwp + FEC_GRP_HASH_TABLE_HIGH); | 1604 | writel(0, fep->hwp + FEC_GRP_HASH_TABLE_HIGH); |
1605 | writel(0, fep->hwp + FEC_GRP_HASH_TABLE_LOW); | 1605 | writel(0, fep->hwp + FEC_GRP_HASH_TABLE_LOW); |
1606 | 1606 | ||
1607 | dmi = dev->mc_list; | 1607 | netdev_for_each_mc_addr(dmi, dev) { |
1608 | |||
1609 | for (j = 0; j < netdev_mc_count(dev); j++, dmi = dmi->next) { | ||
1610 | /* Only support group multicast for now */ | 1608 | /* Only support group multicast for now */ |
1611 | if (!(dmi->dmi_addr[0] & 1)) | 1609 | if (!(dmi->dmi_addr[0] & 1)) |
1612 | continue; | 1610 | continue; |
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c index 10903b75802f..0dbd7219bbde 100644 --- a/drivers/net/fec_mpc52xx.c +++ b/drivers/net/fec_mpc52xx.c | |||
@@ -575,19 +575,16 @@ static void mpc52xx_fec_set_multicast_list(struct net_device *dev) | |||
575 | out_be32(&fec->gaddr2, 0xffffffff); | 575 | out_be32(&fec->gaddr2, 0xffffffff); |
576 | } else { | 576 | } else { |
577 | u32 crc; | 577 | u32 crc; |
578 | int i; | ||
579 | struct dev_mc_list *dmi; | 578 | struct dev_mc_list *dmi; |
580 | u32 gaddr1 = 0x00000000; | 579 | u32 gaddr1 = 0x00000000; |
581 | u32 gaddr2 = 0x00000000; | 580 | u32 gaddr2 = 0x00000000; |
582 | 581 | ||
583 | dmi = dev->mc_list; | 582 | netdev_for_each_mc_addr(dmi, dev) { |
584 | for (i=0; i<netdev_mc_count(dev); i++) { | ||
585 | crc = ether_crc_le(6, dmi->dmi_addr) >> 26; | 583 | crc = ether_crc_le(6, dmi->dmi_addr) >> 26; |
586 | if (crc >= 32) | 584 | if (crc >= 32) |
587 | gaddr1 |= 1 << (crc-32); | 585 | gaddr1 |= 1 << (crc-32); |
588 | else | 586 | else |
589 | gaddr2 |= 1 << crc; | 587 | gaddr2 |= 1 << crc; |
590 | dmi = dmi->next; | ||
591 | } | 588 | } |
592 | out_be32(&fec->gaddr1, gaddr1); | 589 | out_be32(&fec->gaddr1, gaddr1); |
593 | out_be32(&fec->gaddr2, gaddr2); | 590 | out_be32(&fec->gaddr2, gaddr2); |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 3eb713b014f9..ca05e5662029 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -3095,7 +3095,7 @@ static void nv_set_multicast(struct net_device *dev) | |||
3095 | } else { | 3095 | } else { |
3096 | pff |= NVREG_PFF_MYADDR; | 3096 | pff |= NVREG_PFF_MYADDR; |
3097 | 3097 | ||
3098 | if (dev->flags & IFF_ALLMULTI || dev->mc_list) { | 3098 | if (dev->flags & IFF_ALLMULTI || !netdev_mc_empty(dev)) { |
3099 | u32 alwaysOff[2]; | 3099 | u32 alwaysOff[2]; |
3100 | u32 alwaysOn[2]; | 3100 | u32 alwaysOn[2]; |
3101 | 3101 | ||
@@ -3105,8 +3105,7 @@ static void nv_set_multicast(struct net_device *dev) | |||
3105 | } else { | 3105 | } else { |
3106 | struct dev_mc_list *walk; | 3106 | struct dev_mc_list *walk; |
3107 | 3107 | ||
3108 | walk = dev->mc_list; | 3108 | netdev_for_each_mc_addr(walk, dev) { |
3109 | while (walk != NULL) { | ||
3110 | u32 a, b; | 3109 | u32 a, b; |
3111 | a = le32_to_cpu(*(__le32 *) walk->dmi_addr); | 3110 | a = le32_to_cpu(*(__le32 *) walk->dmi_addr); |
3112 | b = le16_to_cpu(*(__le16 *) (&walk->dmi_addr[4])); | 3111 | b = le16_to_cpu(*(__le16 *) (&walk->dmi_addr[4])); |
@@ -3114,7 +3113,6 @@ static void nv_set_multicast(struct net_device *dev) | |||
3114 | alwaysOff[0] &= ~a; | 3113 | alwaysOff[0] &= ~a; |
3115 | alwaysOn[1] &= b; | 3114 | alwaysOn[1] &= b; |
3116 | alwaysOff[1] &= ~b; | 3115 | alwaysOff[1] &= ~b; |
3117 | walk = walk->next; | ||
3118 | } | 3116 | } |
3119 | } | 3117 | } |
3120 | addr[0] = alwaysOn[0]; | 3118 | addr[0] = alwaysOn[0]; |
diff --git a/drivers/net/fs_enet/mac-fcc.c b/drivers/net/fs_enet/mac-fcc.c index 482f27d5f7d4..a761d31e3d6d 100644 --- a/drivers/net/fs_enet/mac-fcc.c +++ b/drivers/net/fs_enet/mac-fcc.c | |||
@@ -235,7 +235,7 @@ static void set_multicast_list(struct net_device *dev) | |||
235 | 235 | ||
236 | if ((dev->flags & IFF_PROMISC) == 0) { | 236 | if ((dev->flags & IFF_PROMISC) == 0) { |
237 | set_multicast_start(dev); | 237 | set_multicast_start(dev); |
238 | for (pmc = dev->mc_list; pmc != NULL; pmc = pmc->next) | 238 | netdev_for_each_mc_addr(pmc, dev) |
239 | set_multicast_one(dev, pmc->dmi_addr); | 239 | set_multicast_one(dev, pmc->dmi_addr); |
240 | set_multicast_finish(dev); | 240 | set_multicast_finish(dev); |
241 | } else | 241 | } else |
diff --git a/drivers/net/fs_enet/mac-fec.c b/drivers/net/fs_enet/mac-fec.c index ddf13ef8ac87..ca806d1ab3f6 100644 --- a/drivers/net/fs_enet/mac-fec.c +++ b/drivers/net/fs_enet/mac-fec.c | |||
@@ -236,7 +236,7 @@ static void set_multicast_list(struct net_device *dev) | |||
236 | 236 | ||
237 | if ((dev->flags & IFF_PROMISC) == 0) { | 237 | if ((dev->flags & IFF_PROMISC) == 0) { |
238 | set_multicast_start(dev); | 238 | set_multicast_start(dev); |
239 | for (pmc = dev->mc_list; pmc != NULL; pmc = pmc->next) | 239 | netdev_for_each_mc_addr(pmc, dev) |
240 | set_multicast_one(dev, pmc->dmi_addr); | 240 | set_multicast_one(dev, pmc->dmi_addr); |
241 | set_multicast_finish(dev); | 241 | set_multicast_finish(dev); |
242 | } else | 242 | } else |
diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c index 141dbc91e5e7..5bfc99b9475e 100644 --- a/drivers/net/fs_enet/mac-scc.c +++ b/drivers/net/fs_enet/mac-scc.c | |||
@@ -228,7 +228,7 @@ static void set_multicast_list(struct net_device *dev) | |||
228 | 228 | ||
229 | if ((dev->flags & IFF_PROMISC) == 0) { | 229 | if ((dev->flags & IFF_PROMISC) == 0) { |
230 | set_multicast_start(dev); | 230 | set_multicast_start(dev); |
231 | for (pmc = dev->mc_list; pmc != NULL; pmc = pmc->next) | 231 | netdev_for_each_mc_addr(pmc, dev) |
232 | set_multicast_one(dev, pmc->dmi_addr); | 232 | set_multicast_one(dev, pmc->dmi_addr); |
233 | set_multicast_finish(dev); | 233 | set_multicast_finish(dev); |
234 | } else | 234 | } else |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index c9be090485dd..6aa526ee9096 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -2867,7 +2867,7 @@ static void gfar_set_multi(struct net_device *dev) | |||
2867 | return; | 2867 | return; |
2868 | 2868 | ||
2869 | /* Parse the list, and set the appropriate bits */ | 2869 | /* Parse the list, and set the appropriate bits */ |
2870 | for(mc_ptr = dev->mc_list; mc_ptr; mc_ptr = mc_ptr->next) { | 2870 | netdev_for_each_mc_addr(mc_ptr, dev) { |
2871 | if (idx < em_num) { | 2871 | if (idx < em_num) { |
2872 | gfar_set_mac_for_addr(dev, idx, | 2872 | gfar_set_mac_for_addr(dev, idx, |
2873 | mc_ptr->dmi_addr); | 2873 | mc_ptr->dmi_addr); |
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c index c70b147b4feb..373546dd0831 100644 --- a/drivers/net/hamachi.c +++ b/drivers/net/hamachi.c | |||
@@ -1859,12 +1859,13 @@ static void set_rx_mode(struct net_device *dev) | |||
1859 | writew(0x000B, ioaddr + AddrMode); | 1859 | writew(0x000B, ioaddr + AddrMode); |
1860 | } else if (!netdev_mc_empty(dev)) { /* Must use the CAM filter. */ | 1860 | } else if (!netdev_mc_empty(dev)) { /* Must use the CAM filter. */ |
1861 | struct dev_mc_list *mclist; | 1861 | struct dev_mc_list *mclist; |
1862 | int i; | 1862 | int i = 0; |
1863 | for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev); | 1863 | |
1864 | i++, mclist = mclist->next) { | 1864 | netdev_for_each_mc_addr(mclist, dev) { |
1865 | writel(*(u32*)(mclist->dmi_addr), ioaddr + 0x100 + i*8); | 1865 | writel(*(u32*)(mclist->dmi_addr), ioaddr + 0x100 + i*8); |
1866 | writel(0x20000 | (*(u16*)&mclist->dmi_addr[4]), | 1866 | writel(0x20000 | (*(u16*)&mclist->dmi_addr[4]), |
1867 | ioaddr + 0x104 + i*8); | 1867 | ioaddr + 0x104 + i*8); |
1868 | i++; | ||
1868 | } | 1869 | } |
1869 | /* Clear remaining entries. */ | 1870 | /* Clear remaining entries. */ |
1870 | for (; i < 64; i++) | 1871 | for (; i < 64; i++) |
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c index debac1bc6799..b766a69bf0ca 100644 --- a/drivers/net/hp100.c +++ b/drivers/net/hp100.c | |||
@@ -2098,7 +2098,7 @@ static void hp100_set_multicast_list(struct net_device *dev) | |||
2098 | /* set hash filter to receive all multicast packets */ | 2098 | /* set hash filter to receive all multicast packets */ |
2099 | memset(&lp->hash_bytes, 0xff, 8); | 2099 | memset(&lp->hash_bytes, 0xff, 8); |
2100 | } else { | 2100 | } else { |
2101 | int i, j, idx; | 2101 | int i, idx; |
2102 | u_char *addrs; | 2102 | u_char *addrs; |
2103 | struct dev_mc_list *dmi; | 2103 | struct dev_mc_list *dmi; |
2104 | 2104 | ||
@@ -2107,14 +2107,14 @@ static void hp100_set_multicast_list(struct net_device *dev) | |||
2107 | printk("hp100: %s: computing hash filter - mc_count = %i\n", | 2107 | printk("hp100: %s: computing hash filter - mc_count = %i\n", |
2108 | dev->name, netdev_mc_count(dev)); | 2108 | dev->name, netdev_mc_count(dev)); |
2109 | #endif | 2109 | #endif |
2110 | for (i = 0, dmi = dev->mc_list; i < netdev_mc_count(dev); i++, dmi = dmi->next) { | 2110 | netdev_for_each_mc_addr(dmi, dev) { |
2111 | addrs = dmi->dmi_addr; | 2111 | addrs = dmi->dmi_addr; |
2112 | if ((*addrs & 0x01) == 0x01) { /* multicast address? */ | 2112 | if ((*addrs & 0x01) == 0x01) { /* multicast address? */ |
2113 | #ifdef HP100_DEBUG | 2113 | #ifdef HP100_DEBUG |
2114 | printk("hp100: %s: multicast = %pM, ", | 2114 | printk("hp100: %s: multicast = %pM, ", |
2115 | dev->name, addrs); | 2115 | dev->name, addrs); |
2116 | #endif | 2116 | #endif |
2117 | for (j = idx = 0; j < 6; j++) { | 2117 | for (i = idx = 0; i < 6; i++) { |
2118 | idx ^= *addrs++ & 0x3f; | 2118 | idx ^= *addrs++ & 0x3f; |
2119 | printk(":%02x:", idx); | 2119 | printk(":%02x:", idx); |
2120 | } | 2120 | } |
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c index b75d27e82a3d..fb0ac6d7c040 100644 --- a/drivers/net/ibm_newemac/core.c +++ b/drivers/net/ibm_newemac/core.c | |||
@@ -395,7 +395,7 @@ static void emac_hash_mc(struct emac_instance *dev) | |||
395 | 395 | ||
396 | memset(gaht_temp, 0, sizeof (gaht_temp)); | 396 | memset(gaht_temp, 0, sizeof (gaht_temp)); |
397 | 397 | ||
398 | for (dmi = dev->ndev->mc_list; dmi; dmi = dmi->next) { | 398 | netdev_for_each_mc_addr(dmi, dev->ndev) { |
399 | int slot, reg, mask; | 399 | int slot, reg, mask; |
400 | DBG2(dev, "mc %pM" NL, dmi->dmi_addr); | 400 | DBG2(dev, "mc %pM" NL, dmi->dmi_addr); |
401 | 401 | ||
diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c index 052c74091d91..b5d0f4e973f7 100644 --- a/drivers/net/ibmlana.c +++ b/drivers/net/ibmlana.c | |||
@@ -420,7 +420,7 @@ static void InitBoard(struct net_device *dev) | |||
420 | /* start putting the multicast addresses into the CAM list. Stop if | 420 | /* start putting the multicast addresses into the CAM list. Stop if |
421 | it is full. */ | 421 | it is full. */ |
422 | 422 | ||
423 | for (mcptr = dev->mc_list; mcptr != NULL; mcptr = mcptr->next) { | 423 | netdev_for_each_mc_addr(mcptr, dev) { |
424 | putcam(cams, &camcnt, mcptr->dmi_addr); | 424 | putcam(cams, &camcnt, mcptr->dmi_addr); |
425 | if (camcnt == 16) | 425 | if (camcnt == 16) |
426 | break; | 426 | break; |
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index 41b9c0efcbdd..f2b937966950 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -1072,8 +1072,7 @@ static void ibmveth_set_multicast_list(struct net_device *netdev) | |||
1072 | ibmveth_error_printk("h_multicast_ctrl rc=%ld when entering promisc mode\n", lpar_rc); | 1072 | ibmveth_error_printk("h_multicast_ctrl rc=%ld when entering promisc mode\n", lpar_rc); |
1073 | } | 1073 | } |
1074 | } else { | 1074 | } else { |
1075 | struct dev_mc_list *mclist = netdev->mc_list; | 1075 | struct dev_mc_list *mclist; |
1076 | int i; | ||
1077 | /* clear the filter table & disable filtering */ | 1076 | /* clear the filter table & disable filtering */ |
1078 | lpar_rc = h_multicast_ctrl(adapter->vdev->unit_address, | 1077 | lpar_rc = h_multicast_ctrl(adapter->vdev->unit_address, |
1079 | IbmVethMcastEnableRecv | | 1078 | IbmVethMcastEnableRecv | |
@@ -1084,7 +1083,7 @@ static void ibmveth_set_multicast_list(struct net_device *netdev) | |||
1084 | ibmveth_error_printk("h_multicast_ctrl rc=%ld when attempting to clear filter table\n", lpar_rc); | 1083 | ibmveth_error_printk("h_multicast_ctrl rc=%ld when attempting to clear filter table\n", lpar_rc); |
1085 | } | 1084 | } |
1086 | /* add the addresses to the filter table */ | 1085 | /* add the addresses to the filter table */ |
1087 | for(i = 0; i < netdev_mc_count(netdev); ++i, mclist = mclist->next) { | 1086 | netdev_for_each_mc_addr(mclist, netdev) { |
1088 | // add the multicast address to the filter table | 1087 | // add the multicast address to the filter table |
1089 | unsigned long mcast_addr = 0; | 1088 | unsigned long mcast_addr = 0; |
1090 | memcpy(((char *)&mcast_addr)+2, mclist->dmi_addr, 6); | 1089 | memcpy(((char *)&mcast_addr)+2, mclist->dmi_addr, 6); |
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index f588e49c65f1..583a21c1def3 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -2877,7 +2877,7 @@ static int igb_write_mc_addr_list(struct net_device *netdev) | |||
2877 | { | 2877 | { |
2878 | struct igb_adapter *adapter = netdev_priv(netdev); | 2878 | struct igb_adapter *adapter = netdev_priv(netdev); |
2879 | struct e1000_hw *hw = &adapter->hw; | 2879 | struct e1000_hw *hw = &adapter->hw; |
2880 | struct dev_mc_list *mc_ptr = netdev->mc_list; | 2880 | struct dev_mc_list *mc_ptr; |
2881 | u8 *mta_list; | 2881 | u8 *mta_list; |
2882 | int i; | 2882 | int i; |
2883 | 2883 | ||
@@ -2893,14 +2893,10 @@ static int igb_write_mc_addr_list(struct net_device *netdev) | |||
2893 | return -ENOMEM; | 2893 | return -ENOMEM; |
2894 | 2894 | ||
2895 | /* The shared function expects a packed array of only addresses. */ | 2895 | /* The shared function expects a packed array of only addresses. */ |
2896 | mc_ptr = netdev->mc_list; | 2896 | i = 0; |
2897 | netdev_for_each_mc_addr(mc_ptr, netdev) | ||
2898 | memcpy(mta_list + (i++ * ETH_ALEN), mc_ptr->dmi_addr, ETH_ALEN); | ||
2897 | 2899 | ||
2898 | for (i = 0; i < netdev_mc_count(netdev); i++) { | ||
2899 | if (!mc_ptr) | ||
2900 | break; | ||
2901 | memcpy(mta_list + (i*ETH_ALEN), mc_ptr->dmi_addr, ETH_ALEN); | ||
2902 | mc_ptr = mc_ptr->next; | ||
2903 | } | ||
2904 | igb_update_mc_addr_list(hw, mta_list, i); | 2900 | igb_update_mc_addr_list(hw, mta_list, i); |
2905 | kfree(mta_list); | 2901 | kfree(mta_list); |
2906 | 2902 | ||
diff --git a/drivers/net/igbvf/netdev.c b/drivers/net/igbvf/netdev.c index 6029c400f2be..a77afd8a14bb 100644 --- a/drivers/net/igbvf/netdev.c +++ b/drivers/net/igbvf/netdev.c | |||
@@ -1413,15 +1413,9 @@ static void igbvf_set_multi(struct net_device *netdev) | |||
1413 | } | 1413 | } |
1414 | 1414 | ||
1415 | /* prepare a packed array of only addresses. */ | 1415 | /* prepare a packed array of only addresses. */ |
1416 | mc_ptr = netdev->mc_list; | 1416 | i = 0; |
1417 | 1417 | netdev_for_each_mc_addr(mc_ptr, netdev) | |
1418 | for (i = 0; i < netdev_mc_count(netdev); i++) { | 1418 | memcpy(mta_list + (i++ * ETH_ALEN), mc_ptr->dmi_addr, ETH_ALEN); |
1419 | if (!mc_ptr) | ||
1420 | break; | ||
1421 | memcpy(mta_list + (i*ETH_ALEN), mc_ptr->dmi_addr, | ||
1422 | ETH_ALEN); | ||
1423 | mc_ptr = mc_ptr->next; | ||
1424 | } | ||
1425 | 1419 | ||
1426 | hw->mac.ops.update_mc_addr_list(hw, mta_list, i, 0, 0); | 1420 | hw->mac.ops.update_mc_addr_list(hw, mta_list, i, 0, 0); |
1427 | kfree(mta_list); | 1421 | kfree(mta_list); |
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c index 0bd5fef22d49..70871b9b045a 100644 --- a/drivers/net/ioc3-eth.c +++ b/drivers/net/ioc3-eth.c | |||
@@ -1664,11 +1664,10 @@ static int ioc3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
1664 | 1664 | ||
1665 | static void ioc3_set_multicast_list(struct net_device *dev) | 1665 | static void ioc3_set_multicast_list(struct net_device *dev) |
1666 | { | 1666 | { |
1667 | struct dev_mc_list *dmi = dev->mc_list; | 1667 | struct dev_mc_list *dmi; |
1668 | struct ioc3_private *ip = netdev_priv(dev); | 1668 | struct ioc3_private *ip = netdev_priv(dev); |
1669 | struct ioc3 *ioc3 = ip->regs; | 1669 | struct ioc3 *ioc3 = ip->regs; |
1670 | u64 ehar = 0; | 1670 | u64 ehar = 0; |
1671 | int i; | ||
1672 | 1671 | ||
1673 | netif_stop_queue(dev); /* Lock out others. */ | 1672 | netif_stop_queue(dev); /* Lock out others. */ |
1674 | 1673 | ||
@@ -1689,9 +1688,8 @@ static void ioc3_set_multicast_list(struct net_device *dev) | |||
1689 | ip->ehar_h = 0xffffffff; | 1688 | ip->ehar_h = 0xffffffff; |
1690 | ip->ehar_l = 0xffffffff; | 1689 | ip->ehar_l = 0xffffffff; |
1691 | } else { | 1690 | } else { |
1692 | for (i = 0; i < netdev_mc_count(dev); i++) { | 1691 | netdev_for_each_mc_addr(dmi, dev) { |
1693 | char *addr = dmi->dmi_addr; | 1692 | char *addr = dmi->dmi_addr; |
1694 | dmi = dmi->next; | ||
1695 | 1693 | ||
1696 | if (!(*addr & 1)) | 1694 | if (!(*addr & 1)) |
1697 | continue; | 1695 | continue; |
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c index 3ca49e348c9d..150415e83f61 100644 --- a/drivers/net/ipg.c +++ b/drivers/net/ipg.c | |||
@@ -608,8 +608,7 @@ static void ipg_nic_set_multicast_list(struct net_device *dev) | |||
608 | hashtable[1] = 0x00000000; | 608 | hashtable[1] = 0x00000000; |
609 | 609 | ||
610 | /* Cycle through all multicast addresses to filter. */ | 610 | /* Cycle through all multicast addresses to filter. */ |
611 | for (mc_list_ptr = dev->mc_list; | 611 | netdev_for_each_mc_addr(mc_list_ptr, dev) { |
612 | mc_list_ptr != NULL; mc_list_ptr = mc_list_ptr->next) { | ||
613 | /* Calculate CRC result for each multicast address. */ | 612 | /* Calculate CRC result for each multicast address. */ |
614 | hashindex = crc32_le(0xffffffff, mc_list_ptr->dmi_addr, | 613 | hashindex = crc32_le(0xffffffff, mc_list_ptr->dmi_addr, |
615 | ETH_ALEN); | 614 | ETH_ALEN); |
diff --git a/drivers/net/isa-skeleton.c b/drivers/net/isa-skeleton.c index bb4a3cda6e4b..d09e4d3a15a6 100644 --- a/drivers/net/isa-skeleton.c +++ b/drivers/net/isa-skeleton.c | |||
@@ -666,7 +666,7 @@ set_multicast_list(struct net_device *dev) | |||
666 | else if (!netdev_mc_empty(dev)) | 666 | else if (!netdev_mc_empty(dev)) |
667 | { | 667 | { |
668 | /* Walk the address list, and load the filter */ | 668 | /* Walk the address list, and load the filter */ |
669 | hardware_set_filter(dev->mc_list); | 669 | hardware_set_filter(dev); |
670 | 670 | ||
671 | outw(MULTICAST, ioaddr); | 671 | outw(MULTICAST, ioaddr); |
672 | } | 672 | } |
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c index ff015e15f5d1..966de5d69521 100644 --- a/drivers/net/iseries_veth.c +++ b/drivers/net/iseries_veth.c | |||
@@ -961,15 +961,14 @@ static void veth_set_multicast_list(struct net_device *dev) | |||
961 | (netdev_mc_count(dev) > VETH_MAX_MCAST)) { | 961 | (netdev_mc_count(dev) > VETH_MAX_MCAST)) { |
962 | port->promiscuous = 1; | 962 | port->promiscuous = 1; |
963 | } else { | 963 | } else { |
964 | struct dev_mc_list *dmi = dev->mc_list; | 964 | struct dev_mc_list *dmi; |
965 | int i; | ||
966 | 965 | ||
967 | port->promiscuous = 0; | 966 | port->promiscuous = 0; |
968 | 967 | ||
969 | /* Update table */ | 968 | /* Update table */ |
970 | port->num_mcast = 0; | 969 | port->num_mcast = 0; |
971 | 970 | ||
972 | for (i = 0; i < netdev_mc_count(dev); i++) { | 971 | netdev_for_each_mc_addr(dmi, dev) { |
973 | u8 *addr = dmi->dmi_addr; | 972 | u8 *addr = dmi->dmi_addr; |
974 | u64 xaddr = 0; | 973 | u64 xaddr = 0; |
975 | 974 | ||
@@ -978,7 +977,6 @@ static void veth_set_multicast_list(struct net_device *dev) | |||
978 | port->mcast_addr[port->num_mcast] = xaddr; | 977 | port->mcast_addr[port->num_mcast] = xaddr; |
979 | port->num_mcast++; | 978 | port->num_mcast++; |
980 | } | 979 | } |
981 | dmi = dmi->next; | ||
982 | } | 980 | } |
983 | } | 981 | } |
984 | 982 | ||
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index 93d018505ebb..c9fef65cb98b 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -1088,10 +1088,9 @@ ixgb_set_multi(struct net_device *netdev) | |||
1088 | 1088 | ||
1089 | IXGB_WRITE_REG(hw, RCTL, rctl); | 1089 | IXGB_WRITE_REG(hw, RCTL, rctl); |
1090 | 1090 | ||
1091 | for (i = 0, mc_ptr = netdev->mc_list; | 1091 | i = 0; |
1092 | mc_ptr; | 1092 | netdev_for_each_mc_addr(mc_ptr, netdev) |
1093 | i++, mc_ptr = mc_ptr->next) | 1093 | memcpy(&mta[i++ * IXGB_ETH_LENGTH_OF_ADDRESS], |
1094 | memcpy(&mta[i * IXGB_ETH_LENGTH_OF_ADDRESS], | ||
1095 | mc_ptr->dmi_addr, IXGB_ETH_LENGTH_OF_ADDRESS); | 1094 | mc_ptr->dmi_addr, IXGB_ETH_LENGTH_OF_ADDRESS); |
1096 | 1095 | ||
1097 | ixgb_mc_addr_list_update(hw, mta, netdev_mc_count(netdev), 0); | 1096 | ixgb_mc_addr_list_update(hw, mta, netdev_mc_count(netdev), 0); |