drivers/net: Omit check for multicast bit in netdev_for_each_mc_addr
authorTobias Klauser <tklauser@distanz.ch>
Thu, 7 Jul 2011 22:06:26 +0000 (22:06 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 Jul 2011 16:03:20 +0000 (09:03 -0700)
There is no need to check for the address being a multicast address in
the netdev_for_each_mc_addr loop, so remove it. This patch covers all
remaining network drivers still containing such a check.

Cc: Joe Perches <joe@perches.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
20 files changed:
drivers/net/7990.c
drivers/net/a2065.c
drivers/net/bmac.c
drivers/net/declance.c
drivers/net/ewrk3.c
drivers/net/fec.c
drivers/net/hp100.c
drivers/net/ioc3-eth.c
drivers/net/korina.c
drivers/net/ks8851_mll.c
drivers/net/ksz884x.c
drivers/net/pcnet32.c
drivers/net/smc911x.c
drivers/net/smc9194.c
drivers/net/smc91x.c
drivers/net/sunbmac.c
drivers/net/sungem.c
drivers/net/sunhme.c
drivers/net/sunlance.c
drivers/net/sunqe.c

index 903bcb3ef5bd3f2bac81c76f7e4933bfefeed9e0..60b35fb5f524abe02c9d09d0a64036593d1b956a 100644 (file)
@@ -594,7 +594,6 @@ static void lance_load_multicast (struct net_device *dev)
         volatile struct lance_init_block *ib = lp->init_block;
         volatile u16 *mcast_table = (u16 *)&ib->filter;
        struct netdev_hw_addr *ha;
-        char *addrs;
         u32 crc;
 
         /* set all multicast bits */
@@ -609,13 +608,7 @@ static void lance_load_multicast (struct net_device *dev)
 
         /* Add addresses */
        netdev_for_each_mc_addr(ha, dev) {
-               addrs = ha->addr;
-
-                /* multicast address? */
-                if (!(*addrs & 1))
-                        continue;
-
-               crc = ether_crc_le(6, addrs);
+               crc = ether_crc_le(6, ha->addr);
                 crc = crc >> 26;
                 mcast_table [crc >> 4] |= 1 << (crc & 0xf);
         }
index 7d9a1a6ea8b2d4c472e130b0ad19e2f2091d0416..e1e1b07d9b8d5ba1fc34bdacc201dcef1b4e9bda 100644 (file)
@@ -587,7 +587,6 @@ static void lance_load_multicast(struct net_device *dev)
        volatile struct lance_init_block *ib = lp->init_block;
        volatile u16 *mcast_table = (u16 *)&ib->filter;
        struct netdev_hw_addr *ha;
-       char *addrs;
        u32 crc;
 
        /* set all multicast bits */
@@ -602,13 +601,7 @@ static void lance_load_multicast(struct net_device *dev)
 
        /* Add addresses */
        netdev_for_each_mc_addr(ha, dev) {
-               addrs = ha->addr;
-
-               /* multicast address? */
-               if (!(*addrs & 1))
-                       continue;
-
-               crc = ether_crc_le(6, addrs);
+               crc = ether_crc_le(6, ha->addr);
                crc = crc >> 26;
                mcast_table[crc >> 4] |= 1 << (crc & 0xf);
        }
index d2e58e2bea78e53fcc901d848f28311441f3cb6a..45e45e8d3d66f86f2c886a88678c56a27302f032 100644 (file)
@@ -1015,7 +1015,6 @@ static void bmac_set_multicast(struct net_device *dev)
 static void bmac_set_multicast(struct net_device *dev)
 {
        struct netdev_hw_addr *ha;
-       char *addrs;
        int i;
        unsigned short rx_cfg;
        u32 crc;
@@ -1039,12 +1038,7 @@ static void bmac_set_multicast(struct net_device *dev)
                for(i = 0; i < 4; i++) hash_table[i] = 0;
 
                netdev_for_each_mc_addr(ha, dev) {
-                       addrs = ha->addr;
-
-                       if(!(*addrs & 1))
-                               continue;
-
-                       crc = ether_crc_le(6, addrs);
+                       crc = ether_crc_le(6, ha->addr);
                        crc >>= 26;
                        hash_table[crc >> 4] |= 1 << (crc & 0xf);
                }
index cabd3a542ef050e33979cc27a3d07987911db67d..d5598f6584a3c64a7d6af59695564def992eb512 100644 (file)
@@ -946,7 +946,6 @@ static void lance_load_multicast(struct net_device *dev)
        struct lance_private *lp = netdev_priv(dev);
        volatile u16 *ib = (volatile u16 *)dev->mem_start;
        struct netdev_hw_addr *ha;
-       char *addrs;
        u32 crc;
 
        /* set all multicast bits */
@@ -965,13 +964,7 @@ static void lance_load_multicast(struct net_device *dev)
 
        /* Add addresses */
        netdev_for_each_mc_addr(ha, dev) {
-               addrs = ha->addr;
-
-               /* multicast address? */
-               if (!(*addrs & 1))
-                       continue;
-
-               crc = ether_crc_le(ETH_ALEN, addrs);
+               crc = ether_crc_le(ETH_ALEN, ha->addr);
                crc = crc >> 26;
                *lib_ptr(ib, filter[crc >> 4], lp->type) |= 1 << (crc & 0xf);
        }
index d1e229f9e5407a944e21be0d340d82279a1db145..05a5f71451a76ba16fe62d5eb833153d60356e53 100644 (file)
@@ -1169,7 +1169,7 @@ static void SetMulticastFilter(struct net_device *dev)
        struct netdev_hw_addr *ha;
        u_long iobase = dev->base_addr;
        int i;
-       char *addrs, bit, byte;
+       char bit, byte;
        short __iomem *p = lp->mctbl;
        u16 hashcode;
        u32 crc;
@@ -1211,25 +1211,22 @@ static void SetMulticastFilter(struct net_device *dev)
 
                /* Update table */
                netdev_for_each_mc_addr(ha, dev) {
-                       addrs = ha->addr;
-                       if ((*addrs & 0x01) == 1) {     /* multicast address? */
-                               crc = ether_crc_le(ETH_ALEN, addrs);
-                               hashcode = crc & ((1 << 9) - 1);        /* hashcode is 9 LSb of CRC */
+                       crc = ether_crc_le(ETH_ALEN, ha->addr);
+                       hashcode = crc & ((1 << 9) - 1);        /* hashcode is 9 LSb of CRC */
 
-                               byte = hashcode >> 3;   /* bit[3-8] -> byte in filter */
-                               bit = 1 << (hashcode & 0x07);   /* bit[0-2] -> bit in byte */
+                       byte = hashcode >> 3;   /* bit[3-8] -> byte in filter */
+                       bit = 1 << (hashcode & 0x07);   /* bit[0-2] -> bit in byte */
 
-                               if (lp->shmem_length == IO_ONLY) {
-                                       u_char tmp;
+                       if (lp->shmem_length == IO_ONLY) {
+                               u_char tmp;
 
-                                       outw(PAGE0_HTE + byte, EWRK3_PIR1);
-                                       tmp = inb(EWRK3_DATA);
-                                       tmp |= bit;
-                                       outw(PAGE0_HTE + byte, EWRK3_PIR1);
-                                       outb(tmp, EWRK3_DATA);
-                               } else {
-                                       writeb(readb(lp->mctbl + byte) | bit, lp->mctbl + byte);
-                               }
+                               outw(PAGE0_HTE + byte, EWRK3_PIR1);
+                               tmp = inb(EWRK3_DATA);
+                               tmp |= bit;
+                               outw(PAGE0_HTE + byte, EWRK3_PIR1);
+                               outb(tmp, EWRK3_DATA);
+                       } else {
+                               writeb(readb(lp->mctbl + byte) | bit, lp->mctbl + byte);
                        }
                }
        }
index 7ae3f2814200c9e7e9d5773e792de6905484a2ab..5b631fe74738367d50c6b59e6f0f93995ef4c87d 100644 (file)
@@ -1227,10 +1227,6 @@ static void set_multicast_list(struct net_device *ndev)
        writel(0, fep->hwp + FEC_GRP_HASH_TABLE_LOW);
 
        netdev_for_each_mc_addr(ha, ndev) {
-               /* Only support group multicast for now */
-               if (!(ha->addr[0] & 1))
-                       continue;
-
                /* calculate crc32 value of mac address */
                crc = 0xffffffff;
 
index c3ecb118c1df39f925e40f023f6e2f8a63ec763f..b6519c1ba7e1442443eb3f32d5fcdb14af28ea7e 100644 (file)
@@ -2103,20 +2103,18 @@ static void hp100_set_multicast_list(struct net_device *dev)
 #endif
                        netdev_for_each_mc_addr(ha, dev) {
                                addrs = ha->addr;
-                               if ((*addrs & 0x01) == 0x01) {  /* multicast address? */
 #ifdef HP100_DEBUG
-                                       printk("hp100: %s: multicast = %pM, ",
-                                                    dev->name, addrs);
+                               printk("hp100: %s: multicast = %pM, ",
+                                            dev->name, addrs);
 #endif
-                                       for (i = idx = 0; i < 6; i++) {
-                                               idx ^= *addrs++ & 0x3f;
-                                               printk(":%02x:", idx);
-                                       }
+                               for (i = idx = 0; i < 6; i++) {
+                                       idx ^= *addrs++ & 0x3f;
+                                       printk(":%02x:", idx);
+                               }
 #ifdef HP100_DEBUG
-                                       printk("idx = %i\n", idx);
+                               printk("idx = %i\n", idx);
 #endif
-                                       lp->hash_bytes[idx >> 3] |= (1 << (idx & 7));
-                               }
+                               lp->hash_bytes[idx >> 3] |= (1 << (idx & 7));
                        }
                }
 #else
index 318a25a92310b3887052fb3a496fc10faa9624e3..a234e4504522122ccd39f7f0318cf87b339685d1 100644 (file)
@@ -1664,12 +1664,7 @@ static void ioc3_set_multicast_list(struct net_device *dev)
                        ip->ehar_l = 0xffffffff;
                } else {
                        netdev_for_each_mc_addr(ha, dev) {
-                               char *addr = ha->addr;
-
-                               if (!(*addr & 1))
-                                       continue;
-
-                               ehar |= (1UL << ioc3_hash(addr));
+                               ehar |= (1UL << ioc3_hash(ha->addr));
                        }
                        ip->ehar_h = ehar >> 32;
                        ip->ehar_l = ehar & 0xffffffff;
index c7a9bef4dfb0890001c5243211862def6a4de2a6..763844c587fd13ac9303347e0408855598a1bbe6 100644 (file)
@@ -504,12 +504,7 @@ static void korina_multicast_list(struct net_device *dev)
                        hash_table[i] = 0;
 
                netdev_for_each_mc_addr(ha, dev) {
-                       char *addrs = ha->addr;
-
-                       if (!(*addrs & 1))
-                               continue;
-
-                       crc = ether_crc_le(6, addrs);
+                       crc = ether_crc_le(6, ha->addr);
                        crc >>= 26;
                        hash_table[crc >> 4] |= 1 << (15 - (crc & 0xf));
                }
index a82378231fc550cb9d6b3ab3c08486bd5c4f2b92..d19c849059d80755cacb8093de0668776216401d 100644 (file)
@@ -1190,8 +1190,6 @@ static void ks_set_rx_mode(struct net_device *netdev)
                        int i = 0;
 
                        netdev_for_each_mc_addr(ha, netdev) {
-                               if (!(*ha->addr & 1))
-                                       continue;
                                if (i >= MAX_MCAST_LST)
                                        break;
                                memcpy(ks->mcast_lst[i++], ha->addr, ETH_ALEN);
index 2ac6c6c984b3a1629dd42199c59bcaadeec07999..27418d31a09f52e27615c3a9051edb8a87386a8f 100644 (file)
@@ -5785,8 +5785,6 @@ static void netdev_set_rx_mode(struct net_device *dev)
                }
 
                netdev_for_each_mc_addr(ha, dev) {
-                       if (!(*ha->addr & 1))
-                               continue;
                        if (i >= MAX_MULTICAST_LIST)
                                break;
                        memcpy(hw->multi_list[i++], ha->addr, MAC_ADDR_LEN);
index b48aba9e42274de4609d3920d133021a11de4b6b..8b3090dc4bcdf6c3b674d401b89a3a8aa3f5f5be 100644 (file)
@@ -2570,7 +2570,6 @@ static void pcnet32_load_multicast(struct net_device *dev)
        volatile __le16 *mcast_table = (__le16 *)ib->filter;
        struct netdev_hw_addr *ha;
        unsigned long ioaddr = dev->base_addr;
-       char *addrs;
        int i;
        u32 crc;
 
@@ -2590,13 +2589,7 @@ static void pcnet32_load_multicast(struct net_device *dev)
 
        /* Add addresses */
        netdev_for_each_mc_addr(ha, dev) {
-               addrs = ha->addr;
-
-               /* multicast address? */
-               if (!(*addrs & 1))
-                       continue;
-
-               crc = ether_crc_le(6, addrs);
+               crc = ether_crc_le(6, ha->addr);
                crc = crc >> 26;
                mcast_table[crc >> 4] |= cpu_to_le16(1 << (crc & 0xf));
        }
index 053863aefb12f183b0095cd0d962bc1698db3580..a91fe1723020f3cda01d6c755ce13d0741faffb2 100644 (file)
@@ -1351,11 +1351,6 @@ static void smc911x_set_multicast_list(struct net_device *dev)
                netdev_for_each_mc_addr(ha, dev) {
                        u32 position;
 
-                       /* make sure this is a multicast address -
-                               shouldn't this be a given if we have it here ? */
-                       if (!(*ha->addr & 1))
-                               continue;
-
                        /* upper 6 bits are used as hash index */
                        position = ether_crc(ETH_ALEN, ha->addr)>>26;
 
index 7486d0908064c598a0de1252d4ecfd85aba12789..5b65ac4b3cefc0a40a500a0e10fe66e06a974470 100644 (file)
@@ -447,11 +447,6 @@ static void smc_setmulticast(int ioaddr, struct net_device *dev)
        netdev_for_each_mc_addr(ha, dev) {
                int position;
 
-               /* make sure this is a multicast address - shouldn't this
-                  be a given if we have it here ? */
-               if (!(*ha->addr & 1))
-                       continue;
-
                /* only use the low order bits */
                position = ether_crc_le(6, ha->addr) & 0x3f;
 
index f6285748bd3c0bd82bd8a6cba684527378ad2874..2b1d254d59af8ec7405e142d99d92fd21848c0ef 100644 (file)
@@ -1425,11 +1425,6 @@ static void smc_set_multicast_list(struct net_device *dev)
                netdev_for_each_mc_addr(ha, dev) {
                        int position;
 
-                       /* make sure this is a multicast address -
-                          shouldn't this be a given if we have it here ? */
-                       if (!(*ha->addr & 1))
-                               continue;
-
                        /* only use the low order bits */
                        position = crc32_le(~0, ha->addr, 6) & 0x3f;
 
index aa4765803a4c4c9750fa7e24b9404dc1af61559e..297a4242106b300b48fcbbccbe142dde7f353df9 100644 (file)
@@ -998,7 +998,6 @@ static void bigmac_set_multicast(struct net_device *dev)
        struct bigmac *bp = netdev_priv(dev);
        void __iomem *bregs = bp->bregs;
        struct netdev_hw_addr *ha;
-       char *addrs;
        int i;
        u32 tmp, crc;
 
@@ -1027,12 +1026,7 @@ static void bigmac_set_multicast(struct net_device *dev)
                        hash_table[i] = 0;
 
                netdev_for_each_mc_addr(ha, dev) {
-                       addrs = ha->addr;
-
-                       if (!(*addrs & 1))
-                               continue;
-
-                       crc = ether_crc_le(6, addrs);
+                       crc = ether_crc_le(6, ha->addr);
                        crc >>= 26;
                        hash_table[crc >> 4] |= 1 << (crc & 0xf);
                }
index 71d4a0329d0298c910bf781e6275f2a7fd08eda9..ade35dde5b51593638327ab5a640f995fb0c08a3 100644 (file)
@@ -1802,12 +1802,7 @@ static u32 gem_setup_multicast(struct gem *gp)
 
                memset(hash_table, 0, sizeof(hash_table));
                netdev_for_each_mc_addr(ha, gp->dev) {
-                       char *addrs = ha->addr;
-
-                       if (!(*addrs & 1))
-                               continue;
-
-                       crc = ether_crc_le(6, addrs);
+                       crc = ether_crc_le(6, ha->addr);
                        crc >>= 24;
                        hash_table[crc >> 4] |= 1 << (15 - (crc & 0xf));
                }
index 30aad54b1b3a9bad0d72b04990847db1a9a87c5b..856e05b9fba3876fcea95289bf4eb13dea39c0ca 100644 (file)
@@ -1524,17 +1524,11 @@ static int happy_meal_init(struct happy_meal *hp)
        } else if ((hp->dev->flags & IFF_PROMISC) == 0) {
                u16 hash_table[4];
                struct netdev_hw_addr *ha;
-               char *addrs;
                u32 crc;
 
                memset(hash_table, 0, sizeof(hash_table));
                netdev_for_each_mc_addr(ha, hp->dev) {
-                       addrs = ha->addr;
-
-                       if (!(*addrs & 1))
-                               continue;
-
-                       crc = ether_crc_le(6, addrs);
+                       crc = ether_crc_le(6, ha->addr);
                        crc >>= 26;
                        hash_table[crc >> 4] |= 1 << (crc & 0xf);
                }
@@ -2361,7 +2355,6 @@ static void happy_meal_set_multicast(struct net_device *dev)
        struct happy_meal *hp = netdev_priv(dev);
        void __iomem *bregs = hp->bigmacregs;
        struct netdev_hw_addr *ha;
-       char *addrs;
        u32 crc;
 
        spin_lock_irq(&hp->happy_lock);
@@ -2379,12 +2372,7 @@ static void happy_meal_set_multicast(struct net_device *dev)
 
                memset(hash_table, 0, sizeof(hash_table));
                netdev_for_each_mc_addr(ha, dev) {
-                       addrs = ha->addr;
-
-                       if (!(*addrs & 1))
-                               continue;
-
-                       crc = ether_crc_le(6, addrs);
+                       crc = ether_crc_le(6, ha->addr);
                        crc >>= 26;
                        hash_table[crc >> 4] |= 1 << (crc & 0xf);
                }
index 32a5c7f63c43caa806bcb5acae6f367bf2a9f274..06f2d4382dc4f7811f7d6700d6ff720a97821526 100644 (file)
@@ -1170,7 +1170,6 @@ static void lance_load_multicast(struct net_device *dev)
 {
        struct lance_private *lp = netdev_priv(dev);
        struct netdev_hw_addr *ha;
-       char *addrs;
        u32 crc;
        u32 val;
 
@@ -1195,12 +1194,7 @@ static void lance_load_multicast(struct net_device *dev)
 
        /* Add addresses */
        netdev_for_each_mc_addr(ha, dev) {
-               addrs = ha->addr;
-
-               /* multicast address? */
-               if (!(*addrs & 1))
-                       continue;
-               crc = ether_crc_le(6, addrs);
+               crc = ether_crc_le(6, ha->addr);
                crc = crc >> 26;
                if (lp->pio_buffer) {
                        struct lance_init_block __iomem *ib = lp->init_block_iomem;
index 18ecdc303751055b63f26c20b5dfd136da32688e..209c7f8df003e52d880043e64f27540258881eca 100644 (file)
@@ -628,7 +628,6 @@ static void qe_set_multicast(struct net_device *dev)
        struct sunqe *qep = netdev_priv(dev);
        struct netdev_hw_addr *ha;
        u8 new_mconfig = qep->mconfig;
-       char *addrs;
        int i;
        u32 crc;
 
@@ -651,11 +650,7 @@ static void qe_set_multicast(struct net_device *dev)
 
                memset(hash_table, 0, sizeof(hash_table));
                netdev_for_each_mc_addr(ha, dev) {
-                       addrs = ha->addr;
-
-                       if (!(*addrs & 1))
-                               continue;
-                       crc = ether_crc_le(6, addrs);
+                       crc = ether_crc_le(6, ha->addr);
                        crc >>= 26;
                        hash_table[crc >> 4] |= 1 << (crc & 0xf);
                }