Date: Mon, 21 Oct 2019 18:12:17 +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: r353855 - head/sys/dev/qlxgb Message-ID: <201910211812.x9LICHXk072566@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: glebius Date: Mon Oct 21 18:12:17 2019 New Revision: 353855 URL: https://svnweb.freebsd.org/changeset/base/353855 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/qlxgb/qla_os.c Modified: head/sys/dev/qlxgb/qla_os.c ============================================================================== --- head/sys/dev/qlxgb/qla_os.c Mon Oct 21 18:12:12 2019 (r353854) +++ head/sys/dev/qlxgb/qla_os.c Mon Oct 21 18:12:17 2019 (r353855) @@ -763,32 +763,26 @@ qla_init(void *arg) QL_DPRINT2((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 void 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 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, qla_copy_maddr, mta); qla_hw_set_multi(ha, mta, mcnt, add_multi); return;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910211812.x9LICHXk072566>