Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Oct 2019 20:32:29 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r353519 - head/sys/dev/usb/net
Message-ID:  <201910142032.x9EKWTLq076184@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Mon Oct 14 20:32:28 2019
New Revision: 353519
URL: https://svnweb.freebsd.org/changeset/base/353519

Log:
  Convert to if_foreach_llmaddr() KPI.
  
  Reviewed by:	hselasky

Modified:
  head/sys/dev/usb/net/if_aue.c

Modified: head/sys/dev/usb/net/if_aue.c
==============================================================================
--- head/sys/dev/usb/net/if_aue.c	Mon Oct 14 20:32:11 2019	(r353518)
+++ head/sys/dev/usb/net/if_aue.c	Mon Oct 14 20:32:28 2019	(r353519)
@@ -540,13 +540,23 @@ aue_miibus_statchg(device_t dev)
 }
 
 #define	AUE_BITS	6
+static u_int
+aue_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
+{
+	uint8_t *hashtbl = arg;
+	uint32_t h;
+
+	h = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN) & ((1 << AUE_BITS) - 1);
+	hashtbl[(h >> 3)] |=  1 << (h & 0x7);
+
+	return (1);
+}
+
 static void
 aue_setmulti(struct usb_ether *ue)
 {
 	struct aue_softc *sc = uether_getsc(ue);
 	struct ifnet *ifp = uether_getifp(ue);
-	struct ifmultiaddr *ifma;
-	uint32_t h = 0;
 	uint32_t i;
 	uint8_t hashtbl[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
 
@@ -560,15 +570,7 @@ aue_setmulti(struct usb_ether *ue)
 	AUE_CLRBIT(sc, AUE_CTL0, AUE_CTL0_ALLMULTI);
 
 	/* now program new ones */
-	if_maddr_rlock(ifp);
-	CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
-		if (ifma->ifma_addr->sa_family != AF_LINK)
-			continue;
-		h = ether_crc32_le(LLADDR((struct sockaddr_dl *)
-		    ifma->ifma_addr), ETHER_ADDR_LEN) & ((1 << AUE_BITS) - 1);
-		hashtbl[(h >> 3)] |=  1 << (h & 0x7);
-	}
-	if_maddr_runlock(ifp);
+	if_foreach_llmaddr(ifp, aue_hash_maddr, hashtbl);
 
 	/* write the hashtable */
 	for (i = 0; i != 8; i++)



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