aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJiri Pirko <jpirko@redhat.com>2010-02-19 18:06:27 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-22 18:45:50 -0500
commit3b9a7728d878a3e7adc79fb89c3bb9ebc23760d7 (patch)
tree1d39563eabca941f0a8f763d5c2b5973e0d0b6e0 /drivers
parent0bc88e4af07621bc4b84477374745d01a470e85d (diff)
net/arm: convert to use netdev_for_each_mc_addr
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/arm/am79c961a.c10
-rw-r--r--drivers/net/arm/at91_ether.c7
-rw-r--r--drivers/net/arm/ixp4xx_eth.c13
-rw-r--r--drivers/net/arm/ks8695net.c20
-rw-r--r--drivers/net/arm/w90p910_ether.c8
5 files changed, 28 insertions, 30 deletions
diff --git a/drivers/net/arm/am79c961a.c b/drivers/net/arm/am79c961a.c
index 1c3c1f94268e..f1f58c5e27bf 100644
--- a/drivers/net/arm/am79c961a.c
+++ b/drivers/net/arm/am79c961a.c
@@ -351,13 +351,13 @@ static struct net_device_stats *am79c961_getstats (struct net_device *dev)
351 return &priv->stats; 351 return &priv->stats;
352} 352}
353 353
354static void am79c961_mc_hash(struct dev_mc_list *dmi, unsigned short *hash) 354static void am79c961_mc_hash(char *addr, unsigned short *hash)
355{ 355{
356 if (dmi->dmi_addrlen == ETH_ALEN && dmi->dmi_addr[0] & 0x01) { 356 if (addr[0] & 0x01) {
357 int idx, bit; 357 int idx, bit;
358 u32 crc; 358 u32 crc;
359 359
360 crc = ether_crc_le(ETH_ALEN, dmi->dmi_addr); 360 crc = ether_crc_le(ETH_ALEN, addr);
361 361
362 idx = crc >> 30; 362 idx = crc >> 30;
363 bit = (crc >> 26) & 15; 363 bit = (crc >> 26) & 15;
@@ -387,8 +387,8 @@ static void am79c961_setmulticastlist (struct net_device *dev)
387 387
388 memset(multi_hash, 0x00, sizeof(multi_hash)); 388 memset(multi_hash, 0x00, sizeof(multi_hash));
389 389
390 for (dmi = dev->mc_list; dmi; dmi = dmi->next) 390 netdev_for_each_mc_addr(dmi, dev)
391 am79c961_mc_hash(dmi, multi_hash); 391 am79c961_mc_hash(dmi->dmi_addr, multi_hash);
392 } 392 }
393 393
394 spin_lock_irqsave(&priv->chip_lock, flags); 394 spin_lock_irqsave(&priv->chip_lock, flags);
diff --git a/drivers/net/arm/at91_ether.c b/drivers/net/arm/at91_ether.c
index 17d85d98987d..8b23d5a175bf 100644
--- a/drivers/net/arm/at91_ether.c
+++ b/drivers/net/arm/at91_ether.c
@@ -558,14 +558,11 @@ static void at91ether_sethashtable(struct net_device *dev)
558{ 558{
559 struct dev_mc_list *curr; 559 struct dev_mc_list *curr;
560 unsigned long mc_filter[2]; 560 unsigned long mc_filter[2];
561 unsigned int i, bitnr; 561 unsigned int bitnr;
562 562
563 mc_filter[0] = mc_filter[1] = 0; 563 mc_filter[0] = mc_filter[1] = 0;
564 564
565 curr = dev->mc_list; 565 netdev_for_each_mc_addr(curr, dev) {
566 for (i = 0; i < netdev_mc_count(dev); i++, curr = curr->next) {
567 if (!curr) break; /* unexpected end of list */
568
569 bitnr = hash_get_index(curr->dmi_addr); 566 bitnr = hash_get_index(curr->dmi_addr);
570 mc_filter[bitnr >> 5] |= 1 << (bitnr & 31); 567 mc_filter[bitnr >> 5] |= 1 << (bitnr & 31);
571 } 568 }
diff --git a/drivers/net/arm/ixp4xx_eth.c b/drivers/net/arm/ixp4xx_eth.c
index 1a5f78b160f9..6e2ae1d06df1 100644
--- a/drivers/net/arm/ixp4xx_eth.c
+++ b/drivers/net/arm/ixp4xx_eth.c
@@ -735,22 +735,25 @@ static int eth_xmit(struct sk_buff *skb, struct net_device *dev)
735static void eth_set_mcast_list(struct net_device *dev) 735static void eth_set_mcast_list(struct net_device *dev)
736{ 736{
737 struct port *port = netdev_priv(dev); 737 struct port *port = netdev_priv(dev);
738 struct dev_mc_list *mclist = dev->mc_list; 738 struct dev_mc_list *mclist;
739 u8 diffs[ETH_ALEN], *addr; 739 u8 diffs[ETH_ALEN], *addr;
740 int cnt = netdev_mc_count(dev), i; 740 int i;
741 741
742 if ((dev->flags & IFF_PROMISC) || !mclist || !cnt) { 742 if ((dev->flags & IFF_PROMISC) || netdev_mc_empty(dev)) {
743 __raw_writel(DEFAULT_RX_CNTRL0 & ~RX_CNTRL0_ADDR_FLTR_EN, 743 __raw_writel(DEFAULT_RX_CNTRL0 & ~RX_CNTRL0_ADDR_FLTR_EN,
744 &port->regs->rx_control[0]); 744 &port->regs->rx_control[0]);
745 return; 745 return;
746 } 746 }
747 747
748 memset(diffs, 0, ETH_ALEN); 748 memset(diffs, 0, ETH_ALEN);
749 addr = mclist->dmi_addr; /* first MAC address */
750 749
751 while (--cnt && (mclist = mclist->next)) 750 addr = NULL;
751 netdev_for_each_mc_addr(mclist, dev) {
752 if (!addr)
753 addr = mclist->dmi_addr; /* first MAC address */
752 for (i = 0; i < ETH_ALEN; i++) 754 for (i = 0; i < ETH_ALEN; i++)
753 diffs[i] |= addr[i] ^ mclist->dmi_addr[i]; 755 diffs[i] |= addr[i] ^ mclist->dmi_addr[i];
756 }
754 757
755 for (i = 0; i < ETH_ALEN; i++) { 758 for (i = 0; i < ETH_ALEN; i++) {
756 __raw_writel(addr[i], &port->regs->mcast_addr[i]); 759 __raw_writel(addr[i], &port->regs->mcast_addr[i]);
diff --git a/drivers/net/arm/ks8695net.c b/drivers/net/arm/ks8695net.c
index 1dc181a9fbc3..238069699515 100644
--- a/drivers/net/arm/ks8695net.c
+++ b/drivers/net/arm/ks8695net.c
@@ -327,25 +327,24 @@ ks8695_refill_rxbuffers(struct ks8695_priv *ksp)
327 */ 327 */
328static void 328static void
329ks8695_init_partial_multicast(struct ks8695_priv *ksp, 329ks8695_init_partial_multicast(struct ks8695_priv *ksp,
330 struct dev_mc_list *addr, 330 struct net_device *ndev)
331 int nr_addr)
332{ 331{
333 u32 low, high; 332 u32 low, high;
334 int i; 333 int i;
334 struct dev_mc_list *dmi;
335 335
336 for (i = 0; i < nr_addr; i++, addr = addr->next) { 336 i = 0;
337 /* Ran out of addresses? */ 337 netdev_for_each_mc_addr(dmi, ndev) {
338 if (!addr)
339 break;
340 /* Ran out of space in chip? */ 338 /* Ran out of space in chip? */
341 BUG_ON(i == KS8695_NR_ADDRESSES); 339 BUG_ON(i == KS8695_NR_ADDRESSES);
342 340
343 low = (addr->dmi_addr[2] << 24) | (addr->dmi_addr[3] << 16) | 341 low = (dmi->dmi_addr[2] << 24) | (dmi->dmi_addr[3] << 16) |
344 (addr->dmi_addr[4] << 8) | (addr->dmi_addr[5]); 342 (dmi->dmi_addr[4] << 8) | (dmi->dmi_addr[5]);
345 high = (addr->dmi_addr[0] << 8) | (addr->dmi_addr[1]); 343 high = (dmi->dmi_addr[0] << 8) | (dmi->dmi_addr[1]);
346 344
347 ks8695_writereg(ksp, KS8695_AAL_(i), low); 345 ks8695_writereg(ksp, KS8695_AAL_(i), low);
348 ks8695_writereg(ksp, KS8695_AAH_(i), AAH_E | high); 346 ks8695_writereg(ksp, KS8695_AAH_(i), AAH_E | high);
347 i++;
349 } 348 }
350 349
351 /* Clear the remaining Additional Station Addresses */ 350 /* Clear the remaining Additional Station Addresses */
@@ -1215,8 +1214,7 @@ ks8695_set_multicast(struct net_device *ndev)
1215 } else { 1214 } else {
1216 /* enable specific multicasts */ 1215 /* enable specific multicasts */
1217 ctrl &= ~DRXC_RM; 1216 ctrl &= ~DRXC_RM;
1218 ks8695_init_partial_multicast(ksp, ndev->mc_list, 1217 ks8695_init_partial_multicast(ksp, ndev);
1219 netdev_mc_count(ndev));
1220 } 1218 }
1221 1219
1222 ks8695_writereg(ksp, KS8695_DRXC, ctrl); 1220 ks8695_writereg(ksp, KS8695_DRXC, ctrl);
diff --git a/drivers/net/arm/w90p910_ether.c b/drivers/net/arm/w90p910_ether.c
index b7f3866d546f..febd813c916d 100644
--- a/drivers/net/arm/w90p910_ether.c
+++ b/drivers/net/arm/w90p910_ether.c
@@ -858,10 +858,10 @@ static void w90p910_ether_set_multicast_list(struct net_device *dev)
858 858
859 if (dev->flags & IFF_PROMISC) 859 if (dev->flags & IFF_PROMISC)
860 rx_mode = CAMCMR_AUP | CAMCMR_AMP | CAMCMR_ABP | CAMCMR_ECMP; 860 rx_mode = CAMCMR_AUP | CAMCMR_AMP | CAMCMR_ABP | CAMCMR_ECMP;
861 else if ((dev->flags & IFF_ALLMULTI) || dev->mc_list) 861 else if ((dev->flags & IFF_ALLMULTI) || !netdev_mc_empty(dev))
862 rx_mode = CAMCMR_AMP | CAMCMR_ABP | CAMCMR_ECMP; 862 rx_mode = CAMCMR_AMP | CAMCMR_ABP | CAMCMR_ECMP;
863 else 863 else
864 rx_mode = CAMCMR_ECMP | CAMCMR_ABP; 864 rx_mode = CAMCMR_ECMP | CAMCMR_ABP;
865 __raw_writel(rx_mode, ether->reg + REG_CAMCMR); 865 __raw_writel(rx_mode, ether->reg + REG_CAMCMR);
866} 866}
867 867