Date: Mon, 14 Oct 2019 20:30:44 +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: r353513 - head/sys/dev/usb/net Message-ID: <201910142030.x9EKUiYO070752@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: glebius Date: Mon Oct 14 20:30:44 2019 New Revision: 353513 URL: https://svnweb.freebsd.org/changeset/base/353513 Log: Convert to if_foreach_llmaddr() KPI. Reviewed by: hselasky Modified: head/sys/dev/usb/net/if_mos.c Modified: head/sys/dev/usb/net/if_mos.c ============================================================================== --- head/sys/dev/usb/net/if_mos.c Mon Oct 14 20:30:30 2019 (r353512) +++ head/sys/dev/usb/net/if_mos.c Mon Oct 14 20:30:44 2019 (r353513) @@ -589,16 +589,23 @@ mos_setpromisc(struct usb_ether *ue) mos_reg_write_1(sc, MOS_CTL, rxmode); } +static u_int +mos_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint8_t *hashtbl = arg; + uint32_t h; + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26; + hashtbl[h / 8] |= 1 << (h % 8); + return (1); +} + static void mos_setmulti(struct usb_ether *ue) { struct mos_softc *sc = uether_getsc(ue); struct ifnet *ifp = uether_getifp(ue); - struct ifmultiaddr *ifma; - - uint32_t h = 0; uint8_t rxmode; uint8_t hashtbl[8] = {0, 0, 0, 0, 0, 0, 0, 0}; int allmulti = 0; @@ -611,17 +618,7 @@ mos_setmulti(struct usb_ether *ue) allmulti = 1; /* get all new ones */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) { - allmulti = 1; - continue; - } - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; - hashtbl[h / 8] |= 1 << (h % 8); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, mos_hash_maddr, &hashtbl); /* now program new ones */ if (allmulti == 1) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910142030.x9EKUiYO070752>