Date: Mon, 14 Oct 2019 20:26:18 +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: r353506 - head/sys/dev/usb/wlan Message-ID: <201910142026.x9EKQIqn070182@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: glebius Date: Mon Oct 14 20:26:17 2019 New Revision: 353506 URL: https://svnweb.freebsd.org/changeset/base/353506 Log: Convert to if_foreach_llmaddr() KPI. Reviewed by: hselasky Modified: head/sys/dev/usb/wlan/if_zyd.c Modified: head/sys/dev/usb/wlan/if_zyd.c ============================================================================== --- head/sys/dev/usb/wlan/if_zyd.c Mon Oct 14 20:23:16 2019 (r353505) +++ head/sys/dev/usb/wlan/if_zyd.c Mon Oct 14 20:26:17 2019 (r353506) @@ -1970,49 +1970,48 @@ fail: return (error); } +static u_int +zyd_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *hash = arg; + uint8_t v; + + v = ((uint8_t *)LLADDR(sdl))[5] >> 2; + if (v < 32) + hash[0] |= 1 << v; + else + hash[1] |= 1 << (v - 32); + + return (1); +} + static void zyd_set_multi(struct zyd_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; - uint32_t low, high; + uint32_t hash[2]; int error; if ((sc->sc_flags & ZYD_FLAG_RUNNING) == 0) return; - low = 0x00000000; - high = 0x80000000; + hash[0] = 0x00000000; + hash[1] = 0x80000000; if (ic->ic_opmode == IEEE80211_M_MONITOR || ic->ic_allmulti > 0 || ic->ic_promisc > 0) { - low = 0xffffffff; - high = 0xffffffff; + hash[0] = 0xffffffff; + hash[1] = 0xffffffff; } else { struct ieee80211vap *vap; - struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint8_t v; - TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { - ifp = vap->iv_ifp; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - v = ((uint8_t *)LLADDR((struct sockaddr_dl *) - ifma->ifma_addr))[5] >> 2; - if (v < 32) - low |= 1 << v; - else - high |= 1 << (v - 32); - } - if_maddr_runlock(ifp); - } + TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) + if_foreach_llmaddr(vap->iv_ifp, zyd_hash_maddr, &hash); } /* reprogram multicast global hash table */ - zyd_write32_m(sc, ZYD_MAC_GHTBL, low); - zyd_write32_m(sc, ZYD_MAC_GHTBH, high); + zyd_write32_m(sc, ZYD_MAC_GHTBL, hash[0]); + zyd_write32_m(sc, ZYD_MAC_GHTBH, hash[1]); fail: if (error != 0) device_printf(sc->sc_dev,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910142026.x9EKQIqn070182>