diff options
author | Jiri Pirko <jpirko@redhat.com> | 2010-02-23 18:17:07 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-26 05:07:31 -0500 |
commit | 567ec874d15b478c8eda7e9a5d2dcb05f13f1fb5 (patch) | |
tree | e0c22740e44eca6f035e7dccbcff114a72d007a3 /drivers | |
parent | f9dcbcc9e338d08c0f7de7eba4eaafbbb7f81249 (diff) |
net: convert multiple drivers to use netdev_for_each_mc_addr, part6
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/smc911x.c | 4 | ||||
-rw-r--r-- | drivers/net/smc9194.c | 10 | ||||
-rw-r--r-- | drivers/net/smc91x.c | 7 | ||||
-rw-r--r-- | drivers/net/starfire.c | 3 | ||||
-rw-r--r-- | drivers/net/tc35815.c | 8 | ||||
-rw-r--r-- | drivers/net/tehuti.c | 4 | ||||
-rw-r--r-- | drivers/net/tg3.c | 5 | ||||
-rw-r--r-- | drivers/net/tlan.c | 7 | ||||
-rw-r--r-- | drivers/net/tsi108_eth.c | 20 | ||||
-rw-r--r-- | drivers/net/typhoon.c | 5 | ||||
-rw-r--r-- | drivers/net/ucc_geth.c | 7 | ||||
-rw-r--r-- | drivers/net/via-rhine.c | 6 | ||||
-rw-r--r-- | drivers/net/via-velocity.c | 6 | ||||
-rw-r--r-- | drivers/net/virtio_net.c | 5 | ||||
-rw-r--r-- | drivers/net/vmxnet3/vmxnet3_drv.c | 11 | ||||
-rw-r--r-- | drivers/net/vxge/vxge-main.c | 4 | ||||
-rw-r--r-- | drivers/net/yellowfin.c | 4 | ||||
-rw-r--r-- | drivers/net/znet.c | 3 |
18 files changed, 42 insertions, 77 deletions
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index ef9674c6713f..9871a2b61f86 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c | |||
@@ -1341,7 +1341,6 @@ static void smc911x_set_multicast_list(struct net_device *dev) | |||
1341 | * within that register. | 1341 | * within that register. |
1342 | */ | 1342 | */ |
1343 | else if (!netdev_mc_empty(dev)) { | 1343 | else if (!netdev_mc_empty(dev)) { |
1344 | int i; | ||
1345 | struct dev_mc_list *cur_addr; | 1344 | struct dev_mc_list *cur_addr; |
1346 | 1345 | ||
1347 | /* Set the Hash perfec mode */ | 1346 | /* Set the Hash perfec mode */ |
@@ -1350,8 +1349,7 @@ static void smc911x_set_multicast_list(struct net_device *dev) | |||
1350 | /* start with a table of all zeros: reject all */ | 1349 | /* start with a table of all zeros: reject all */ |
1351 | memset(multicast_table, 0, sizeof(multicast_table)); | 1350 | memset(multicast_table, 0, sizeof(multicast_table)); |
1352 | 1351 | ||
1353 | cur_addr = dev->mc_list; | 1352 | netdev_for_each_mc_addr(cur_addr, dev) { |
1354 | for (i = 0; i < netdev_mc_count(dev); i++, cur_addr = cur_addr->next) { | ||
1355 | u32 position; | 1353 | u32 position; |
1356 | 1354 | ||
1357 | /* do we have a pointer here? */ | 1355 | /* do we have a pointer here? */ |
diff --git a/drivers/net/smc9194.c b/drivers/net/smc9194.c index 41c3dddeab50..f9a960e7fc1f 100644 --- a/drivers/net/smc9194.c +++ b/drivers/net/smc9194.c | |||
@@ -434,18 +434,18 @@ static void smc_shutdown( int ioaddr ) | |||
434 | */ | 434 | */ |
435 | 435 | ||
436 | 436 | ||
437 | static void smc_setmulticast( int ioaddr, int count, struct dev_mc_list * addrs ) { | 437 | static void smc_setmulticast(int ioaddr, struct net_device *dev) |
438 | { | ||
438 | int i; | 439 | int i; |
439 | unsigned char multicast_table[ 8 ]; | 440 | unsigned char multicast_table[ 8 ]; |
440 | struct dev_mc_list * cur_addr; | 441 | struct dev_mc_list *cur_addr; |
441 | /* table for flipping the order of 3 bits */ | 442 | /* table for flipping the order of 3 bits */ |
442 | unsigned char invert3[] = { 0, 4, 2, 6, 1, 5, 3, 7 }; | 443 | unsigned char invert3[] = { 0, 4, 2, 6, 1, 5, 3, 7 }; |
443 | 444 | ||
444 | /* start with a table of all zeros: reject all */ | 445 | /* start with a table of all zeros: reject all */ |
445 | memset( multicast_table, 0, sizeof( multicast_table ) ); | 446 | memset( multicast_table, 0, sizeof( multicast_table ) ); |
446 | 447 | ||
447 | cur_addr = addrs; | 448 | netdev_for_each_mc_addr(cur_addr, dev) { |
448 | for ( i = 0; i < count ; i ++, cur_addr = cur_addr->next ) { | ||
449 | int position; | 449 | int position; |
450 | 450 | ||
451 | /* do we have a pointer here? */ | 451 | /* do we have a pointer here? */ |
@@ -1550,7 +1550,7 @@ static void smc_set_multicast_list(struct net_device *dev) | |||
1550 | ioaddr + RCR ); | 1550 | ioaddr + RCR ); |
1551 | /* NOTE: this has to set the bank, so make sure it is the | 1551 | /* NOTE: this has to set the bank, so make sure it is the |
1552 | last thing called. The bank is set to zero at the top */ | 1552 | last thing called. The bank is set to zero at the top */ |
1553 | smc_setmulticast(ioaddr, netdev_mc_count(dev), dev->mc_list); | 1553 | smc_setmulticast(ioaddr, dev); |
1554 | } | 1554 | } |
1555 | else { | 1555 | else { |
1556 | outw( inw( ioaddr + RCR ) & ~(RCR_PROMISC | RCR_ALMUL), | 1556 | outw( inw( ioaddr + RCR ) & ~(RCR_PROMISC | RCR_ALMUL), |
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index 66450127c5a1..fc1b5a1a3583 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
@@ -1413,7 +1413,6 @@ static void smc_set_multicast_list(struct net_device *dev) | |||
1413 | * within that register. | 1413 | * within that register. |
1414 | */ | 1414 | */ |
1415 | else if (!netdev_mc_empty(dev)) { | 1415 | else if (!netdev_mc_empty(dev)) { |
1416 | int i; | ||
1417 | struct dev_mc_list *cur_addr; | 1416 | struct dev_mc_list *cur_addr; |
1418 | 1417 | ||
1419 | /* table for flipping the order of 3 bits */ | 1418 | /* table for flipping the order of 3 bits */ |
@@ -1422,13 +1421,9 @@ static void smc_set_multicast_list(struct net_device *dev) | |||
1422 | /* start with a table of all zeros: reject all */ | 1421 | /* start with a table of all zeros: reject all */ |
1423 | memset(multicast_table, 0, sizeof(multicast_table)); | 1422 | memset(multicast_table, 0, sizeof(multicast_table)); |
1424 | 1423 | ||
1425 | cur_addr = dev->mc_list; | 1424 | netdev_for_each_mc_addr(cur_addr, dev) { |
1426 | for (i = 0; i < netdev_mc_count(dev); i++, cur_addr = cur_addr->next) { | ||
1427 | int position; | 1425 | int position; |
1428 | 1426 | ||
1429 | /* do we have a pointer here? */ | ||
1430 | if (!cur_addr) | ||
1431 | break; | ||
1432 | /* make sure this is a multicast address - | 1427 | /* make sure this is a multicast address - |
1433 | shouldn't this be a given if we have it here ? */ | 1428 | shouldn't this be a given if we have it here ? */ |
1434 | if (!(*cur_addr->dmi_addr & 1)) | 1429 | if (!(*cur_addr->dmi_addr & 1)) |
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c index 0f405ef51858..6dfa69899019 100644 --- a/drivers/net/starfire.c +++ b/drivers/net/starfire.c | |||
@@ -1825,8 +1825,7 @@ static void set_rx_mode(struct net_device *dev) | |||
1825 | __le16 mc_filter[32] __attribute__ ((aligned(sizeof(long)))); /* Multicast hash filter */ | 1825 | __le16 mc_filter[32] __attribute__ ((aligned(sizeof(long)))); /* Multicast hash filter */ |
1826 | 1826 | ||
1827 | memset(mc_filter, 0, sizeof(mc_filter)); | 1827 | memset(mc_filter, 0, sizeof(mc_filter)); |
1828 | for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev); | 1828 | netdev_for_each_mc_addr(mclist, dev) { |
1829 | i++, mclist = mclist->next) { | ||
1830 | /* The chip uses the upper 9 CRC bits | 1829 | /* The chip uses the upper 9 CRC bits |
1831 | as index into the hash table */ | 1830 | as index into the hash table */ |
1832 | int bit_nr = ether_crc_le(ETH_ALEN, mclist->dmi_addr) >> 23; | 1831 | int bit_nr = ether_crc_le(ETH_ALEN, mclist->dmi_addr) >> 23; |
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c index a2c635ecdab8..876f45afbed4 100644 --- a/drivers/net/tc35815.c +++ b/drivers/net/tc35815.c | |||
@@ -1945,18 +1945,18 @@ tc35815_set_multicast_list(struct net_device *dev) | |||
1945 | /* Disable promiscuous mode, use normal mode. */ | 1945 | /* Disable promiscuous mode, use normal mode. */ |
1946 | tc_writel(CAM_CompEn | CAM_BroadAcc | CAM_GroupAcc, &tr->CAM_Ctl); | 1946 | tc_writel(CAM_CompEn | CAM_BroadAcc | CAM_GroupAcc, &tr->CAM_Ctl); |
1947 | } else if (!netdev_mc_empty(dev)) { | 1947 | } else if (!netdev_mc_empty(dev)) { |
1948 | struct dev_mc_list *cur_addr = dev->mc_list; | 1948 | struct dev_mc_list *cur_addr; |
1949 | int i; | 1949 | int i; |
1950 | int ena_bits = CAM_Ena_Bit(CAM_ENTRY_SOURCE); | 1950 | int ena_bits = CAM_Ena_Bit(CAM_ENTRY_SOURCE); |
1951 | 1951 | ||
1952 | tc_writel(0, &tr->CAM_Ctl); | 1952 | tc_writel(0, &tr->CAM_Ctl); |
1953 | /* Walk the address list, and load the filter */ | 1953 | /* Walk the address list, and load the filter */ |
1954 | for (i = 0; i < netdev_mc_count(dev); i++, cur_addr = cur_addr->next) { | 1954 | i = 0; |
1955 | if (!cur_addr) | 1955 | netdev_for_each_mc_addr(cur_addr, dev) { |
1956 | break; | ||
1957 | /* entry 0,1 is reserved. */ | 1956 | /* entry 0,1 is reserved. */ |
1958 | tc35815_set_cam_entry(dev, i + 2, cur_addr->dmi_addr); | 1957 | tc35815_set_cam_entry(dev, i + 2, cur_addr->dmi_addr); |
1959 | ena_bits |= CAM_Ena_Bit(i + 2); | 1958 | ena_bits |= CAM_Ena_Bit(i + 2); |
1959 | i++; | ||
1960 | } | 1960 | } |
1961 | tc_writel(ena_bits, &tr->CAM_Ena); | 1961 | tc_writel(ena_bits, &tr->CAM_Ena); |
1962 | tc_writel(CAM_CompEn | CAM_BroadAcc, &tr->CAM_Ctl); | 1962 | tc_writel(CAM_CompEn | CAM_BroadAcc, &tr->CAM_Ctl); |
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c index 2517cc00ac2a..0c9780217c87 100644 --- a/drivers/net/tehuti.c +++ b/drivers/net/tehuti.c | |||
@@ -824,10 +824,8 @@ static void bdx_setmulti(struct net_device *ndev) | |||
824 | /* TBD: sort addreses and write them in ascending order | 824 | /* TBD: sort addreses and write them in ascending order |
825 | * into RX_MAC_MCST regs. we skip this phase now and accept ALL | 825 | * into RX_MAC_MCST regs. we skip this phase now and accept ALL |
826 | * multicast frames throu IMF */ | 826 | * multicast frames throu IMF */ |
827 | mclist = ndev->mc_list; | ||
828 | |||
829 | /* accept the rest of addresses throu IMF */ | 827 | /* accept the rest of addresses throu IMF */ |
830 | for (; mclist; mclist = mclist->next) { | 828 | netdev_for_each_mc_addr(mclist, ndev) { |
831 | hash = 0; | 829 | hash = 0; |
832 | for (i = 0; i < ETH_ALEN; i++) | 830 | for (i = 0; i < ETH_ALEN; i++) |
833 | hash ^= mclist->dmi_addr[i]; | 831 | hash ^= mclist->dmi_addr[i]; |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index f204f73c4f99..0d06e4007f44 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -9458,15 +9458,12 @@ static void __tg3_set_rx_mode(struct net_device *dev) | |||
9458 | } else { | 9458 | } else { |
9459 | /* Accept one or more multicast(s). */ | 9459 | /* Accept one or more multicast(s). */ |
9460 | struct dev_mc_list *mclist; | 9460 | struct dev_mc_list *mclist; |
9461 | unsigned int i; | ||
9462 | u32 mc_filter[4] = { 0, }; | 9461 | u32 mc_filter[4] = { 0, }; |
9463 | u32 regidx; | 9462 | u32 regidx; |
9464 | u32 bit; | 9463 | u32 bit; |
9465 | u32 crc; | 9464 | u32 crc; |
9466 | 9465 | ||
9467 | for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev); | 9466 | netdev_for_each_mc_addr(mclist, dev) { |
9468 | i++, mclist = mclist->next) { | ||
9469 | |||
9470 | crc = calc_crc (mclist->dmi_addr, ETH_ALEN); | 9467 | crc = calc_crc (mclist->dmi_addr, ETH_ALEN); |
9471 | bit = ~crc & 0x7f; | 9468 | bit = ~crc & 0x7f; |
9472 | regidx = (bit & 0x60) >> 5; | 9469 | regidx = (bit & 0x60) >> 5; |
diff --git a/drivers/net/tlan.c b/drivers/net/tlan.c index e44d5a074c69..390540c101c7 100644 --- a/drivers/net/tlan.c +++ b/drivers/net/tlan.c | |||
@@ -1314,7 +1314,7 @@ static struct net_device_stats *TLan_GetStats( struct net_device *dev ) | |||
1314 | 1314 | ||
1315 | static void TLan_SetMulticastList( struct net_device *dev ) | 1315 | static void TLan_SetMulticastList( struct net_device *dev ) |
1316 | { | 1316 | { |
1317 | struct dev_mc_list *dmi = dev->mc_list; | 1317 | struct dev_mc_list *dmi; |
1318 | u32 hash1 = 0; | 1318 | u32 hash1 = 0; |
1319 | u32 hash2 = 0; | 1319 | u32 hash2 = 0; |
1320 | int i; | 1320 | int i; |
@@ -1335,7 +1335,8 @@ static void TLan_SetMulticastList( struct net_device *dev ) | |||
1335 | TLan_DioWrite32( dev->base_addr, TLAN_HASH_1, 0xFFFFFFFF ); | 1335 | TLan_DioWrite32( dev->base_addr, TLAN_HASH_1, 0xFFFFFFFF ); |
1336 | TLan_DioWrite32( dev->base_addr, TLAN_HASH_2, 0xFFFFFFFF ); | 1336 | TLan_DioWrite32( dev->base_addr, TLAN_HASH_2, 0xFFFFFFFF ); |
1337 | } else { | 1337 | } else { |
1338 | for ( i = 0; i < netdev_mc_count(dev); i++ ) { | 1338 | i = 0; |
1339 | netdev_for_each_mc_addr(dmi, dev) { | ||
1339 | if ( i < 3 ) { | 1340 | if ( i < 3 ) { |
1340 | TLan_SetMac( dev, i + 1, | 1341 | TLan_SetMac( dev, i + 1, |
1341 | (char *) &dmi->dmi_addr ); | 1342 | (char *) &dmi->dmi_addr ); |
@@ -1346,7 +1347,7 @@ static void TLan_SetMulticastList( struct net_device *dev ) | |||
1346 | else | 1347 | else |
1347 | hash2 |= ( 1 << ( offset - 32 ) ); | 1348 | hash2 |= ( 1 << ( offset - 32 ) ); |
1348 | } | 1349 | } |
1349 | dmi = dmi->next; | 1350 | i++; |
1350 | } | 1351 | } |
1351 | for ( ; i < 3; i++ ) | 1352 | for ( ; i < 3; i++ ) |
1352 | TLan_SetMac( dev, i + 1, NULL ); | 1353 | TLan_SetMac( dev, i + 1, NULL ); |
diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c index f4b30c4826fb..647cdd1d4e20 100644 --- a/drivers/net/tsi108_eth.c +++ b/drivers/net/tsi108_eth.c | |||
@@ -1186,27 +1186,17 @@ static void tsi108_set_rx_mode(struct net_device *dev) | |||
1186 | 1186 | ||
1187 | if (dev->flags & IFF_ALLMULTI || !netdev_mc_empty(dev)) { | 1187 | if (dev->flags & IFF_ALLMULTI || !netdev_mc_empty(dev)) { |
1188 | int i; | 1188 | int i; |
1189 | struct dev_mc_list *mc = dev->mc_list; | 1189 | struct dev_mc_list *mc; |
1190 | rxcfg |= TSI108_EC_RXCFG_MFE | TSI108_EC_RXCFG_MC_HASH; | 1190 | rxcfg |= TSI108_EC_RXCFG_MFE | TSI108_EC_RXCFG_MC_HASH; |
1191 | 1191 | ||
1192 | memset(data->mc_hash, 0, sizeof(data->mc_hash)); | 1192 | memset(data->mc_hash, 0, sizeof(data->mc_hash)); |
1193 | 1193 | ||
1194 | while (mc) { | 1194 | netdev_for_each_mc_addr(mc, dev) { |
1195 | u32 hash, crc; | 1195 | u32 hash, crc; |
1196 | 1196 | ||
1197 | if (mc->dmi_addrlen == 6) { | 1197 | crc = ether_crc(6, mc->dmi_addr); |
1198 | crc = ether_crc(6, mc->dmi_addr); | 1198 | hash = crc >> 23; |
1199 | hash = crc >> 23; | 1199 | __set_bit(hash, &data->mc_hash[0]); |
1200 | |||
1201 | __set_bit(hash, &data->mc_hash[0]); | ||
1202 | } else { | ||
1203 | printk(KERN_ERR | ||
1204 | "%s: got multicast address of length %d instead of 6.\n", | ||
1205 | dev->name, | ||
1206 | mc->dmi_addrlen); | ||
1207 | } | ||
1208 | |||
1209 | mc = mc->next; | ||
1210 | } | 1200 | } |
1211 | 1201 | ||
1212 | TSI_WRITE(TSI108_EC_HASHADDR, | 1202 | TSI_WRITE(TSI108_EC_HASHADDR, |
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c index 38c216132ef5..e3ddcb8f29df 100644 --- a/drivers/net/typhoon.c +++ b/drivers/net/typhoon.c | |||
@@ -922,12 +922,9 @@ typhoon_set_rx_mode(struct net_device *dev) | |||
922 | filter |= TYPHOON_RX_FILTER_ALL_MCAST; | 922 | filter |= TYPHOON_RX_FILTER_ALL_MCAST; |
923 | } else if (!netdev_mc_empty(dev)) { | 923 | } else if (!netdev_mc_empty(dev)) { |
924 | struct dev_mc_list *mclist; | 924 | struct dev_mc_list *mclist; |
925 | int i; | ||
926 | 925 | ||
927 | memset(mc_filter, 0, sizeof(mc_filter)); | 926 | memset(mc_filter, 0, sizeof(mc_filter)); |
928 | for (i = 0, mclist = dev->mc_list; | 927 | netdev_for_each_mc_addr(mclist, dev) { |
929 | mclist && i < netdev_mc_count(dev); | ||
930 | i++, mclist = mclist->next) { | ||
931 | int bit = ether_crc(ETH_ALEN, mclist->dmi_addr) & 0x3f; | 928 | int bit = ether_crc(ETH_ALEN, mclist->dmi_addr) & 0x3f; |
932 | mc_filter[bit >> 5] |= 1 << (bit & 0x1f); | 929 | mc_filter[bit >> 5] |= 1 << (bit & 0x1f); |
933 | } | 930 | } |
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index a05720289c7e..23a97518bc1f 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -2002,7 +2002,6 @@ static void ucc_geth_set_multi(struct net_device *dev) | |||
2002 | struct dev_mc_list *dmi; | 2002 | struct dev_mc_list *dmi; |
2003 | struct ucc_fast __iomem *uf_regs; | 2003 | struct ucc_fast __iomem *uf_regs; |
2004 | struct ucc_geth_82xx_address_filtering_pram __iomem *p_82xx_addr_filt; | 2004 | struct ucc_geth_82xx_address_filtering_pram __iomem *p_82xx_addr_filt; |
2005 | int i; | ||
2006 | 2005 | ||
2007 | ugeth = netdev_priv(dev); | 2006 | ugeth = netdev_priv(dev); |
2008 | 2007 | ||
@@ -2029,11 +2028,7 @@ static void ucc_geth_set_multi(struct net_device *dev) | |||
2029 | out_be32(&p_82xx_addr_filt->gaddr_h, 0x0); | 2028 | out_be32(&p_82xx_addr_filt->gaddr_h, 0x0); |
2030 | out_be32(&p_82xx_addr_filt->gaddr_l, 0x0); | 2029 | out_be32(&p_82xx_addr_filt->gaddr_l, 0x0); |
2031 | 2030 | ||
2032 | dmi = dev->mc_list; | 2031 | netdev_for_each_mc_addr(dmi, dev) { |
2033 | |||
2034 | for (i = 0; i < netdev_mc_count(dev); | ||
2035 | i++, dmi = dmi->next) { | ||
2036 | |||
2037 | /* Only support group multicast for now. | 2032 | /* Only support group multicast for now. |
2038 | */ | 2033 | */ |
2039 | if (!(dmi->dmi_addr[0] & 1)) | 2034 | if (!(dmi->dmi_addr[0] & 1)) |
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index 85df7ac636b5..50f881aa3939 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c | |||
@@ -1705,11 +1705,9 @@ static void rhine_set_rx_mode(struct net_device *dev) | |||
1705 | rx_mode = 0x0C; | 1705 | rx_mode = 0x0C; |
1706 | } else { | 1706 | } else { |
1707 | struct dev_mc_list *mclist; | 1707 | struct dev_mc_list *mclist; |
1708 | int i; | 1708 | |
1709 | memset(mc_filter, 0, sizeof(mc_filter)); | 1709 | memset(mc_filter, 0, sizeof(mc_filter)); |
1710 | for (i = 0, mclist = dev->mc_list; | 1710 | netdev_for_each_mc_addr(mclist, dev) { |
1711 | mclist && i < netdev_mc_count(dev); | ||
1712 | i++, mclist = mclist->next) { | ||
1713 | int bit_nr = ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26; | 1711 | int bit_nr = ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26; |
1714 | 1712 | ||
1715 | mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31); | 1713 | mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31); |
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index 4e47f2683b83..3a486f3bad3d 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c | |||
@@ -1141,11 +1141,11 @@ static void velocity_set_multi(struct net_device *dev) | |||
1141 | int offset = MCAM_SIZE - vptr->multicast_limit; | 1141 | int offset = MCAM_SIZE - vptr->multicast_limit; |
1142 | mac_get_cam_mask(regs, vptr->mCAMmask); | 1142 | mac_get_cam_mask(regs, vptr->mCAMmask); |
1143 | 1143 | ||
1144 | for (i = 0, mclist = dev->mc_list; | 1144 | i = 0; |
1145 | mclist && i < netdev_mc_count(dev); | 1145 | netdev_for_each_mc_addr(mclist, dev) { |
1146 | i++, mclist = mclist->next) { | ||
1147 | mac_set_cam(regs, i + offset, mclist->dmi_addr); | 1146 | mac_set_cam(regs, i + offset, mclist->dmi_addr); |
1148 | vptr->mCAMmask[(offset + i) / 8] |= 1 << ((offset + i) & 7); | 1147 | vptr->mCAMmask[(offset + i) / 8] |= 1 << ((offset + i) & 7); |
1148 | i++; | ||
1149 | } | 1149 | } |
1150 | 1150 | ||
1151 | mac_set_cam_mask(regs, vptr->mCAMmask); | 1151 | mac_set_cam_mask(regs, vptr->mCAMmask); |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index ce35b42cc2cb..e6095f3aa05f 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -776,8 +776,9 @@ static void virtnet_set_rx_mode(struct net_device *dev) | |||
776 | 776 | ||
777 | mac_data->entries = mc_count; | 777 | mac_data->entries = mc_count; |
778 | addr = dev->mc_list; | 778 | addr = dev->mc_list; |
779 | for (i = 0; i < mc_count; i++, addr = addr->next) | 779 | i = 0; |
780 | memcpy(&mac_data->macs[i][0], addr->da_addr, ETH_ALEN); | 780 | netdev_for_each_mc_addr(addr, dev) |
781 | memcpy(&mac_data->macs[i++][0], addr->da_addr, ETH_ALEN); | ||
781 | 782 | ||
782 | sg_set_buf(&sg[1], mac_data, | 783 | sg_set_buf(&sg[1], mac_data, |
783 | sizeof(mac_data->entries) + (mc_count * ETH_ALEN)); | 784 | sizeof(mac_data->entries) + (mc_count * ETH_ALEN)); |
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index ee1b397417f3..cff3485d9673 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | |||
@@ -1675,15 +1675,12 @@ vmxnet3_copy_mc(struct net_device *netdev) | |||
1675 | /* We may be called with BH disabled */ | 1675 | /* We may be called with BH disabled */ |
1676 | buf = kmalloc(sz, GFP_ATOMIC); | 1676 | buf = kmalloc(sz, GFP_ATOMIC); |
1677 | if (buf) { | 1677 | if (buf) { |
1678 | int i; | 1678 | struct dev_mc_list *mc; |
1679 | struct dev_mc_list *mc = netdev->mc_list; | 1679 | int i = 0; |
1680 | 1680 | ||
1681 | for (i = 0; i < netdev_mc_count(netdev); i++) { | 1681 | netdev_for_each_mc_addr(mc, netdev) |
1682 | BUG_ON(!mc); | 1682 | memcpy(buf + i++ * ETH_ALEN, mc->dmi_addr, |
1683 | memcpy(buf + i * ETH_ALEN, mc->dmi_addr, | ||
1684 | ETH_ALEN); | 1683 | ETH_ALEN); |
1685 | mc = mc->next; | ||
1686 | } | ||
1687 | } | 1684 | } |
1688 | } | 1685 | } |
1689 | return buf; | 1686 | return buf; |
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c index c248b01218a1..46a7c9e689ec 100644 --- a/drivers/net/vxge/vxge-main.c +++ b/drivers/net/vxge/vxge-main.c | |||
@@ -1217,9 +1217,7 @@ static void vxge_set_multicast(struct net_device *dev) | |||
1217 | } | 1217 | } |
1218 | 1218 | ||
1219 | /* Add new ones */ | 1219 | /* Add new ones */ |
1220 | for (i = 0, mclist = dev->mc_list; i < netdev_mc_count(dev); | 1220 | netdev_for_each_mc_addr(mclist, dev) { |
1221 | i++, mclist = mclist->next) { | ||
1222 | |||
1223 | memcpy(mac_info.macaddr, mclist->dmi_addr, ETH_ALEN); | 1221 | memcpy(mac_info.macaddr, mclist->dmi_addr, ETH_ALEN); |
1224 | for (vpath_idx = 0; vpath_idx < vdev->no_of_vpath; | 1222 | for (vpath_idx = 0; vpath_idx < vdev->no_of_vpath; |
1225 | vpath_idx++) { | 1223 | vpath_idx++) { |
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c index e4aab4d5b553..7d4107f5eeb0 100644 --- a/drivers/net/yellowfin.c +++ b/drivers/net/yellowfin.c | |||
@@ -1303,9 +1303,9 @@ static void set_rx_mode(struct net_device *dev) | |||
1303 | struct dev_mc_list *mclist; | 1303 | struct dev_mc_list *mclist; |
1304 | u16 hash_table[4]; | 1304 | u16 hash_table[4]; |
1305 | int i; | 1305 | int i; |
1306 | |||
1306 | memset(hash_table, 0, sizeof(hash_table)); | 1307 | memset(hash_table, 0, sizeof(hash_table)); |
1307 | for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev); | 1308 | netdev_for_each_mc_addr(mclist, dev) { |
1308 | i++, mclist = mclist->next) { | ||
1309 | unsigned int bit; | 1309 | unsigned int bit; |
1310 | 1310 | ||
1311 | /* Due to a bug in the early chip versions, multiple filter | 1311 | /* Due to a bug in the early chip versions, multiple filter |
diff --git a/drivers/net/znet.c b/drivers/net/znet.c index bc5ae0f6e934..def49d2ec69a 100644 --- a/drivers/net/znet.c +++ b/drivers/net/znet.c | |||
@@ -313,7 +313,8 @@ static void znet_set_multicast_list (struct net_device *dev) | |||
313 | /* Byte D */ | 313 | /* Byte D */ |
314 | cfblk->dummy_1 = 1; /* set to 1 */ | 314 | cfblk->dummy_1 = 1; /* set to 1 */ |
315 | cfblk->tx_ifs_retrig = 3; /* Hmm... Disabled */ | 315 | cfblk->tx_ifs_retrig = 3; /* Hmm... Disabled */ |
316 | cfblk->mc_all = (dev->mc_list || (dev->flags&IFF_ALLMULTI));/* multicast all mode */ | 316 | cfblk->mc_all = (!netdev_mc_empty(dev) || |
317 | (dev->flags & IFF_ALLMULTI)); /* multicast all mode */ | ||
317 | cfblk->rcv_mon = 0; /* Monitor mode disabled */ | 318 | cfblk->rcv_mon = 0; /* Monitor mode disabled */ |
318 | cfblk->frag_acpt = 0; /* Do not accept fragments */ | 319 | cfblk->frag_acpt = 0; /* Do not accept fragments */ |
319 | cfblk->tstrttrs = 0; /* No start transmission threshold */ | 320 | cfblk->tstrttrs = 0; /* No start transmission threshold */ |