Commit 498d8e23 authored by Tobias Klauser's avatar Tobias Klauser Committed by David S. Miller

drivers/net: Omit check for multicast bit in netdev_for_each_mc_addr

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: default avatarTobias Klauser <tklauser@distanz.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 40f5d72a
...@@ -594,7 +594,6 @@ static void lance_load_multicast (struct net_device *dev) ...@@ -594,7 +594,6 @@ static void lance_load_multicast (struct net_device *dev)
volatile struct lance_init_block *ib = lp->init_block; volatile struct lance_init_block *ib = lp->init_block;
volatile u16 *mcast_table = (u16 *)&ib->filter; volatile u16 *mcast_table = (u16 *)&ib->filter;
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
char *addrs;
u32 crc; u32 crc;
/* set all multicast bits */ /* set all multicast bits */
...@@ -609,13 +608,7 @@ static void lance_load_multicast (struct net_device *dev) ...@@ -609,13 +608,7 @@ static void lance_load_multicast (struct net_device *dev)
/* Add addresses */ /* Add addresses */
netdev_for_each_mc_addr(ha, dev) { netdev_for_each_mc_addr(ha, dev) {
addrs = ha->addr; crc = ether_crc_le(6, ha->addr);
/* multicast address? */
if (!(*addrs & 1))
continue;
crc = ether_crc_le(6, addrs);
crc = crc >> 26; crc = crc >> 26;
mcast_table [crc >> 4] |= 1 << (crc & 0xf); mcast_table [crc >> 4] |= 1 << (crc & 0xf);
} }
......
...@@ -587,7 +587,6 @@ static void lance_load_multicast(struct net_device *dev) ...@@ -587,7 +587,6 @@ static void lance_load_multicast(struct net_device *dev)
volatile struct lance_init_block *ib = lp->init_block; volatile struct lance_init_block *ib = lp->init_block;
volatile u16 *mcast_table = (u16 *)&ib->filter; volatile u16 *mcast_table = (u16 *)&ib->filter;
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
char *addrs;
u32 crc; u32 crc;
/* set all multicast bits */ /* set all multicast bits */
...@@ -602,13 +601,7 @@ static void lance_load_multicast(struct net_device *dev) ...@@ -602,13 +601,7 @@ static void lance_load_multicast(struct net_device *dev)
/* Add addresses */ /* Add addresses */
netdev_for_each_mc_addr(ha, dev) { netdev_for_each_mc_addr(ha, dev) {
addrs = ha->addr; crc = ether_crc_le(6, ha->addr);
/* multicast address? */
if (!(*addrs & 1))
continue;
crc = ether_crc_le(6, addrs);
crc = crc >> 26; crc = crc >> 26;
mcast_table[crc >> 4] |= 1 << (crc & 0xf); mcast_table[crc >> 4] |= 1 << (crc & 0xf);
} }
......
...@@ -1015,7 +1015,6 @@ static void bmac_set_multicast(struct net_device *dev) ...@@ -1015,7 +1015,6 @@ static void bmac_set_multicast(struct net_device *dev)
static void bmac_set_multicast(struct net_device *dev) static void bmac_set_multicast(struct net_device *dev)
{ {
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
char *addrs;
int i; int i;
unsigned short rx_cfg; unsigned short rx_cfg;
u32 crc; u32 crc;
...@@ -1039,12 +1038,7 @@ static void bmac_set_multicast(struct net_device *dev) ...@@ -1039,12 +1038,7 @@ static void bmac_set_multicast(struct net_device *dev)
for(i = 0; i < 4; i++) hash_table[i] = 0; for(i = 0; i < 4; i++) hash_table[i] = 0;
netdev_for_each_mc_addr(ha, dev) { netdev_for_each_mc_addr(ha, dev) {
addrs = ha->addr; crc = ether_crc_le(6, ha->addr);
if(!(*addrs & 1))
continue;
crc = ether_crc_le(6, addrs);
crc >>= 26; crc >>= 26;
hash_table[crc >> 4] |= 1 << (crc & 0xf); hash_table[crc >> 4] |= 1 << (crc & 0xf);
} }
......
...@@ -946,7 +946,6 @@ static void lance_load_multicast(struct net_device *dev) ...@@ -946,7 +946,6 @@ static void lance_load_multicast(struct net_device *dev)
struct lance_private *lp = netdev_priv(dev); struct lance_private *lp = netdev_priv(dev);
volatile u16 *ib = (volatile u16 *)dev->mem_start; volatile u16 *ib = (volatile u16 *)dev->mem_start;
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
char *addrs;
u32 crc; u32 crc;
/* set all multicast bits */ /* set all multicast bits */
...@@ -965,13 +964,7 @@ static void lance_load_multicast(struct net_device *dev) ...@@ -965,13 +964,7 @@ static void lance_load_multicast(struct net_device *dev)
/* Add addresses */ /* Add addresses */
netdev_for_each_mc_addr(ha, dev) { netdev_for_each_mc_addr(ha, dev) {
addrs = ha->addr; crc = ether_crc_le(ETH_ALEN, ha->addr);
/* multicast address? */
if (!(*addrs & 1))
continue;
crc = ether_crc_le(ETH_ALEN, addrs);
crc = crc >> 26; crc = crc >> 26;
*lib_ptr(ib, filter[crc >> 4], lp->type) |= 1 << (crc & 0xf); *lib_ptr(ib, filter[crc >> 4], lp->type) |= 1 << (crc & 0xf);
} }
......
...@@ -1169,7 +1169,7 @@ static void SetMulticastFilter(struct net_device *dev) ...@@ -1169,7 +1169,7 @@ static void SetMulticastFilter(struct net_device *dev)
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
u_long iobase = dev->base_addr; u_long iobase = dev->base_addr;
int i; int i;
char *addrs, bit, byte; char bit, byte;
short __iomem *p = lp->mctbl; short __iomem *p = lp->mctbl;
u16 hashcode; u16 hashcode;
u32 crc; u32 crc;
...@@ -1211,9 +1211,7 @@ static void SetMulticastFilter(struct net_device *dev) ...@@ -1211,9 +1211,7 @@ static void SetMulticastFilter(struct net_device *dev)
/* Update table */ /* Update table */
netdev_for_each_mc_addr(ha, dev) { netdev_for_each_mc_addr(ha, dev) {
addrs = ha->addr; crc = ether_crc_le(ETH_ALEN, 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 */ hashcode = crc & ((1 << 9) - 1); /* hashcode is 9 LSb of CRC */
byte = hashcode >> 3; /* bit[3-8] -> byte in filter */ byte = hashcode >> 3; /* bit[3-8] -> byte in filter */
...@@ -1232,7 +1230,6 @@ static void SetMulticastFilter(struct net_device *dev) ...@@ -1232,7 +1230,6 @@ static void SetMulticastFilter(struct net_device *dev)
} }
} }
} }
}
spin_unlock_irq(&lp->hw_lock); spin_unlock_irq(&lp->hw_lock);
} }
......
...@@ -1227,10 +1227,6 @@ static void set_multicast_list(struct net_device *ndev) ...@@ -1227,10 +1227,6 @@ static void set_multicast_list(struct net_device *ndev)
writel(0, fep->hwp + FEC_GRP_HASH_TABLE_LOW); writel(0, fep->hwp + FEC_GRP_HASH_TABLE_LOW);
netdev_for_each_mc_addr(ha, ndev) { 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 */ /* calculate crc32 value of mac address */
crc = 0xffffffff; crc = 0xffffffff;
......
...@@ -2103,7 +2103,6 @@ static void hp100_set_multicast_list(struct net_device *dev) ...@@ -2103,7 +2103,6 @@ static void hp100_set_multicast_list(struct net_device *dev)
#endif #endif
netdev_for_each_mc_addr(ha, dev) { netdev_for_each_mc_addr(ha, dev) {
addrs = ha->addr; addrs = ha->addr;
if ((*addrs & 0x01) == 0x01) { /* multicast address? */
#ifdef HP100_DEBUG #ifdef HP100_DEBUG
printk("hp100: %s: multicast = %pM, ", printk("hp100: %s: multicast = %pM, ",
dev->name, addrs); dev->name, addrs);
...@@ -2118,7 +2117,6 @@ static void hp100_set_multicast_list(struct net_device *dev) ...@@ -2118,7 +2117,6 @@ static void hp100_set_multicast_list(struct net_device *dev)
lp->hash_bytes[idx >> 3] |= (1 << (idx & 7)); lp->hash_bytes[idx >> 3] |= (1 << (idx & 7));
} }
} }
}
#else #else
memset(&lp->hash_bytes, 0xff, 8); memset(&lp->hash_bytes, 0xff, 8);
#endif #endif
......
...@@ -1664,12 +1664,7 @@ static void ioc3_set_multicast_list(struct net_device *dev) ...@@ -1664,12 +1664,7 @@ static void ioc3_set_multicast_list(struct net_device *dev)
ip->ehar_l = 0xffffffff; ip->ehar_l = 0xffffffff;
} else { } else {
netdev_for_each_mc_addr(ha, dev) { netdev_for_each_mc_addr(ha, dev) {
char *addr = ha->addr; ehar |= (1UL << ioc3_hash(ha->addr));
if (!(*addr & 1))
continue;
ehar |= (1UL << ioc3_hash(addr));
} }
ip->ehar_h = ehar >> 32; ip->ehar_h = ehar >> 32;
ip->ehar_l = ehar & 0xffffffff; ip->ehar_l = ehar & 0xffffffff;
......
...@@ -504,12 +504,7 @@ static void korina_multicast_list(struct net_device *dev) ...@@ -504,12 +504,7 @@ static void korina_multicast_list(struct net_device *dev)
hash_table[i] = 0; hash_table[i] = 0;
netdev_for_each_mc_addr(ha, dev) { netdev_for_each_mc_addr(ha, dev) {
char *addrs = ha->addr; crc = ether_crc_le(6, ha->addr);
if (!(*addrs & 1))
continue;
crc = ether_crc_le(6, addrs);
crc >>= 26; crc >>= 26;
hash_table[crc >> 4] |= 1 << (15 - (crc & 0xf)); hash_table[crc >> 4] |= 1 << (15 - (crc & 0xf));
} }
......
...@@ -1190,8 +1190,6 @@ static void ks_set_rx_mode(struct net_device *netdev) ...@@ -1190,8 +1190,6 @@ static void ks_set_rx_mode(struct net_device *netdev)
int i = 0; int i = 0;
netdev_for_each_mc_addr(ha, netdev) { netdev_for_each_mc_addr(ha, netdev) {
if (!(*ha->addr & 1))
continue;
if (i >= MAX_MCAST_LST) if (i >= MAX_MCAST_LST)
break; break;
memcpy(ks->mcast_lst[i++], ha->addr, ETH_ALEN); memcpy(ks->mcast_lst[i++], ha->addr, ETH_ALEN);
......
...@@ -5785,8 +5785,6 @@ static void netdev_set_rx_mode(struct net_device *dev) ...@@ -5785,8 +5785,6 @@ static void netdev_set_rx_mode(struct net_device *dev)
} }
netdev_for_each_mc_addr(ha, dev) { netdev_for_each_mc_addr(ha, dev) {
if (!(*ha->addr & 1))
continue;
if (i >= MAX_MULTICAST_LIST) if (i >= MAX_MULTICAST_LIST)
break; break;
memcpy(hw->multi_list[i++], ha->addr, MAC_ADDR_LEN); memcpy(hw->multi_list[i++], ha->addr, MAC_ADDR_LEN);
......
...@@ -2570,7 +2570,6 @@ static void pcnet32_load_multicast(struct net_device *dev) ...@@ -2570,7 +2570,6 @@ static void pcnet32_load_multicast(struct net_device *dev)
volatile __le16 *mcast_table = (__le16 *)ib->filter; volatile __le16 *mcast_table = (__le16 *)ib->filter;
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
unsigned long ioaddr = dev->base_addr; unsigned long ioaddr = dev->base_addr;
char *addrs;
int i; int i;
u32 crc; u32 crc;
...@@ -2590,13 +2589,7 @@ static void pcnet32_load_multicast(struct net_device *dev) ...@@ -2590,13 +2589,7 @@ static void pcnet32_load_multicast(struct net_device *dev)
/* Add addresses */ /* Add addresses */
netdev_for_each_mc_addr(ha, dev) { netdev_for_each_mc_addr(ha, dev) {
addrs = ha->addr; crc = ether_crc_le(6, ha->addr);
/* multicast address? */
if (!(*addrs & 1))
continue;
crc = ether_crc_le(6, addrs);
crc = crc >> 26; crc = crc >> 26;
mcast_table[crc >> 4] |= cpu_to_le16(1 << (crc & 0xf)); mcast_table[crc >> 4] |= cpu_to_le16(1 << (crc & 0xf));
} }
......
...@@ -1351,11 +1351,6 @@ static void smc911x_set_multicast_list(struct net_device *dev) ...@@ -1351,11 +1351,6 @@ static void smc911x_set_multicast_list(struct net_device *dev)
netdev_for_each_mc_addr(ha, dev) { netdev_for_each_mc_addr(ha, dev) {
u32 position; 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 */ /* upper 6 bits are used as hash index */
position = ether_crc(ETH_ALEN, ha->addr)>>26; position = ether_crc(ETH_ALEN, ha->addr)>>26;
......
...@@ -447,11 +447,6 @@ static void smc_setmulticast(int ioaddr, struct net_device *dev) ...@@ -447,11 +447,6 @@ static void smc_setmulticast(int ioaddr, struct net_device *dev)
netdev_for_each_mc_addr(ha, dev) { netdev_for_each_mc_addr(ha, dev) {
int position; 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 */ /* only use the low order bits */
position = ether_crc_le(6, ha->addr) & 0x3f; position = ether_crc_le(6, ha->addr) & 0x3f;
......
...@@ -1425,11 +1425,6 @@ static void smc_set_multicast_list(struct net_device *dev) ...@@ -1425,11 +1425,6 @@ static void smc_set_multicast_list(struct net_device *dev)
netdev_for_each_mc_addr(ha, dev) { netdev_for_each_mc_addr(ha, dev) {
int position; 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 */ /* only use the low order bits */
position = crc32_le(~0, ha->addr, 6) & 0x3f; position = crc32_le(~0, ha->addr, 6) & 0x3f;
......
...@@ -998,7 +998,6 @@ static void bigmac_set_multicast(struct net_device *dev) ...@@ -998,7 +998,6 @@ static void bigmac_set_multicast(struct net_device *dev)
struct bigmac *bp = netdev_priv(dev); struct bigmac *bp = netdev_priv(dev);
void __iomem *bregs = bp->bregs; void __iomem *bregs = bp->bregs;
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
char *addrs;
int i; int i;
u32 tmp, crc; u32 tmp, crc;
...@@ -1027,12 +1026,7 @@ static void bigmac_set_multicast(struct net_device *dev) ...@@ -1027,12 +1026,7 @@ static void bigmac_set_multicast(struct net_device *dev)
hash_table[i] = 0; hash_table[i] = 0;
netdev_for_each_mc_addr(ha, dev) { netdev_for_each_mc_addr(ha, dev) {
addrs = ha->addr; crc = ether_crc_le(6, ha->addr);
if (!(*addrs & 1))
continue;
crc = ether_crc_le(6, addrs);
crc >>= 26; crc >>= 26;
hash_table[crc >> 4] |= 1 << (crc & 0xf); hash_table[crc >> 4] |= 1 << (crc & 0xf);
} }
......
...@@ -1802,12 +1802,7 @@ static u32 gem_setup_multicast(struct gem *gp) ...@@ -1802,12 +1802,7 @@ static u32 gem_setup_multicast(struct gem *gp)
memset(hash_table, 0, sizeof(hash_table)); memset(hash_table, 0, sizeof(hash_table));
netdev_for_each_mc_addr(ha, gp->dev) { netdev_for_each_mc_addr(ha, gp->dev) {
char *addrs = ha->addr; crc = ether_crc_le(6, ha->addr);
if (!(*addrs & 1))
continue;
crc = ether_crc_le(6, addrs);
crc >>= 24; crc >>= 24;
hash_table[crc >> 4] |= 1 << (15 - (crc & 0xf)); hash_table[crc >> 4] |= 1 << (15 - (crc & 0xf));
} }
......
...@@ -1524,17 +1524,11 @@ static int happy_meal_init(struct happy_meal *hp) ...@@ -1524,17 +1524,11 @@ static int happy_meal_init(struct happy_meal *hp)
} else if ((hp->dev->flags & IFF_PROMISC) == 0) { } else if ((hp->dev->flags & IFF_PROMISC) == 0) {
u16 hash_table[4]; u16 hash_table[4];
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
char *addrs;
u32 crc; u32 crc;
memset(hash_table, 0, sizeof(hash_table)); memset(hash_table, 0, sizeof(hash_table));
netdev_for_each_mc_addr(ha, hp->dev) { netdev_for_each_mc_addr(ha, hp->dev) {
addrs = ha->addr; crc = ether_crc_le(6, ha->addr);
if (!(*addrs & 1))
continue;
crc = ether_crc_le(6, addrs);
crc >>= 26; crc >>= 26;
hash_table[crc >> 4] |= 1 << (crc & 0xf); hash_table[crc >> 4] |= 1 << (crc & 0xf);
} }
...@@ -2361,7 +2355,6 @@ static void happy_meal_set_multicast(struct net_device *dev) ...@@ -2361,7 +2355,6 @@ static void happy_meal_set_multicast(struct net_device *dev)
struct happy_meal *hp = netdev_priv(dev); struct happy_meal *hp = netdev_priv(dev);
void __iomem *bregs = hp->bigmacregs; void __iomem *bregs = hp->bigmacregs;
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
char *addrs;
u32 crc; u32 crc;
spin_lock_irq(&hp->happy_lock); spin_lock_irq(&hp->happy_lock);
...@@ -2379,12 +2372,7 @@ static void happy_meal_set_multicast(struct net_device *dev) ...@@ -2379,12 +2372,7 @@ static void happy_meal_set_multicast(struct net_device *dev)
memset(hash_table, 0, sizeof(hash_table)); memset(hash_table, 0, sizeof(hash_table));
netdev_for_each_mc_addr(ha, dev) { netdev_for_each_mc_addr(ha, dev) {
addrs = ha->addr; crc = ether_crc_le(6, ha->addr);
if (!(*addrs & 1))
continue;
crc = ether_crc_le(6, addrs);
crc >>= 26; crc >>= 26;
hash_table[crc >> 4] |= 1 << (crc & 0xf); hash_table[crc >> 4] |= 1 << (crc & 0xf);
} }
......
...@@ -1170,7 +1170,6 @@ static void lance_load_multicast(struct net_device *dev) ...@@ -1170,7 +1170,6 @@ static void lance_load_multicast(struct net_device *dev)
{ {
struct lance_private *lp = netdev_priv(dev); struct lance_private *lp = netdev_priv(dev);
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
char *addrs;
u32 crc; u32 crc;
u32 val; u32 val;
...@@ -1195,12 +1194,7 @@ static void lance_load_multicast(struct net_device *dev) ...@@ -1195,12 +1194,7 @@ static void lance_load_multicast(struct net_device *dev)
/* Add addresses */ /* Add addresses */
netdev_for_each_mc_addr(ha, dev) { netdev_for_each_mc_addr(ha, dev) {
addrs = ha->addr; crc = ether_crc_le(6, ha->addr);
/* multicast address? */
if (!(*addrs & 1))
continue;
crc = ether_crc_le(6, addrs);
crc = crc >> 26; crc = crc >> 26;
if (lp->pio_buffer) { if (lp->pio_buffer) {
struct lance_init_block __iomem *ib = lp->init_block_iomem; struct lance_init_block __iomem *ib = lp->init_block_iomem;
......
...@@ -628,7 +628,6 @@ static void qe_set_multicast(struct net_device *dev) ...@@ -628,7 +628,6 @@ static void qe_set_multicast(struct net_device *dev)
struct sunqe *qep = netdev_priv(dev); struct sunqe *qep = netdev_priv(dev);
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
u8 new_mconfig = qep->mconfig; u8 new_mconfig = qep->mconfig;
char *addrs;
int i; int i;
u32 crc; u32 crc;
...@@ -651,11 +650,7 @@ static void qe_set_multicast(struct net_device *dev) ...@@ -651,11 +650,7 @@ static void qe_set_multicast(struct net_device *dev)
memset(hash_table, 0, sizeof(hash_table)); memset(hash_table, 0, sizeof(hash_table));
netdev_for_each_mc_addr(ha, dev) { netdev_for_each_mc_addr(ha, dev) {
addrs = ha->addr; crc = ether_crc_le(6, ha->addr);
if (!(*addrs & 1))
continue;
crc = ether_crc_le(6, addrs);
crc >>= 26; crc >>= 26;
hash_table[crc >> 4] |= 1 << (crc & 0xf); hash_table[crc >> 4] |= 1 << (crc & 0xf);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment