svn commit: r353856 - head/sys/dev/qlxgbe
Gleb Smirnoff
glebius at FreeBSD.org
Mon Oct 21 18:12:22 UTC 2019
Author: glebius
Date: Mon Oct 21 18:12:21 2019
New Revision: 353856
URL: https://svnweb.freebsd.org/changeset/base/353856
Log:
Convert to if_foreach_llmaddr() KPI.
Modified:
head/sys/dev/qlxgbe/ql_os.c
Modified: head/sys/dev/qlxgbe/ql_os.c
==============================================================================
--- head/sys/dev/qlxgbe/ql_os.c Mon Oct 21 18:12:17 2019 (r353855)
+++ head/sys/dev/qlxgbe/ql_os.c Mon Oct 21 18:12:21 2019 (r353856)
@@ -977,32 +977,28 @@ qla_init(void *arg)
QL_DPRINT2(ha, (ha->pci_dev, "%s: exit\n", __func__));
}
+static u_int
+qla_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 int
qla_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 ret = 0;
- 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, qla_copy_maddr, mta);
if (QLA_LOCK(ha, __func__, QLA_LOCK_DEFAULT_MS_TIMEOUT,
QLA_LOCK_NO_SLEEP) != 0)
More information about the svn-src-all
mailing list