diff options
author | Jiri Pirko <jpirko@redhat.com> | 2010-02-17 06:09:31 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-17 16:27:12 -0500 |
commit | e1d444771e0895c7706bc99857d69e4f2a58a531 (patch) | |
tree | b17410e94c6c78416b6e125fad0c4ed208edc39f | |
parent | d7b855c2dcc89587f36338bd383203322efb9903 (diff) |
net: convert multiple drivers to use netdev_for_each_mc_addr
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/cpmac.c | 4 | ||||
-rw-r--r-- | drivers/net/cris/eth_v10.c | 6 | ||||
-rw-r--r-- | drivers/net/cs89x0.c | 2 | ||||
-rw-r--r-- | drivers/net/declance.c | 6 | ||||
-rw-r--r-- | drivers/net/defxx.c | 11 | ||||
-rw-r--r-- | drivers/net/depca.c | 3 | ||||
-rw-r--r-- | drivers/net/dl2k.c | 5 | ||||
-rw-r--r-- | drivers/net/dm9000.c | 5 |
8 files changed, 15 insertions, 27 deletions
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c index c9c537be4ab9..0074f3bf17be 100644 --- a/drivers/net/cpmac.c +++ b/drivers/net/cpmac.c | |||
@@ -320,7 +320,6 @@ static int cpmac_config(struct net_device *dev, struct ifmap *map) | |||
320 | static void cpmac_set_multicast_list(struct net_device *dev) | 320 | static void cpmac_set_multicast_list(struct net_device *dev) |
321 | { | 321 | { |
322 | struct dev_mc_list *iter; | 322 | struct dev_mc_list *iter; |
323 | int i; | ||
324 | u8 tmp; | 323 | u8 tmp; |
325 | u32 mbp, bit, hash[2] = { 0, }; | 324 | u32 mbp, bit, hash[2] = { 0, }; |
326 | struct cpmac_priv *priv = netdev_priv(dev); | 325 | struct cpmac_priv *priv = netdev_priv(dev); |
@@ -340,8 +339,7 @@ static void cpmac_set_multicast_list(struct net_device *dev) | |||
340 | * cpmac uses some strange mac address hashing | 339 | * cpmac uses some strange mac address hashing |
341 | * (not crc32) | 340 | * (not crc32) |
342 | */ | 341 | */ |
343 | for (i = 0, iter = dev->mc_list; i < netdev_mc_count(dev); | 342 | netdev_for_each_mc_addr(iter, dev) { |
344 | i++, iter = iter->next) { | ||
345 | bit = 0; | 343 | bit = 0; |
346 | tmp = iter->dmi_addr[0]; | 344 | tmp = iter->dmi_addr[0]; |
347 | bit ^= (tmp >> 2) ^ (tmp << 4); | 345 | bit ^= (tmp >> 2) ^ (tmp << 4); |
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c index c9309eadebc1..dd24aadb778c 100644 --- a/drivers/net/cris/eth_v10.c +++ b/drivers/net/cris/eth_v10.c | |||
@@ -1596,13 +1596,12 @@ set_multicast_list(struct net_device *dev) | |||
1596 | } else { | 1596 | } else { |
1597 | /* MC mode, receive normal and MC packets */ | 1597 | /* MC mode, receive normal and MC packets */ |
1598 | char hash_ix; | 1598 | char hash_ix; |
1599 | struct dev_mc_list *dmi = dev->mc_list; | 1599 | struct dev_mc_list *dmi; |
1600 | int i; | ||
1601 | char *baddr; | 1600 | char *baddr; |
1602 | 1601 | ||
1603 | lo_bits = 0x00000000ul; | 1602 | lo_bits = 0x00000000ul; |
1604 | hi_bits = 0x00000000ul; | 1603 | hi_bits = 0x00000000ul; |
1605 | for (i = 0; i < num_addr; i++) { | 1604 | netdev_for_each_mc_addr(dmi, dev) { |
1606 | /* Calculate the hash index for the GA registers */ | 1605 | /* Calculate the hash index for the GA registers */ |
1607 | 1606 | ||
1608 | hash_ix = 0; | 1607 | hash_ix = 0; |
@@ -1632,7 +1631,6 @@ set_multicast_list(struct net_device *dev) | |||
1632 | } else { | 1631 | } else { |
1633 | lo_bits |= (1 << hash_ix); | 1632 | lo_bits |= (1 << hash_ix); |
1634 | } | 1633 | } |
1635 | dmi = dmi->next; | ||
1636 | } | 1634 | } |
1637 | /* Disable individual receive */ | 1635 | /* Disable individual receive */ |
1638 | SETS(network_rec_config_shadow, R_NETWORK_REC_CONFIG, individual, discard); | 1636 | SETS(network_rec_config_shadow, R_NETWORK_REC_CONFIG, individual, discard); |
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index 0e79cef95c0a..14624019ce71 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c | |||
@@ -1785,7 +1785,7 @@ static void set_multicast_list(struct net_device *dev) | |||
1785 | { | 1785 | { |
1786 | lp->rx_mode = RX_ALL_ACCEPT; | 1786 | lp->rx_mode = RX_ALL_ACCEPT; |
1787 | } | 1787 | } |
1788 | else if((dev->flags&IFF_ALLMULTI)||dev->mc_list) | 1788 | else if ((dev->flags & IFF_ALLMULTI) || !netdev_mc_empty(dev)) |
1789 | { | 1789 | { |
1790 | /* The multicast-accept list is initialized to accept-all, and we | 1790 | /* The multicast-accept list is initialized to accept-all, and we |
1791 | rely on higher-level filtering for now. */ | 1791 | rely on higher-level filtering for now. */ |
diff --git a/drivers/net/declance.c b/drivers/net/declance.c index 76e0de6a4263..8cf3cc6f20e2 100644 --- a/drivers/net/declance.c +++ b/drivers/net/declance.c | |||
@@ -940,9 +940,8 @@ static void lance_load_multicast(struct net_device *dev) | |||
940 | { | 940 | { |
941 | struct lance_private *lp = netdev_priv(dev); | 941 | struct lance_private *lp = netdev_priv(dev); |
942 | volatile u16 *ib = (volatile u16 *)dev->mem_start; | 942 | volatile u16 *ib = (volatile u16 *)dev->mem_start; |
943 | struct dev_mc_list *dmi = dev->mc_list; | 943 | struct dev_mc_list *dmi; |
944 | char *addrs; | 944 | char *addrs; |
945 | int i; | ||
946 | u32 crc; | 945 | u32 crc; |
947 | 946 | ||
948 | /* set all multicast bits */ | 947 | /* set all multicast bits */ |
@@ -960,9 +959,8 @@ static void lance_load_multicast(struct net_device *dev) | |||
960 | *lib_ptr(ib, filter[3], lp->type) = 0; | 959 | *lib_ptr(ib, filter[3], lp->type) = 0; |
961 | 960 | ||
962 | /* Add addresses */ | 961 | /* Add addresses */ |
963 | for (i = 0; i < netdev_mc_count(dev); i++) { | 962 | netdev_for_each_mc_addr(dmi, dev) { |
964 | addrs = dmi->dmi_addr; | 963 | addrs = dmi->dmi_addr; |
965 | dmi = dmi->next; | ||
966 | 964 | ||
967 | /* multicast address? */ | 965 | /* multicast address? */ |
968 | if (!(*addrs & 1)) | 966 | if (!(*addrs & 1)) |
diff --git a/drivers/net/defxx.c b/drivers/net/defxx.c index 5adb1e03956d..ed53a8d45f4e 100644 --- a/drivers/net/defxx.c +++ b/drivers/net/defxx.c | |||
@@ -2240,12 +2240,11 @@ static void dfx_ctl_set_multicast_list(struct net_device *dev) | |||
2240 | 2240 | ||
2241 | /* Copy addresses to multicast address table, then update adapter CAM */ | 2241 | /* Copy addresses to multicast address table, then update adapter CAM */ |
2242 | 2242 | ||
2243 | dmi = dev->mc_list; /* point to first multicast addr */ | 2243 | i = 0; |
2244 | for (i=0; i < bp->mc_count; i++) | 2244 | netdev_for_each_mc_addr(dmi, dev) |
2245 | { | 2245 | memcpy(&bp->mc_table[i++ * FDDI_K_ALEN], |
2246 | memcpy(&bp->mc_table[i*FDDI_K_ALEN], dmi->dmi_addr, FDDI_K_ALEN); | 2246 | dmi->dmi_addr, FDDI_K_ALEN); |
2247 | dmi = dmi->next; /* point to next multicast addr */ | 2247 | |
2248 | } | ||
2249 | if (dfx_ctl_update_cam(bp) != DFX_K_SUCCESS) | 2248 | if (dfx_ctl_update_cam(bp) != DFX_K_SUCCESS) |
2250 | { | 2249 | { |
2251 | DBG_printk("%s: Could not update multicast address table!\n", dev->name); | 2250 | DBG_printk("%s: Could not update multicast address table!\n", dev->name); |
diff --git a/drivers/net/depca.c b/drivers/net/depca.c index 314bc96689f4..64a569bc92a6 100644 --- a/drivers/net/depca.c +++ b/drivers/net/depca.c | |||
@@ -1287,9 +1287,8 @@ static void SetMulticastFilter(struct net_device *dev) | |||
1287 | lp->init_block.mcast_table[i] = 0; | 1287 | lp->init_block.mcast_table[i] = 0; |
1288 | } | 1288 | } |
1289 | /* Add multicast addresses */ | 1289 | /* Add multicast addresses */ |
1290 | for (i = 0; i < netdev_mc_count(dev); i++) { /* for each address in the list */ | 1290 | netdev_for_each_mc_addr(dmi, dev) { |
1291 | addrs = dmi->dmi_addr; | 1291 | addrs = dmi->dmi_addr; |
1292 | dmi = dmi->next; | ||
1293 | if ((*addrs & 0x01) == 1) { /* multicast address? */ | 1292 | if ((*addrs & 0x01) == 1) { /* multicast address? */ |
1294 | crc = ether_crc(ETH_ALEN, addrs); | 1293 | crc = ether_crc(ETH_ALEN, addrs); |
1295 | hashcode = (crc & 1); /* hashcode is 6 LSb of CRC ... */ | 1294 | hashcode = (crc & 1); /* hashcode is 6 LSb of CRC ... */ |
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c index dea40953ed1b..b05bad829827 100644 --- a/drivers/net/dl2k.c +++ b/drivers/net/dl2k.c | |||
@@ -1132,15 +1132,12 @@ set_multicast (struct net_device *dev) | |||
1132 | /* Receive broadcast and multicast frames */ | 1132 | /* Receive broadcast and multicast frames */ |
1133 | rx_mode = ReceiveBroadcast | ReceiveMulticast | ReceiveUnicast; | 1133 | rx_mode = ReceiveBroadcast | ReceiveMulticast | ReceiveUnicast; |
1134 | } else if (!netdev_mc_empty(dev)) { | 1134 | } else if (!netdev_mc_empty(dev)) { |
1135 | int i; | ||
1136 | struct dev_mc_list *mclist; | 1135 | struct dev_mc_list *mclist; |
1137 | /* Receive broadcast frames and multicast frames filtering | 1136 | /* Receive broadcast frames and multicast frames filtering |
1138 | by Hashtable */ | 1137 | by Hashtable */ |
1139 | rx_mode = | 1138 | rx_mode = |
1140 | ReceiveBroadcast | ReceiveMulticastHash | ReceiveUnicast; | 1139 | ReceiveBroadcast | ReceiveMulticastHash | ReceiveUnicast; |
1141 | for (i=0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev); | 1140 | netdev_for_each_mc_addr(mclist, dev) { |
1142 | i++, mclist=mclist->next) | ||
1143 | { | ||
1144 | int bit, index = 0; | 1141 | int bit, index = 0; |
1145 | int crc = ether_crc_le (ETH_ALEN, mclist->dmi_addr); | 1142 | int crc = ether_crc_le (ETH_ALEN, mclist->dmi_addr); |
1146 | /* The inverted high significant 6 bits of CRC are | 1143 | /* The inverted high significant 6 bits of CRC are |
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index da0985a7a87a..1c67f1138ca7 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c | |||
@@ -724,8 +724,7 @@ static void | |||
724 | dm9000_hash_table(struct net_device *dev) | 724 | dm9000_hash_table(struct net_device *dev) |
725 | { | 725 | { |
726 | board_info_t *db = netdev_priv(dev); | 726 | board_info_t *db = netdev_priv(dev); |
727 | struct dev_mc_list *mcptr = dev->mc_list; | 727 | struct dev_mc_list *mcptr; |
728 | int mc_cnt = netdev_mc_count(dev); | ||
729 | int i, oft; | 728 | int i, oft; |
730 | u32 hash_val; | 729 | u32 hash_val; |
731 | u16 hash_table[4]; | 730 | u16 hash_table[4]; |
@@ -753,7 +752,7 @@ dm9000_hash_table(struct net_device *dev) | |||
753 | rcr |= RCR_ALL; | 752 | rcr |= RCR_ALL; |
754 | 753 | ||
755 | /* the multicast address in Hash Table : 64 bits */ | 754 | /* the multicast address in Hash Table : 64 bits */ |
756 | for (i = 0; i < mc_cnt; i++, mcptr = mcptr->next) { | 755 | netdev_for_each_mc_addr(mcptr, dev) { |
757 | hash_val = ether_crc_le(6, mcptr->dmi_addr) & 0x3f; | 756 | hash_val = ether_crc_le(6, mcptr->dmi_addr) & 0x3f; |
758 | hash_table[hash_val / 16] |= (u16) 1 << (hash_val % 16); | 757 | hash_table[hash_val / 16] |= (u16) 1 << (hash_val % 16); |
759 | } | 758 | } |