Commit 498d8e236304a62a2774d7264bdff2c6e8102b5b
Committed by
David S. Miller
1 parent
40f5d72a4f
Exists in
master
and in
4 other branches
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: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 20 changed files with 35 additions and 141 deletions Side-by-side Diff
- 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
drivers/net/7990.c
... | ... | @@ -594,7 +594,6 @@ |
594 | 594 | volatile struct lance_init_block *ib = lp->init_block; |
595 | 595 | volatile u16 *mcast_table = (u16 *)&ib->filter; |
596 | 596 | struct netdev_hw_addr *ha; |
597 | - char *addrs; | |
598 | 597 | u32 crc; |
599 | 598 | |
600 | 599 | /* set all multicast bits */ |
... | ... | @@ -609,13 +608,7 @@ |
609 | 608 | |
610 | 609 | /* Add addresses */ |
611 | 610 | netdev_for_each_mc_addr(ha, dev) { |
612 | - addrs = ha->addr; | |
613 | - | |
614 | - /* multicast address? */ | |
615 | - if (!(*addrs & 1)) | |
616 | - continue; | |
617 | - | |
618 | - crc = ether_crc_le(6, addrs); | |
611 | + crc = ether_crc_le(6, ha->addr); | |
619 | 612 | crc = crc >> 26; |
620 | 613 | mcast_table [crc >> 4] |= 1 << (crc & 0xf); |
621 | 614 | } |
drivers/net/a2065.c
... | ... | @@ -587,7 +587,6 @@ |
587 | 587 | volatile struct lance_init_block *ib = lp->init_block; |
588 | 588 | volatile u16 *mcast_table = (u16 *)&ib->filter; |
589 | 589 | struct netdev_hw_addr *ha; |
590 | - char *addrs; | |
591 | 590 | u32 crc; |
592 | 591 | |
593 | 592 | /* set all multicast bits */ |
... | ... | @@ -602,13 +601,7 @@ |
602 | 601 | |
603 | 602 | /* Add addresses */ |
604 | 603 | netdev_for_each_mc_addr(ha, dev) { |
605 | - addrs = ha->addr; | |
606 | - | |
607 | - /* multicast address? */ | |
608 | - if (!(*addrs & 1)) | |
609 | - continue; | |
610 | - | |
611 | - crc = ether_crc_le(6, addrs); | |
604 | + crc = ether_crc_le(6, ha->addr); | |
612 | 605 | crc = crc >> 26; |
613 | 606 | mcast_table[crc >> 4] |= 1 << (crc & 0xf); |
614 | 607 | } |
drivers/net/bmac.c
... | ... | @@ -1015,7 +1015,6 @@ |
1015 | 1015 | static void bmac_set_multicast(struct net_device *dev) |
1016 | 1016 | { |
1017 | 1017 | struct netdev_hw_addr *ha; |
1018 | - char *addrs; | |
1019 | 1018 | int i; |
1020 | 1019 | unsigned short rx_cfg; |
1021 | 1020 | u32 crc; |
... | ... | @@ -1039,12 +1038,7 @@ |
1039 | 1038 | for(i = 0; i < 4; i++) hash_table[i] = 0; |
1040 | 1039 | |
1041 | 1040 | netdev_for_each_mc_addr(ha, dev) { |
1042 | - addrs = ha->addr; | |
1043 | - | |
1044 | - if(!(*addrs & 1)) | |
1045 | - continue; | |
1046 | - | |
1047 | - crc = ether_crc_le(6, addrs); | |
1041 | + crc = ether_crc_le(6, ha->addr); | |
1048 | 1042 | crc >>= 26; |
1049 | 1043 | hash_table[crc >> 4] |= 1 << (crc & 0xf); |
1050 | 1044 | } |
drivers/net/declance.c
... | ... | @@ -946,7 +946,6 @@ |
946 | 946 | struct lance_private *lp = netdev_priv(dev); |
947 | 947 | volatile u16 *ib = (volatile u16 *)dev->mem_start; |
948 | 948 | struct netdev_hw_addr *ha; |
949 | - char *addrs; | |
950 | 949 | u32 crc; |
951 | 950 | |
952 | 951 | /* set all multicast bits */ |
... | ... | @@ -965,13 +964,7 @@ |
965 | 964 | |
966 | 965 | /* Add addresses */ |
967 | 966 | netdev_for_each_mc_addr(ha, dev) { |
968 | - addrs = ha->addr; | |
969 | - | |
970 | - /* multicast address? */ | |
971 | - if (!(*addrs & 1)) | |
972 | - continue; | |
973 | - | |
974 | - crc = ether_crc_le(ETH_ALEN, addrs); | |
967 | + crc = ether_crc_le(ETH_ALEN, ha->addr); | |
975 | 968 | crc = crc >> 26; |
976 | 969 | *lib_ptr(ib, filter[crc >> 4], lp->type) |= 1 << (crc & 0xf); |
977 | 970 | } |
drivers/net/ewrk3.c
... | ... | @@ -1169,7 +1169,7 @@ |
1169 | 1169 | struct netdev_hw_addr *ha; |
1170 | 1170 | u_long iobase = dev->base_addr; |
1171 | 1171 | int i; |
1172 | - char *addrs, bit, byte; | |
1172 | + char bit, byte; | |
1173 | 1173 | short __iomem *p = lp->mctbl; |
1174 | 1174 | u16 hashcode; |
1175 | 1175 | u32 crc; |
1176 | 1176 | |
1177 | 1177 | |
1178 | 1178 | |
... | ... | @@ -1211,25 +1211,22 @@ |
1211 | 1211 | |
1212 | 1212 | /* Update table */ |
1213 | 1213 | netdev_for_each_mc_addr(ha, dev) { |
1214 | - addrs = ha->addr; | |
1215 | - if ((*addrs & 0x01) == 1) { /* multicast address? */ | |
1216 | - crc = ether_crc_le(ETH_ALEN, addrs); | |
1217 | - hashcode = crc & ((1 << 9) - 1); /* hashcode is 9 LSb of CRC */ | |
1214 | + crc = ether_crc_le(ETH_ALEN, ha->addr); | |
1215 | + hashcode = crc & ((1 << 9) - 1); /* hashcode is 9 LSb of CRC */ | |
1218 | 1216 | |
1219 | - byte = hashcode >> 3; /* bit[3-8] -> byte in filter */ | |
1220 | - bit = 1 << (hashcode & 0x07); /* bit[0-2] -> bit in byte */ | |
1217 | + byte = hashcode >> 3; /* bit[3-8] -> byte in filter */ | |
1218 | + bit = 1 << (hashcode & 0x07); /* bit[0-2] -> bit in byte */ | |
1221 | 1219 | |
1222 | - if (lp->shmem_length == IO_ONLY) { | |
1223 | - u_char tmp; | |
1220 | + if (lp->shmem_length == IO_ONLY) { | |
1221 | + u_char tmp; | |
1224 | 1222 | |
1225 | - outw(PAGE0_HTE + byte, EWRK3_PIR1); | |
1226 | - tmp = inb(EWRK3_DATA); | |
1227 | - tmp |= bit; | |
1228 | - outw(PAGE0_HTE + byte, EWRK3_PIR1); | |
1229 | - outb(tmp, EWRK3_DATA); | |
1230 | - } else { | |
1231 | - writeb(readb(lp->mctbl + byte) | bit, lp->mctbl + byte); | |
1232 | - } | |
1223 | + outw(PAGE0_HTE + byte, EWRK3_PIR1); | |
1224 | + tmp = inb(EWRK3_DATA); | |
1225 | + tmp |= bit; | |
1226 | + outw(PAGE0_HTE + byte, EWRK3_PIR1); | |
1227 | + outb(tmp, EWRK3_DATA); | |
1228 | + } else { | |
1229 | + writeb(readb(lp->mctbl + byte) | bit, lp->mctbl + byte); | |
1233 | 1230 | } |
1234 | 1231 | } |
1235 | 1232 | } |
drivers/net/fec.c
... | ... | @@ -1227,10 +1227,6 @@ |
1227 | 1227 | writel(0, fep->hwp + FEC_GRP_HASH_TABLE_LOW); |
1228 | 1228 | |
1229 | 1229 | netdev_for_each_mc_addr(ha, ndev) { |
1230 | - /* Only support group multicast for now */ | |
1231 | - if (!(ha->addr[0] & 1)) | |
1232 | - continue; | |
1233 | - | |
1234 | 1230 | /* calculate crc32 value of mac address */ |
1235 | 1231 | crc = 0xffffffff; |
1236 | 1232 |
drivers/net/hp100.c
... | ... | @@ -2103,20 +2103,18 @@ |
2103 | 2103 | #endif |
2104 | 2104 | netdev_for_each_mc_addr(ha, dev) { |
2105 | 2105 | addrs = ha->addr; |
2106 | - if ((*addrs & 0x01) == 0x01) { /* multicast address? */ | |
2107 | 2106 | #ifdef HP100_DEBUG |
2108 | - printk("hp100: %s: multicast = %pM, ", | |
2109 | - dev->name, addrs); | |
2107 | + printk("hp100: %s: multicast = %pM, ", | |
2108 | + dev->name, addrs); | |
2110 | 2109 | #endif |
2111 | - for (i = idx = 0; i < 6; i++) { | |
2112 | - idx ^= *addrs++ & 0x3f; | |
2113 | - printk(":%02x:", idx); | |
2114 | - } | |
2110 | + for (i = idx = 0; i < 6; i++) { | |
2111 | + idx ^= *addrs++ & 0x3f; | |
2112 | + printk(":%02x:", idx); | |
2113 | + } | |
2115 | 2114 | #ifdef HP100_DEBUG |
2116 | - printk("idx = %i\n", idx); | |
2115 | + printk("idx = %i\n", idx); | |
2117 | 2116 | #endif |
2118 | - lp->hash_bytes[idx >> 3] |= (1 << (idx & 7)); | |
2119 | - } | |
2117 | + lp->hash_bytes[idx >> 3] |= (1 << (idx & 7)); | |
2120 | 2118 | } |
2121 | 2119 | } |
2122 | 2120 | #else |
drivers/net/ioc3-eth.c
... | ... | @@ -1664,12 +1664,7 @@ |
1664 | 1664 | ip->ehar_l = 0xffffffff; |
1665 | 1665 | } else { |
1666 | 1666 | netdev_for_each_mc_addr(ha, dev) { |
1667 | - char *addr = ha->addr; | |
1668 | - | |
1669 | - if (!(*addr & 1)) | |
1670 | - continue; | |
1671 | - | |
1672 | - ehar |= (1UL << ioc3_hash(addr)); | |
1667 | + ehar |= (1UL << ioc3_hash(ha->addr)); | |
1673 | 1668 | } |
1674 | 1669 | ip->ehar_h = ehar >> 32; |
1675 | 1670 | ip->ehar_l = ehar & 0xffffffff; |
drivers/net/korina.c
... | ... | @@ -504,12 +504,7 @@ |
504 | 504 | hash_table[i] = 0; |
505 | 505 | |
506 | 506 | netdev_for_each_mc_addr(ha, dev) { |
507 | - char *addrs = ha->addr; | |
508 | - | |
509 | - if (!(*addrs & 1)) | |
510 | - continue; | |
511 | - | |
512 | - crc = ether_crc_le(6, addrs); | |
507 | + crc = ether_crc_le(6, ha->addr); | |
513 | 508 | crc >>= 26; |
514 | 509 | hash_table[crc >> 4] |= 1 << (15 - (crc & 0xf)); |
515 | 510 | } |
drivers/net/ks8851_mll.c
drivers/net/ksz884x.c
drivers/net/pcnet32.c
... | ... | @@ -2570,7 +2570,6 @@ |
2570 | 2570 | volatile __le16 *mcast_table = (__le16 *)ib->filter; |
2571 | 2571 | struct netdev_hw_addr *ha; |
2572 | 2572 | unsigned long ioaddr = dev->base_addr; |
2573 | - char *addrs; | |
2574 | 2573 | int i; |
2575 | 2574 | u32 crc; |
2576 | 2575 | |
... | ... | @@ -2590,13 +2589,7 @@ |
2590 | 2589 | |
2591 | 2590 | /* Add addresses */ |
2592 | 2591 | netdev_for_each_mc_addr(ha, dev) { |
2593 | - addrs = ha->addr; | |
2594 | - | |
2595 | - /* multicast address? */ | |
2596 | - if (!(*addrs & 1)) | |
2597 | - continue; | |
2598 | - | |
2599 | - crc = ether_crc_le(6, addrs); | |
2592 | + crc = ether_crc_le(6, ha->addr); | |
2600 | 2593 | crc = crc >> 26; |
2601 | 2594 | mcast_table[crc >> 4] |= cpu_to_le16(1 << (crc & 0xf)); |
2602 | 2595 | } |
drivers/net/smc911x.c
... | ... | @@ -1351,11 +1351,6 @@ |
1351 | 1351 | netdev_for_each_mc_addr(ha, dev) { |
1352 | 1352 | u32 position; |
1353 | 1353 | |
1354 | - /* make sure this is a multicast address - | |
1355 | - shouldn't this be a given if we have it here ? */ | |
1356 | - if (!(*ha->addr & 1)) | |
1357 | - continue; | |
1358 | - | |
1359 | 1354 | /* upper 6 bits are used as hash index */ |
1360 | 1355 | position = ether_crc(ETH_ALEN, ha->addr)>>26; |
1361 | 1356 |
drivers/net/smc9194.c
... | ... | @@ -447,11 +447,6 @@ |
447 | 447 | netdev_for_each_mc_addr(ha, dev) { |
448 | 448 | int position; |
449 | 449 | |
450 | - /* make sure this is a multicast address - shouldn't this | |
451 | - be a given if we have it here ? */ | |
452 | - if (!(*ha->addr & 1)) | |
453 | - continue; | |
454 | - | |
455 | 450 | /* only use the low order bits */ |
456 | 451 | position = ether_crc_le(6, ha->addr) & 0x3f; |
457 | 452 |
drivers/net/smc91x.c
... | ... | @@ -1425,11 +1425,6 @@ |
1425 | 1425 | netdev_for_each_mc_addr(ha, dev) { |
1426 | 1426 | int position; |
1427 | 1427 | |
1428 | - /* make sure this is a multicast address - | |
1429 | - shouldn't this be a given if we have it here ? */ | |
1430 | - if (!(*ha->addr & 1)) | |
1431 | - continue; | |
1432 | - | |
1433 | 1428 | /* only use the low order bits */ |
1434 | 1429 | position = crc32_le(~0, ha->addr, 6) & 0x3f; |
1435 | 1430 |
drivers/net/sunbmac.c
... | ... | @@ -998,7 +998,6 @@ |
998 | 998 | struct bigmac *bp = netdev_priv(dev); |
999 | 999 | void __iomem *bregs = bp->bregs; |
1000 | 1000 | struct netdev_hw_addr *ha; |
1001 | - char *addrs; | |
1002 | 1001 | int i; |
1003 | 1002 | u32 tmp, crc; |
1004 | 1003 | |
... | ... | @@ -1027,12 +1026,7 @@ |
1027 | 1026 | hash_table[i] = 0; |
1028 | 1027 | |
1029 | 1028 | netdev_for_each_mc_addr(ha, dev) { |
1030 | - addrs = ha->addr; | |
1031 | - | |
1032 | - if (!(*addrs & 1)) | |
1033 | - continue; | |
1034 | - | |
1035 | - crc = ether_crc_le(6, addrs); | |
1029 | + crc = ether_crc_le(6, ha->addr); | |
1036 | 1030 | crc >>= 26; |
1037 | 1031 | hash_table[crc >> 4] |= 1 << (crc & 0xf); |
1038 | 1032 | } |
drivers/net/sungem.c
... | ... | @@ -1802,12 +1802,7 @@ |
1802 | 1802 | |
1803 | 1803 | memset(hash_table, 0, sizeof(hash_table)); |
1804 | 1804 | netdev_for_each_mc_addr(ha, gp->dev) { |
1805 | - char *addrs = ha->addr; | |
1806 | - | |
1807 | - if (!(*addrs & 1)) | |
1808 | - continue; | |
1809 | - | |
1810 | - crc = ether_crc_le(6, addrs); | |
1805 | + crc = ether_crc_le(6, ha->addr); | |
1811 | 1806 | crc >>= 24; |
1812 | 1807 | hash_table[crc >> 4] |= 1 << (15 - (crc & 0xf)); |
1813 | 1808 | } |
drivers/net/sunhme.c
... | ... | @@ -1524,17 +1524,11 @@ |
1524 | 1524 | } else if ((hp->dev->flags & IFF_PROMISC) == 0) { |
1525 | 1525 | u16 hash_table[4]; |
1526 | 1526 | struct netdev_hw_addr *ha; |
1527 | - char *addrs; | |
1528 | 1527 | u32 crc; |
1529 | 1528 | |
1530 | 1529 | memset(hash_table, 0, sizeof(hash_table)); |
1531 | 1530 | netdev_for_each_mc_addr(ha, hp->dev) { |
1532 | - addrs = ha->addr; | |
1533 | - | |
1534 | - if (!(*addrs & 1)) | |
1535 | - continue; | |
1536 | - | |
1537 | - crc = ether_crc_le(6, addrs); | |
1531 | + crc = ether_crc_le(6, ha->addr); | |
1538 | 1532 | crc >>= 26; |
1539 | 1533 | hash_table[crc >> 4] |= 1 << (crc & 0xf); |
1540 | 1534 | } |
... | ... | @@ -2361,7 +2355,6 @@ |
2361 | 2355 | struct happy_meal *hp = netdev_priv(dev); |
2362 | 2356 | void __iomem *bregs = hp->bigmacregs; |
2363 | 2357 | struct netdev_hw_addr *ha; |
2364 | - char *addrs; | |
2365 | 2358 | u32 crc; |
2366 | 2359 | |
2367 | 2360 | spin_lock_irq(&hp->happy_lock); |
... | ... | @@ -2379,12 +2372,7 @@ |
2379 | 2372 | |
2380 | 2373 | memset(hash_table, 0, sizeof(hash_table)); |
2381 | 2374 | netdev_for_each_mc_addr(ha, dev) { |
2382 | - addrs = ha->addr; | |
2383 | - | |
2384 | - if (!(*addrs & 1)) | |
2385 | - continue; | |
2386 | - | |
2387 | - crc = ether_crc_le(6, addrs); | |
2375 | + crc = ether_crc_le(6, ha->addr); | |
2388 | 2376 | crc >>= 26; |
2389 | 2377 | hash_table[crc >> 4] |= 1 << (crc & 0xf); |
2390 | 2378 | } |
drivers/net/sunlance.c
... | ... | @@ -1170,7 +1170,6 @@ |
1170 | 1170 | { |
1171 | 1171 | struct lance_private *lp = netdev_priv(dev); |
1172 | 1172 | struct netdev_hw_addr *ha; |
1173 | - char *addrs; | |
1174 | 1173 | u32 crc; |
1175 | 1174 | u32 val; |
1176 | 1175 | |
... | ... | @@ -1195,12 +1194,7 @@ |
1195 | 1194 | |
1196 | 1195 | /* Add addresses */ |
1197 | 1196 | netdev_for_each_mc_addr(ha, dev) { |
1198 | - addrs = ha->addr; | |
1199 | - | |
1200 | - /* multicast address? */ | |
1201 | - if (!(*addrs & 1)) | |
1202 | - continue; | |
1203 | - crc = ether_crc_le(6, addrs); | |
1197 | + crc = ether_crc_le(6, ha->addr); | |
1204 | 1198 | crc = crc >> 26; |
1205 | 1199 | if (lp->pio_buffer) { |
1206 | 1200 | struct lance_init_block __iomem *ib = lp->init_block_iomem; |
drivers/net/sunqe.c
... | ... | @@ -628,7 +628,6 @@ |
628 | 628 | struct sunqe *qep = netdev_priv(dev); |
629 | 629 | struct netdev_hw_addr *ha; |
630 | 630 | u8 new_mconfig = qep->mconfig; |
631 | - char *addrs; | |
632 | 631 | int i; |
633 | 632 | u32 crc; |
634 | 633 | |
... | ... | @@ -651,11 +650,7 @@ |
651 | 650 | |
652 | 651 | memset(hash_table, 0, sizeof(hash_table)); |
653 | 652 | netdev_for_each_mc_addr(ha, dev) { |
654 | - addrs = ha->addr; | |
655 | - | |
656 | - if (!(*addrs & 1)) | |
657 | - continue; | |
658 | - crc = ether_crc_le(6, addrs); | |
653 | + crc = ether_crc_le(6, ha->addr); | |
659 | 654 | crc >>= 26; |
660 | 655 | hash_table[crc >> 4] |= 1 << (crc & 0xf); |
661 | 656 | } |