Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/wi/if_wi.c
Show First 20 Lines • Show All 1,500 Lines • ▼ Show 20 Lines | default: | ||||
DPRINTF(("wi_info_intr: got fid %x type %x len %d\n", fid, | DPRINTF(("wi_info_intr: got fid %x type %x len %d\n", fid, | ||||
le16toh(ltbuf[1]), le16toh(ltbuf[0]))); | le16toh(ltbuf[1]), le16toh(ltbuf[0]))); | ||||
break; | break; | ||||
} | } | ||||
finish: | finish: | ||||
CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_INFO); | CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_INFO); | ||||
} | } | ||||
struct wi_mcast_ctx { | |||||
struct wi_mcast mlist; | |||||
int mcnt; | |||||
}; | |||||
static u_int | |||||
wi_copy_mcast(void *arg, struct sockaddr_dl *sdl, u_int count) | |||||
{ | |||||
struct wi_mcast_ctx *ctx = arg; | |||||
if (ctx->mcnt >= 16) | |||||
return (0); | |||||
IEEE80211_ADDR_COPY(&ctx->mlist.wi_mcast[ctx->mcnt++], LLADDR(sdl)); | |||||
return (1); | |||||
} | |||||
static int | static int | ||||
wi_write_multi(struct wi_softc *sc) | wi_write_multi(struct wi_softc *sc) | ||||
{ | { | ||||
struct ieee80211com *ic = &sc->sc_ic; | struct ieee80211com *ic = &sc->sc_ic; | ||||
struct ieee80211vap *vap; | struct ieee80211vap *vap; | ||||
struct wi_mcast mlist; | struct wi_mcast_ctx ctx; | ||||
int n; | |||||
if (ic->ic_allmulti > 0 || ic->ic_promisc > 0) { | if (ic->ic_allmulti > 0 || ic->ic_promisc > 0) { | ||||
allmulti: | allmulti: | ||||
memset(&mlist, 0, sizeof(mlist)); | memset(&ctx.mlist, 0, sizeof(ctx.mlist)); | ||||
return wi_write_rid(sc, WI_RID_MCAST_LIST, &mlist, | return wi_write_rid(sc, WI_RID_MCAST_LIST, &ctx.mlist, | ||||
sizeof(mlist)); | sizeof(ctx.mlist)); | ||||
} | } | ||||
n = 0; | ctx.mcnt = 0; | ||||
TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { | TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { | ||||
struct ifnet *ifp; | if_foreach_llmaddr(vap->iv_ifp, wi_copy_mcast, &ctx); | ||||
struct ifmultiaddr *ifma; | if (ctx.mcnt >= 16) | ||||
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; | |||||
if (n >= 16) | |||||
goto allmulti; | goto allmulti; | ||||
IEEE80211_ADDR_COPY(&mlist.wi_mcast[n], | |||||
(LLADDR((struct sockaddr_dl *)ifma->ifma_addr))); | |||||
n++; | |||||
} | } | ||||
if_maddr_runlock(ifp); | return wi_write_rid(sc, WI_RID_MCAST_LIST, &ctx.mlist, | ||||
} | IEEE80211_ADDR_LEN * ctx.mcnt); | ||||
return wi_write_rid(sc, WI_RID_MCAST_LIST, &mlist, | |||||
IEEE80211_ADDR_LEN * n); | |||||
} | } | ||||
static void | static void | ||||
wi_update_mcast(struct ieee80211com *ic) | wi_update_mcast(struct ieee80211com *ic) | ||||
{ | { | ||||
wi_write_multi(ic->ic_softc); | wi_write_multi(ic->ic_softc); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 529 Lines • Show Last 20 Lines |