aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Korsgaard <jacmet@sunsite.dk>2007-11-22 06:25:13 -0500
committerJeff Garzik <jeff@garzik.org>2007-11-23 22:09:01 -0500
commit7b31f7ffa9ed7ba5fbe1cab8fb17a8c545e6a0eb (patch)
tree9851d34e83934a685ddf70f65c4ba17be7cf80e9
parent8b31cfbcd1b54362ef06c85beb40e65a349169a2 (diff)
smc911x: Fix multicast handling
smc911x_set_multicast_list fails to fill out the multicast hash table correctly; Bit 1 was used rather than bit 5 to decide if the lower or upper register should be used. The function is at the same time cleaned up by calling ether_crc rather than using it's own bit reversal table. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/net/smc911x.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 69a78b325767..1a3d80bfe9ea 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -1379,13 +1379,6 @@ static void smc911x_set_multicast_list(struct net_device *dev)
1379 unsigned int multicast_table[2]; 1379 unsigned int multicast_table[2];
1380 unsigned int mcr, update_multicast = 0; 1380 unsigned int mcr, update_multicast = 0;
1381 unsigned long flags; 1381 unsigned long flags;
1382 /* table for flipping the order of 5 bits */
1383 static const unsigned char invert5[] =
1384 {0x00, 0x10, 0x08, 0x18, 0x04, 0x14, 0x0C, 0x1C,
1385 0x02, 0x12, 0x0A, 0x1A, 0x06, 0x16, 0x0E, 0x1E,
1386 0x01, 0x11, 0x09, 0x19, 0x05, 0x15, 0x0D, 0x1D,
1387 0x03, 0x13, 0x0B, 0x1B, 0x07, 0x17, 0x0F, 0x1F};
1388
1389 1382
1390 DBG(SMC_DEBUG_FUNC, "%s: --> %s\n", dev->name, __FUNCTION__); 1383 DBG(SMC_DEBUG_FUNC, "%s: --> %s\n", dev->name, __FUNCTION__);
1391 1384
@@ -1432,7 +1425,7 @@ static void smc911x_set_multicast_list(struct net_device *dev)
1432 1425
1433 cur_addr = dev->mc_list; 1426 cur_addr = dev->mc_list;
1434 for (i = 0; i < dev->mc_count; i++, cur_addr = cur_addr->next) { 1427 for (i = 0; i < dev->mc_count; i++, cur_addr = cur_addr->next) {
1435 int position; 1428 u32 position;
1436 1429
1437 /* do we have a pointer here? */ 1430 /* do we have a pointer here? */
1438 if (!cur_addr) 1431 if (!cur_addr)
@@ -1442,12 +1435,10 @@ static void smc911x_set_multicast_list(struct net_device *dev)
1442 if (!(*cur_addr->dmi_addr & 1)) 1435 if (!(*cur_addr->dmi_addr & 1))
1443 continue; 1436 continue;
1444 1437
1445 /* only use the low order bits */ 1438 /* upper 6 bits are used as hash index */
1446 position = crc32_le(~0, cur_addr->dmi_addr, 6) & 0x3f; 1439 position = ether_crc(ETH_ALEN, cur_addr->dmi_addr)>>26;
1447 1440
1448 /* do some messy swapping to put the bit in the right spot */ 1441 multicast_table[position>>5] |= 1 << (position&0x1f);
1449 multicast_table[invert5[position&0x1F]&0x1] |=
1450 (1<<invert5[(position>>1)&0x1F]);
1451 } 1442 }
1452 1443
1453 /* be sure I get rid of flags I might have set */ 1444 /* be sure I get rid of flags I might have set */