From owner-svn-src-all@FreeBSD.ORG Mon Feb 7 01:13:57 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 742BF106564A; Mon, 7 Feb 2011 01:13:57 +0000 (UTC) (envelope-from ticso@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 63B868FC18; Mon, 7 Feb 2011 01:13:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p171DvQL092346; Mon, 7 Feb 2011 01:13:57 GMT (envelope-from ticso@svn.freebsd.org) Received: (from ticso@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p171Dvto092344; Mon, 7 Feb 2011 01:13:57 GMT (envelope-from ticso@svn.freebsd.org) Message-Id: <201102070113.p171Dvto092344@svn.freebsd.org> From: Bernd Walter Date: Mon, 7 Feb 2011 01:13:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r218387 - head/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Feb 2011 01:13:57 -0000 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);