diff options
author | Jiri Pirko <jpirko@redhat.com> | 2010-02-17 22:34:54 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-18 17:47:50 -0500 |
commit | 4302b67e041ea81c8fc233bee1296516e1294a27 (patch) | |
tree | c6160bcf70f321c7436f34033d39180c9043bfd9 /drivers/net/tulip/tulip_core.c | |
parent | 5508590c193661bc1484ad7b952af5fceacea40d (diff) |
tulip: convert to use netdev_for_each_mc_addr
also bug in de2104x.c was corrected:
for (i = 0; i < 32; i++) loop should be outside mc_list iteration.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tulip/tulip_core.c')
-rw-r--r-- | drivers/net/tulip/tulip_core.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index cce2ada07950..7f544ef2f5fc 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c | |||
@@ -997,12 +997,10 @@ static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev) | |||
997 | memset(hash_table, 0, sizeof(hash_table)); | 997 | memset(hash_table, 0, sizeof(hash_table)); |
998 | set_bit_le(255, hash_table); /* Broadcast entry */ | 998 | set_bit_le(255, hash_table); /* Broadcast entry */ |
999 | /* This should work on big-endian machines as well. */ | 999 | /* This should work on big-endian machines as well. */ |
1000 | for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev); | 1000 | netdev_for_each_mc_addr(mclist, dev) { |
1001 | i++, mclist = mclist->next) { | ||
1002 | int index = ether_crc_le(ETH_ALEN, mclist->dmi_addr) & 0x1ff; | 1001 | int index = ether_crc_le(ETH_ALEN, mclist->dmi_addr) & 0x1ff; |
1003 | 1002 | ||
1004 | set_bit_le(index, hash_table); | 1003 | set_bit_le(index, hash_table); |
1005 | |||
1006 | } | 1004 | } |
1007 | for (i = 0; i < 32; i++) { | 1005 | for (i = 0; i < 32; i++) { |
1008 | *setup_frm++ = hash_table[i]; | 1006 | *setup_frm++ = hash_table[i]; |
@@ -1021,20 +1019,18 @@ static void build_setup_frame_perfect(u16 *setup_frm, struct net_device *dev) | |||
1021 | { | 1019 | { |
1022 | struct tulip_private *tp = netdev_priv(dev); | 1020 | struct tulip_private *tp = netdev_priv(dev); |
1023 | struct dev_mc_list *mclist; | 1021 | struct dev_mc_list *mclist; |
1024 | int i; | ||
1025 | u16 *eaddrs; | 1022 | u16 *eaddrs; |
1026 | 1023 | ||
1027 | /* We have <= 14 addresses so we can use the wonderful | 1024 | /* We have <= 14 addresses so we can use the wonderful |
1028 | 16 address perfect filtering of the Tulip. */ | 1025 | 16 address perfect filtering of the Tulip. */ |
1029 | for (i = 0, mclist = dev->mc_list; i < netdev_mc_count(dev); | 1026 | netdev_for_each_mc_addr(mclist, dev) { |
1030 | i++, mclist = mclist->next) { | ||
1031 | eaddrs = (u16 *)mclist->dmi_addr; | 1027 | eaddrs = (u16 *)mclist->dmi_addr; |
1032 | *setup_frm++ = *eaddrs; *setup_frm++ = *eaddrs++; | 1028 | *setup_frm++ = *eaddrs; *setup_frm++ = *eaddrs++; |
1033 | *setup_frm++ = *eaddrs; *setup_frm++ = *eaddrs++; | 1029 | *setup_frm++ = *eaddrs; *setup_frm++ = *eaddrs++; |
1034 | *setup_frm++ = *eaddrs; *setup_frm++ = *eaddrs++; | 1030 | *setup_frm++ = *eaddrs; *setup_frm++ = *eaddrs++; |
1035 | } | 1031 | } |
1036 | /* Fill the unused entries with the broadcast address. */ | 1032 | /* Fill the unused entries with the broadcast address. */ |
1037 | memset(setup_frm, 0xff, (15-i)*12); | 1033 | memset(setup_frm, 0xff, (15 - netdev_mc_count(dev)) * 12); |
1038 | setup_frm = &tp->setup_frame[15*6]; | 1034 | setup_frm = &tp->setup_frame[15*6]; |
1039 | 1035 | ||
1040 | /* Fill the final entry with our physical address. */ | 1036 | /* Fill the final entry with our physical address. */ |
@@ -1066,7 +1062,6 @@ static void set_rx_mode(struct net_device *dev) | |||
1066 | /* Some work-alikes have only a 64-entry hash filter table. */ | 1062 | /* Some work-alikes have only a 64-entry hash filter table. */ |
1067 | /* Should verify correctness on big-endian/__powerpc__ */ | 1063 | /* Should verify correctness on big-endian/__powerpc__ */ |
1068 | struct dev_mc_list *mclist; | 1064 | struct dev_mc_list *mclist; |
1069 | int i; | ||
1070 | if (netdev_mc_count(dev) > 64) { | 1065 | if (netdev_mc_count(dev) > 64) { |
1071 | /* Arbitrary non-effective limit. */ | 1066 | /* Arbitrary non-effective limit. */ |
1072 | tp->csr6 |= AcceptAllMulticast; | 1067 | tp->csr6 |= AcceptAllMulticast; |
@@ -1074,9 +1069,7 @@ static void set_rx_mode(struct net_device *dev) | |||
1074 | } else { | 1069 | } else { |
1075 | u32 mc_filter[2] = {0, 0}; /* Multicast hash filter */ | 1070 | u32 mc_filter[2] = {0, 0}; /* Multicast hash filter */ |
1076 | int filterbit; | 1071 | int filterbit; |
1077 | for (i = 0, mclist = dev->mc_list; | 1072 | netdev_for_each_mc_addr(mclist, dev) { |
1078 | mclist && i < netdev_mc_count(dev); | ||
1079 | i++, mclist = mclist->next) { | ||
1080 | if (tp->flags & COMET_MAC_ADDR) | 1073 | if (tp->flags & COMET_MAC_ADDR) |
1081 | filterbit = ether_crc_le(ETH_ALEN, mclist->dmi_addr); | 1074 | filterbit = ether_crc_le(ETH_ALEN, mclist->dmi_addr); |
1082 | else | 1075 | else |