diff options
author | Jiri Pirko <jpirko@redhat.com> | 2010-02-07 23:30:35 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-12 14:38:58 -0500 |
commit | 4cd24eaf0c6ee7f0242e34ee77ec899f255e66b5 (patch) | |
tree | 99f57f6374a58022e1e5ed1cbc12699288c7eae1 /drivers/net/tulip | |
parent | 8e5574211d96c0552f84c757718475fdb4021be7 (diff) |
net: use netdev_mc_count and netdev_mc_empty when appropriate
This patch replaces dev->mc_count in all drivers (hopefully I didn't miss
anything). Used spatch and did small tweaks and conding style changes when
it was suitable.
Jirka
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tulip')
-rw-r--r-- | drivers/net/tulip/de2104x.c | 8 | ||||
-rw-r--r-- | drivers/net/tulip/de4x5.c | 6 | ||||
-rw-r--r-- | drivers/net/tulip/dmfe.c | 15 | ||||
-rw-r--r-- | drivers/net/tulip/tulip_core.c | 18 | ||||
-rw-r--r-- | drivers/net/tulip/uli526x.c | 12 | ||||
-rw-r--r-- | drivers/net/tulip/winbond-840.c | 7 |
6 files changed, 37 insertions, 29 deletions
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index 29330209ad8b..a4cff23dcdf9 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c | |||
@@ -677,7 +677,7 @@ static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev) | |||
677 | memset(hash_table, 0, sizeof(hash_table)); | 677 | memset(hash_table, 0, sizeof(hash_table)); |
678 | set_bit_le(255, hash_table); /* Broadcast entry */ | 678 | set_bit_le(255, hash_table); /* Broadcast entry */ |
679 | /* This should work on big-endian machines as well. */ | 679 | /* This should work on big-endian machines as well. */ |
680 | for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; | 680 | for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev); |
681 | i++, mclist = mclist->next) { | 681 | i++, mclist = mclist->next) { |
682 | int index = ether_crc_le(ETH_ALEN, mclist->dmi_addr) & 0x1ff; | 682 | int index = ether_crc_le(ETH_ALEN, mclist->dmi_addr) & 0x1ff; |
683 | 683 | ||
@@ -706,7 +706,7 @@ static void build_setup_frame_perfect(u16 *setup_frm, struct net_device *dev) | |||
706 | 706 | ||
707 | /* We have <= 14 addresses so we can use the wonderful | 707 | /* We have <= 14 addresses so we can use the wonderful |
708 | 16 address perfect filtering of the Tulip. */ | 708 | 16 address perfect filtering of the Tulip. */ |
709 | for (i = 0, mclist = dev->mc_list; i < dev->mc_count; | 709 | for (i = 0, mclist = dev->mc_list; i < netdev_mc_count(dev); |
710 | i++, mclist = mclist->next) { | 710 | i++, mclist = mclist->next) { |
711 | eaddrs = (u16 *)mclist->dmi_addr; | 711 | eaddrs = (u16 *)mclist->dmi_addr; |
712 | *setup_frm++ = *eaddrs; *setup_frm++ = *eaddrs++; | 712 | *setup_frm++ = *eaddrs; *setup_frm++ = *eaddrs++; |
@@ -741,7 +741,7 @@ static void __de_set_rx_mode (struct net_device *dev) | |||
741 | goto out; | 741 | goto out; |
742 | } | 742 | } |
743 | 743 | ||
744 | if ((dev->mc_count > 1000) || (dev->flags & IFF_ALLMULTI)) { | 744 | if ((netdev_mc_count(dev) > 1000) || (dev->flags & IFF_ALLMULTI)) { |
745 | /* Too many to filter well -- accept all multicasts. */ | 745 | /* Too many to filter well -- accept all multicasts. */ |
746 | macmode |= AcceptAllMulticast; | 746 | macmode |= AcceptAllMulticast; |
747 | goto out; | 747 | goto out; |
@@ -749,7 +749,7 @@ static void __de_set_rx_mode (struct net_device *dev) | |||
749 | 749 | ||
750 | /* Note that only the low-address shortword of setup_frame is valid! | 750 | /* Note that only the low-address shortword of setup_frame is valid! |
751 | The values are doubled for big-endian architectures. */ | 751 | The values are doubled for big-endian architectures. */ |
752 | if (dev->mc_count > 14) /* Must use a multicast hash table. */ | 752 | if (netdev_mc_count(dev) > 14) /* Must use a multicast hash table. */ |
753 | build_setup_frame_hash (de->setup_frame, dev); | 753 | build_setup_frame_hash (de->setup_frame, dev); |
754 | else | 754 | else |
755 | build_setup_frame_perfect (de->setup_frame, dev); | 755 | build_setup_frame_perfect (de->setup_frame, dev); |
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c index a8349b7200b5..0b6a9731091c 100644 --- a/drivers/net/tulip/de4x5.c +++ b/drivers/net/tulip/de4x5.c | |||
@@ -1963,10 +1963,10 @@ SetMulticastFilter(struct net_device *dev) | |||
1963 | omr &= ~(OMR_PR | OMR_PM); | 1963 | omr &= ~(OMR_PR | OMR_PM); |
1964 | pa = build_setup_frame(dev, ALL); /* Build the basic frame */ | 1964 | pa = build_setup_frame(dev, ALL); /* Build the basic frame */ |
1965 | 1965 | ||
1966 | if ((dev->flags & IFF_ALLMULTI) || (dev->mc_count > 14)) { | 1966 | if ((dev->flags & IFF_ALLMULTI) || (netdev_mc_count(dev) > 14)) { |
1967 | omr |= OMR_PM; /* Pass all multicasts */ | 1967 | omr |= OMR_PM; /* Pass all multicasts */ |
1968 | } else if (lp->setup_f == HASH_PERF) { /* Hash Filtering */ | 1968 | } else if (lp->setup_f == HASH_PERF) { /* Hash Filtering */ |
1969 | for (i=0;i<dev->mc_count;i++) { /* for each address in the list */ | 1969 | for (i = 0; i < netdev_mc_count(dev) ;i++) { |
1970 | addrs=dmi->dmi_addr; | 1970 | addrs=dmi->dmi_addr; |
1971 | dmi=dmi->next; | 1971 | dmi=dmi->next; |
1972 | if ((*addrs & 0x01) == 1) { /* multicast address? */ | 1972 | if ((*addrs & 0x01) == 1) { /* multicast address? */ |
@@ -1984,7 +1984,7 @@ SetMulticastFilter(struct net_device *dev) | |||
1984 | } | 1984 | } |
1985 | } | 1985 | } |
1986 | } else { /* Perfect filtering */ | 1986 | } else { /* Perfect filtering */ |
1987 | for (j=0; j<dev->mc_count; j++) { | 1987 | for (j=0; j<netdev_mc_count(dev); j++) { |
1988 | addrs=dmi->dmi_addr; | 1988 | addrs=dmi->dmi_addr; |
1989 | dmi=dmi->next; | 1989 | dmi=dmi->next; |
1990 | for (i=0; i<ETH_ALEN; i++) { | 1990 | for (i=0; i<ETH_ALEN; i++) { |
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c index 5fc61c1012e5..534afbdb9c91 100644 --- a/drivers/net/tulip/dmfe.c +++ b/drivers/net/tulip/dmfe.c | |||
@@ -658,9 +658,9 @@ static void dmfe_init_dm910x(struct DEVICE *dev) | |||
658 | 658 | ||
659 | /* Send setup frame */ | 659 | /* Send setup frame */ |
660 | if (db->chip_id == PCI_DM9132_ID) | 660 | if (db->chip_id == PCI_DM9132_ID) |
661 | dm9132_id_table(dev, dev->mc_count); /* DM9132 */ | 661 | dm9132_id_table(dev, netdev_mc_count(dev)); /* DM9132 */ |
662 | else | 662 | else |
663 | send_filter_frame(dev, dev->mc_count); /* DM9102/DM9102A */ | 663 | send_filter_frame(dev, netdev_mc_count(dev)); /* DM9102/DM9102A */ |
664 | 664 | ||
665 | /* Init CR7, interrupt active bit */ | 665 | /* Init CR7, interrupt active bit */ |
666 | db->cr7_data = CR7_DEFAULT; | 666 | db->cr7_data = CR7_DEFAULT; |
@@ -1052,6 +1052,7 @@ static void dmfe_set_filter_mode(struct DEVICE * dev) | |||
1052 | { | 1052 | { |
1053 | struct dmfe_board_info *db = netdev_priv(dev); | 1053 | struct dmfe_board_info *db = netdev_priv(dev); |
1054 | unsigned long flags; | 1054 | unsigned long flags; |
1055 | int mc_count = netdev_mc_count(dev); | ||
1055 | 1056 | ||
1056 | DMFE_DBUG(0, "dmfe_set_filter_mode()", 0); | 1057 | DMFE_DBUG(0, "dmfe_set_filter_mode()", 0); |
1057 | spin_lock_irqsave(&db->lock, flags); | 1058 | spin_lock_irqsave(&db->lock, flags); |
@@ -1064,19 +1065,19 @@ static void dmfe_set_filter_mode(struct DEVICE * dev) | |||
1064 | return; | 1065 | return; |
1065 | } | 1066 | } |
1066 | 1067 | ||
1067 | if (dev->flags & IFF_ALLMULTI || dev->mc_count > DMFE_MAX_MULTICAST) { | 1068 | if (dev->flags & IFF_ALLMULTI || mc_count > DMFE_MAX_MULTICAST) { |
1068 | DMFE_DBUG(0, "Pass all multicast address", dev->mc_count); | 1069 | DMFE_DBUG(0, "Pass all multicast address", mc_count); |
1069 | db->cr6_data &= ~(CR6_PM | CR6_PBF); | 1070 | db->cr6_data &= ~(CR6_PM | CR6_PBF); |
1070 | db->cr6_data |= CR6_PAM; | 1071 | db->cr6_data |= CR6_PAM; |
1071 | spin_unlock_irqrestore(&db->lock, flags); | 1072 | spin_unlock_irqrestore(&db->lock, flags); |
1072 | return; | 1073 | return; |
1073 | } | 1074 | } |
1074 | 1075 | ||
1075 | DMFE_DBUG(0, "Set multicast address", dev->mc_count); | 1076 | DMFE_DBUG(0, "Set multicast address", mc_count); |
1076 | if (db->chip_id == PCI_DM9132_ID) | 1077 | if (db->chip_id == PCI_DM9132_ID) |
1077 | dm9132_id_table(dev, dev->mc_count); /* DM9132 */ | 1078 | dm9132_id_table(dev, mc_count); /* DM9132 */ |
1078 | else | 1079 | else |
1079 | send_filter_frame(dev, dev->mc_count); /* DM9102/DM9102A */ | 1080 | send_filter_frame(dev, mc_count); /* DM9102/DM9102A */ |
1080 | spin_unlock_irqrestore(&db->lock, flags); | 1081 | spin_unlock_irqrestore(&db->lock, flags); |
1081 | } | 1082 | } |
1082 | 1083 | ||
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index e1a5f03a49c5..cce2ada07950 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c | |||
@@ -997,7 +997,7 @@ 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 < dev->mc_count; | 1000 | for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev); |
1001 | i++, mclist = mclist->next) { | 1001 | i++, mclist = mclist->next) { |
1002 | int index = ether_crc_le(ETH_ALEN, mclist->dmi_addr) & 0x1ff; | 1002 | int index = ether_crc_le(ETH_ALEN, mclist->dmi_addr) & 0x1ff; |
1003 | 1003 | ||
@@ -1026,7 +1026,7 @@ static void build_setup_frame_perfect(u16 *setup_frm, struct net_device *dev) | |||
1026 | 1026 | ||
1027 | /* We have <= 14 addresses so we can use the wonderful | 1027 | /* We have <= 14 addresses so we can use the wonderful |
1028 | 16 address perfect filtering of the Tulip. */ | 1028 | 16 address perfect filtering of the Tulip. */ |
1029 | for (i = 0, mclist = dev->mc_list; i < dev->mc_count; | 1029 | for (i = 0, mclist = dev->mc_list; i < netdev_mc_count(dev); |
1030 | i++, mclist = mclist->next) { | 1030 | i++, mclist = mclist->next) { |
1031 | eaddrs = (u16 *)mclist->dmi_addr; | 1031 | eaddrs = (u16 *)mclist->dmi_addr; |
1032 | *setup_frm++ = *eaddrs; *setup_frm++ = *eaddrs++; | 1032 | *setup_frm++ = *eaddrs; *setup_frm++ = *eaddrs++; |
@@ -1057,7 +1057,8 @@ static void set_rx_mode(struct net_device *dev) | |||
1057 | if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */ | 1057 | if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */ |
1058 | tp->csr6 |= AcceptAllMulticast | AcceptAllPhys; | 1058 | tp->csr6 |= AcceptAllMulticast | AcceptAllPhys; |
1059 | csr6 |= AcceptAllMulticast | AcceptAllPhys; | 1059 | csr6 |= AcceptAllMulticast | AcceptAllPhys; |
1060 | } else if ((dev->mc_count > 1000) || (dev->flags & IFF_ALLMULTI)) { | 1060 | } else if ((netdev_mc_count(dev) > 1000) || |
1061 | (dev->flags & IFF_ALLMULTI)) { | ||
1061 | /* Too many to filter well -- accept all multicasts. */ | 1062 | /* Too many to filter well -- accept all multicasts. */ |
1062 | tp->csr6 |= AcceptAllMulticast; | 1063 | tp->csr6 |= AcceptAllMulticast; |
1063 | csr6 |= AcceptAllMulticast; | 1064 | csr6 |= AcceptAllMulticast; |
@@ -1066,14 +1067,16 @@ static void set_rx_mode(struct net_device *dev) | |||
1066 | /* Should verify correctness on big-endian/__powerpc__ */ | 1067 | /* Should verify correctness on big-endian/__powerpc__ */ |
1067 | struct dev_mc_list *mclist; | 1068 | struct dev_mc_list *mclist; |
1068 | int i; | 1069 | int i; |
1069 | if (dev->mc_count > 64) { /* Arbitrary non-effective limit. */ | 1070 | if (netdev_mc_count(dev) > 64) { |
1071 | /* Arbitrary non-effective limit. */ | ||
1070 | tp->csr6 |= AcceptAllMulticast; | 1072 | tp->csr6 |= AcceptAllMulticast; |
1071 | csr6 |= AcceptAllMulticast; | 1073 | csr6 |= AcceptAllMulticast; |
1072 | } else { | 1074 | } else { |
1073 | u32 mc_filter[2] = {0, 0}; /* Multicast hash filter */ | 1075 | u32 mc_filter[2] = {0, 0}; /* Multicast hash filter */ |
1074 | int filterbit; | 1076 | int filterbit; |
1075 | for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; | 1077 | for (i = 0, mclist = dev->mc_list; |
1076 | i++, mclist = mclist->next) { | 1078 | mclist && i < netdev_mc_count(dev); |
1079 | i++, mclist = mclist->next) { | ||
1077 | if (tp->flags & COMET_MAC_ADDR) | 1080 | if (tp->flags & COMET_MAC_ADDR) |
1078 | filterbit = ether_crc_le(ETH_ALEN, mclist->dmi_addr); | 1081 | filterbit = ether_crc_le(ETH_ALEN, mclist->dmi_addr); |
1079 | else | 1082 | else |
@@ -1107,7 +1110,8 @@ static void set_rx_mode(struct net_device *dev) | |||
1107 | 1110 | ||
1108 | /* Note that only the low-address shortword of setup_frame is valid! | 1111 | /* Note that only the low-address shortword of setup_frame is valid! |
1109 | The values are doubled for big-endian architectures. */ | 1112 | The values are doubled for big-endian architectures. */ |
1110 | if (dev->mc_count > 14) { /* Must use a multicast hash table. */ | 1113 | if (netdev_mc_count(dev) > 14) { |
1114 | /* Must use a multicast hash table. */ | ||
1111 | build_setup_frame_hash(tp->setup_frame, dev); | 1115 | build_setup_frame_hash(tp->setup_frame, dev); |
1112 | tx_flags = 0x08400000 | 192; | 1116 | tx_flags = 0x08400000 | 192; |
1113 | } else { | 1117 | } else { |
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c index dc3335d906f6..216ceb322ed4 100644 --- a/drivers/net/tulip/uli526x.c +++ b/drivers/net/tulip/uli526x.c | |||
@@ -557,7 +557,7 @@ static void uli526x_init(struct net_device *dev) | |||
557 | update_cr6(db->cr6_data, ioaddr); | 557 | update_cr6(db->cr6_data, ioaddr); |
558 | 558 | ||
559 | /* Send setup frame */ | 559 | /* Send setup frame */ |
560 | send_filter_frame(dev, dev->mc_count); /* M5261/M5263 */ | 560 | send_filter_frame(dev, netdev_mc_count(dev)); /* M5261/M5263 */ |
561 | 561 | ||
562 | /* Init CR7, interrupt active bit */ | 562 | /* Init CR7, interrupt active bit */ |
563 | db->cr7_data = CR7_DEFAULT; | 563 | db->cr7_data = CR7_DEFAULT; |
@@ -906,16 +906,18 @@ static void uli526x_set_filter_mode(struct net_device * dev) | |||
906 | return; | 906 | return; |
907 | } | 907 | } |
908 | 908 | ||
909 | if (dev->flags & IFF_ALLMULTI || dev->mc_count > ULI5261_MAX_MULTICAST) { | 909 | if (dev->flags & IFF_ALLMULTI || |
910 | ULI526X_DBUG(0, "Pass all multicast address", dev->mc_count); | 910 | netdev_mc_count(dev) > ULI5261_MAX_MULTICAST) { |
911 | ULI526X_DBUG(0, "Pass all multicast address", | ||
912 | netdev_mc_count(dev)); | ||
911 | db->cr6_data &= ~(CR6_PM | CR6_PBF); | 913 | db->cr6_data &= ~(CR6_PM | CR6_PBF); |
912 | db->cr6_data |= CR6_PAM; | 914 | db->cr6_data |= CR6_PAM; |
913 | spin_unlock_irqrestore(&db->lock, flags); | 915 | spin_unlock_irqrestore(&db->lock, flags); |
914 | return; | 916 | return; |
915 | } | 917 | } |
916 | 918 | ||
917 | ULI526X_DBUG(0, "Set multicast address", dev->mc_count); | 919 | ULI526X_DBUG(0, "Set multicast address", netdev_mc_count(dev)); |
918 | send_filter_frame(dev, dev->mc_count); /* M5261/M5263 */ | 920 | send_filter_frame(dev, netdev_mc_count(dev)); /* M5261/M5263 */ |
919 | spin_unlock_irqrestore(&db->lock, flags); | 921 | spin_unlock_irqrestore(&db->lock, flags); |
920 | } | 922 | } |
921 | 923 | ||
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c index 9fb89afccf7c..98711a9f35ac 100644 --- a/drivers/net/tulip/winbond-840.c +++ b/drivers/net/tulip/winbond-840.c | |||
@@ -1361,7 +1361,7 @@ static u32 __set_rx_mode(struct net_device *dev) | |||
1361 | memset(mc_filter, 0xff, sizeof(mc_filter)); | 1361 | memset(mc_filter, 0xff, sizeof(mc_filter)); |
1362 | rx_mode = RxAcceptBroadcast | AcceptMulticast | RxAcceptAllPhys | 1362 | rx_mode = RxAcceptBroadcast | AcceptMulticast | RxAcceptAllPhys |
1363 | | AcceptMyPhys; | 1363 | | AcceptMyPhys; |
1364 | } else if ((dev->mc_count > multicast_filter_limit) || | 1364 | } else if ((netdev_mc_count(dev) > multicast_filter_limit) || |
1365 | (dev->flags & IFF_ALLMULTI)) { | 1365 | (dev->flags & IFF_ALLMULTI)) { |
1366 | /* Too many to match, or accept all multicasts. */ | 1366 | /* Too many to match, or accept all multicasts. */ |
1367 | memset(mc_filter, 0xff, sizeof(mc_filter)); | 1367 | memset(mc_filter, 0xff, sizeof(mc_filter)); |
@@ -1370,8 +1370,9 @@ static u32 __set_rx_mode(struct net_device *dev) | |||
1370 | struct dev_mc_list *mclist; | 1370 | struct dev_mc_list *mclist; |
1371 | int i; | 1371 | int i; |
1372 | memset(mc_filter, 0, sizeof(mc_filter)); | 1372 | memset(mc_filter, 0, sizeof(mc_filter)); |
1373 | for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; | 1373 | for (i = 0, mclist = dev->mc_list; |
1374 | i++, mclist = mclist->next) { | 1374 | mclist && i < netdev_mc_count(dev); |
1375 | i++, mclist = mclist->next) { | ||
1375 | int filterbit = (ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26) ^ 0x3F; | 1376 | int filterbit = (ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26) ^ 0x3F; |
1376 | filterbit &= 0x3f; | 1377 | filterbit &= 0x3f; |
1377 | mc_filter[filterbit >> 5] |= 1 << (filterbit & 31); | 1378 | mc_filter[filterbit >> 5] |= 1 << (filterbit & 31); |