Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Mar 2010 16:37:17 +0000 (UTC)
From:      Bernd Walter <ticso@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r205124 - stable/8/sys/arm/at91
Message-ID:  <201003131637.o2DGbHU0073760@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003131637.o2DGbHU0073760>