diff options
author | Gleb Smirnoff <glebius@FreeBSD.org> | 2019-10-21 18:06:53 +0000 |
---|---|---|
committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2019-10-21 18:06:53 +0000 |
commit | 1d15d9f065dc59326ebd66646675f0f9e9c72290 (patch) | |
tree | 37a1e2064881e599cdc44e1a9a440875353232fc /sys/dev/fxp | |
parent | 349ecfc38aa2c6bb74fe2aaa1c768e0380647632 (diff) |
Convert to if_foreach_llmaddr() KPI.
Notes
Notes:
svn path=/head/; revision=353814
Diffstat (limited to 'sys/dev/fxp')
-rw-r--r-- | sys/dev/fxp/if_fxp.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c index 1a1fba6fc0dc..a764e0576a49 100644 --- a/sys/dev/fxp/if_fxp.c +++ b/sys/dev/fxp/if_fxp.c @@ -245,7 +245,7 @@ static void fxp_discard_rfabuf(struct fxp_softc *sc, struct fxp_rx *rxp); static int fxp_new_rfabuf(struct fxp_softc *sc, struct fxp_rx *rxp); -static int fxp_mc_addrs(struct fxp_softc *sc); +static void fxp_mc_addrs(struct fxp_softc *sc); static void fxp_mc_setup(struct fxp_softc *sc); static uint16_t fxp_eeprom_getword(struct fxp_softc *sc, int offset, int autosize); @@ -2976,27 +2976,37 @@ fxp_ioctl(if_t ifp, u_long command, caddr_t data) return (error); } +static u_int +fxp_setup_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct fxp_softc *sc = arg; + struct fxp_cb_mcs *mcsp = sc->mcsp; + + if (mcsp->mc_cnt < MAXMCADDR) + bcopy(LLADDR(sdl), mcsp->mc_addr[mcsp->mc_cnt * ETHER_ADDR_LEN], + ETHER_ADDR_LEN); + mcsp->mc_cnt++; + return (1); +} + /* * Fill in the multicast address list and return number of entries. */ -static int +static void fxp_mc_addrs(struct fxp_softc *sc) { struct fxp_cb_mcs *mcsp = sc->mcsp; if_t ifp = sc->ifp; - int nmcasts = 0; if ((if_getflags(ifp) & IFF_ALLMULTI) == 0) { - if_maddr_rlock(ifp); - if_setupmultiaddr(ifp, mcsp->mc_addr, &nmcasts, MAXMCADDR); - if (nmcasts >= MAXMCADDR) { + mcsp->mc_cnt = 0; + if_foreach_llmaddr(sc->ifp, fxp_setup_maddr, sc); + if (mcsp->mc_cnt >= MAXMCADDR) { if_setflagbits(ifp, IFF_ALLMULTI, 0); - nmcasts = 0; + mcsp->mc_cnt = 0; } - if_maddr_runlock(ifp); } - mcsp->mc_cnt = htole16(nmcasts * ETHER_ADDR_LEN); - return (nmcasts); + mcsp->mc_cnt = htole16(mcsp->mc_cnt * ETHER_ADDR_LEN); } /* |