svn commit: r205124 - stable/8/sys/arm/at91
Bernd Walter
ticso at FreeBSD.org
Sat Mar 13 16:37:18 UTC 2010
Author: ticso
Date: Sat Mar 13 16:37:17 2010
New Revision: 205124
URL: http://svn.freebsd.org/changeset/base/205124
Log:
MFC 204462,204463,204476: fix multicast hashes
Modified:
stable/8/sys/arm/at91/if_ate.c
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
stable/8/sys/dev/xen/xenpci/ (props changed)
Modified: stable/8/sys/arm/at91/if_ate.c
==============================================================================
--- stable/8/sys/arm/at91/if_ate.c Sat Mar 13 16:15:15 2010 (r205123)
+++ stable/8/sys/arm/at91/if_ate.c Sat Mar 13 16:37:17 2010 (r205124)
@@ -383,6 +383,16 @@ ate_load_rx_buf(void *arg, bus_dma_segme
bus_dmamap_sync(sc->rxtag, sc->rx_map[i], BUS_DMASYNC_PREREAD);
}
+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 using the standard
* algorithm. I wonder why this isn't in ether somewhere as a lot
@@ -417,8 +427,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);
More information about the svn-src-stable-8
mailing list