aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Pirko <jpirko@redhat.com>2010-02-19 19:13:58 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-22 18:45:51 -0500
commit0ddf477b8a9b02412a6cabd51c486998811c7dd1 (patch)
treedf82cf6637248439897153aca2f8fa6216003b61
parent3b9a7728d878a3e7adc79fb89c3bb9ebc23760d7 (diff)
net: convert multiple drivers to use netdev_for_each_mc_addr, part3
Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/7990.c6
-rw-r--r--drivers/net/82596.c9
-rw-r--r--drivers/net/a2065.c6
-rw-r--r--drivers/net/amd8111e.c11
-rw-r--r--drivers/net/amd8111e.h1
-rw-r--r--drivers/net/appletalk/ltpc.c1
-rw-r--r--drivers/net/at1700.c4
-rw-r--r--drivers/net/atl1c/atl1c_main.c2
-rw-r--r--drivers/net/atl1e/atl1e_main.c2
-rw-r--r--drivers/net/atlx/atl2.c2
-rw-r--r--drivers/net/atlx/atlx.c2
-rw-r--r--drivers/net/atp.c4
-rw-r--r--drivers/net/au1000_eth.c5
-rw-r--r--drivers/net/b44.c8
-rw-r--r--drivers/net/bcm63xx_enet.c13
-rw-r--r--drivers/net/benet/be_cmds.c10
-rw-r--r--drivers/net/benet/be_cmds.h3
-rw-r--r--drivers/net/benet/be_main.c6
-rw-r--r--drivers/net/bfin_mac.c6
-rw-r--r--drivers/net/bmac.c7
-rw-r--r--drivers/net/bnx2.c4
-rw-r--r--drivers/net/bnx2x_main.c12
22 files changed, 50 insertions, 74 deletions
diff --git a/drivers/net/7990.c b/drivers/net/7990.c
index 079d0be37821..4e9a5a20b6a6 100644
--- a/drivers/net/7990.c
+++ b/drivers/net/7990.c
@@ -595,9 +595,8 @@ static void lance_load_multicast (struct net_device *dev)
595 struct lance_private *lp = netdev_priv(dev); 595 struct lance_private *lp = netdev_priv(dev);
596 volatile struct lance_init_block *ib = lp->init_block; 596 volatile struct lance_init_block *ib = lp->init_block;
597 volatile u16 *mcast_table = (u16 *)&ib->filter; 597 volatile u16 *mcast_table = (u16 *)&ib->filter;
598 struct dev_mc_list *dmi=dev->mc_list; 598 struct dev_mc_list *dmi;
599 char *addrs; 599 char *addrs;
600 int i;
601 u32 crc; 600 u32 crc;
602 601
603 /* set all multicast bits */ 602 /* set all multicast bits */
@@ -611,9 +610,8 @@ static void lance_load_multicast (struct net_device *dev)
611 ib->filter [1] = 0; 610 ib->filter [1] = 0;
612 611
613 /* Add addresses */ 612 /* Add addresses */
614 for (i = 0; i < netdev_mc_count(dev); i++){ 613 netdev_for_each_mc_addr(dmi, dev) {
615 addrs = dmi->dmi_addr; 614 addrs = dmi->dmi_addr;
616 dmi = dmi->next;
617 615
618 /* multicast address? */ 616 /* multicast address? */
619 if (!(*addrs & 1)) 617 if (!(*addrs & 1))
diff --git a/drivers/net/82596.c b/drivers/net/82596.c
index 638ce3b29854..f94d17d78bb0 100644
--- a/drivers/net/82596.c
+++ b/drivers/net/82596.c
@@ -1550,13 +1550,16 @@ static void set_multicast_list(struct net_device *dev)
1550 return; 1550 return;
1551 cmd = &lp->mc_cmd; 1551 cmd = &lp->mc_cmd;
1552 cmd->cmd.command = CmdMulticastList; 1552 cmd->cmd.command = CmdMulticastList;
1553 cmd->mc_cnt = netdev_mc_count(dev) * 6; 1553 cmd->mc_cnt = cnt * ETH_ALEN;
1554 cp = cmd->mc_addrs; 1554 cp = cmd->mc_addrs;
1555 for (dmi = dev->mc_list; cnt && dmi != NULL; dmi = dmi->next, cnt--, cp += 6) { 1555 netdev_for_each_mc_addr(dmi, dev) {
1556 memcpy(cp, dmi->dmi_addr, 6); 1556 if (!cnt--)
1557 break;
1558 memcpy(cp, dmi->dmi_addr, ETH_ALEN);
1557 if (i596_debug > 1) 1559 if (i596_debug > 1)
1558 DEB(DEB_MULTI,printk(KERN_INFO "%s: Adding address %pM\n", 1560 DEB(DEB_MULTI,printk(KERN_INFO "%s: Adding address %pM\n",
1559 dev->name, cp)); 1561 dev->name, cp));
1562 cp += ETH_ALEN;
1560 } 1563 }
1561 i596_add_cmd(dev, &cmd->cmd); 1564 i596_add_cmd(dev, &cmd->cmd);
1562 } 1565 }
diff --git a/drivers/net/a2065.c b/drivers/net/a2065.c
index 6a65f660c192..bd4d829eca12 100644
--- a/drivers/net/a2065.c
+++ b/drivers/net/a2065.c
@@ -603,9 +603,8 @@ static void lance_load_multicast (struct net_device *dev)
603 struct lance_private *lp = netdev_priv(dev); 603 struct lance_private *lp = netdev_priv(dev);
604 volatile struct lance_init_block *ib = lp->init_block; 604 volatile struct lance_init_block *ib = lp->init_block;
605 volatile u16 *mcast_table = (u16 *)&ib->filter; 605 volatile u16 *mcast_table = (u16 *)&ib->filter;
606 struct dev_mc_list *dmi=dev->mc_list; 606 struct dev_mc_list *dmi;
607 char *addrs; 607 char *addrs;
608 int i;
609 u32 crc; 608 u32 crc;
610 609
611 /* set all multicast bits */ 610 /* set all multicast bits */
@@ -619,9 +618,8 @@ static void lance_load_multicast (struct net_device *dev)
619 ib->filter [1] = 0; 618 ib->filter [1] = 0;
620 619
621 /* Add addresses */ 620 /* Add addresses */
622 for (i = 0; i < netdev_mc_count(dev); i++){ 621 netdev_for_each_mc_addr(dmi, dev) {
623 addrs = dmi->dmi_addr; 622 addrs = dmi->dmi_addr;
624 dmi = dmi->next;
625 623
626 /* multicast address? */ 624 /* multicast address? */
627 if (!(*addrs & 1)) 625 if (!(*addrs & 1))
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index bdffdfb4c88b..b8a59d255b49 100644
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -1377,10 +1377,11 @@ list to the device.
1377*/ 1377*/
1378static void amd8111e_set_multicast_list(struct net_device *dev) 1378static void amd8111e_set_multicast_list(struct net_device *dev)
1379{ 1379{
1380 struct dev_mc_list* mc_ptr; 1380 struct dev_mc_list *mc_ptr;
1381 struct amd8111e_priv *lp = netdev_priv(dev); 1381 struct amd8111e_priv *lp = netdev_priv(dev);
1382 u32 mc_filter[2] ; 1382 u32 mc_filter[2] ;
1383 int i,bit_num; 1383 int bit_num;
1384
1384 if(dev->flags & IFF_PROMISC){ 1385 if(dev->flags & IFF_PROMISC){
1385 writel( VAL2 | PROM, lp->mmio + CMD2); 1386 writel( VAL2 | PROM, lp->mmio + CMD2);
1386 return; 1387 return;
@@ -1391,7 +1392,6 @@ static void amd8111e_set_multicast_list(struct net_device *dev)
1391 netdev_mc_count(dev) > MAX_FILTER_SIZE) { 1392 netdev_mc_count(dev) > MAX_FILTER_SIZE) {
1392 /* get all multicast packet */ 1393 /* get all multicast packet */
1393 mc_filter[1] = mc_filter[0] = 0xffffffff; 1394 mc_filter[1] = mc_filter[0] = 0xffffffff;
1394 lp->mc_list = dev->mc_list;
1395 lp->options |= OPTION_MULTICAST_ENABLE; 1395 lp->options |= OPTION_MULTICAST_ENABLE;
1396 amd8111e_writeq(*(u64*)mc_filter,lp->mmio + LADRF); 1396 amd8111e_writeq(*(u64*)mc_filter,lp->mmio + LADRF);
1397 return; 1397 return;
@@ -1399,7 +1399,6 @@ static void amd8111e_set_multicast_list(struct net_device *dev)
1399 if (netdev_mc_empty(dev)) { 1399 if (netdev_mc_empty(dev)) {
1400 /* get only own packets */ 1400 /* get only own packets */
1401 mc_filter[1] = mc_filter[0] = 0; 1401 mc_filter[1] = mc_filter[0] = 0;
1402 lp->mc_list = NULL;
1403 lp->options &= ~OPTION_MULTICAST_ENABLE; 1402 lp->options &= ~OPTION_MULTICAST_ENABLE;
1404 amd8111e_writeq(*(u64*)mc_filter,lp->mmio + LADRF); 1403 amd8111e_writeq(*(u64*)mc_filter,lp->mmio + LADRF);
1405 /* disable promiscous mode */ 1404 /* disable promiscous mode */
@@ -1408,10 +1407,8 @@ static void amd8111e_set_multicast_list(struct net_device *dev)
1408 } 1407 }
1409 /* load all the multicast addresses in the logic filter */ 1408 /* load all the multicast addresses in the logic filter */
1410 lp->options |= OPTION_MULTICAST_ENABLE; 1409 lp->options |= OPTION_MULTICAST_ENABLE;
1411 lp->mc_list = dev->mc_list;
1412 mc_filter[1] = mc_filter[0] = 0; 1410 mc_filter[1] = mc_filter[0] = 0;
1413 for (i = 0, mc_ptr = dev->mc_list; mc_ptr && i < netdev_mc_count(dev); 1411 netdev_for_each_mc_addr(mc_ptr, dev) {
1414 i++, mc_ptr = mc_ptr->next) {
1415 bit_num = (ether_crc_le(ETH_ALEN, mc_ptr->dmi_addr) >> 26) & 0x3f; 1412 bit_num = (ether_crc_le(ETH_ALEN, mc_ptr->dmi_addr) >> 26) & 0x3f;
1416 mc_filter[bit_num >> 5] |= 1 << (bit_num & 31); 1413 mc_filter[bit_num >> 5] |= 1 << (bit_num & 31);
1417 } 1414 }
diff --git a/drivers/net/amd8111e.h b/drivers/net/amd8111e.h
index 28c60a71ed50..ac36eb6981e3 100644
--- a/drivers/net/amd8111e.h
+++ b/drivers/net/amd8111e.h
@@ -789,7 +789,6 @@ struct amd8111e_priv{
789 char opened; 789 char opened;
790 struct net_device_stats stats; 790 struct net_device_stats stats;
791 unsigned int drv_rx_errors; 791 unsigned int drv_rx_errors;
792 struct dev_mc_list* mc_list;
793 struct amd8111e_coalesce_conf coal_conf; 792 struct amd8111e_coalesce_conf coal_conf;
794 793
795 struct ipg_info ipg_data; 794 struct ipg_info ipg_data;
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c
index dbfbd3b7ff86..8ea4ec705bef 100644
--- a/drivers/net/appletalk/ltpc.c
+++ b/drivers/net/appletalk/ltpc.c
@@ -1125,7 +1125,6 @@ struct net_device * __init ltpc_probe(void)
1125 printk(KERN_INFO "Apple/Farallon LocalTalk-PC card at %03x, DMA%d. Using polled mode.\n",io,dma); 1125 printk(KERN_INFO "Apple/Farallon LocalTalk-PC card at %03x, DMA%d. Using polled mode.\n",io,dma);
1126 1126
1127 dev->netdev_ops = &ltpc_netdev; 1127 dev->netdev_ops = &ltpc_netdev;
1128 dev->mc_list = NULL;
1129 dev->base_addr = io; 1128 dev->base_addr = io;
1130 dev->irq = irq; 1129 dev->irq = irq;
1131 dev->dma = dma; 1130 dev->dma = dma;
diff --git a/drivers/net/at1700.c b/drivers/net/at1700.c
index fe60cd02c86c..309843ab8869 100644
--- a/drivers/net/at1700.c
+++ b/drivers/net/at1700.c
@@ -849,11 +849,9 @@ set_rx_mode(struct net_device *dev)
849 outb(1, ioaddr + RX_MODE); /* Ignore almost all multicasts. */ 849 outb(1, ioaddr + RX_MODE); /* Ignore almost all multicasts. */
850 } else { 850 } else {
851 struct dev_mc_list *mclist; 851 struct dev_mc_list *mclist;
852 int i;
853 852
854 memset(mc_filter, 0, sizeof(mc_filter)); 853 memset(mc_filter, 0, sizeof(mc_filter));
855 for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev); 854 netdev_for_each_mc_addr(mclist, dev) {
856 i++, mclist = mclist->next) {
857 unsigned int bit = 855 unsigned int bit =
858 ether_crc_le(ETH_ALEN, mclist->dmi_addr) >> 26; 856 ether_crc_le(ETH_ALEN, mclist->dmi_addr) >> 26;
859 mc_filter[bit >> 3] |= (1 << bit); 857 mc_filter[bit >> 3] |= (1 << bit);
diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c
index 3d4c0a5a77eb..50dc531a02d8 100644
--- a/drivers/net/atl1c/atl1c_main.c
+++ b/drivers/net/atl1c/atl1c_main.c
@@ -377,7 +377,7 @@ static void atl1c_set_multi(struct net_device *netdev)
377 AT_WRITE_REG_ARRAY(hw, REG_RX_HASH_TABLE, 1, 0); 377 AT_WRITE_REG_ARRAY(hw, REG_RX_HASH_TABLE, 1, 0);
378 378
379 /* comoute mc addresses' hash value ,and put it into hash table */ 379 /* comoute mc addresses' hash value ,and put it into hash table */
380 for (mc_ptr = netdev->mc_list; mc_ptr; mc_ptr = mc_ptr->next) { 380 netdev_for_each_mc_addr(mc_ptr, netdev) {
381 hash_value = atl1c_hash_mc_addr(hw, mc_ptr->dmi_addr); 381 hash_value = atl1c_hash_mc_addr(hw, mc_ptr->dmi_addr);
382 atl1c_hash_set(hw, hash_value); 382 atl1c_hash_set(hw, hash_value);
383 } 383 }
diff --git a/drivers/net/atl1e/atl1e_main.c b/drivers/net/atl1e/atl1e_main.c
index 7d8de10ba628..73302ae468aa 100644
--- a/drivers/net/atl1e/atl1e_main.c
+++ b/drivers/net/atl1e/atl1e_main.c
@@ -307,7 +307,7 @@ static void atl1e_set_multi(struct net_device *netdev)
307 AT_WRITE_REG_ARRAY(hw, REG_RX_HASH_TABLE, 1, 0); 307 AT_WRITE_REG_ARRAY(hw, REG_RX_HASH_TABLE, 1, 0);
308 308
309 /* comoute mc addresses' hash value ,and put it into hash table */ 309 /* comoute mc addresses' hash value ,and put it into hash table */
310 for (mc_ptr = netdev->mc_list; mc_ptr; mc_ptr = mc_ptr->next) { 310 netdev_for_each_mc_addr(mc_ptr, netdev) {
311 hash_value = atl1e_hash_mc_addr(hw, mc_ptr->dmi_addr); 311 hash_value = atl1e_hash_mc_addr(hw, mc_ptr->dmi_addr);
312 atl1e_hash_set(hw, hash_value); 312 atl1e_hash_set(hw, hash_value);
313 } 313 }
diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c
index 40cf9e5cb9e2..7061d7108f08 100644
--- a/drivers/net/atlx/atl2.c
+++ b/drivers/net/atlx/atl2.c
@@ -157,7 +157,7 @@ static void atl2_set_multi(struct net_device *netdev)
157 ATL2_WRITE_REG_ARRAY(hw, REG_RX_HASH_TABLE, 1, 0); 157 ATL2_WRITE_REG_ARRAY(hw, REG_RX_HASH_TABLE, 1, 0);
158 158
159 /* comoute mc addresses' hash value ,and put it into hash table */ 159 /* comoute mc addresses' hash value ,and put it into hash table */
160 for (mc_ptr = netdev->mc_list; mc_ptr; mc_ptr = mc_ptr->next) { 160 netdev_for_each_mc_addr(mc_ptr, netdev) {
161 hash_value = atl2_hash_mc_addr(hw, mc_ptr->dmi_addr); 161 hash_value = atl2_hash_mc_addr(hw, mc_ptr->dmi_addr);
162 atl2_hash_set(hw, hash_value); 162 atl2_hash_set(hw, hash_value);
163 } 163 }
diff --git a/drivers/net/atlx/atlx.c b/drivers/net/atlx/atlx.c
index 3dc014215679..72f3306352e2 100644
--- a/drivers/net/atlx/atlx.c
+++ b/drivers/net/atlx/atlx.c
@@ -144,7 +144,7 @@ static void atlx_set_multi(struct net_device *netdev)
144 iowrite32(0, (hw->hw_addr + REG_RX_HASH_TABLE) + (1 << 2)); 144 iowrite32(0, (hw->hw_addr + REG_RX_HASH_TABLE) + (1 << 2));
145 145
146 /* compute mc addresses' hash value ,and put it into hash table */ 146 /* compute mc addresses' hash value ,and put it into hash table */
147 for (mc_ptr = netdev->mc_list; mc_ptr; mc_ptr = mc_ptr->next) { 147 netdev_for_each_mc_addr(mc_ptr, netdev) {
148 hash_value = atlx_hash_mc_addr(hw, mc_ptr->dmi_addr); 148 hash_value = atlx_hash_mc_addr(hw, mc_ptr->dmi_addr);
149 atlx_hash_set(hw, hash_value); 149 atlx_hash_set(hw, hash_value);
150 } 150 }
diff --git a/drivers/net/atp.c b/drivers/net/atp.c
index a841feb5df20..6ad16205dc17 100644
--- a/drivers/net/atp.c
+++ b/drivers/net/atp.c
@@ -886,9 +886,7 @@ static void set_rx_mode_8012(struct net_device *dev)
886 struct dev_mc_list *mclist; 886 struct dev_mc_list *mclist;
887 887
888 memset(mc_filter, 0, sizeof(mc_filter)); 888 memset(mc_filter, 0, sizeof(mc_filter));
889 for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev); 889 netdev_for_each_mc_addr(mclist, dev) {
890 i++, mclist = mclist->next)
891 {
892 int filterbit = ether_crc_le(ETH_ALEN, mclist->dmi_addr) & 0x3f; 890 int filterbit = ether_crc_le(ETH_ALEN, mclist->dmi_addr) & 0x3f;
893 mc_filter[filterbit >> 5] |= 1 << (filterbit & 31); 891 mc_filter[filterbit >> 5] |= 1 << (filterbit & 31);
894 } 892 }
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index 9337d023919c..a66b06aa1f0b 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -1018,16 +1018,13 @@ static void au1000_multicast_list(struct net_device *dev)
1018 aup->mac->control &= ~MAC_PROMISCUOUS; 1018 aup->mac->control &= ~MAC_PROMISCUOUS;
1019 printk(KERN_INFO "%s: Pass all multicast\n", dev->name); 1019 printk(KERN_INFO "%s: Pass all multicast\n", dev->name);
1020 } else { 1020 } else {
1021 int i;
1022 struct dev_mc_list *mclist; 1021 struct dev_mc_list *mclist;
1023 u32 mc_filter[2]; /* Multicast hash filter */ 1022 u32 mc_filter[2]; /* Multicast hash filter */
1024 1023
1025 mc_filter[1] = mc_filter[0] = 0; 1024 mc_filter[1] = mc_filter[0] = 0;
1026 for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev); 1025 netdev_for_each_mc_addr(mclist, dev)
1027 i++, mclist = mclist->next) {
1028 set_bit(ether_crc(ETH_ALEN, mclist->dmi_addr)>>26, 1026 set_bit(ether_crc(ETH_ALEN, mclist->dmi_addr)>>26,
1029 (long *)mc_filter); 1027 (long *)mc_filter);
1030 }
1031 aup->mac->multi_hash_high = mc_filter[1]; 1028 aup->mac->multi_hash_high = mc_filter[1];
1032 aup->mac->multi_hash_low = mc_filter[0]; 1029 aup->mac->multi_hash_low = mc_filter[0];
1033 aup->mac->control &= ~MAC_PROMISCUOUS; 1030 aup->mac->control &= ~MAC_PROMISCUOUS;
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index bcb6a029a0a8..332c60356285 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -1684,9 +1684,11 @@ static int __b44_load_mcast(struct b44 *bp, struct net_device *dev)
1684 int i, num_ents; 1684 int i, num_ents;
1685 1685
1686 num_ents = min_t(int, netdev_mc_count(dev), B44_MCAST_TABLE_SIZE); 1686 num_ents = min_t(int, netdev_mc_count(dev), B44_MCAST_TABLE_SIZE);
1687 mclist = dev->mc_list; 1687 i = 0;
1688 for (i = 0; mclist && i < num_ents; i++, mclist = mclist->next) { 1688 netdev_for_each_mc_addr(mclist, dev) {
1689 __b44_cam_write(bp, mclist->dmi_addr, i + 1); 1689 if (i == num_ents)
1690 break;
1691 __b44_cam_write(bp, mclist->dmi_addr, i++ + 1);
1690 } 1692 }
1691 return i+1; 1693 return i+1;
1692} 1694}
diff --git a/drivers/net/bcm63xx_enet.c b/drivers/net/bcm63xx_enet.c
index 0927ffa0d753..8cdcab7655c0 100644
--- a/drivers/net/bcm63xx_enet.c
+++ b/drivers/net/bcm63xx_enet.c
@@ -631,16 +631,13 @@ static void bcm_enet_set_multicast_list(struct net_device *dev)
631 return; 631 return;
632 } 632 }
633 633
634 for (i = 0, mc_list = dev->mc_list; 634 i = 0;
635 (mc_list != NULL) && (i < netdev_mc_count(dev)) && (i < 3); 635 netdev_for_each_mc_addr(mc_list, dev) {
636 i++, mc_list = mc_list->next) {
637 u8 *dmi_addr; 636 u8 *dmi_addr;
638 u32 tmp; 637 u32 tmp;
639 638
640 /* filter non ethernet address */ 639 if (i == 3)
641 if (mc_list->dmi_addrlen != 6) 640 break;
642 continue;
643
644 /* update perfect match registers */ 641 /* update perfect match registers */
645 dmi_addr = mc_list->dmi_addr; 642 dmi_addr = mc_list->dmi_addr;
646 tmp = (dmi_addr[2] << 24) | (dmi_addr[3] << 16) | 643 tmp = (dmi_addr[2] << 24) | (dmi_addr[3] << 16) |
@@ -649,7 +646,7 @@ static void bcm_enet_set_multicast_list(struct net_device *dev)
649 646
650 tmp = (dmi_addr[0] << 8 | dmi_addr[1]); 647 tmp = (dmi_addr[0] << 8 | dmi_addr[1]);
651 tmp |= ENET_PMH_DATAVALID_MASK; 648 tmp |= ENET_PMH_DATAVALID_MASK;
652 enet_writel(priv, tmp, ENET_PMH_REG(i + 1)); 649 enet_writel(priv, tmp, ENET_PMH_REG(i++ + 1));
653 } 650 }
654 651
655 for (; i < 3; i++) { 652 for (; i < 3; i++) {
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index ee16b374e02c..c8a2bacb1d13 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -1134,8 +1134,7 @@ err:
1134 * (mc == NULL) => multicast promiscous 1134 * (mc == NULL) => multicast promiscous
1135 */ 1135 */
1136int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id, 1136int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id,
1137 struct dev_mc_list *mc_list, u32 mc_count, 1137 struct net_device *netdev, struct be_dma_mem *mem)
1138 struct be_dma_mem *mem)
1139{ 1138{
1140 struct be_mcc_wrb *wrb; 1139 struct be_mcc_wrb *wrb;
1141 struct be_cmd_req_mcast_mac_config *req = mem->va; 1140 struct be_cmd_req_mcast_mac_config *req = mem->va;
@@ -1162,13 +1161,14 @@ int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id,
1162 OPCODE_COMMON_NTWK_MULTICAST_SET, sizeof(*req)); 1161 OPCODE_COMMON_NTWK_MULTICAST_SET, sizeof(*req));
1163 1162
1164 req->interface_id = if_id; 1163 req->interface_id = if_id;
1165 if (mc_list) { 1164 if (netdev) {
1166 int i; 1165 int i;
1167 struct dev_mc_list *mc; 1166 struct dev_mc_list *mc;
1168 1167
1169 req->num_mac = cpu_to_le16(mc_count); 1168 req->num_mac = cpu_to_le16(netdev_mc_count(netdev));
1170 1169
1171 for (mc = mc_list, i = 0; mc; mc = mc->next, i++) 1170 i = 0;
1171 netdev_for_each_mc_addr(mc, netdev)
1172 memcpy(req->mac[i].byte, mc->dmi_addr, ETH_ALEN); 1172 memcpy(req->mac[i].byte, mc->dmi_addr, ETH_ALEN);
1173 } else { 1173 } else {
1174 req->promiscuous = 1; 1174 req->promiscuous = 1;
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h
index 3464924d6c28..728b0d736929 100644
--- a/drivers/net/benet/be_cmds.h
+++ b/drivers/net/benet/be_cmds.h
@@ -912,8 +912,7 @@ extern int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id,
912extern int be_cmd_promiscuous_config(struct be_adapter *adapter, 912extern int be_cmd_promiscuous_config(struct be_adapter *adapter,
913 u8 port_num, bool en); 913 u8 port_num, bool en);
914extern int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id, 914extern int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id,
915 struct dev_mc_list *mc_list, u32 mc_count, 915 struct net_device *netdev, struct be_dma_mem *mem);
916 struct be_dma_mem *mem);
917extern int be_cmd_set_flow_control(struct be_adapter *adapter, 916extern int be_cmd_set_flow_control(struct be_adapter *adapter,
918 u32 tx_fc, u32 rx_fc); 917 u32 tx_fc, u32 rx_fc);
919extern int be_cmd_get_flow_control(struct be_adapter *adapter, 918extern int be_cmd_get_flow_control(struct be_adapter *adapter,
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index de0830e14aa5..27ccdd80257b 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -577,13 +577,13 @@ static void be_set_multicast_list(struct net_device *netdev)
577 /* Enable multicast promisc if num configured exceeds what we support */ 577 /* Enable multicast promisc if num configured exceeds what we support */
578 if (netdev->flags & IFF_ALLMULTI || 578 if (netdev->flags & IFF_ALLMULTI ||
579 netdev_mc_count(netdev) > BE_MAX_MC) { 579 netdev_mc_count(netdev) > BE_MAX_MC) {
580 be_cmd_multicast_set(adapter, adapter->if_handle, NULL, 0, 580 be_cmd_multicast_set(adapter, adapter->if_handle, NULL,
581 &adapter->mc_cmd_mem); 581 &adapter->mc_cmd_mem);
582 goto done; 582 goto done;
583 } 583 }
584 584
585 be_cmd_multicast_set(adapter, adapter->if_handle, netdev->mc_list, 585 be_cmd_multicast_set(adapter, adapter->if_handle, netdev,
586 netdev_mc_count(netdev), &adapter->mc_cmd_mem); 586 &adapter->mc_cmd_mem);
587done: 587done:
588 return; 588 return;
589} 589}
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index ef7f77113e26..587f93cf03f6 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -812,16 +812,14 @@ static void bfin_mac_timeout(struct net_device *dev)
812static void bfin_mac_multicast_hash(struct net_device *dev) 812static void bfin_mac_multicast_hash(struct net_device *dev)
813{ 813{
814 u32 emac_hashhi, emac_hashlo; 814 u32 emac_hashhi, emac_hashlo;
815 struct dev_mc_list *dmi = dev->mc_list; 815 struct dev_mc_list *dmi;
816 char *addrs; 816 char *addrs;
817 int i;
818 u32 crc; 817 u32 crc;
819 818
820 emac_hashhi = emac_hashlo = 0; 819 emac_hashhi = emac_hashlo = 0;
821 820
822 for (i = 0; i < netdev_mc_count(dev); i++) { 821 netdev_for_each_mc_addr(dmi, dev) {
823 addrs = dmi->dmi_addr; 822 addrs = dmi->dmi_addr;
824 dmi = dmi->next;
825 823
826 /* skip non-multicast addresses */ 824 /* skip non-multicast addresses */
827 if (!(*addrs & 1)) 825 if (!(*addrs & 1))
diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c
index 189fa69c2094..119468e76323 100644
--- a/drivers/net/bmac.c
+++ b/drivers/net/bmac.c
@@ -1000,7 +1000,7 @@ static void bmac_set_multicast(struct net_device *dev)
1000 rx_cfg = bmac_rx_on(dev, 0, 0); 1000 rx_cfg = bmac_rx_on(dev, 0, 0);
1001 XXDEBUG(("bmac: multi disabled, rx_cfg=%#08x\n", rx_cfg)); 1001 XXDEBUG(("bmac: multi disabled, rx_cfg=%#08x\n", rx_cfg));
1002 } else { 1002 } else {
1003 for (dmi=dev->mc_list; dmi!=NULL; dmi=dmi->next) 1003 netdev_for_each_mc_addr(dmi, dev)
1004 bmac_addhash(bp, dmi->dmi_addr); 1004 bmac_addhash(bp, dmi->dmi_addr);
1005 bmac_update_hash_table_mask(dev, bp); 1005 bmac_update_hash_table_mask(dev, bp);
1006 rx_cfg = bmac_rx_on(dev, 1, 0); 1006 rx_cfg = bmac_rx_on(dev, 1, 0);
@@ -1015,7 +1015,7 @@ static void bmac_set_multicast(struct net_device *dev)
1015 1015
1016static void bmac_set_multicast(struct net_device *dev) 1016static void bmac_set_multicast(struct net_device *dev)
1017{ 1017{
1018 struct dev_mc_list *dmi = dev->mc_list; 1018 struct dev_mc_list *dmi;
1019 char *addrs; 1019 char *addrs;
1020 int i; 1020 int i;
1021 unsigned short rx_cfg; 1021 unsigned short rx_cfg;
@@ -1039,9 +1039,8 @@ static void bmac_set_multicast(struct net_device *dev)
1039 1039
1040 for(i = 0; i < 4; i++) hash_table[i] = 0; 1040 for(i = 0; i < 4; i++) hash_table[i] = 0;
1041 1041
1042 for(i = 0; i < netdev_mc_count(dev); i++) { 1042 netdev_for_each_mc_addr(dmi, dev) {
1043 addrs = dmi->dmi_addr; 1043 addrs = dmi->dmi_addr;
1044 dmi = dmi->next;
1045 1044
1046 if(!(*addrs & 1)) 1045 if(!(*addrs & 1))
1047 continue; 1046 continue;
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index a6cc9d02e589..d3f739a295df 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -3552,9 +3552,7 @@ bnx2_set_rx_mode(struct net_device *dev)
3552 3552
3553 memset(mc_filter, 0, 4 * NUM_MC_HASH_REGISTERS); 3553 memset(mc_filter, 0, 4 * NUM_MC_HASH_REGISTERS);
3554 3554
3555 for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev); 3555 netdev_for_each_mc_addr(mclist, dev) {
3556 i++, mclist = mclist->next) {
3557
3558 crc = ether_crc_le(ETH_ALEN, mclist->dmi_addr); 3556 crc = ether_crc_le(ETH_ALEN, mclist->dmi_addr);
3559 bit = crc & 0xff; 3557 bit = crc & 0xff;
3560 regidx = (bit & 0xe0) >> 5; 3558 regidx = (bit & 0xe0) >> 5;
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index 7f9db47e8cc3..5adf2a05246f 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -11483,10 +11483,8 @@ static void bnx2x_set_rx_mode(struct net_device *dev)
11483 struct mac_configuration_cmd *config = 11483 struct mac_configuration_cmd *config =
11484 bnx2x_sp(bp, mcast_config); 11484 bnx2x_sp(bp, mcast_config);
11485 11485
11486 for (i = 0, mclist = dev->mc_list; 11486 i = 0;
11487 mclist && (i < netdev_mc_count(dev)); 11487 netdev_for_each_mc_addr(mclist, dev) {
11488 i++, mclist = mclist->next) {
11489
11490 config->config_table[i]. 11488 config->config_table[i].
11491 cam_entry.msb_mac_addr = 11489 cam_entry.msb_mac_addr =
11492 swab16(*(u16 *)&mclist->dmi_addr[0]); 11490 swab16(*(u16 *)&mclist->dmi_addr[0]);
@@ -11514,6 +11512,7 @@ static void bnx2x_set_rx_mode(struct net_device *dev)
11514 cam_entry.middle_mac_addr, 11512 cam_entry.middle_mac_addr,
11515 config->config_table[i]. 11513 config->config_table[i].
11516 cam_entry.lsb_mac_addr); 11514 cam_entry.lsb_mac_addr);
11515 i++;
11517 } 11516 }
11518 old = config->hdr.length; 11517 old = config->hdr.length;
11519 if (old > i) { 11518 if (old > i) {
@@ -11555,10 +11554,7 @@ static void bnx2x_set_rx_mode(struct net_device *dev)
11555 11554
11556 memset(mc_filter, 0, 4 * MC_HASH_SIZE); 11555 memset(mc_filter, 0, 4 * MC_HASH_SIZE);
11557 11556
11558 for (i = 0, mclist = dev->mc_list; 11557 netdev_for_each_mc_addr(mclist, dev) {
11559 mclist && (i < netdev_mc_count(dev));
11560 i++, mclist = mclist->next) {
11561
11562 DP(NETIF_MSG_IFUP, "Adding mcast MAC: %pM\n", 11558 DP(NETIF_MSG_IFUP, "Adding mcast MAC: %pM\n",
11563 mclist->dmi_addr); 11559 mclist->dmi_addr);
11564 11560