diff options
author | phk <phk@FreeBSD.org> | 2001-02-06 10:12:15 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2001-02-06 10:12:15 +0000 |
commit | d214ae21714540c7d954bd861ed084fb157abeb9 (patch) | |
tree | 7c665d67872a65310572d737c33defbe1a63008e /sys | |
parent | 43450ced687857ec4a35796cfed2820c891c103d (diff) | |
download | FreeBSD-src-d214ae21714540c7d954bd861ed084fb157abeb9.zip FreeBSD-src-d214ae21714540c7d954bd861ed084fb157abeb9.tar.gz |
Convert if_multiaddrs from LIST to TAILQ so that it can be traversed
backwards in the three drivers which want to do that.
Reviewed by: mikeh
Diffstat (limited to 'sys')
45 files changed, 72 insertions, 108 deletions
diff --git a/sys/dev/awi/awi.c b/sys/dev/awi/awi.c index 77e22a6..4dab87b 100644 --- a/sys/dev/awi/awi.c +++ b/sys/dev/awi/awi.c @@ -791,7 +791,7 @@ awi_init(sc) #ifdef __FreeBSD__ if (ifp->if_amcount != 0) goto set_mib; - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; if (n == AWI_GROUP_ADDR_SIZE) diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c index f66e65d..7e57dae 100644 --- a/sys/dev/dc/if_dc.c +++ b/sys/dev/dc/if_dc.c @@ -1051,7 +1051,7 @@ void dc_setfilt_21143(sc) else DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI); - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = dc_crc_le(sc, @@ -1122,7 +1122,7 @@ void dc_setfilt_admtek(sc) return; /* now program new ones */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = dc_crc_be(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); @@ -1190,7 +1190,7 @@ void dc_setfilt_asix(sc) return; /* now program new ones */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = dc_crc_be(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); @@ -1244,7 +1244,7 @@ void dc_setfilt_xircom(sc) else DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI); - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = dc_crc_le(sc, diff --git a/sys/dev/de/if_de.c b/sys/dev/de/if_de.c index 714947b..4f41a34 100644 --- a/sys/dev/de/if_de.c +++ b/sys/dev/de/if_de.c @@ -3012,7 +3012,7 @@ tulip_addr_filter( #endif multicnt = 0; - LIST_FOREACH(ifma, &sc->tulip_if.if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &sc->tulip_if.if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family == AF_LINK) multicnt++; @@ -3040,7 +3040,7 @@ tulip_addr_filter( */ bzero(sc->tulip_setupdata, sizeof(sc->tulip_setupdata)); - LIST_FOREACH(ifma, &sc->tulip_if.if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &sc->tulip_if.if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -3090,7 +3090,7 @@ tulip_addr_filter( /* * Else can get perfect filtering for 16 addresses. */ - LIST_FOREACH(ifma, &sc->tulip_if.if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &sc->tulip_if.if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; addrp = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c index a8979aa..2c0967c 100644 --- a/sys/dev/ed/if_ed.c +++ b/sys/dev/ed/if_ed.c @@ -3286,7 +3286,7 @@ ds_getmcaf(sc, mcaf) mcaf[0] = 0; mcaf[1] = 0; - LIST_FOREACH(ifma, &sc->arpcom.ac_if.if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &sc->arpcom.ac_if.if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; index = ds_crc(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)) diff --git a/sys/dev/fe/if_fe.c b/sys/dev/fe/if_fe.c index a670a90..c11cbc6 100644 --- a/sys/dev/fe/if_fe.c +++ b/sys/dev/fe/if_fe.c @@ -2120,7 +2120,7 @@ fe_mcaf ( struct fe_softc *sc ) struct ifmultiaddr *ifma; filter = fe_filter_nothing; - LIST_FOREACH(ifma, &sc->arpcom.ac_if.if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &sc->arpcom.ac_if.if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; index = fe_hash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c index 0149221..8cc34ff 100644 --- a/sys/dev/fxp/if_fxp.c +++ b/sys/dev/fxp/if_fxp.c @@ -1907,7 +1907,7 @@ fxp_mc_setup(sc) nmcasts = 0; if (!sc->all_mcasts) { - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; if (nmcasts >= MAXMCADDR) { diff --git a/sys/dev/ie/if_ie.c b/sys/dev/ie/if_ie.c index ccc1f54..caed7d8 100644 --- a/sys/dev/ie/if_ie.c +++ b/sys/dev/ie/if_ie.c @@ -2150,7 +2150,7 @@ ie_mc_reset(int unit) * Step through the list of addresses. */ ie->mcast_count = 0; - LIST_FOREACH(ifma, &ie->arpcom.ac_if.if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ie->arpcom.ac_if.if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/dev/lnc/if_lnc.c b/sys/dev/lnc/if_lnc.c index f41c4ff..5031065 100644 --- a/sys/dev/lnc/if_lnc.c +++ b/sys/dev/lnc/if_lnc.c @@ -245,7 +245,7 @@ lnc_setladrf(struct lnc_softc *sc) */ bzero(sc->init_block->ladrf, MULTICAST_FILTER_LEN); - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/dev/pdq/pdq_ifsubr.c b/sys/dev/pdq/pdq_ifsubr.c index 3c437a8..32f2097 100644 --- a/sys/dev/pdq/pdq_ifsubr.c +++ b/sys/dev/pdq/pdq_ifsubr.c @@ -227,8 +227,8 @@ pdq_os_addr_fill( pdq_softc_t *sc = (pdq_softc_t *) pdq->pdq_os_ctx; struct ifmultiaddr *ifma; - for (ifma = LIST_FIRST(&sc->sc_if.if_multiaddrs); ifma && num_addrs > 0; - ifma = LIST_NEXT(ifma, ifma_link)) { + for (ifma = TAILQ_FIRST(&sc->sc_if.if_multiaddrs); ifma && num_addrs > 0; + ifma = TAILQ_NEXT(ifma, ifma_link)) { char *mcaddr; if (ifma->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/dev/ray/if_ray.c b/sys/dev/ray/if_ray.c index ea6a5cc..d28eb2d 100644 --- a/sys/dev/ray/if_ray.c +++ b/sys/dev/ray/if_ray.c @@ -2420,7 +2420,7 @@ ray_mcast(struct ray_softc *sc, struct ray_comq_entry *com) * The multicast list is only 16 items long so use promiscuous * mode and don't bother updating the multicast list. */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) if (count == 0) { ray_com_runq_done(sc); return; @@ -2438,7 +2438,7 @@ ray_mcast(struct ray_softc *sc, struct ray_comq_entry *com) SRAM_WRITE_FIELD_1(sc, com->c_ccs, ray_cmd_update_mcast, c_nmcast, count); bufp = RAY_HOST_TO_ECF_BASE; - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { SRAM_WRITE_REGION( sc, bufp, diff --git a/sys/dev/sf/if_sf.c b/sys/dev/sf/if_sf.c index fbaac99..2e1cacf 100644 --- a/sys/dev/sf/if_sf.c +++ b/sys/dev/sf/if_sf.c @@ -448,14 +448,7 @@ static void sf_setmulti(sc) SF_SETBIT(sc, SF_RXFILT, SF_RXFILT_ALLMULTI); } else { i = 1; - /* First find the tail of the list. */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (LIST_NEXT(ifma, ifma_link) == NULL) - break; - } - /* Now traverse the list backwards. */ - for (; ifma != NULL && ifma != (void *)&ifp->if_multiaddrs; - ifma = (struct ifmultiaddr *)ifma->ifma_link.le_prev) { + TAILQ_FOREACH_REVERSE(ifma, &ifp->if_multiaddrs, ifmultihead, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; /* diff --git a/sys/dev/sk/if_sk.c b/sys/dev/sk/if_sk.c index a6dba79..960b98b 100644 --- a/sys/dev/sk/if_sk.c +++ b/sys/dev/sk/if_sk.c @@ -557,14 +557,7 @@ static void sk_setmulti(sc_if) hashes[1] = 0xFFFFFFFF; } else { i = 1; - /* First find the tail of the list. */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (LIST_NEXT(ifma, ifma_link) == NULL) - break; - } - /* Now traverse the list backwards. */ - for (; ifma != NULL && ifma != (void *)&ifp->if_multiaddrs; - ifma = (struct ifmultiaddr *)ifma->ifma_link.le_prev) { + TAILQ_FOREACH_REVERSE(ifma, &ifp->if_multiaddrs, ifmultihead, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; /* diff --git a/sys/dev/sn/if_sn.c b/sys/dev/sn/if_sn.c index bd5e172..50a0f08 100644 --- a/sys/dev/sn/if_sn.c +++ b/sys/dev/sn/if_sn.c @@ -1461,7 +1461,7 @@ sn_getmcf(struct arpcom *ac, u_char *mcf) bzero(mcf, MCFSZ); - LIST_FOREACH(ifma, &ac->ac_if.if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ac->ac_if.if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) return 0; index = smc_crc(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)) & 0x3f; diff --git a/sys/dev/snc/dp83932.c b/sys/dev/snc/dp83932.c index 496cc3a..70da649 100644 --- a/sys/dev/snc/dp83932.c +++ b/sys/dev/snc/dp83932.c @@ -678,7 +678,7 @@ camprogram(sc) ifp->if_flags &= ~IFF_ALLMULTI; /* Loop through multicast addresses */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; if (mcount == MAXCAM) { diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c index 1d52547..b13f1ba 100644 --- a/sys/dev/ti/if_ti.c +++ b/sys/dev/ti/if_ti.c @@ -1081,7 +1081,7 @@ static void ti_setmulti(sc) } /* Now program new ones. */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; mc = malloc(sizeof(struct ti_mc_entry), M_DEVBUF, M_NOWAIT); diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c index 50856e6..81fcd14 100644 --- a/sys/dev/usb/if_aue.c +++ b/sys/dev/usb/if_aue.c @@ -538,7 +538,7 @@ Static void aue_setmulti(sc) csr_write_1(sc, AUE_MAR0 + i, 0); /* now program new ones */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = aue_crc(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c index 9a03646..0395022 100644 --- a/sys/dev/usb/if_cue.c +++ b/sys/dev/usb/if_cue.c @@ -382,7 +382,7 @@ Static void cue_setmulti(sc) sc->cue_mctab[i] = 0; /* now program new ones */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = cue_crc(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c index d907c01..33fca8e 100644 --- a/sys/dev/usb/if_kue.c +++ b/sys/dev/usb/if_kue.c @@ -336,7 +336,7 @@ Static void kue_setmulti(sc) sc->kue_rxfilt &= ~KUE_RXFILT_ALLMULTI; - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; /* diff --git a/sys/dev/vr/if_vr.c b/sys/dev/vr/if_vr.c index 8ea9944..0f44a1d 100644 --- a/sys/dev/vr/if_vr.c +++ b/sys/dev/vr/if_vr.c @@ -530,7 +530,7 @@ static void vr_setmulti(sc) CSR_WRITE_4(sc, VR_MAR1, 0); /* now program new ones */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = vr_calchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c index 7fad2de..06fa656 100644 --- a/sys/dev/wi/if_wi.c +++ b/sys/dev/wi/if_wi.c @@ -1035,7 +1035,7 @@ static void wi_setmulti(sc) return; } - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; if (i < 16) { diff --git a/sys/dev/wl/if_wl.c b/sys/dev/wl/if_wl.c index b52762c8..afa82ff 100644 --- a/sys/dev/wl/if_wl.c +++ b/sys/dev/wl/if_wl.c @@ -2060,7 +2060,7 @@ wlconfig(int unit) outw(PIOP1(base), AC_MCSETUP|AC_CW_EL); /* ac_command */ outw(PIOR1(base), OFFSET_CU + 8); #if defined(__FreeBSD__) && __FreeBSD_version >= 300000 - LIST_FOREACH(ifma, &sc->wl_if.if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &sc->wl_if.if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/dev/xe/if_xe.c b/sys/dev/xe/if_xe.c index d0e1dd2..ee72834 100644 --- a/sys/dev/xe/if_xe.c +++ b/sys/dev/xe/if_xe.c @@ -1590,10 +1590,10 @@ xe_setmulti(struct xe_softc *scp) { int count; ifp = &scp->arpcom.ac_if; - maddr = LIST_FIRST(&ifp->if_multiaddrs); + maddr = TAILQ_FIRST(&ifp->if_multiaddrs); /* Get length of multicast list */ - for (count = 0; maddr != NULL; maddr = LIST_NEXT(maddr, ifma_link), count++); + for (count = 0; maddr != NULL; maddr = TAILQ_NEXT(maddr, ifma_link), count++); if ((ifp->if_flags & IFF_PROMISC) || (ifp->if_flags & IFF_ALLMULTI) || (count > 9)) { /* @@ -1643,7 +1643,7 @@ xe_setaddrs(struct xe_softc *scp) { u_int8_t *addr; u_int8_t page, slot, byte, i; - maddr = LIST_FIRST(&scp->arpcom.ac_if.if_multiaddrs); + maddr = TAILQ_FIRST(&scp->arpcom.ac_if.if_multiaddrs); XE_SELECT_PAGE(page = 0x50); @@ -1653,7 +1653,7 @@ xe_setaddrs(struct xe_softc *scp) { addr = (u_int8_t *)(&scp->arpcom.ac_enaddr); else { while (maddr != NULL && maddr->ifma_addr->sa_family != AF_LINK) - maddr = LIST_NEXT(maddr, ifma_link); + maddr = TAILQ_NEXT(maddr, ifma_link); if (maddr != NULL) addr = LLADDR((struct sockaddr_dl *)maddr->ifma_addr); else diff --git a/sys/i386/isa/if_le.c b/sys/i386/isa/if_le.c index 7abd008..2096e7e 100644 --- a/sys/i386/isa/if_le.c +++ b/sys/i386/isa/if_le.c @@ -560,7 +560,7 @@ le_multi_filter( sc->le_flags |= IFF_MULTICAST; - LIST_FOREACH(ifma, &sc->le_ac.ac_if.if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &sc->le_ac.ac_if.if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/i386/isa/if_wl.c b/sys/i386/isa/if_wl.c index b52762c8..afa82ff 100644 --- a/sys/i386/isa/if_wl.c +++ b/sys/i386/isa/if_wl.c @@ -2060,7 +2060,7 @@ wlconfig(int unit) outw(PIOP1(base), AC_MCSETUP|AC_CW_EL); /* ac_command */ outw(PIOR1(base), OFFSET_CU + 8); #if defined(__FreeBSD__) && __FreeBSD_version >= 300000 - LIST_FOREACH(ifma, &sc->wl_if.if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &sc->wl_if.if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/net/if.c b/sys/net/if.c index c1a4bd3..dc434f3 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -164,7 +164,7 @@ if_attach(ifp) */ TAILQ_INIT(&ifp->if_addrhead); TAILQ_INIT(&ifp->if_prefixhead); - LIST_INIT(&ifp->if_multiaddrs); + TAILQ_INIT(&ifp->if_multiaddrs); getmicrotime(&ifp->if_lastchange); if (ifnet_addrs == 0 || if_index >= if_indexlim) { unsigned n = (if_indexlim <<= 1) * sizeof(ifa); @@ -1182,7 +1182,7 @@ if_addmulti(ifp, sa, retifma) * If the matching multicast address already exists * then don't add a new one, just add a reference */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (equal(sa, ifma->ifma_addr)) { ifma->ifma_refcount++; if (retifma) @@ -1219,12 +1219,12 @@ if_addmulti(ifp, sa, retifma) * interrupt time; lock them out. */ s = splimp(); - LIST_INSERT_HEAD(&ifp->if_multiaddrs, ifma, ifma_link); + TAILQ_INSERT_HEAD(&ifp->if_multiaddrs, ifma, ifma_link); splx(s); *retifma = ifma; if (llsa != 0) { - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (equal(ifma->ifma_addr, llsa)) break; } @@ -1240,7 +1240,7 @@ if_addmulti(ifp, sa, retifma) ifma->ifma_ifp = ifp; ifma->ifma_refcount = 1; s = splimp(); - LIST_INSERT_HEAD(&ifp->if_multiaddrs, ifma, ifma_link); + TAILQ_INSERT_HEAD(&ifp->if_multiaddrs, ifma, ifma_link); splx(s); } } @@ -1267,7 +1267,7 @@ if_delmulti(ifp, sa) struct ifmultiaddr *ifma; int s; - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) if (equal(sa, ifma->ifma_addr)) break; if (ifma == 0) @@ -1281,7 +1281,7 @@ if_delmulti(ifp, sa) rt_newmaddrmsg(RTM_DELMADDR, ifma); sa = ifma->ifma_lladdr; s = splimp(); - LIST_REMOVE(ifma, ifma_link); + TAILQ_REMOVE(&ifp->if_multiaddrs, ifma, ifma_link); splx(s); free(ifma->ifma_addr, M_IFMADDR); free(ifma, M_IFMADDR); @@ -1299,7 +1299,7 @@ if_delmulti(ifp, sa) * in the record for the link-layer address. (So we don't complain * in that case.) */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) if (equal(sa, ifma->ifma_addr)) break; if (ifma == 0) @@ -1311,7 +1311,7 @@ if_delmulti(ifp, sa) } s = splimp(); - LIST_REMOVE(ifma, ifma_link); + TAILQ_REMOVE(&ifp->if_multiaddrs, ifma, ifma_link); ifp->if_ioctl(ifp, SIOCDELMULTI, 0); splx(s); free(ifma->ifma_addr, M_IFMADDR); @@ -1374,7 +1374,7 @@ ifmaof_ifpforaddr(sa, ifp) { struct ifmultiaddr *ifma; - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) if (equal(ifma->ifma_addr, sa)) break; diff --git a/sys/net/if_var.h b/sys/net/if_var.h index fc60f9c..68b0c01 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -83,7 +83,7 @@ struct ether_header; TAILQ_HEAD(ifnethead, ifnet); /* we use TAILQs so that the order of */ TAILQ_HEAD(ifaddrhead, ifaddr); /* instantiation is preserved in the list */ TAILQ_HEAD(ifprefixhead, ifprefix); -LIST_HEAD(ifmultihead, ifmultiaddr); +TAILQ_HEAD(ifmultihead, ifmultiaddr); /* * Structure defining a queue for a network interface. @@ -352,7 +352,7 @@ struct ifprefix { * address, not a count of pointers to this structure. */ struct ifmultiaddr { - LIST_ENTRY(ifmultiaddr) ifma_link; /* queue macro glue */ + TAILQ_ENTRY(ifmultiaddr) ifma_link; /* queue macro glue */ struct sockaddr *ifma_addr; /* address this membership is for */ struct sockaddr *ifma_lladdr; /* link-layer translation, if any */ struct ifnet *ifma_ifp; /* back-pointer to interface */ diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 2656c7cf..aa7ced1 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -135,7 +135,7 @@ vlan_setmulti(struct ifnet *ifp) } /* Now program new ones. */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; mc = malloc(sizeof(struct vlan_mc_entry), M_DEVBUF, M_NOWAIT); diff --git a/sys/netinet/in_var.h b/sys/netinet/in_var.h index ca2eb07..e89c501 100644 --- a/sys/netinet/in_var.h +++ b/sys/netinet/in_var.h @@ -182,7 +182,7 @@ struct in_multistep { do { \ register struct ifmultiaddr *ifma; \ \ - LIST_FOREACH(ifma, &((ifp)->if_multiaddrs), ifma_link) { \ + TAILQ_FOREACH(ifma, &((ifp)->if_multiaddrs), ifma_link) { \ if (ifma->ifma_addr->sa_family == AF_INET \ && ((struct sockaddr_in *)ifma->ifma_addr)->sin_addr.s_addr == \ (addr).s_addr) \ diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h index 511c1b2..f2f644e 100644 --- a/sys/netinet6/in6_var.h +++ b/sys/netinet6/in6_var.h @@ -517,8 +517,7 @@ struct in6_multistep { /* struct in6_multi *in6m; */ \ do { \ register struct ifmultiaddr *ifma; \ - for (ifma = (ifp)->if_multiaddrs.lh_first; ifma; \ - ifma = ifma->ifma_link.le_next) { \ + TAILQ_FOREACH(ifma, &(ifp)->if_multiaddrs, ifma_link) { \ if (ifma->ifma_addr->sa_family == AF_INET6 \ && IN6_ARE_ADDR_EQUAL(&((struct sockaddr_in6 *)ifma->ifma_addr)->sin6_addr, \ &(addr))) \ diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c index c655bb5..4739856 100644 --- a/sys/netinet6/mld6.c +++ b/sys/netinet6/mld6.c @@ -266,7 +266,7 @@ mld6_input(m, off) mld6_all_nodes_linklocal.s6_addr16[1] = htons(ifp->if_index); /* XXX */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET6) continue; diff --git a/sys/pci/if_dc.c b/sys/pci/if_dc.c index f66e65d..7e57dae 100644 --- a/sys/pci/if_dc.c +++ b/sys/pci/if_dc.c @@ -1051,7 +1051,7 @@ void dc_setfilt_21143(sc) else DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI); - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = dc_crc_le(sc, @@ -1122,7 +1122,7 @@ void dc_setfilt_admtek(sc) return; /* now program new ones */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = dc_crc_be(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); @@ -1190,7 +1190,7 @@ void dc_setfilt_asix(sc) return; /* now program new ones */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = dc_crc_be(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); @@ -1244,7 +1244,7 @@ void dc_setfilt_xircom(sc) else DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI); - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = dc_crc_le(sc, diff --git a/sys/pci/if_de.c b/sys/pci/if_de.c index 714947b..4f41a34 100644 --- a/sys/pci/if_de.c +++ b/sys/pci/if_de.c @@ -3012,7 +3012,7 @@ tulip_addr_filter( #endif multicnt = 0; - LIST_FOREACH(ifma, &sc->tulip_if.if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &sc->tulip_if.if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family == AF_LINK) multicnt++; @@ -3040,7 +3040,7 @@ tulip_addr_filter( */ bzero(sc->tulip_setupdata, sizeof(sc->tulip_setupdata)); - LIST_FOREACH(ifma, &sc->tulip_if.if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &sc->tulip_if.if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -3090,7 +3090,7 @@ tulip_addr_filter( /* * Else can get perfect filtering for 16 addresses. */ - LIST_FOREACH(ifma, &sc->tulip_if.if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &sc->tulip_if.if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; addrp = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); diff --git a/sys/pci/if_fxp.c b/sys/pci/if_fxp.c index 0149221..8cc34ff 100644 --- a/sys/pci/if_fxp.c +++ b/sys/pci/if_fxp.c @@ -1907,7 +1907,7 @@ fxp_mc_setup(sc) nmcasts = 0; if (!sc->all_mcasts) { - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; if (nmcasts >= MAXMCADDR) { diff --git a/sys/pci/if_pcn.c b/sys/pci/if_pcn.c index 0da955b..395a5ff 100644 --- a/sys/pci/if_pcn.c +++ b/sys/pci/if_pcn.c @@ -343,7 +343,7 @@ static void pcn_setmulti(sc) pcn_csr_write(sc, PCN_CSR_MAR0 + i, 0); /* now program new ones */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = pcn_crc(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); diff --git a/sys/pci/if_rl.c b/sys/pci/if_rl.c index d3a51ac..850d995 100644 --- a/sys/pci/if_rl.c +++ b/sys/pci/if_rl.c @@ -719,7 +719,7 @@ static void rl_setmulti(sc) CSR_WRITE_4(sc, RL_MAR4, 0); /* now program new ones */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = rl_calchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); diff --git a/sys/pci/if_sf.c b/sys/pci/if_sf.c index fbaac99..2e1cacf 100644 --- a/sys/pci/if_sf.c +++ b/sys/pci/if_sf.c @@ -448,14 +448,7 @@ static void sf_setmulti(sc) SF_SETBIT(sc, SF_RXFILT, SF_RXFILT_ALLMULTI); } else { i = 1; - /* First find the tail of the list. */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (LIST_NEXT(ifma, ifma_link) == NULL) - break; - } - /* Now traverse the list backwards. */ - for (; ifma != NULL && ifma != (void *)&ifp->if_multiaddrs; - ifma = (struct ifmultiaddr *)ifma->ifma_link.le_prev) { + TAILQ_FOREACH_REVERSE(ifma, &ifp->if_multiaddrs, ifmultihead, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; /* diff --git a/sys/pci/if_sis.c b/sys/pci/if_sis.c index 32ed486..ce4b097 100644 --- a/sys/pci/if_sis.c +++ b/sys/pci/if_sis.c @@ -521,7 +521,7 @@ static void sis_setmulti_ns(sc) CSR_WRITE_4(sc, SIS_RXFILT_DATA, 0); } - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = sis_crc(sc, LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); @@ -563,7 +563,7 @@ static void sis_setmulti_sis(sc) } /* now program new ones */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = sis_crc(sc, LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); diff --git a/sys/pci/if_sk.c b/sys/pci/if_sk.c index a6dba79..960b98b 100644 --- a/sys/pci/if_sk.c +++ b/sys/pci/if_sk.c @@ -557,14 +557,7 @@ static void sk_setmulti(sc_if) hashes[1] = 0xFFFFFFFF; } else { i = 1; - /* First find the tail of the list. */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (LIST_NEXT(ifma, ifma_link) == NULL) - break; - } - /* Now traverse the list backwards. */ - for (; ifma != NULL && ifma != (void *)&ifp->if_multiaddrs; - ifma = (struct ifmultiaddr *)ifma->ifma_link.le_prev) { + TAILQ_FOREACH_REVERSE(ifma, &ifp->if_multiaddrs, ifmultihead, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; /* diff --git a/sys/pci/if_ste.c b/sys/pci/if_ste.c index 8a14d01..ef7b2f6 100644 --- a/sys/pci/if_ste.c +++ b/sys/pci/if_ste.c @@ -587,7 +587,7 @@ static void ste_setmulti(sc) CSR_WRITE_4(sc, STE_MAR1, 0); /* now program new ones */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = ste_calchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); diff --git a/sys/pci/if_ti.c b/sys/pci/if_ti.c index 1d52547..b13f1ba 100644 --- a/sys/pci/if_ti.c +++ b/sys/pci/if_ti.c @@ -1081,7 +1081,7 @@ static void ti_setmulti(sc) } /* Now program new ones. */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; mc = malloc(sizeof(struct ti_mc_entry), M_DEVBUF, M_NOWAIT); diff --git a/sys/pci/if_tl.c b/sys/pci/if_tl.c index eaa3f058..718498a 100644 --- a/sys/pci/if_tl.c +++ b/sys/pci/if_tl.c @@ -952,14 +952,7 @@ static void tl_setmulti(sc) hashes[1] = 0xFFFFFFFF; } else { i = 1; - /* First find the tail of the list. */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (LIST_NEXT(ifma, ifma_link) == NULL) - break; - } - /* Now traverse the list backwards. */ - for (; ifma != NULL && ifma != (void *)&ifp->if_multiaddrs; - ifma = (struct ifmultiaddr *)ifma->ifma_link.le_prev) { + TAILQ_FOREACH_REVERSE(ifma, &ifp->if_multiaddrs, ifmultihead, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; /* diff --git a/sys/pci/if_vr.c b/sys/pci/if_vr.c index 8ea9944..0f44a1d 100644 --- a/sys/pci/if_vr.c +++ b/sys/pci/if_vr.c @@ -530,7 +530,7 @@ static void vr_setmulti(sc) CSR_WRITE_4(sc, VR_MAR1, 0); /* now program new ones */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = vr_calchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); diff --git a/sys/pci/if_wb.c b/sys/pci/if_wb.c index 67e0b57..f79be10 100644 --- a/sys/pci/if_wb.c +++ b/sys/pci/if_wb.c @@ -641,7 +641,7 @@ static void wb_setmulti(sc) CSR_WRITE_4(sc, WB_MAR1, 0); /* now program new ones */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = wb_calchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); diff --git a/sys/pci/if_wx.c b/sys/pci/if_wx.c index 1316093..b455618 100644 --- a/sys/pci/if_wx.c +++ b/sys/pci/if_wx.c @@ -518,7 +518,7 @@ wx_mc_setup(sc) } sc->wx_nmca = 0; - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) { continue; } diff --git a/sys/pci/if_xl.c b/sys/pci/if_xl.c index 1fc62b3..0fcaf8b 100644 --- a/sys/pci/if_xl.c +++ b/sys/pci/if_xl.c @@ -808,7 +808,7 @@ static void xl_setmulti(sc) return; } - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) mcnt++; if (mcnt) @@ -851,7 +851,7 @@ static void xl_setmulti_hash(sc) CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_HASH|i); /* now program new ones */ - LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = xl_calchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); |