Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Oops! We actually want the *lower* 6 bits of the...



details:   https://anonhg.NetBSD.org/src/rev/c39db63355e0
branches:  trunk
changeset: 486068:c39db63355e0
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Fri May 12 16:57:30 2000 +0000

description:
Oops!  We actually want the *lower* 6 bits of the crc32 of the multicast
address to generate the multicast filter bit index, not the upper 6.

Should address kern/8268.

diffstat:

 sys/dev/ic/smc83c170.c |  15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

diffs (43 lines):

diff -r a3d06b4cf355 -r c39db63355e0 sys/dev/ic/smc83c170.c
--- a/sys/dev/ic/smc83c170.c    Fri May 12 16:45:42 2000 +0000
+++ b/sys/dev/ic/smc83c170.c    Fri May 12 16:57:30 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: smc83c170.c,v 1.30 2000/05/12 16:45:43 thorpej Exp $   */
+/*     $NetBSD: smc83c170.c,v 1.31 2000/05/12 16:57:30 thorpej Exp $   */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -1319,14 +1319,14 @@
        struct ifnet *ifp = &sc->sc_ethercom.ec_if;
        struct ether_multi *enm;
        struct ether_multistep step;
-       u_int32_t crc, mchash[4];
+       u_int32_t hash, mchash[4];
 
        /*
         * Set up the multicast address filter by passing all multicast
-        * addresses through a CRC generator, and then using the high-order
+        * addresses through a CRC generator, and then using the low-order
         * 6 bits as an index into the 64 bit multicast hash table (only
         * the lower 16 bits of each 32 bit multicast hash register are
-        * valid).  The high order bit selects the register, while the
+        * valid).  The high order bits select the register, while the
         * rest of the bits select the bit within the register.
         */
 
@@ -1354,13 +1354,10 @@
                        goto allmulti;
                }
 
-               crc = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN);
-
-               /* Just want the 6 most significant bits. */
-               crc >>= 26;
+               hash = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN) & 0x3f;
 
                /* Set the corresponding bit in the hash table. */
-               mchash[crc >> 4] |= 1 << (crc & 0xf);
+               mchash[hash >> 4] |= 1 << (hash & 0xf);
 
                ETHER_NEXT_MULTI(step, enm);
        }



Home | Main Index | Thread Index | Old Index