Module Name:    src
Committed By:   tsutsui
Date:           Fri Sep 18 14:40:49 UTC 2009

Modified Files:
        src/sys/dev/sbus: be.c

Log Message:
Use the common ether_crc32_le() function for multicast hash.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/dev/sbus/be.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/sbus/be.c
diff -u src/sys/dev/sbus/be.c:1.73 src/sys/dev/sbus/be.c:1.74
--- src/sys/dev/sbus/be.c:1.73	Fri Sep 18 14:35:11 2009
+++ src/sys/dev/sbus/be.c	Fri Sep 18 14:40:49 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: be.c,v 1.73 2009/09/18 14:35:11 tsutsui Exp $	*/
+/*	$NetBSD: be.c,v 1.74 2009/09/18 14:40:49 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.73 2009/09/18 14:35:11 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.74 2009/09/18 14:40:49 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -1151,11 +1151,9 @@
 	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
 	bus_space_tag_t t = sc->sc_bustag;
 	bus_space_handle_t br = sc->sc_br;
+	uint32_t v;
 	uint32_t crc;
 	uint16_t hash[4];
-	uint8_t octet;
-	uint32_t v;
-	int i, j;
 	struct ether_multi *enm;
 	struct ether_multistep step;
 
@@ -1191,23 +1189,10 @@
 			goto chipit;
 		}
 
-		crc = 0xffffffff;
-
-		for (i = 0; i < ETHER_ADDR_LEN; i++) {
-			octet = enm->enm_addrlo[i];
-
-			for (j = 0; j < 8; j++) {
-				if ((crc & 1) ^ (octet & 1)) {
-					crc >>= 1;
-					crc ^= MC_POLY_LE;
-				}
-				else
-					crc >>= 1;
-				octet >>= 1;
-			}
-		}
-
+		crc = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN);
+		/* Just want the 6 most significant bits. */
 		crc >>= 26;
+
 		hash[crc >> 4] |= 1 << (crc & 0xf);
 		ETHER_NEXT_MULTI(step, enm);
 	}

Reply via email to