net/arm: convert to use netdev_for_each_mc_addr
authorJiri Pirko <jpirko@redhat.com>
Fri, 19 Feb 2010 23:06:27 +0000 (23:06 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 22 Feb 2010 23:45:50 +0000 (15:45 -0800)
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/arm/am79c961a.c
drivers/net/arm/at91_ether.c
drivers/net/arm/ixp4xx_eth.c
drivers/net/arm/ks8695net.c
drivers/net/arm/w90p910_ether.c

index 1c3c1f94268e343b1a58208ea1be582ae7f55c23..f1f58c5e27bfd1abe9e388a8637e7087a964d537 100644 (file)
@@ -351,13 +351,13 @@ static struct net_device_stats *am79c961_getstats (struct net_device *dev)
        return &priv->stats;
 }
 
-static void am79c961_mc_hash(struct dev_mc_list *dmi, unsigned short *hash)
+static void am79c961_mc_hash(char *addr, unsigned short *hash)
 {
-       if (dmi->dmi_addrlen == ETH_ALEN && dmi->dmi_addr[0] & 0x01) {
+       if (addr[0] & 0x01) {
                int idx, bit;
                u32 crc;
 
-               crc = ether_crc_le(ETH_ALEN, dmi->dmi_addr);
+               crc = ether_crc_le(ETH_ALEN, addr);
 
                idx = crc >> 30;
                bit = (crc >> 26) & 15;
@@ -387,8 +387,8 @@ static void am79c961_setmulticastlist (struct net_device *dev)
 
                memset(multi_hash, 0x00, sizeof(multi_hash));
 
-               for (dmi = dev->mc_list; dmi; dmi = dmi->next)
-                       am79c961_mc_hash(dmi, multi_hash);
+               netdev_for_each_mc_addr(dmi, dev)
+                       am79c961_mc_hash(dmi->dmi_addr, multi_hash);
        }
 
        spin_lock_irqsave(&priv->chip_lock, flags);
index 17d85d98987d6e618fd668007f45f51a06f47a65..8b23d5a175bfed5581541f5f8da590cc3190352f 100644 (file)
@@ -558,14 +558,11 @@ static void at91ether_sethashtable(struct net_device *dev)
 {
        struct dev_mc_list *curr;
        unsigned long mc_filter[2];
-       unsigned int i, bitnr;
+       unsigned int bitnr;
 
        mc_filter[0] = mc_filter[1] = 0;
 
-       curr = dev->mc_list;
-       for (i = 0; i < netdev_mc_count(dev); i++, curr = curr->next) {
-               if (!curr) break;       /* unexpected end of list */
-
+       netdev_for_each_mc_addr(curr, dev) {
                bitnr = hash_get_index(curr->dmi_addr);
                mc_filter[bitnr >> 5] |= 1 << (bitnr & 31);
        }
index 1a5f78b160f9f899dde7137e124aa07ee57d2182..6e2ae1d06df16c54b6aaaf129c3b8a339fb42315 100644 (file)
@@ -735,22 +735,25 @@ static int eth_xmit(struct sk_buff *skb, struct net_device *dev)
 static void eth_set_mcast_list(struct net_device *dev)
 {
        struct port *port = netdev_priv(dev);
-       struct dev_mc_list *mclist = dev->mc_list;
+       struct dev_mc_list *mclist;
        u8 diffs[ETH_ALEN], *addr;
-       int cnt = netdev_mc_count(dev), i;
+       int i;
 
-       if ((dev->flags & IFF_PROMISC) || !mclist || !cnt) {
+       if ((dev->flags & IFF_PROMISC) || netdev_mc_empty(dev)) {
                __raw_writel(DEFAULT_RX_CNTRL0 & ~RX_CNTRL0_ADDR_FLTR_EN,
                             &port->regs->rx_control[0]);
                return;
        }
 
        memset(diffs, 0, ETH_ALEN);
-       addr = mclist->dmi_addr; /* first MAC address */
 
-       while (--cnt && (mclist = mclist->next))
+       addr = NULL;
+       netdev_for_each_mc_addr(mclist, dev) {
+               if (!addr)
+                       addr = mclist->dmi_addr; /* first MAC address */
                for (i = 0; i < ETH_ALEN; i++)
                        diffs[i] |= addr[i] ^ mclist->dmi_addr[i];
+       }
 
        for (i = 0; i < ETH_ALEN; i++) {
                __raw_writel(addr[i], &port->regs->mcast_addr[i]);
index 1dc181a9fbc3dd707b1b880ded23b5d5ed87cf70..2380696995151a43d18fb8f361e1a33167f35025 100644 (file)
@@ -327,25 +327,24 @@ ks8695_refill_rxbuffers(struct ks8695_priv *ksp)
  */
 static void
 ks8695_init_partial_multicast(struct ks8695_priv *ksp,
-                             struct dev_mc_list *addr,
-                             int nr_addr)
+                             struct net_device *ndev)
 {
        u32 low, high;
        int i;
+       struct dev_mc_list *dmi;
 
-       for (i = 0; i < nr_addr; i++, addr = addr->next) {
-               /* Ran out of addresses? */
-               if (!addr)
-                       break;
+       i = 0;
+       netdev_for_each_mc_addr(dmi, ndev) {
                /* Ran out of space in chip? */
                BUG_ON(i == KS8695_NR_ADDRESSES);
 
-               low = (addr->dmi_addr[2] << 24) | (addr->dmi_addr[3] << 16) |
-                       (addr->dmi_addr[4] << 8) | (addr->dmi_addr[5]);
-               high = (addr->dmi_addr[0] << 8) | (addr->dmi_addr[1]);
+               low = (dmi->dmi_addr[2] << 24) | (dmi->dmi_addr[3] << 16) |
+                     (dmi->dmi_addr[4] << 8) | (dmi->dmi_addr[5]);
+               high = (dmi->dmi_addr[0] << 8) | (dmi->dmi_addr[1]);
 
                ks8695_writereg(ksp, KS8695_AAL_(i), low);
                ks8695_writereg(ksp, KS8695_AAH_(i), AAH_E | high);
+               i++;
        }
 
        /* Clear the remaining Additional Station Addresses */
@@ -1215,8 +1214,7 @@ ks8695_set_multicast(struct net_device *ndev)
        } else {
                /* enable specific multicasts */
                ctrl &= ~DRXC_RM;
-               ks8695_init_partial_multicast(ksp, ndev->mc_list,
-                                             netdev_mc_count(ndev));
+               ks8695_init_partial_multicast(ksp, ndev);
        }
 
        ks8695_writereg(ksp, KS8695_DRXC, ctrl);
index b7f3866d546fdf570645f527c253917d2be45be6..febd813c916d06474b05b55b861b0f136f19dacc 100644 (file)
@@ -858,10 +858,10 @@ static void w90p910_ether_set_multicast_list(struct net_device *dev)
 
        if (dev->flags & IFF_PROMISC)
                rx_mode = CAMCMR_AUP | CAMCMR_AMP | CAMCMR_ABP | CAMCMR_ECMP;
-       else if ((dev->flags & IFF_ALLMULTI) || dev->mc_list)
-                       rx_mode = CAMCMR_AMP | CAMCMR_ABP | CAMCMR_ECMP;
-               else
-                               rx_mode = CAMCMR_ECMP | CAMCMR_ABP;
+       else if ((dev->flags & IFF_ALLMULTI) || !netdev_mc_empty(dev))
+               rx_mode = CAMCMR_AMP | CAMCMR_ABP | CAMCMR_ECMP;
+       else
+               rx_mode = CAMCMR_ECMP | CAMCMR_ABP;
        __raw_writel(rx_mode, ether->reg + REG_CAMCMR);
 }