Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Oct 2019 18:12:27 +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: r353857 - head/sys/dev/qlxge
Message-ID:  <201910211812.x9LICRg7072666@repo.freebsd.org>

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

Log:
  Convert to if_foreach_llmaddr() KPI.

Modified:
  head/sys/dev/qlxge/qls_os.c

Modified: head/sys/dev/qlxge/qls_os.c
==============================================================================
--- head/sys/dev/qlxge/qls_os.c	Mon Oct 21 18:12:21 2019	(r353856)
+++ head/sys/dev/qlxge/qls_os.c	Mon Oct 21 18:12:26 2019	(r353857)
@@ -835,31 +835,27 @@ qls_init(void *arg)
 	QL_DPRINT2((ha->pci_dev, "%s: exit\n", __func__));
 }
 
+static u_int
+qls_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int mcnt)
+{
+	uint8_t *mta = arg;
+
+	if (mcnt == Q8_MAX_NUM_MULTICAST_ADDRS)
+		return (0);
+
+	bcopy(LLADDR(sdl), &mta[mcnt * Q8_MAC_ADDR_LEN], Q8_MAC_ADDR_LEN);
+
+	return (1);
+}
+
 static void
 qls_set_multi(qla_host_t *ha, uint32_t add_multi)
 {
 	uint8_t mta[Q8_MAX_NUM_MULTICAST_ADDRS * Q8_MAC_ADDR_LEN];
-	struct ifmultiaddr *ifma;
-	int mcnt = 0;
 	struct ifnet *ifp = ha->ifp;
+	int mcnt;
 
-	if_maddr_rlock(ifp);
-
-	CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
-
-		if (ifma->ifma_addr->sa_family != AF_LINK)
-			continue;
-
-		if (mcnt == Q8_MAX_NUM_MULTICAST_ADDRS)
-			break;
-
-		bcopy(LLADDR((struct sockaddr_dl *) ifma->ifma_addr),
-			&mta[mcnt * Q8_MAC_ADDR_LEN], Q8_MAC_ADDR_LEN);
-
-		mcnt++;
-	}
-
-	if_maddr_runlock(ifp);
+	mcnt = if_foreach_llmaddr(ifp, qls_copy_maddr, mta);
 
 	if (QLA_LOCK(ha, __func__, 1) == 0) {
 		qls_hw_set_multi(ha, mta, mcnt, add_multi);



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