Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Oct 2019 18:06:23 +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: r353811 - head/sys/dev/bfe
Message-ID:  <201910211806.x9LI6NVu065028@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Mon Oct 21 18:06:23 2019
New Revision: 353811
URL: https://svnweb.freebsd.org/changeset/base/353811

Log:
  Convert to if_foreach_llmaddr() KPI.

Modified:
  head/sys/dev/bfe/if_bfe.c

Modified: head/sys/dev/bfe/if_bfe.c
==============================================================================
--- head/sys/dev/bfe/if_bfe.c	Mon Oct 21 18:06:19 2019	(r353810)
+++ head/sys/dev/bfe/if_bfe.c	Mon Oct 21 18:06:23 2019	(r353811)
@@ -1080,13 +1080,21 @@ bfe_cam_write(struct bfe_softc *sc, u_char *data, int 
 	bfe_wait_bit(sc, BFE_CAM_CTRL, BFE_CAM_BUSY, 10000, 1);
 }
 
+static u_int
+bfe_write_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
+{
+	struct bfe_softc *sc = arg;
+
+	bfe_cam_write(sc, LLADDR(sdl), cnt + 1);
+
+	return (1);
+}
+
 static void
 bfe_set_rx_mode(struct bfe_softc *sc)
 {
 	struct ifnet *ifp = sc->bfe_ifp;
-	struct ifmultiaddr  *ifma;
 	u_int32_t val;
-	int i = 0;
 
 	BFE_LOCK_ASSERT(sc);
 
@@ -1104,20 +1112,13 @@ bfe_set_rx_mode(struct bfe_softc *sc)
 
 
 	CSR_WRITE_4(sc, BFE_CAM_CTRL, 0);
-	bfe_cam_write(sc, IF_LLADDR(sc->bfe_ifp), i++);
+	bfe_cam_write(sc, IF_LLADDR(sc->bfe_ifp), 0);
 
 	if (ifp->if_flags & IFF_ALLMULTI)
 		val |= BFE_RXCONF_ALLMULTI;
 	else {
 		val &= ~BFE_RXCONF_ALLMULTI;
-		if_maddr_rlock(ifp);
-		CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
-			if (ifma->ifma_addr->sa_family != AF_LINK)
-				continue;
-			bfe_cam_write(sc,
-			    LLADDR((struct sockaddr_dl *)ifma->ifma_addr), i++);
-		}
-		if_maddr_runlock(ifp);
+		if_foreach_llmaddr(ifp, bfe_write_maddr, sc);
 	}
 
 	CSR_WRITE_4(sc, BFE_RXCONF, val);



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