Author: ticso
Date: Mon Feb  7 01:13:57 2011
New Revision: 218387
URL: http://svn.freebsd.org/changeset/base/218387

Log:
  unbreak mutlicast hash creation for the second time.
  at91_emac hardware is *not* using ether_crc32_be algorithm!

Modified:
  head/sys/arm/at91/if_ate.c

Modified: head/sys/arm/at91/if_ate.c
==============================================================================
--- head/sys/arm/at91/if_ate.c  Sun Feb  6 23:34:09 2011        (r218386)
+++ head/sys/arm/at91/if_ate.c  Mon Feb  7 01:13:57 2011        (r218387)
@@ -433,6 +433,16 @@ ate_load_rx_buf(void *arg, bus_dma_segme
        bus_dmamap_sync(sc->rx_desc_tag, sc->rx_desc_map, 
BUS_DMASYNC_POSTWRITE);
 }
 
+static uint32_t
+ate_mac_hash(const uint8_t *buf)
+{
+       uint32_t index = 0;
+       for (int i = 0; i < 48; i++) {
+               index ^= ((buf[i >> 3] >> (i & 7)) & 1) << (i % 6);
+       }
+       return (index);
+}
+
 /*
  * Compute the multicast filter for this device.
  */
@@ -462,8 +472,8 @@ ate_setmcast(struct ate_softc *sc)
        TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
                if (ifma->ifma_addr->sa_family != AF_LINK)
                        continue;
-               index = ether_crc32_be(LLADDR((struct sockaddr_dl *)
-                   ifma->ifma_addr), ETHER_ADDR_LEN) >> 26;
+               index = ate_mac_hash(LLADDR((struct sockaddr_dl *)
+                   ifma->ifma_addr));
                af[index >> 3] |= 1 << (index & 7);
        }
        if_maddr_runlock(ifp);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to