Date: Mon, 7 Feb 2011 01:13:57 +0000 (UTC) From: Bernd Walter <ticso@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r218387 - head/sys/arm/at91 Message-ID: <201102070113.p171Dvto092344@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102070113.p171Dvto092344>