From 7aeac9ef1893e0b29408213e3a320d9d1ef28357 Mon Sep 17 00:00:00 2001 From: mmacy Date: Fri, 18 May 2018 20:13:34 +0000 Subject: [PATCH] ifnet: Replace if_addr_lock rwlock with epoch + mutex Run on LLNW canaries and tested by pho@ gallatin: Using a 14-core, 28-HTT single socket E5-2697 v3 with a 40GbE MLX5 based ConnectX 4-LX NIC, I see an almost 12% improvement in received packet rate, and a larger improvement in bytes delivered all the way to userspace. When the host receiving 64 streams of netperf -H $DUT -t UDP_STREAM -- -m 1, I see, using nstat -I mce0 1 before the patch: InMpps OMpps InGbs OGbs err TCP Est %CPU syscalls csw irq GBfree 4.98 0.00 4.42 0.00 4235592 33 83.80 4720653 2149771 1235 247.32 4.73 0.00 4.20 0.00 4025260 33 82.99 4724900 2139833 1204 247.32 4.72 0.00 4.20 0.00 4035252 33 82.14 4719162 2132023 1264 247.32 4.71 0.00 4.21 0.00 4073206 33 83.68 4744973 2123317 1347 247.32 4.72 0.00 4.21 0.00 4061118 33 80.82 4713615 2188091 1490 247.32 4.72 0.00 4.21 0.00 4051675 33 85.29 4727399 2109011 1205 247.32 4.73 0.00 4.21 0.00 4039056 33 84.65 4724735 2102603 1053 247.32 After the patch InMpps OMpps InGbs OGbs err TCP Est %CPU syscalls csw irq GBfree 5.43 0.00 4.20 0.00 3313143 33 84.96 5434214 1900162 2656 245.51 5.43 0.00 4.20 0.00 3308527 33 85.24 5439695 1809382 2521 245.51 5.42 0.00 4.19 0.00 3316778 33 87.54 5416028 1805835 2256 245.51 5.42 0.00 4.19 0.00 3317673 33 90.44 5426044 1763056 2332 245.51 5.42 0.00 4.19 0.00 3314839 33 88.11 5435732 1792218 2499 245.52 5.44 0.00 4.19 0.00 3293228 33 91.84 5426301 1668597 2121 245.52 Similarly, netperf reports 230Mb/s before the patch, and 270Mb/s after the patch Reviewed by: gallatin Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D15366 --- sys/arm/allwinner/if_emac.c | 2 +- sys/arm/at91/if_ate.c | 2 +- sys/arm/at91/if_macb.c | 2 +- sys/arm/cavium/cns11xx/if_ece.c | 2 +- sys/arm/ralink/if_fv.c | 2 +- sys/arm/ti/cpsw/if_cpsw.c | 2 +- sys/arm/xscale/ixp425/if_npe.c | 2 +- sys/compat/linux/linux_ioctl.c | 6 +- sys/contrib/ipfilter/netinet/ip_compat.h | 2 +- sys/contrib/ipfilter/netinet/ip_fil_freebsd.c | 4 +- sys/dev/ae/if_ae.c | 2 +- sys/dev/age/if_age.c | 2 +- sys/dev/al_eth/al_eth.c | 6 +- sys/dev/alc/if_alc.c | 2 +- sys/dev/ale/if_ale.c | 2 +- sys/dev/altera/atse/if_atse.c | 2 +- sys/dev/ath/if_ath.c | 2 +- sys/dev/bce/if_bce.c | 2 +- sys/dev/bfe/if_bfe.c | 2 +- sys/dev/bm/if_bm.c | 2 +- sys/dev/bxe/bxe.c | 8 +- sys/dev/cas/if_cas.c | 2 +- sys/dev/cs/if_cs.c | 2 +- sys/dev/cxgb/cxgb_adapter.h | 2 +- sys/dev/cxgbe/t4_main.c | 2 +- sys/dev/cxgbe/tom/t4_tom.c | 2 +- sys/dev/dc/if_dc.c | 10 +- sys/dev/de/if_de.c | 6 +- sys/dev/dwc/if_dwc.c | 2 +- sys/dev/ed/if_ed.c | 2 +- sys/dev/et/if_et.c | 2 +- sys/dev/ex/if_ex.c | 4 +- sys/dev/fe/if_fe.c | 2 +- sys/dev/ffec/if_ffec.c | 2 +- sys/dev/gem/if_gem.c | 2 +- sys/dev/hme/if_hme.c | 2 +- sys/dev/hyperv/netvsc/if_hn.c | 4 +- sys/dev/if_ndis/if_ndis.c | 4 +- sys/dev/ixgbe/if_ixv.c | 2 +- sys/dev/ixl/if_ixlv.c | 6 +- sys/dev/ixl/ixl_pf_main.c | 8 +- sys/dev/jme/if_jme.c | 2 +- sys/dev/le/lance.c | 2 +- sys/dev/lge/if_lge.c | 2 +- sys/dev/liquidio/lio_ioctl.c | 2 +- sys/dev/malo/if_malo.c | 2 +- sys/dev/mge/if_mge.c | 2 +- sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c | 4 +- sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 5 +- sys/dev/msk/if_msk.c | 2 +- sys/dev/mxge/if_mxge.c | 2 +- sys/dev/my/if_my.c | 2 +- sys/dev/nge/if_nge.c | 2 +- sys/dev/oce/oce_hw.c | 2 +- sys/dev/otus/if_otus.c | 2 +- sys/dev/pcn/if_pcn.c | 2 +- sys/dev/qlnx/qlnxe/qlnx_os.c | 2 +- sys/dev/qlxgb/qla_os.c | 2 +- sys/dev/qlxgbe/ql_os.c | 2 +- sys/dev/qlxge/qls_os.c | 2 +- sys/dev/re/if_re.c | 2 +- sys/dev/rl/if_rl.c | 2 +- sys/dev/rtwn/if_rtwn_rx.c | 2 +- sys/dev/sf/if_sf.c | 3 +- sys/dev/sfxge/sfxge_port.c | 2 +- sys/dev/sge/if_sge.c | 2 +- sys/dev/sis/if_sis.c | 4 +- sys/dev/sk/if_sk.c | 5 +- sys/dev/sn/if_sn.c | 2 +- sys/dev/ste/if_ste.c | 2 +- sys/dev/stge/if_stge.c | 2 +- sys/dev/ti/if_ti.c | 2 +- sys/dev/tl/if_tl.c | 3 +- sys/dev/tsec/if_tsec.c | 2 +- sys/dev/tx/if_tx.c | 2 +- sys/dev/txp/if_txp.c | 2 +- sys/dev/usb/net/if_aue.c | 2 +- sys/dev/usb/net/if_axe.c | 2 +- sys/dev/usb/net/if_axge.c | 2 +- sys/dev/usb/net/if_cue.c | 2 +- sys/dev/usb/net/if_kue.c | 2 +- sys/dev/usb/net/if_mos.c | 2 +- sys/dev/usb/net/if_rue.c | 2 +- sys/dev/usb/net/if_smsc.c | 4 +- sys/dev/usb/net/if_udav.c | 2 +- sys/dev/usb/net/if_ure.c | 2 +- sys/dev/usb/wlan/if_rsu.c | 2 +- sys/dev/usb/wlan/if_zyd.c | 2 +- sys/dev/vge/if_vge.c | 4 +- sys/dev/virtio/network/if_vtnet.c | 5 +- sys/dev/vmware/vmxnet3/if_vmx.c | 2 +- sys/dev/vr/if_vr.c | 4 +- sys/dev/vte/if_vte.c | 2 +- sys/dev/wb/if_wb.c | 2 +- sys/dev/wi/if_wi.c | 2 +- sys/dev/xe/if_xe.c | 2 +- sys/dev/xen/netfront/netfront.c | 2 +- sys/dev/xl/if_xl.c | 4 +- sys/kern/subr_witness.c | 4 +- sys/modules/Makefile | 1 + sys/net/if.c | 107 +++++++++++------- sys/net/if_lagg.c | 2 +- sys/net/if_spppsubr.c | 8 +- sys/net/if_stf.c | 4 +- sys/net/if_tap.c | 3 +- sys/net/if_tun.c | 4 +- sys/net/if_var.h | 35 +++--- sys/net/if_vlan.c | 2 +- sys/net/rtsock.c | 8 +- sys/netgraph/ng_eiface.c | 5 +- sys/netinet/if_ether.c | 8 +- sys/netinet/igmp.c | 12 +- sys/netinet/in.c | 34 +++--- sys/netinet/in_debug.c | 4 +- sys/netinet/in_mcast.c | 20 ++-- sys/netinet/in_pcb.c | 18 +-- sys/netinet/in_var.h | 8 +- sys/netinet/ip_carp.c | 7 +- sys/netinet/ip_divert.c | 3 +- sys/netinet/ip_icmp.c | 7 +- sys/netinet/ip_input.c | 6 +- sys/netinet/raw_ip.c | 4 +- sys/netinet/sctp_bsd_addr.c | 4 +- sys/netinet6/icmp6.c | 4 +- sys/netinet6/in6.c | 27 ++--- sys/netinet6/in6_ifattach.c | 6 +- sys/netinet6/in6_mcast.c | 10 +- sys/netinet6/in6_pcb.c | 4 +- sys/netinet6/in6_src.c | 2 +- sys/netinet6/in6_var.h | 8 +- sys/netinet6/ip6_input.c | 4 +- sys/netinet6/mld6.c | 10 +- sys/netinet6/nd6.c | 16 +-- sys/netinet6/nd6_rtr.c | 12 +- sys/netpfil/ipfw/ip_fw2.c | 4 +- sys/netpfil/ipfw/ip_fw_dynamic.c | 1 - sys/netpfil/ipfw/ip_fw_nat.c | 2 +- sys/netpfil/pf/pf_if.c | 2 +- sys/nfs/bootp_subr.c | 5 +- sys/nfs/nfs_diskless.c | 2 +- .../infiniband/core/ib_roce_gid_mgmt.c | 4 +- .../infiniband/ulp/ipoib/ipoib_multicast.c | 2 +- sys/ofed/include/rdma/ib_addr.h | 3 +- sys/powerpc/ps3/if_glc.c | 2 +- sys/powerpc/pseries/phyp_llan.c | 2 +- 145 files changed, 373 insertions(+), 340 deletions(-) diff --git a/sys/arm/allwinner/if_emac.c b/sys/arm/allwinner/if_emac.c index d50906cc3569..1aa679797280 100644 --- a/sys/arm/allwinner/if_emac.c +++ b/sys/arm/allwinner/if_emac.c @@ -240,7 +240,7 @@ emac_set_rx_mode(struct emac_softc *sc) hashes[1] = 0xffffffff; } else { if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &sc->emac_ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &sc->emac_ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = ether_crc32_be(LLADDR((struct sockaddr_dl *) diff --git a/sys/arm/at91/if_ate.c b/sys/arm/at91/if_ate.c index 26179b292664..31bec89e59f3 100644 --- a/sys/arm/at91/if_ate.c +++ b/sys/arm/at91/if_ate.c @@ -535,7 +535,7 @@ ate_setmcast(struct ate_softc *sc) mcaf[0] = 0; mcaf[1] = 0; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; index = ate_mac_hash(LLADDR((struct sockaddr_dl *) diff --git a/sys/arm/at91/if_macb.c b/sys/arm/at91/if_macb.c index 66e9068ffd98..51138ea14114 100644 --- a/sys/arm/at91/if_macb.c +++ b/sys/arm/at91/if_macb.c @@ -1137,7 +1137,7 @@ set_filter(struct macb_softc *sc) multicast_filter[0] = 0; multicast_filter[1] = 0; - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; count++; diff --git a/sys/arm/cavium/cns11xx/if_ece.c b/sys/arm/cavium/cns11xx/if_ece.c index 9ed5cbdbf03f..5188ba753a80 100644 --- a/sys/arm/cavium/cns11xx/if_ece.c +++ b/sys/arm/cavium/cns11xx/if_ece.c @@ -1839,7 +1839,7 @@ set_filter(struct ece_softc *sc) return; } if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; add_mac_entry(sc, diff --git a/sys/arm/ralink/if_fv.c b/sys/arm/ralink/if_fv.c index 31713f32d7b0..115eb8c08d53 100644 --- a/sys/arm/ralink/if_fv.c +++ b/sys/arm/ralink/if_fv.c @@ -227,7 +227,7 @@ fv_setfilt(struct fv_softc *sc) i = 0; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; ma = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); diff --git a/sys/arm/ti/cpsw/if_cpsw.c b/sys/arm/ti/cpsw/if_cpsw.c index 4cb55ae9b04a..8b3a7691a76a 100644 --- a/sys/arm/ti/cpsw/if_cpsw.c +++ b/sys/arm/ti/cpsw/if_cpsw.c @@ -2465,7 +2465,7 @@ cpswp_ale_update_addresses(struct cpswp_softc *sc, int purge) /* Set other multicast addrs desired. */ if_maddr_rlock(sc->ifp); - TAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; cpsw_ale_mc_entry_set(sc->swsc, portmask, sc->vlan, diff --git a/sys/arm/xscale/ixp425/if_npe.c b/sys/arm/xscale/ixp425/if_npe.c index d797154ee1d4..dbeee47fc261 100644 --- a/sys/arm/xscale/ixp425/if_npe.c +++ b/sys/arm/xscale/ixp425/if_npe.c @@ -435,7 +435,7 @@ npe_setmcast(struct npe_softc *sc) memset(set, 0xff, ETHER_ADDR_LEN); if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; mac = LLADDR((struct sockaddr_dl *) ifma->ifma_addr); diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c index 30b565c20b69..d3ee9928d0ed 100644 --- a/sys/compat/linux/linux_ioctl.c +++ b/sys/compat/linux/linux_ioctl.c @@ -2241,7 +2241,7 @@ linux_ifconf(struct thread *td, struct ifconf *uifc) ifc.ifc_len = 0; IFNET_RLOCK(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct sockaddr *sa = ifa->ifa_addr; if (sa->sa_family == AF_INET) ifc.ifc_len += sizeof(ifr); @@ -2282,7 +2282,7 @@ linux_ifconf(struct thread *td, struct ifconf *uifc) strlcpy(ifr.ifr_name, ifp->if_xname, LINUX_IFNAMSIZ); /* Walk the address list */ - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct sockaddr *sa = ifa->ifa_addr; if (sa->sa_family == AF_INET) { @@ -2361,7 +2361,7 @@ linux_gifhwaddr(struct ifnet *ifp, struct l_ifreq *ifr) if (ifp->if_type != IFT_ETHER) return (ENOENT); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sdl = (struct sockaddr_dl*)ifa->ifa_addr; if (sdl != NULL && (sdl->sdl_family == AF_LINK) && (sdl->sdl_type == IFT_ETHER)) { diff --git a/sys/contrib/ipfilter/netinet/ip_compat.h b/sys/contrib/ipfilter/netinet/ip_compat.h index 58dbb9839615..d10c8f0dedf8 100644 --- a/sys/contrib/ipfilter/netinet/ip_compat.h +++ b/sys/contrib/ipfilter/netinet/ip_compat.h @@ -227,7 +227,7 @@ struct route; struct mbuf; struct ifnet { char if_xname[IFNAMSIZ]; - TAILQ_HEAD(, ifaddr) if_addrlist; + STAILQ_HEAD(, ifaddr) if_addrlist; int (*if_output)(struct ifnet *, struct mbuf *, const struct sockaddr *, struct route *); }; diff --git a/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c b/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c index 9ce4d41f2e99..aa3c7e2e1c05 100644 --- a/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c +++ b/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c @@ -1021,7 +1021,7 @@ ipf_ifpaddr(softc, v, atype, ifptr, inp, inpmask) else if (v == 6) bzero((char *)inp, sizeof(*inp)); #endif - ifa = TAILQ_FIRST(&ifp->if_addrhead); + ifa = CK_STAILQ_FIRST(&ifp->if_addrhead); sock = ifa->ifa_addr; while (sock != NULL && ifa != NULL) { @@ -1036,7 +1036,7 @@ ipf_ifpaddr(softc, v, atype, ifptr, inp, inpmask) break; } #endif - ifa = TAILQ_NEXT(ifa, ifa_link); + ifa = CK_STAILQ_NEXT(ifa, ifa_link); if (ifa != NULL) sock = ifa->ifa_addr; } diff --git a/sys/dev/ae/if_ae.c b/sys/dev/ae/if_ae.c index 9a6d9fabb9ac..16f3b0ec0ca8 100644 --- a/sys/dev/ae/if_ae.c +++ b/sys/dev/ae/if_ae.c @@ -2071,7 +2071,7 @@ ae_rxfilter(ae_softc_t *sc) */ bzero(mchash, sizeof(mchash)); if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/age/if_age.c b/sys/dev/age/if_age.c index 3cf2903cb982..c9497d418803 100644 --- a/sys/dev/age/if_age.c +++ b/sys/dev/age/if_age.c @@ -3170,7 +3170,7 @@ age_rxfilter(struct age_softc *sc) bzero(mchash, sizeof(mchash)); if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &sc->age_ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &sc->age_ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/al_eth/al_eth.c b/sys/dev/al_eth/al_eth.c index 211e55c40fde..e949191ccfc2 100644 --- a/sys/dev/al_eth/al_eth.c +++ b/sys/dev/al_eth/al_eth.c @@ -2891,7 +2891,7 @@ al_eth_set_rx_mode(struct al_eth_adapter *adapter) unsigned char *mac; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; if (mc == MAX_NUM_MULTICAST_ADDRESSES) @@ -2905,7 +2905,7 @@ al_eth_set_rx_mode(struct al_eth_adapter *adapter) if_maddr_runlock(ifp); if_addr_rlock(ifp); - TAILQ_FOREACH(ifua, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifua, &ifp->if_addrhead, ifa_link) { if (ifua->ifa_addr->sa_family != AF_LINK) continue; if (uc == MAX_NUM_ADDRESSES) @@ -2951,7 +2951,7 @@ al_eth_set_rx_mode(struct al_eth_adapter *adapter) /* set new addresses */ i = AL_ETH_MAC_TABLE_UNICAST_IDX_BASE + 1; if_addr_rlock(ifp); - TAILQ_FOREACH(ifua, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifua, &ifp->if_addrhead, ifa_link) { if (ifua->ifa_addr->sa_family != AF_LINK) { continue; } diff --git a/sys/dev/alc/if_alc.c b/sys/dev/alc/if_alc.c index ead3741838f7..8108d11ff96b 100644 --- a/sys/dev/alc/if_alc.c +++ b/sys/dev/alc/if_alc.c @@ -4608,7 +4608,7 @@ alc_rxfilter(struct alc_softc *sc) } if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &sc->alc_ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &sc->alc_ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/ale/if_ale.c b/sys/dev/ale/if_ale.c index 7d3291c4e551..32f7e2e54b6e 100644 --- a/sys/dev/ale/if_ale.c +++ b/sys/dev/ale/if_ale.c @@ -3038,7 +3038,7 @@ ale_rxfilter(struct ale_softc *sc) bzero(mchash, sizeof(mchash)); if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &sc->ale_ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &sc->ale_ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/altera/atse/if_atse.c b/sys/dev/altera/atse/if_atse.c index 10581cec6724..7377f970146c 100644 --- a/sys/dev/altera/atse/if_atse.c +++ b/sys/dev/altera/atse/if_atse.c @@ -485,7 +485,7 @@ atse_rxfilter_locked(struct atse_softc *sc) * do all the programming afterwards. */ if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) { continue; } diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index 5d59bf548ca8..00214f7707e1 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -3615,7 +3615,7 @@ ath_update_mcast_hw(struct ath_softc *sc) TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { ifp = vap->iv_ifp; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { caddr_t dl; uint32_t val; uint8_t pos; diff --git a/sys/dev/bce/if_bce.c b/sys/dev/bce/if_bce.c index f7fb3e46bb76..37eed4abcbc0 100644 --- a/sys/dev/bce/if_bce.c +++ b/sys/dev/bce/if_bce.c @@ -8117,7 +8117,7 @@ bce_set_rx_mode(struct bce_softc *sc) DBPRINT(sc, BCE_INFO_MISC, "Enabling selective multicast mode.\n"); if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = ether_crc32_le(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/bfe/if_bfe.c b/sys/dev/bfe/if_bfe.c index a6678992ae0d..374f53f7c62c 100644 --- a/sys/dev/bfe/if_bfe.c +++ b/sys/dev/bfe/if_bfe.c @@ -1109,7 +1109,7 @@ bfe_set_rx_mode(struct bfe_softc *sc) else { val &= ~BFE_RXCONF_ALLMULTI; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; bfe_cam_write(sc, diff --git a/sys/dev/bm/if_bm.c b/sys/dev/bm/if_bm.c index cecb2e0d634c..3ab20e79f3c4 100644 --- a/sys/dev/bm/if_bm.c +++ b/sys/dev/bm/if_bm.c @@ -939,7 +939,7 @@ bm_setladrf(struct bm_softc *sc) memset(hash, 0, sizeof(hash)); if_maddr_rlock(ifp); - TAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { if (inm->ifma_addr->sa_family != AF_LINK) continue; crc = ether_crc32_le(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/bxe/bxe.c b/sys/dev/bxe/bxe.c index 429abbd847b6..3174d871088c 100644 --- a/sys/dev/bxe/bxe.c +++ b/sys/dev/bxe/bxe.c @@ -12004,7 +12004,7 @@ bxe_init_mcast_macs_list(struct bxe_softc *sc, struct ifmultiaddr *ifma; struct ecore_mcast_list_elem *mc_mac; - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) { continue; } @@ -12027,7 +12027,7 @@ bxe_init_mcast_macs_list(struct bxe_softc *sc, } bzero(mc_mac, (sizeof(*mc_mac) * mc_count)); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) { continue; } @@ -12130,7 +12130,7 @@ bxe_set_uc_list(struct bxe_softc *sc) ifa = if_getifaddr(ifp); /* XXX Is this structure */ while (ifa) { if (ifa->ifa_addr->sa_family != AF_LINK) { - ifa = TAILQ_NEXT(ifa, ifa_link); + ifa = CK_STAILQ_NEXT(ifa, ifa_link); continue; } @@ -12150,7 +12150,7 @@ bxe_set_uc_list(struct bxe_softc *sc) return (rc); } - ifa = TAILQ_NEXT(ifa, ifa_link); + ifa = CK_STAILQ_NEXT(ifa, ifa_link); } #if __FreeBSD_version < 800000 diff --git a/sys/dev/cas/if_cas.c b/sys/dev/cas/if_cas.c index 790e84593257..790667ec600f 100644 --- a/sys/dev/cas/if_cas.c +++ b/sys/dev/cas/if_cas.c @@ -2546,7 +2546,7 @@ cas_setladrf(struct cas_softc *sc) memset(hash, 0, sizeof(hash)); if_maddr_rlock(ifp); - TAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { if (inm->ifma_addr->sa_family != AF_LINK) continue; crc = ether_crc32_le(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/cs/if_cs.c b/sys/dev/cs/if_cs.c index b0b988f9972a..f7011172db09 100644 --- a/sys/dev/cs/if_cs.c +++ b/sys/dev/cs/if_cs.c @@ -1007,7 +1007,7 @@ cs_setmode(struct cs_softc *sc) * frames we're interested in. */ if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { struct sockaddr_dl *dl = (struct sockaddr_dl *)ifma->ifma_addr; diff --git a/sys/dev/cxgb/cxgb_adapter.h b/sys/dev/cxgb/cxgb_adapter.h index 39abeba2fa5d..a78addd9cd18 100644 --- a/sys/dev/cxgb/cxgb_adapter.h +++ b/sys/dev/cxgb/cxgb_adapter.h @@ -471,7 +471,7 @@ t3_get_next_mcaddr(struct t3_rx_mode *rm) int i = 0; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; if (i == rm->idx) { diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 7ee2d76edd2d..692d6e556d58 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -4266,7 +4266,7 @@ update_mac_settings(struct ifnet *ifp, int flags) int i = 0, j; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; mcaddr[i] = diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index 3b3c457bf856..cf8f790f1453 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -965,7 +965,7 @@ update_clip_table(struct adapter *sc, struct tom_data *td) /* XXX: races with if_vmove */ CURVNET_SET(vi->ifp->if_vnet); - TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { + CK_STAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { lip = &ia->ia_addr.sin6_addr; KASSERT(!IN6_IS_ADDR_MULTICAST(lip), diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c index dba0f642906e..54f98f51484a 100644 --- a/sys/dev/dc/if_dc.c +++ b/sys/dev/dc/if_dc.c @@ -997,7 +997,7 @@ dc_setfilt_21143(struct dc_softc *sc) DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI); if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = dc_mchash_le(sc, @@ -1075,7 +1075,7 @@ dc_setfilt_admtek(struct dc_softc *sc) /* Now program new ones. */ if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; if (DC_IS_CENTAUR(sc)) @@ -1148,7 +1148,7 @@ dc_setfilt_asix(struct dc_softc *sc) /* now program new ones */ if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = dc_mchash_be(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); @@ -1209,7 +1209,7 @@ dc_setfilt_uli(struct dc_softc *sc) /* Now build perfect filters. */ mcnt = 0; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; if (mcnt >= DC_ULI_FILTER_NPERF) { @@ -1294,7 +1294,7 @@ dc_setfilt_xircom(struct dc_softc *sc) DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI); if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = dc_mchash_le(sc, diff --git a/sys/dev/de/if_de.c b/sys/dev/de/if_de.c index 8c1912cbbb18..09cc3a09d9c8 100644 --- a/sys/dev/de/if_de.c +++ b/sys/dev/de/if_de.c @@ -3053,7 +3053,7 @@ tulip_addr_filter(tulip_softc_t * const sc) else bcopy(sc->tulip_enaddr, eaddr, ETHER_ADDR_LEN); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family == AF_LINK) multicnt++; @@ -3080,7 +3080,7 @@ tulip_addr_filter(tulip_softc_t * const sc) */ bzero(sc->tulip_setupdata, sizeof(sc->tulip_setupdata)); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -3112,7 +3112,7 @@ tulip_addr_filter(tulip_softc_t * const sc) /* * Else can get perfect filtering for 16 addresses. */ - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->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/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index 769fa66d9f05..a01c03aafd18 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -607,7 +607,7 @@ dwc_setup_rxfilter(struct dwc_softc *sc) for (i = 0; i < nhash; i++) hash[i] = 0; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; crc = ether_crc32_le(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c index 696da5745d11..d4b06127ef56 100644 --- a/sys/dev/ed/if_ed.c +++ b/sys/dev/ed/if_ed.c @@ -1701,7 +1701,7 @@ ed_ds_getmcaf(struct ed_softc *sc, uint32_t *mcaf) mcaf[1] = 0; if_maddr_rlock(sc->ifp); - TAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; index = ether_crc32_be(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/et/if_et.c b/sys/dev/et/if_et.c index 734787964404..ab5a9b463224 100644 --- a/sys/dev/et/if_et.c +++ b/sys/dev/et/if_et.c @@ -1581,7 +1581,7 @@ et_setmulti(struct et_softc *sc) count = 0; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { uint32_t *hp, h; if (ifma->ifma_addr->sa_family != AF_LINK) diff --git a/sys/dev/ex/if_ex.c b/sys/dev/ex/if_ex.c index f8686878a6b8..a978aa38f660 100644 --- a/sys/dev/ex/if_ex.c +++ b/sys/dev/ex/if_ex.c @@ -866,7 +866,7 @@ ex_setmulti(struct ex_softc *sc) count = 0; if_maddr_rlock(ifp); - TAILQ_FOREACH(maddr, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(maddr, &ifp->if_multiaddrs, ifma_link) { if (maddr->ifma_addr->sa_family != AF_LINK) continue; count++; @@ -900,7 +900,7 @@ ex_setmulti(struct ex_softc *sc) CSR_WRITE_2(sc, IO_PORT_REG, (count + 1) * 6); if_maddr_rlock(ifp); - TAILQ_FOREACH(maddr, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(maddr, &ifp->if_multiaddrs, ifma_link) { if (maddr->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/dev/fe/if_fe.c b/sys/dev/fe/if_fe.c index 94b83be3f9e8..22ffcb3d9719 100644 --- a/sys/dev/fe/if_fe.c +++ b/sys/dev/fe/if_fe.c @@ -2076,7 +2076,7 @@ fe_mcaf ( struct fe_softc *sc ) filter = fe_filter_nothing; if_maddr_rlock(sc->ifp); - TAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; index = ether_crc32_le(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/ffec/if_ffec.c b/sys/dev/ffec/if_ffec.c index 164e25594242..ea291ab8df2d 100644 --- a/sys/dev/ffec/if_ffec.c +++ b/sys/dev/ffec/if_ffec.c @@ -994,7 +994,7 @@ ffec_setup_rxfilter(struct ffec_softc *sc) else { ghash = 0; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; /* 6 bits from MSB in LE CRC32 are used for hash. */ diff --git a/sys/dev/gem/if_gem.c b/sys/dev/gem/if_gem.c index d46b4ebff97c..470a575013e2 100644 --- a/sys/dev/gem/if_gem.c +++ b/sys/dev/gem/if_gem.c @@ -2249,7 +2249,7 @@ gem_setladrf(struct gem_softc *sc) memset(hash, 0, sizeof(hash)); if_maddr_rlock(ifp); - TAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { if (inm->ifma_addr->sa_family != AF_LINK) continue; crc = ether_crc32_le(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/hme/if_hme.c b/sys/dev/hme/if_hme.c index 463d65dd8f9e..d70ffb3481b6 100644 --- a/sys/dev/hme/if_hme.c +++ b/sys/dev/hme/if_hme.c @@ -1723,7 +1723,7 @@ hme_setladrf(struct hme_softc *sc, int reenable) */ if_maddr_rlock(ifp); - TAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { if (inm->ifma_addr->sa_family != AF_LINK) continue; crc = ether_crc32_le(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c index 9700c9191086..183e8850fe3d 100644 --- a/sys/dev/hyperv/netvsc/if_hn.c +++ b/sys/dev/hyperv/netvsc/if_hn.c @@ -931,7 +931,7 @@ hn_rxfilter_config(struct hn_softc *sc) filter |= NDIS_PACKET_TYPE_BROADCAST; /* TODO: support multicast list */ if ((ifp->if_flags & IFF_ALLMULTI) || - !TAILQ_EMPTY(&ifp->if_multiaddrs)) + !CK_STAILQ_EMPTY(&ifp->if_multiaddrs)) filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; } return (hn_set_rxfilter(sc, filter)); @@ -1323,7 +1323,7 @@ hn_xpnt_vf_saveifflags(struct hn_softc *sc) HN_LOCK_ASSERT(sc); /* XXX vlan(4) style mcast addr maintenance */ - if (!TAILQ_EMPTY(&ifp->if_multiaddrs)) + if (!CK_STAILQ_EMPTY(&ifp->if_multiaddrs)) allmulti = IFF_ALLMULTI; /* Always set the VF's if_flags */ diff --git a/sys/dev/if_ndis/if_ndis.c b/sys/dev/if_ndis/if_ndis.c index ac6ff249925c..7a545dbc8f8f 100644 --- a/sys/dev/if_ndis/if_ndis.c +++ b/sys/dev/if_ndis/if_ndis.c @@ -313,7 +313,7 @@ ndis_setmulti(sc) return; } - if (TAILQ_EMPTY(&ifp->if_multiaddrs)) + if (CK_STAILQ_EMPTY(&ifp->if_multiaddrs)) return; len = sizeof(mclistsz); @@ -330,7 +330,7 @@ ndis_setmulti(sc) len = 0; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c index a019fc80341d..4d0ba7957bfa 100644 --- a/sys/dev/ixgbe/if_ixv.c +++ b/sys/dev/ixgbe/if_ixv.c @@ -846,7 +846,7 @@ ixv_if_multi_set(if_ctx_t ctx) IOCTL_DEBUGOUT("ixv_if_multi_set: begin"); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), diff --git a/sys/dev/ixl/if_ixlv.c b/sys/dev/ixl/if_ixlv.c index 5c86b93e7ff2..851e4d3f2337 100644 --- a/sys/dev/ixl/if_ixlv.c +++ b/sys/dev/ixl/if_ixlv.c @@ -2433,7 +2433,7 @@ ixlv_add_multi(struct ixl_vsi *vsi) ** Get a count, to decide if we ** simply use multicast promiscuous. */ - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; mcnt++; @@ -2454,7 +2454,7 @@ ixlv_add_multi(struct ixl_vsi *vsi) mcnt = 0; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; if (!ixlv_add_mac_filter(sc, @@ -2494,7 +2494,7 @@ ixlv_del_multi(struct ixl_vsi *vsi) && (f->flags & IXL_FILTER_MC)) { /* check if mac address in filter is in sc's list */ match = FALSE; - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; u8 *mc_addr = diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index 0351d5b0852c..a5ef2dccc8eb 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -876,7 +876,7 @@ ixl_set_promisc(struct ixl_vsi *vsi) else { /* Need to count the multicast addresses */ struct ifmultiaddr *ifma; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; if (mcnt == MAX_MULTICAST_ADDR) { @@ -916,7 +916,7 @@ ixl_add_multi(struct ixl_vsi *vsi) ** First just get a count, to decide if we ** we simply use multicast promiscuous. */ - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; mcnt++; @@ -933,7 +933,7 @@ ixl_add_multi(struct ixl_vsi *vsi) mcnt = 0; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; ixl_add_mc_filter(vsi, @@ -966,7 +966,7 @@ ixl_del_multi(struct ixl_vsi *vsi) SLIST_FOREACH(f, &vsi->ftl, next) { if ((f->flags & IXL_FILTER_USED) && (f->flags & IXL_FILTER_MC)) { match = FALSE; - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; u8 *mc_addr = (u8 *)LLADDR((struct sockaddr_dl *)ifma->ifma_addr); diff --git a/sys/dev/jme/if_jme.c b/sys/dev/jme/if_jme.c index c80d4da15e39..267804bc768c 100644 --- a/sys/dev/jme/if_jme.c +++ b/sys/dev/jme/if_jme.c @@ -3278,7 +3278,7 @@ jme_set_filter(struct jme_softc *sc) bzero(mchash, sizeof(mchash)); if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &sc->jme_ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &sc->jme_ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/le/lance.c b/sys/dev/le/lance.c index d72b50413d5b..57b17c082629 100644 --- a/sys/dev/le/lance.c +++ b/sys/dev/le/lance.c @@ -602,7 +602,7 @@ lance_setladrf(struct lance_softc *sc, uint16_t *af) af[0] = af[1] = af[2] = af[3] = 0x0000; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/dev/lge/if_lge.c b/sys/dev/lge/if_lge.c index dba01794b139..9ef420a022fc 100644 --- a/sys/dev/lge/if_lge.c +++ b/sys/dev/lge/if_lge.c @@ -393,7 +393,7 @@ lge_setmulti(sc) /* now program new ones */ if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = ether_crc32_be(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/liquidio/lio_ioctl.c b/sys/dev/liquidio/lio_ioctl.c index b4f1a9510e2d..b983ae01c053 100644 --- a/sys/dev/liquidio/lio_ioctl.c +++ b/sys/dev/liquidio/lio_ioctl.c @@ -519,7 +519,7 @@ lio_set_mcast_list(struct ifnet *ifp) /* to protect access to if_multiaddrs */ if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; *mc = 0; diff --git a/sys/dev/malo/if_malo.c b/sys/dev/malo/if_malo.c index 9b4190aa7c08..25f9ee33e74b 100644 --- a/sys/dev/malo/if_malo.c +++ b/sys/dev/malo/if_malo.c @@ -1539,7 +1539,7 @@ malo_setmcastfilter(struct malo_softc *sc) ifp = vap->iv_ifp; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/dev/mge/if_mge.c b/sys/dev/mge/if_mge.c index 447ec370b235..dfa2cff5590f 100644 --- a/sys/dev/mge/if_mge.c +++ b/sys/dev/mge/if_mge.c @@ -2052,7 +2052,7 @@ mge_setup_multicast(struct mge_softc *sc) memset(omt, 0, sizeof(omt)); if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c b/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c index cdf7abef2d65..b378f5d9febf 100644 --- a/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c +++ b/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c @@ -623,7 +623,7 @@ static void mlx4_en_cache_uclist(struct net_device *dev) mlx4_en_clear_uclist(dev); if_addr_rlock(dev); - TAILQ_FOREACH(ifa, &dev->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &dev->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_LINK) continue; if (((struct sockaddr_dl *)ifa->ifa_addr)->sdl_alen != @@ -661,7 +661,7 @@ static void mlx4_en_cache_mclist(struct net_device *dev) mlx4_en_clear_mclist(dev); if_maddr_rlock(dev); - TAILQ_FOREACH(ifma, &dev->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &dev->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; if (((struct sockaddr_dl *)ifma->ifma_addr)->sdl_alen != diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c index dbd3ca26b8f1..55c28aa045f3 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c @@ -29,7 +29,6 @@ #include #include - #define MLX5_SET_CFG(p, f, v) MLX5_SET(create_flow_group_in, p, f, v) enum { @@ -767,7 +766,7 @@ mlx5e_sync_ifp_addr(struct mlx5e_priv *priv) LLADDR((struct sockaddr_dl *)(ifp->if_addr->ifa_addr))); if_addr_rlock(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_LINK) continue; mlx5e_add_eth_addr_to_hash(priv->eth_addr.if_uc, @@ -776,7 +775,7 @@ mlx5e_sync_ifp_addr(struct mlx5e_priv *priv) if_addr_runlock(ifp); if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; mlx5e_add_eth_addr_to_hash(priv->eth_addr.if_mc, diff --git a/sys/dev/msk/if_msk.c b/sys/dev/msk/if_msk.c index ea500fa2f4ea..91b6e15ad138 100644 --- a/sys/dev/msk/if_msk.c +++ b/sys/dev/msk/if_msk.c @@ -600,7 +600,7 @@ msk_rxfilter(struct msk_if_softc *sc_if) } else { mode |= GM_RXCR_UCF_ENA; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/mxge/if_mxge.c b/sys/dev/mxge/if_mxge.c index 70a8ce2d6ce1..99b545e424c0 100644 --- a/sys/dev/mxge/if_mxge.c +++ b/sys/dev/mxge/if_mxge.c @@ -1146,7 +1146,7 @@ mxge_set_multicast_list(mxge_softc_t *sc) /* Walk the multicast list, and add each address */ if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), diff --git a/sys/dev/my/if_my.c b/sys/dev/my/if_my.c index 4c879260b0d2..b1d5e3586c9d 100644 --- a/sys/dev/my/if_my.c +++ b/sys/dev/my/if_my.c @@ -336,7 +336,7 @@ my_setmulti(struct my_softc * sc) /* now program new ones */ if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = ~ether_crc32_be(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/nge/if_nge.c b/sys/dev/nge/if_nge.c index 8d9e1861bea5..42896b6e9888 100644 --- a/sys/dev/nge/if_nge.c +++ b/sys/dev/nge/if_nge.c @@ -727,7 +727,7 @@ nge_rxfilter(struct nge_softc *sc) * which bit within that byte needs to be set. */ if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = ether_crc32_be(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/oce/oce_hw.c b/sys/dev/oce/oce_hw.c index 054d7336ffda..4aad51da5db6 100644 --- a/sys/dev/oce/oce_hw.c +++ b/sys/dev/oce/oce_hw.c @@ -569,7 +569,7 @@ oce_hw_update_multicast(POCE_SOFTC sc) #if __FreeBSD_version > 800000 if_maddr_rlock(ifp); #endif - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/dev/otus/if_otus.c b/sys/dev/otus/if_otus.c index 54ec7fdadb30..8b5cd4dc3bd0 100644 --- a/sys/dev/otus/if_otus.c +++ b/sys/dev/otus/if_otus.c @@ -2330,7 +2330,7 @@ otus_set_multi(struct otus_softc *sc) TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { ifp = vap->iv_ifp; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { caddr_t dl; uint32_t val; diff --git a/sys/dev/pcn/if_pcn.c b/sys/dev/pcn/if_pcn.c index 5a35cac26493..6073310b2ac9 100644 --- a/sys/dev/pcn/if_pcn.c +++ b/sys/dev/pcn/if_pcn.c @@ -371,7 +371,7 @@ pcn_setmulti(sc) /* now program new ones */ if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = ether_crc32_le(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/qlnx/qlnxe/qlnx_os.c b/sys/dev/qlnx/qlnxe/qlnx_os.c index 78efdeb9119b..f69f9b0a1f68 100644 --- a/sys/dev/qlnx/qlnxe/qlnx_os.c +++ b/sys/dev/qlnx/qlnxe/qlnx_os.c @@ -2278,7 +2278,7 @@ qlnx_set_multi(qlnx_host_t *ha, uint32_t add_multi) if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/dev/qlxgb/qla_os.c b/sys/dev/qlxgb/qla_os.c index f690b4fc833a..cfed18f148a3 100644 --- a/sys/dev/qlxgb/qla_os.c +++ b/sys/dev/qlxgb/qla_os.c @@ -773,7 +773,7 @@ qla_set_multi(qla_host_t *ha, uint32_t add_multi) if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/dev/qlxgbe/ql_os.c b/sys/dev/qlxgbe/ql_os.c index f895fd917823..8cbd67f8cd57 100644 --- a/sys/dev/qlxgbe/ql_os.c +++ b/sys/dev/qlxgbe/ql_os.c @@ -988,7 +988,7 @@ qla_set_multi(qla_host_t *ha, uint32_t add_multi) if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/dev/qlxge/qls_os.c b/sys/dev/qlxge/qls_os.c index 7250b8369466..5cd16a8956e5 100644 --- a/sys/dev/qlxge/qls_os.c +++ b/sys/dev/qlxge/qls_os.c @@ -845,7 +845,7 @@ qls_set_multi(qla_host_t *ha, uint32_t add_multi) if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c index f8f01efafcdb..cccd0440162e 100644 --- a/sys/dev/re/if_re.c +++ b/sys/dev/re/if_re.c @@ -685,7 +685,7 @@ re_set_rxmode(struct rl_softc *sc) } if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = ether_crc32_be(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/rl/if_rl.c b/sys/dev/rl/if_rl.c index 7866677923f4..7e8c63131607 100644 --- a/sys/dev/rl/if_rl.c +++ b/sys/dev/rl/if_rl.c @@ -538,7 +538,7 @@ rl_rxfilter(struct rl_softc *sc) } else { /* Now program new ones. */ if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = ether_crc32_be(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/rtwn/if_rtwn_rx.c b/sys/dev/rtwn/if_rtwn_rx.c index 04062e0d1282..21609e31515c 100644 --- a/sys/dev/rtwn/if_rtwn_rx.c +++ b/sys/dev/rtwn/if_rtwn_rx.c @@ -387,7 +387,7 @@ rtwn_set_multi(struct rtwn_softc *sc) TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { ifp = vap->iv_ifp; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { caddr_t dl; uint8_t pos; diff --git a/sys/dev/sf/if_sf.c b/sys/dev/sf/if_sf.c index ef07f5db7fc2..9c0a7014ae30 100644 --- a/sys/dev/sf/if_sf.c +++ b/sys/dev/sf/if_sf.c @@ -484,8 +484,9 @@ sf_rxfilter(struct sf_softc *sc) /* Now program new ones. */ i = 1; + /* XXX how do we maintain reverse semantics without impl */ if_maddr_rlock(ifp); - TAILQ_FOREACH_REVERSE(ifma, &ifp->if_multiaddrs, ifmultihead, + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/dev/sfxge/sfxge_port.c b/sys/dev/sfxge/sfxge_port.c index 63bf4cd57994..ac1b6b0f8635 100644 --- a/sys/dev/sfxge/sfxge_port.c +++ b/sys/dev/sfxge/sfxge_port.c @@ -369,7 +369,7 @@ sfxge_mac_multicast_list_set(struct sfxge_softc *sc) port->mcast_count = 0; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family == AF_LINK) { if (port->mcast_count == EFX_MAC_MULTICAST_LIST_MAX) { device_printf(sc->dev, diff --git a/sys/dev/sge/if_sge.c b/sys/dev/sge/if_sge.c index 7c9bdd954700..9fb84670e2cf 100644 --- a/sys/dev/sge/if_sge.c +++ b/sys/dev/sge/if_sge.c @@ -469,7 +469,7 @@ sge_rxfilter(struct sge_softc *sc) hashes[0] = hashes[1] = 0; /* Now program new ones. */ if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/sis/if_sis.c b/sys/dev/sis/if_sis.c index cf719ec310dc..017033488565 100644 --- a/sys/dev/sis/if_sis.c +++ b/sys/dev/sis/if_sis.c @@ -744,7 +744,7 @@ sis_rxfilter_ns(struct sis_softc *sc) } if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = sis_mchash(sc, @@ -802,7 +802,7 @@ sis_rxfilter_sis(struct sis_softc *sc) hashes[i] = 0; i = 0; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = sis_mchash(sc, diff --git a/sys/dev/sk/if_sk.c b/sys/dev/sk/if_sk.c index a288b5145b07..d5c60d4c87c2 100644 --- a/sys/dev/sk/if_sk.c +++ b/sys/dev/sk/if_sk.c @@ -749,7 +749,8 @@ sk_rxfilter_genesis(sc_if) } else { i = 1; if_maddr_rlock(ifp); - TAILQ_FOREACH_REVERSE(ifma, &ifp->if_multiaddrs, ifmultihead, + /* XXX want to maintain reverse semantics */ + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -801,7 +802,7 @@ sk_rxfilter_yukon(sc_if) } else { mode |= YU_RCR_UFLEN; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/sn/if_sn.c b/sys/dev/sn/if_sn.c index 46cd32ebaadc..df5e2adaf9ce 100644 --- a/sys/dev/sn/if_sn.c +++ b/sys/dev/sn/if_sn.c @@ -1418,7 +1418,7 @@ sn_getmcf(struct ifnet *ifp, uint8_t *mcf) bzero(mcf, MCFSZ); if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) { if_maddr_runlock(ifp); return 0; diff --git a/sys/dev/ste/if_ste.c b/sys/dev/ste/if_ste.c index 0005615a6304..7a24439b80b5 100644 --- a/sys/dev/ste/if_ste.c +++ b/sys/dev/ste/if_ste.c @@ -434,7 +434,7 @@ ste_rxfilter(struct ste_softc *sc) rxcfg |= STE_RXMODE_MULTIHASH; /* Now program new ones. */ if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = ether_crc32_be(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/stge/if_stge.c b/sys/dev/stge/if_stge.c index 4a4fb1ac74df..54513f6d32e3 100644 --- a/sys/dev/stge/if_stge.c +++ b/sys/dev/stge/if_stge.c @@ -2547,7 +2547,7 @@ stge_set_multi(struct stge_softc *sc) count = 0; if_maddr_rlock(sc->sc_ifp); - TAILQ_FOREACH(ifma, &sc->sc_ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &sc->sc_ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c index c966302c7136..1aa9dd3ecbe1 100644 --- a/sys/dev/ti/if_ti.c +++ b/sys/dev/ti/if_ti.c @@ -1978,7 +1978,7 @@ ti_setmulti(struct ti_softc *sc) /* Now program new ones. */ if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_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/tl/if_tl.c b/sys/dev/tl/if_tl.c index 70c1d17ec3fc..3a36f3079f95 100644 --- a/sys/dev/tl/if_tl.c +++ b/sys/dev/tl/if_tl.c @@ -880,7 +880,8 @@ tl_setmulti(sc) } else { i = 1; if_maddr_rlock(ifp); - TAILQ_FOREACH_REVERSE(ifma, &ifp->if_multiaddrs, ifmultihead, ifma_link) { + /* XXX want to maintain reverse semantics - pop list and re-add? */ + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; /* diff --git a/sys/dev/tsec/if_tsec.c b/sys/dev/tsec/if_tsec.c index 34bd22957db2..701d9abbbb41 100644 --- a/sys/dev/tsec/if_tsec.c +++ b/sys/dev/tsec/if_tsec.c @@ -1905,7 +1905,7 @@ tsec_setup_multicast(struct tsec_softc *sc) } if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/dev/tx/if_tx.c b/sys/dev/tx/if_tx.c index e1af1acc325f..c3bcffa70bd0 100644 --- a/sys/dev/tx/if_tx.c +++ b/sys/dev/tx/if_tx.c @@ -1399,7 +1399,7 @@ epic_set_mc_table(epic_softc_t *sc) filter[3] = 0; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = ether_crc32_be(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/txp/if_txp.c b/sys/dev/txp/if_txp.c index cb8140e39e15..0de96c512b5e 100644 --- a/sys/dev/txp/if_txp.c +++ b/sys/dev/txp/if_txp.c @@ -2742,7 +2742,7 @@ txp_set_filter(struct txp_softc *sc) mchash[0] = mchash[1] = 0; mcnt = 0; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/usb/net/if_aue.c b/sys/dev/usb/net/if_aue.c index 5669e3fc4b47..e5d426345f94 100644 --- a/sys/dev/usb/net/if_aue.c +++ b/sys/dev/usb/net/if_aue.c @@ -555,7 +555,7 @@ aue_setmulti(struct usb_ether *ue) /* now program new ones */ if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = ether_crc32_le(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/usb/net/if_axe.c b/sys/dev/usb/net/if_axe.c index 68f4479d8e21..4d5ed403111c 100644 --- a/sys/dev/usb/net/if_axe.c +++ b/sys/dev/usb/net/if_axe.c @@ -502,7 +502,7 @@ axe_setmulti(struct usb_ether *ue) rxmode &= ~AXE_RXCMD_ALLMULTI; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/dev/usb/net/if_axge.c b/sys/dev/usb/net/if_axge.c index 1e82f6549b0a..daaf12f9d61c 100644 --- a/sys/dev/usb/net/if_axge.c +++ b/sys/dev/usb/net/if_axge.c @@ -786,7 +786,7 @@ axge_rxfilter(struct usb_ether *ue) rxmode |= RCR_ACPT_MCAST; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = ether_crc32_be(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/usb/net/if_cue.c b/sys/dev/usb/net/if_cue.c index 9d66e51289b9..191804e8718e 100644 --- a/sys/dev/usb/net/if_cue.c +++ b/sys/dev/usb/net/if_cue.c @@ -328,7 +328,7 @@ cue_setmulti(struct usb_ether *ue) /* now program new ones */ if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/dev/usb/net/if_kue.c b/sys/dev/usb/net/if_kue.c index 4c07043e1712..05d39e566fd8 100644 --- a/sys/dev/usb/net/if_kue.c +++ b/sys/dev/usb/net/if_kue.c @@ -377,7 +377,7 @@ kue_setmulti(struct usb_ether *ue) sc->sc_rxfilt &= ~KUE_RXFILT_ALLMULTI; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/dev/usb/net/if_mos.c b/sys/dev/usb/net/if_mos.c index a5823cff1f1e..eb056bef5176 100644 --- a/sys/dev/usb/net/if_mos.c +++ b/sys/dev/usb/net/if_mos.c @@ -606,7 +606,7 @@ mos_setmulti(struct usb_ether *ue) /* get all new ones */ if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) { allmulti = 1; continue; diff --git a/sys/dev/usb/net/if_rue.c b/sys/dev/usb/net/if_rue.c index 3766c993e4ed..50d6905ddfbc 100644 --- a/sys/dev/usb/net/if_rue.c +++ b/sys/dev/usb/net/if_rue.c @@ -500,7 +500,7 @@ rue_setmulti(struct usb_ether *ue) /* now program new ones */ if_maddr_rlock(ifp); - TAILQ_FOREACH (ifma, &ifp->if_multiaddrs, ifma_link) + CK_STAILQ_FOREACH (ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/dev/usb/net/if_smsc.c b/sys/dev/usb/net/if_smsc.c index a67df087f3e7..d4db426e5310 100644 --- a/sys/dev/usb/net/if_smsc.c +++ b/sys/dev/usb/net/if_smsc.c @@ -714,14 +714,14 @@ smsc_setmulti(struct usb_ether *ue) /* Take the lock of the mac address list before hashing each of them */ if_maddr_rlock(ifp); - if (!TAILQ_EMPTY(&ifp->if_multiaddrs)) { + if (!CK_STAILQ_EMPTY(&ifp->if_multiaddrs)) { /* We are filtering on a set of address so calculate hashes of each * of the address and set the corresponding bits in the register. */ sc->sc_mac_csr |= SMSC_MAC_CSR_HPFILT; sc->sc_mac_csr &= ~(SMSC_MAC_CSR_PRMS | SMSC_MAC_CSR_MCPAS); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/dev/usb/net/if_udav.c b/sys/dev/usb/net/if_udav.c index 92a9d4008f0d..8018efcb9174 100644 --- a/sys/dev/usb/net/if_udav.c +++ b/sys/dev/usb/net/if_udav.c @@ -522,7 +522,7 @@ udav_setmulti(struct usb_ether *ue) /* now program new ones */ if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/dev/usb/net/if_ure.c b/sys/dev/usb/net/if_ure.c index db9b0517f238..9fc439dce9e9 100644 --- a/sys/dev/usb/net/if_ure.c +++ b/sys/dev/usb/net/if_ure.c @@ -795,7 +795,7 @@ ure_rxfilter(struct usb_ether *ue) rxmode |= URE_RCR_AM; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = ether_crc32_be(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/usb/wlan/if_rsu.c b/sys/dev/usb/wlan/if_rsu.c index 49eaee2b6aea..9e9087568a91 100644 --- a/sys/dev/usb/wlan/if_rsu.c +++ b/sys/dev/usb/wlan/if_rsu.c @@ -885,7 +885,7 @@ rsu_set_multi(struct rsu_softc *sc) TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { ifp = vap->iv_ifp; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { caddr_t dl; uint8_t pos; diff --git a/sys/dev/usb/wlan/if_zyd.c b/sys/dev/usb/wlan/if_zyd.c index 90eea145badb..9c6202204a0c 100644 --- a/sys/dev/usb/wlan/if_zyd.c +++ b/sys/dev/usb/wlan/if_zyd.c @@ -2000,7 +2000,7 @@ zyd_set_multi(struct zyd_softc *sc) TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { ifp = vap->iv_ifp; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + 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 *) diff --git a/sys/dev/vge/if_vge.c b/sys/dev/vge/if_vge.c index e0ae98fa0b39..e5c7f0cea3f6 100644 --- a/sys/dev/vge/if_vge.c +++ b/sys/dev/vge/if_vge.c @@ -574,7 +574,7 @@ vge_rxfilter(struct vge_softc *sc) vge_cam_clear(sc); /* Now program new ones */ if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; error = vge_cam_set(sc, @@ -587,7 +587,7 @@ vge_rxfilter(struct vge_softc *sc) if (error) { vge_cam_clear(sc); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = ether_crc32_be(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index c2bbdd74f5ba..2ce9a0d5d840 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -81,7 +81,6 @@ __FBSDID("$FreeBSD$"); #include #include #include - #include "virtio_if.h" #include "opt_inet.h" @@ -3321,7 +3320,7 @@ vtnet_rx_filter_mac(struct vtnet_softc *sc) /* Unicast MAC addresses: */ if_addr_rlock(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_LINK) continue; else if (memcmp(LLADDR((struct sockaddr_dl *)ifa->ifa_addr), @@ -3348,7 +3347,7 @@ vtnet_rx_filter_mac(struct vtnet_softc *sc) /* Multicast MAC addresses: */ if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; else if (mcnt == VTNET_MAX_MAC_ENTRIES) { diff --git a/sys/dev/vmware/vmxnet3/if_vmx.c b/sys/dev/vmware/vmxnet3/if_vmx.c index a83e2de31661..b3cb9df49821 100644 --- a/sys/dev/vmware/vmxnet3/if_vmx.c +++ b/sys/dev/vmware/vmxnet3/if_vmx.c @@ -3173,7 +3173,7 @@ vmxnet3_set_rxfilter(struct vmxnet3_softc *sc) int cnt = 0, overflow = 0; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; else if (cnt == VMXNET3_MULTICAST_MAX) { diff --git a/sys/dev/vr/if_vr.c b/sys/dev/vr/if_vr.c index b1c7b540155c..ff7433d8020a 100644 --- a/sys/dev/vr/if_vr.c +++ b/sys/dev/vr/if_vr.c @@ -474,7 +474,7 @@ vr_set_filter(struct vr_softc *sc) * 32 entries multicast perfect filter. */ cam_mask = 0; - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; error = vr_cam_data(sc, VR_MCAST_CAM, mcnt, @@ -496,7 +496,7 @@ vr_set_filter(struct vr_softc *sc) * table based filtering. */ mcnt = 0; - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = ether_crc32_be(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/vte/if_vte.c b/sys/dev/vte/if_vte.c index b0f588888a4a..c38d53406bcc 100644 --- a/sys/dev/vte/if_vte.c +++ b/sys/dev/vte/if_vte.c @@ -1996,7 +1996,7 @@ vte_rxfilter(struct vte_softc *sc) nperf = 0; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &sc->vte_ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &sc->vte_ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; /* diff --git a/sys/dev/wb/if_wb.c b/sys/dev/wb/if_wb.c index e91d38739f94..5b09923b106c 100644 --- a/sys/dev/wb/if_wb.c +++ b/sys/dev/wb/if_wb.c @@ -440,7 +440,7 @@ wb_setmulti(sc) /* now program new ones */ if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = ~ether_crc32_be(LLADDR((struct sockaddr_dl *) diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c index e310257a2fd2..35eb5343d7d7 100644 --- a/sys/dev/wi/if_wi.c +++ b/sys/dev/wi/if_wi.c @@ -1528,7 +1528,7 @@ wi_write_multi(struct wi_softc *sc) ifp = vap->iv_ifp; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; if (n >= 16) diff --git a/sys/dev/xe/if_xe.c b/sys/dev/xe/if_xe.c index 3cd050b70dca..02ecbdd69a3c 100644 --- a/sys/dev/xe/if_xe.c +++ b/sys/dev/xe/if_xe.c @@ -1394,7 +1394,7 @@ xe_set_multicast(struct xe_softc *scp) /* Iterate over multicast address list */ count = 0; if_maddr_rlock(ifp); - TAILQ_FOREACH(maddr, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(maddr, &ifp->if_multiaddrs, ifma_link) { if (maddr->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/dev/xen/netfront/netfront.c b/sys/dev/xen/netfront/netfront.c index f35fa940c18d..ba8ac3caf7fa 100644 --- a/sys/dev/xen/netfront/netfront.c +++ b/sys/dev/xen/netfront/netfront.c @@ -944,7 +944,7 @@ netfront_send_fake_arp(device_t dev, struct netfront_info *info) struct ifaddr *ifa; ifp = info->xn_ifp; - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family == AF_INET) { arp_ifinit(ifp, ifa); } diff --git a/sys/dev/xl/if_xl.c b/sys/dev/xl/if_xl.c index 0d9c907e4042..0afe62a522de 100644 --- a/sys/dev/xl/if_xl.c +++ b/sys/dev/xl/if_xl.c @@ -636,7 +636,7 @@ xl_rxfilter_90x(struct xl_softc *sc) rxfilt |= XL_RXFILTER_ALLMULTI; } else { if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; rxfilt |= XL_RXFILTER_ALLMULTI; @@ -691,7 +691,7 @@ xl_rxfilter_90xB(struct xl_softc *sc) /* Now program new ones. */ mcnt = 0; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; /* diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c index 19e3656e0f28..33a103ec715b 100644 --- a/sys/kern/subr_witness.c +++ b/sys/kern/subr_witness.c @@ -537,7 +537,7 @@ static struct witness_order_list_entry order_lists[] = { { "in_multi_list_mtx", &lock_class_mtx_sleep }, { "igmp_mtx", &lock_class_mtx_sleep }, { "ifnet_rw", &lock_class_rw }, - { "if_addr_lock", &lock_class_rw }, + { "if_addr_lock", &lock_class_mtx_sleep }, { NULL, NULL }, /* * IPv6 multicast: @@ -548,7 +548,7 @@ static struct witness_order_list_entry order_lists[] = { { "in6_multi_list_mtx", &lock_class_mtx_sleep }, { "mld_mtx", &lock_class_mtx_sleep }, { "ifnet_rw", &lock_class_rw }, - { "if_addr_lock", &lock_class_rw }, + { "if_addr_lock", &lock_class_mtx_sleep }, { NULL, NULL }, /* * UNIX Domain Sockets diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 4a4cb8da9e22..b20ca1e798dd 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -121,6 +121,7 @@ SUBDIR= \ ${_ena} \ ${_ep} \ ${_epic} \ + epoch_test \ esp \ ${_et} \ evdev \ diff --git a/sys/net/if.c b/sys/net/if.c index 3a8f8f0098cd..c04f2ad9d387 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -560,8 +561,8 @@ if_alloc(u_char type) TASK_INIT(&ifp->if_linktask, 0, do_link_state_change, ifp); ifp->if_afdata_initialized = 0; IF_AFDATA_LOCK_INIT(ifp); - TAILQ_INIT(&ifp->if_addrhead); - TAILQ_INIT(&ifp->if_multiaddrs); + CK_STAILQ_INIT(&ifp->if_addrhead); + CK_STAILQ_INIT(&ifp->if_multiaddrs); TAILQ_INIT(&ifp->if_groups); #ifdef MAC mac_ifnet_init(ifp); @@ -830,7 +831,7 @@ if_attach_internal(struct ifnet *ifp, int vmove, struct if_clone *ifc) sdl->sdl_len = masklen; while (namelen != 0) sdl->sdl_data[--namelen] = 0xff; - TAILQ_INSERT_HEAD(&ifp->if_addrhead, ifa, ifa_link); + CK_STAILQ_INSERT_HEAD(&ifp->if_addrhead, ifa, ifa_link); /* Reliably crash if used uninitialized. */ ifp->if_broadcastaddr = NULL; @@ -872,7 +873,7 @@ if_attach_internal(struct ifnet *ifp, int vmove, struct if_clone *ifc) * of the interface. */ for (ifa = ifp->if_addr; ifa != NULL; - ifa = TAILQ_NEXT(ifa, ifa_link)) { + ifa = CK_STAILQ_NEXT(ifa, ifa_link)) { if (ifa->ifa_addr->sa_family == AF_LINK) { sdl = (struct sockaddr_dl *)ifa->ifa_addr; sdl->sdl_index = ifp->if_index; @@ -957,7 +958,7 @@ if_purgeaddrs(struct ifnet *ifp) struct ifaddr *ifa, *next; /* XXX cannot hold IF_ADDR_WLOCK over called functions. */ - TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, next) { + CK_STAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, next) { if (ifa->ifa_addr->sa_family == AF_LINK) continue; #ifdef INET @@ -982,7 +983,7 @@ if_purgeaddrs(struct ifnet *ifp) } #endif /* INET6 */ IF_ADDR_WLOCK(ifp); - TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link); + CK_STAILQ_REMOVE(&ifp->if_addrhead, ifa, ifaddr, ifa_link); IF_ADDR_WUNLOCK(ifp); ifa_free(ifa); } @@ -998,9 +999,9 @@ if_purgemaddrs(struct ifnet *ifp) struct ifmultiaddr *ifma; IF_ADDR_WLOCK(ifp); - while (!TAILQ_EMPTY(&ifp->if_multiaddrs)) { - ifma = TAILQ_FIRST(&ifp->if_multiaddrs); - TAILQ_REMOVE(&ifp->if_multiaddrs, ifma, ifma_link); + while (!CK_STAILQ_EMPTY(&ifp->if_multiaddrs)) { + ifma = CK_STAILQ_FIRST(&ifp->if_multiaddrs); + CK_STAILQ_REMOVE(&ifp->if_multiaddrs, ifma, ifmultiaddr, ifma_link); if_delmulti_locked(ifp, ifma, 1); } IF_ADDR_WUNLOCK(ifp); @@ -1172,9 +1173,9 @@ if_detach_internal(struct ifnet *ifp, int vmove, struct if_clone **ifcp) /* We can now free link ifaddr. */ IF_ADDR_WLOCK(ifp); - if (!TAILQ_EMPTY(&ifp->if_addrhead)) { - ifa = TAILQ_FIRST(&ifp->if_addrhead); - TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link); + if (!CK_STAILQ_EMPTY(&ifp->if_addrhead)) { + ifa = CK_STAILQ_FIRST(&ifp->if_addrhead); + CK_STAILQ_REMOVE(&ifp->if_addrhead, ifa, ifaddr, ifa_link); IF_ADDR_WUNLOCK(ifp); ifa_free(ifa); } else @@ -1807,19 +1808,28 @@ ifa_ref(struct ifaddr *ifa) refcount_acquire(&ifa->ifa_refcnt); } +static void +ifa_destroy(epoch_context_t ctx) +{ + struct ifaddr *ifa; + + ifa = __containerof(ctx, struct ifaddr, ifa_epoch_ctx); + counter_u64_free(ifa->ifa_opackets); + counter_u64_free(ifa->ifa_ipackets); + counter_u64_free(ifa->ifa_obytes); + counter_u64_free(ifa->ifa_ibytes); + free(ifa, M_IFADDR); +} + void ifa_free(struct ifaddr *ifa) { - if (refcount_release(&ifa->ifa_refcnt)) { - counter_u64_free(ifa->ifa_opackets); - counter_u64_free(ifa->ifa_ipackets); - counter_u64_free(ifa->ifa_obytes); - counter_u64_free(ifa->ifa_ibytes); - free(ifa, M_IFADDR); - } + if (refcount_release(&ifa->ifa_refcnt)) + epoch_call(net_epoch_preempt, &ifa->ifa_epoch_ctx, ifa_destroy); } + static int ifa_maintain_loopback_route(int cmd, const char *otype, struct ifaddr *ifa, struct sockaddr *ia) @@ -1896,7 +1906,7 @@ ifa_ifwithaddr_internal(const struct sockaddr *addr, int getref) IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != addr->sa_family) continue; if (sa_equal(addr, ifa->ifa_addr)) { @@ -1953,7 +1963,7 @@ ifa_ifwithbroadaddr(const struct sockaddr *addr, int fibnum) if ((fibnum != RT_ALL_FIBS) && (ifp->if_fib != fibnum)) continue; IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != addr->sa_family) continue; if ((ifp->if_flags & IFF_BROADCAST) && @@ -1990,7 +2000,7 @@ ifa_ifwithdstaddr(const struct sockaddr *addr, int fibnum) if ((fibnum != RT_ALL_FIBS) && (ifp->if_fib != fibnum)) continue; IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != addr->sa_family) continue; if (ifa->ifa_dstaddr != NULL && @@ -2042,7 +2052,7 @@ ifa_ifwithnet(const struct sockaddr *addr, int ignore_ptp, int fibnum) if ((fibnum != RT_ALL_FIBS) && (ifp->if_fib != fibnum)) continue; IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { const char *cp, *cp2, *cp3; if (ifa->ifa_addr->sa_family != af) @@ -2127,7 +2137,7 @@ ifaof_ifpforaddr(const struct sockaddr *addr, struct ifnet *ifp) if (af >= AF_MAX) return (NULL); IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != af) continue; if (ifa_maybe == NULL) @@ -2249,7 +2259,7 @@ if_unroute(struct ifnet *ifp, int flag, int fam) ifp->if_flags &= ~flag; getmicrotime(&ifp->if_lastchange); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) if (fam == PF_UNSPEC || (fam == ifa->ifa_addr->sa_family)) pfctlinput(PRC_IFDOWN, ifa->ifa_addr); ifp->if_qflush(ifp); @@ -2272,7 +2282,7 @@ if_route(struct ifnet *ifp, int flag, int fam) ifp->if_flags |= flag; getmicrotime(&ifp->if_lastchange); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) if (fam == PF_UNSPEC || (fam == ifa->ifa_addr->sa_family)) pfctlinput(PRC_IFUP, ifa->ifa_addr); if (ifp->if_carp) @@ -3264,7 +3274,7 @@ ifconf(u_long cmd, caddr_t data) addrs = 0; IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct sockaddr *sa = ifa->ifa_addr; if (prison_if(curthread->td_ucred, sa) != 0) @@ -3336,7 +3346,7 @@ if_findmulti(struct ifnet *ifp, const struct sockaddr *sa) IF_ADDR_LOCK_ASSERT(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (sa->sa_family == AF_LINK) { if (sa_dl_equal(ifma->ifma_addr, sa)) break; @@ -3406,8 +3416,8 @@ if_allocmulti(struct ifnet *ifp, struct sockaddr *sa, struct sockaddr *llsa, #ifdef MCAST_VERBOSE extern void kdb_backtrace(void); #endif -void -if_freemulti(struct ifmultiaddr *ifma) +static void +if_freemulti_internal(struct ifmultiaddr *ifma) { KASSERT(ifma->ifma_refcount == 0, ("if_freemulti: refcount %d", @@ -3423,6 +3433,25 @@ if_freemulti(struct ifmultiaddr *ifma) free(ifma, M_IFMADDR); } +static void +if_destroymulti(epoch_context_t ctx) +{ + struct ifmultiaddr *ifma; + + ifma = __containerof(ctx, struct ifmultiaddr, ifma_epoch_ctx); + if_freemulti_internal(ifma); +} + +void +if_freemulti(struct ifmultiaddr *ifma) +{ + KASSERT(ifma->ifma_refcount == 0, ("if_freemulti_epoch: refcount %d", + ifma->ifma_refcount)); + + epoch_call(net_epoch_preempt, &ifma->ifma_epoch_ctx, if_destroymulti); +} + + /* * Register an additional multicast address with a network interface. * @@ -3516,7 +3545,7 @@ if_addmulti(struct ifnet *ifp, struct sockaddr *sa, error = ENOMEM; goto free_llsa_out; } - TAILQ_INSERT_HEAD(&ifp->if_multiaddrs, ll_ifma, + CK_STAILQ_INSERT_HEAD(&ifp->if_multiaddrs, ll_ifma, ifma_link); } else ll_ifma->ifma_refcount++; @@ -3528,7 +3557,7 @@ if_addmulti(struct ifnet *ifp, struct sockaddr *sa, * referenced link layer address. Add the primary address to the * ifnet address list. */ - TAILQ_INSERT_HEAD(&ifp->if_multiaddrs, ifma, ifma_link); + CK_STAILQ_INSERT_HEAD(&ifp->if_multiaddrs, ifma, ifma_link); if (retifma != NULL) *retifma = ifma; @@ -3620,7 +3649,7 @@ if_delallmulti(struct ifnet *ifp) struct ifmultiaddr *next; IF_ADDR_WLOCK(ifp); - TAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) + CK_STAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) if_delmulti_locked(ifp, ifma, 0); IF_ADDR_WUNLOCK(ifp); } @@ -3731,7 +3760,7 @@ if_delmulti_locked(struct ifnet *ifp, struct ifmultiaddr *ifma, int detaching) return 0; if (ifp != NULL && detaching == 0) - TAILQ_REMOVE(&ifp->if_multiaddrs, ifma, ifma_link); + CK_STAILQ_REMOVE(&ifp->if_multiaddrs, ifma, ifmultiaddr, ifma_link); /* * If this ifma is a network-layer ifma, a link-layer ifma may @@ -3745,7 +3774,7 @@ if_delmulti_locked(struct ifnet *ifp, struct ifmultiaddr *ifma, int detaching) ll_ifma->ifma_ifp = NULL; /* XXX */ if (--ll_ifma->ifma_refcount == 0) { if (ifp != NULL) { - TAILQ_REMOVE(&ifp->if_multiaddrs, ll_ifma, + CK_STAILQ_REMOVE(&ifp->if_multiaddrs, ll_ifma, ifmultiaddr, ifma_link); } if_freemulti(ll_ifma); @@ -3755,7 +3784,7 @@ if_delmulti_locked(struct ifnet *ifp, struct ifmultiaddr *ifma, int detaching) if (ifp) { struct ifmultiaddr *ifmatmp; - TAILQ_FOREACH(ifmatmp, &ifp->if_multiaddrs, ifma_link) + CK_STAILQ_FOREACH(ifmatmp, &ifp->if_multiaddrs, ifma_link) MPASS(ifma != ifmatmp); } #endif @@ -4284,7 +4313,7 @@ if_setupmultiaddr(if_t ifp, void *mta, int *cnt, int max) uint8_t *lmta = (uint8_t *)mta; int mcnt = 0; - TAILQ_FOREACH(ifma, &((struct ifnet *)ifp)->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &((struct ifnet *)ifp)->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -4319,7 +4348,7 @@ if_multiaddr_count(if_t ifp, int max) count = 0; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &((struct ifnet *)ifp)->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &((struct ifnet *)ifp)->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; count++; @@ -4337,7 +4366,7 @@ if_multi_apply(struct ifnet *ifp, int (*filter)(void *, struct ifmultiaddr *, in int cnt = 0; if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) cnt += filter(arg, ifma, cnt); if_maddr_runlock(ifp); return (cnt); diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c index 851337835996..4fc28d789d9a 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -1532,7 +1532,7 @@ lagg_setmulti(struct lagg_port *lp) int error; IF_ADDR_WLOCK(scifp); - TAILQ_FOREACH(ifma, &scifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &scifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; mc = malloc(sizeof(struct lagg_mc), M_DEVBUF, M_NOWAIT); diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index bf7b664661de..1ff05f29b985 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -4837,7 +4837,7 @@ sppp_get_ip_addrs(struct sppp *sp, u_long *src, u_long *dst, u_long *srcmask) */ si = NULL; if_addr_rlock(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) if (ifa->ifa_addr->sa_family == AF_INET) { si = (struct sockaddr_in *)ifa->ifa_addr; sm = (struct sockaddr_in *)ifa->ifa_netmask; @@ -4879,7 +4879,7 @@ sppp_set_ip_addr(struct sppp *sp, u_long src) */ si = NULL; if_addr_rlock(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family == AF_INET) { si = (struct sockaddr_in *)ifa->ifa_addr; if (si != NULL) { @@ -4941,7 +4941,7 @@ sppp_get_ip6_addrs(struct sppp *sp, struct in6_addr *src, struct in6_addr *dst, */ si = NULL; if_addr_rlock(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) if (ifa->ifa_addr->sa_family == AF_INET6) { si = (struct sockaddr_in6 *)ifa->ifa_addr; sm = (struct sockaddr_in6 *)ifa->ifa_netmask; @@ -4996,7 +4996,7 @@ sppp_set_ip6_addr(struct sppp *sp, const struct in6_addr *src) sin6 = NULL; if_addr_rlock(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family == AF_INET6) { sin6 = (struct sockaddr_in6 *)ifa->ifa_addr; if (sin6 && IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { diff --git a/sys/net/if_stf.c b/sys/net/if_stf.c index 688ea1d4a362..37d1984b7830 100644 --- a/sys/net/if_stf.c +++ b/sys/net/if_stf.c @@ -380,7 +380,7 @@ stf_getsrcifa6(struct ifnet *ifp, struct in6_addr *addr, struct in6_addr *mask) struct in_addr in; if_addr_rlock(ifp); - TAILQ_FOREACH(ia, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ia, &ifp->if_addrhead, ifa_link) { if (ia->ifa_addr->sa_family != AF_INET6) continue; sin6 = (struct sockaddr_in6 *)ia->ifa_addr; @@ -557,7 +557,7 @@ stf_checkaddr4(struct stf_softc *sc, struct in_addr *in, struct ifnet *inifp) * reject packets with broadcast */ IN_IFADDR_RLOCK(&in_ifa_tracker); - TAILQ_FOREACH(ia4, &V_in_ifaddrhead, ia_link) { + CK_STAILQ_FOREACH(ia4, &V_in_ifaddrhead, ia_link) { if ((ia4->ia_ifa.ifa_ifp->if_flags & IFF_BROADCAST) == 0) continue; if (in->s_addr == ia4->ia_broadaddr.sin_addr.s_addr) { diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c index f268e07b8a1f..2bce8c1e7aad 100644 --- a/sys/net/if_tap.c +++ b/sys/net/if_tap.c @@ -77,7 +77,6 @@ #include #include - #define CDEV_NAME "tap" #define TAPDEBUG if (tapdebug) printf @@ -544,7 +543,7 @@ tapclose(struct cdev *dev, int foo, int bar, struct thread *td) if (ifp->if_drv_flags & IFF_DRV_RUNNING) { ifp->if_drv_flags &= ~IFF_DRV_RUNNING; mtx_unlock(&tp->tap_mtx); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { rtinit(ifa, (int)RTM_DELETE, 0); } if_purgeaddrs(ifp); diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 26e5b8c54509..cc3a25d72740 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -466,7 +466,7 @@ tunclose(struct cdev *dev, int foo, int bar, struct thread *td) ifp->if_drv_flags &= ~IFF_DRV_RUNNING; mtx_unlock(&tp->tun_mtx); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { /* deal w/IPv4 PtP destination; unlocked read */ if (ifa->ifa_addr->sa_family == AF_INET) { rtinit(ifa, (int)RTM_DELETE, @@ -508,7 +508,7 @@ tuninit(struct ifnet *ifp) #ifdef INET if_addr_rlock(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family == AF_INET) { struct sockaddr_in *si; diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 4a65ca7d7b2f..1e156ab5750a 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -85,14 +85,18 @@ struct netdump_methods; #include /* XXX */ #include /* XXX */ #include /* if_link_task */ - #define IF_DUNIT_NONE -1 #include TAILQ_HEAD(ifnethead, ifnet); /* we use TAILQs so that the order of */ -TAILQ_HEAD(ifaddrhead, ifaddr); /* instantiation is preserved in the list */ -TAILQ_HEAD(ifmultihead, ifmultiaddr); +#ifdef _KERNEL +CK_STAILQ_HEAD(ifaddrhead, ifaddr); /* instantiation is preserved in the list */ +CK_STAILQ_HEAD(ifmultihead, ifmultiaddr); +#else +STAILQ_HEAD(ifaddrhead, ifaddr); /* instantiation is preserved in the list */ +STAILQ_HEAD(ifmultihead, ifmultiaddr); +#endif TAILQ_HEAD(ifgrouphead, ifg_group); #ifdef _KERNEL @@ -281,7 +285,7 @@ struct ifnet { struct task if_linktask; /* task for link change events */ /* Addresses of different protocol families assigned to this if. */ - struct rwlock if_addr_lock; /* lock to protect address lists */ + struct mtx if_addr_lock; /* lock to protect address lists */ /* * if_addrhead is the list of all addresses associated to * an interface. @@ -396,14 +400,15 @@ struct ifnet { /* * Locks for address lists on the network interface. */ -#define IF_ADDR_LOCK_INIT(if) rw_init(&(if)->if_addr_lock, "if_addr_lock") -#define IF_ADDR_LOCK_DESTROY(if) rw_destroy(&(if)->if_addr_lock) -#define IF_ADDR_WLOCK(if) rw_wlock(&(if)->if_addr_lock) -#define IF_ADDR_WUNLOCK(if) rw_wunlock(&(if)->if_addr_lock) -#define IF_ADDR_RLOCK(if) rw_rlock(&(if)->if_addr_lock) -#define IF_ADDR_RUNLOCK(if) rw_runlock(&(if)->if_addr_lock) -#define IF_ADDR_LOCK_ASSERT(if) rw_assert(&(if)->if_addr_lock, RA_LOCKED) -#define IF_ADDR_WLOCK_ASSERT(if) rw_assert(&(if)->if_addr_lock, RA_WLOCKED) +#define IF_ADDR_LOCK_INIT(if) mtx_init(&(if)->if_addr_lock, "if_addr_lock", NULL, MTX_DEF) +#define IF_ADDR_LOCK_DESTROY(if) mtx_destroy(&(if)->if_addr_lock) +#define IF_ADDR_RLOCK(if) epoch_enter_preempt(net_epoch_preempt); +#define IF_ADDR_RUNLOCK(if) epoch_exit_preempt(net_epoch_preempt); + +#define IF_ADDR_WLOCK(if) mtx_lock(&(if)->if_addr_lock) +#define IF_ADDR_WUNLOCK(if) mtx_unlock(&(if)->if_addr_lock) +#define IF_ADDR_LOCK_ASSERT(if) MPASS(in_epoch() || mtx_owned(&(if)->if_addr_lock)) +#define IF_ADDR_WLOCK_ASSERT(if) mtx_assert(&(if)->if_addr_lock, MA_OWNED) /* * Function variations on locking macros intended to be used by loadable @@ -517,7 +522,7 @@ struct ifaddr { struct sockaddr *ifa_netmask; /* used to determine subnet */ struct ifnet *ifa_ifp; /* back-pointer to interface */ struct carp_softc *ifa_carp; /* pointer to CARP data */ - TAILQ_ENTRY(ifaddr) ifa_link; /* queue macro glue */ + STAILQ_ENTRY(ifaddr) ifa_link; /* queue macro glue */ void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */ (int, struct rtentry *, struct rt_addrinfo *); u_short ifa_flags; /* mostly rt_flags for cloning */ @@ -529,6 +534,7 @@ struct ifaddr { counter_u64_t ifa_opackets; counter_u64_t ifa_ibytes; counter_u64_t ifa_obytes; + struct epoch_context ifa_epoch_ctx; }; struct ifaddr * ifa_alloc(size_t size, int flags); @@ -540,13 +546,14 @@ void ifa_ref(struct ifaddr *ifa); * structure except that it keeps track of multicast addresses. */ struct ifmultiaddr { - TAILQ_ENTRY(ifmultiaddr) ifma_link; /* queue macro glue */ + STAILQ_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 */ u_int ifma_refcount; /* reference count */ void *ifma_protospec; /* protocol-specific state, if any */ struct ifmultiaddr *ifma_llifma; /* pointer to ifma for ifma_lladdr */ + struct epoch_context ifma_epoch_ctx; }; extern struct rwlock ifnet_rwlock; diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index e0aa0044062e..3e0a7d383ea5 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -609,7 +609,7 @@ vlan_setmulti(struct ifnet *ifp) /* Now program new ones. */ IF_ADDR_WLOCK(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; mc = malloc(sizeof(struct vlan_mc_entry), M_VLAN, M_NOWAIT); diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index ba9bfd902411..4042c5f6a24b 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -458,7 +458,7 @@ rtm_get_jailed(struct rt_addrinfo *info, struct ifnet *ifp, * that belongs to the jail. */ IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct sockaddr *sa; sa = ifa->ifa_addr; if (sa->sa_family != AF_INET) @@ -500,7 +500,7 @@ rtm_get_jailed(struct rt_addrinfo *info, struct ifnet *ifp, * that belongs to the jail. */ IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct sockaddr *sa; sa = ifa->ifa_addr; if (sa->sa_family != AF_INET6) @@ -1757,7 +1757,7 @@ sysctl_iflist(int af, struct walkarg *w) if (error) goto done; } - while ((ifa = TAILQ_NEXT(ifa, ifa_link)) != NULL) { + while ((ifa = CK_STAILQ_NEXT(ifa, ifa_link)) != NULL) { if (af && af != ifa->ifa_addr->sa_family) continue; if (prison_if(w->w_req->td->td_ucred, @@ -1812,7 +1812,7 @@ sysctl_ifmalist(int af, struct walkarg *w) ifa = ifp->if_addr; info.rti_info[RTAX_IFP] = ifa ? ifa->ifa_addr : NULL; IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (af && af != ifma->ifma_addr->sa_family) continue; if (prison_if(w->w_req->td->td_ucred, diff --git a/sys/netgraph/ng_eiface.c b/sys/netgraph/ng_eiface.c index 115c33e41d7d..fcc6baf57e1a 100644 --- a/sys/netgraph/ng_eiface.c +++ b/sys/netgraph/ng_eiface.c @@ -60,6 +60,7 @@ #include #include + static const struct ng_cmdlist ng_eiface_cmdlist[] = { { NGM_EIFACE_COOKIE, @@ -512,7 +513,7 @@ ng_eiface_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Determine size of response and allocate it */ buflen = 0; if_addr_rlock(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) buflen += SA_SIZE(ifa->ifa_addr); NG_MKRESPONSE(resp, msg, buflen, M_NOWAIT); if (resp == NULL) { @@ -523,7 +524,7 @@ ng_eiface_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Add addresses */ ptr = resp->data; - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { const int len = SA_SIZE(ifa->ifa_addr); if (buflen < len) { diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 7262511749f3..3c59045ffbd9 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -362,7 +362,7 @@ arprequest(struct ifnet *ifp, const struct in_addr *sip, struct ifaddr *ifa; IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET) continue; @@ -886,7 +886,7 @@ in_arpinput(struct mbuf *m) * as a dummy address for the rest of the function. */ IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) if (ifa->ifa_addr->sa_family == AF_INET && (ifa->ifa_carp == NULL || (*carp_iamatch_p)(ifa, &enaddr))) { @@ -901,7 +901,7 @@ in_arpinput(struct mbuf *m) * If bridging, fall back to using any inet address. */ IN_IFADDR_RLOCK(&in_ifa_tracker); - if (!bridged || (ia = TAILQ_FIRST(&V_in_ifaddrhead)) == NULL) { + if (!bridged || (ia = CK_STAILQ_FIRST(&V_in_ifaddrhead)) == NULL) { IN_IFADDR_RUNLOCK(&in_ifa_tracker); goto drop; } @@ -1445,7 +1445,7 @@ arp_handle_ifllchange(struct ifnet *ifp) { struct ifaddr *ifa; - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family == AF_INET) arp_ifinit(ifp, ifa); } diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c index 2f4f5242cd12..45f829942da8 100644 --- a/sys/netinet/igmp.c +++ b/sys/netinet/igmp.c @@ -623,7 +623,7 @@ igmp_ifdetach(struct ifnet *ifp) if (igi->igi_version == IGMP_VERSION_3) { IF_ADDR_WLOCK(ifp); restart: - TAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) { + CK_STAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) continue; @@ -734,7 +734,7 @@ igmp_input_v1_query(struct ifnet *ifp, const struct ip *ip, * except those which are already running. */ IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) continue; @@ -835,7 +835,7 @@ igmp_input_v2_query(struct ifnet *ifp, const struct ip *ip, CTR2(KTR_IGMPV3, "process v2 general query on ifp %p(%s)", ifp, ifp->if_xname); IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) continue; @@ -1698,7 +1698,7 @@ igmp_fasttimo_vnet(void) IF_ADDR_WLOCK(ifp); restart: - TAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) { + CK_STAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) continue; @@ -2012,7 +2012,7 @@ igmp_v3_cancel_link_timers(struct igmp_ifsoftc *igi) */ ifp = igi->igi_ifp; IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) continue; @@ -3323,7 +3323,7 @@ igmp_v3_dispatch_general_query(struct igmp_ifsoftc *igi) ifp = igi->igi_ifp; IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) continue; diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 5cdb7a761d08..81e019f477a8 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -102,7 +102,7 @@ in_localaddr(struct in_addr in) struct in_ifaddr *ia; IN_IFADDR_RLOCK(&in_ifa_tracker); - TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { + CK_STAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { if ((i & ia->ia_subnetmask) == ia->ia_subnet) { IN_IFADDR_RUNLOCK(&in_ifa_tracker); return (1); @@ -143,7 +143,7 @@ in_ifhasaddr(struct ifnet *ifp, struct in_addr in) struct in_ifaddr *ia; IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET) continue; ia = (struct in_ifaddr *)ifa; @@ -278,7 +278,7 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp, * first one on the interface, if possible. */ IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET) continue; ia = (struct in_ifaddr *)ifa; @@ -286,7 +286,7 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp, break; } if (ifa == NULL) - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) if (ifa->ifa_addr->sa_family == AF_INET) { ia = (struct in_ifaddr *)ifa; if (prison_check_ip4(td->td_ucred, @@ -377,7 +377,7 @@ in_aifaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) iaIsFirst = true; ia = NULL; IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct in_ifaddr *it; if (ifa->ifa_addr->sa_family != AF_INET) @@ -455,12 +455,12 @@ in_aifaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) /* if_addrhead is already referenced by ifa_alloc() */ IF_ADDR_WLOCK(ifp); - TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); + CK_STAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); IF_ADDR_WUNLOCK(ifp); ifa_ref(ifa); /* in_ifaddrhead */ IN_IFADDR_WLOCK(); - TAILQ_INSERT_TAIL(&V_in_ifaddrhead, ia, ia_link); + CK_STAILQ_INSERT_TAIL(&V_in_ifaddrhead, ia, ia_link); LIST_INSERT_HEAD(INADDR_HASH(ia->ia_addr.sin_addr.s_addr), ia, ia_hash); IN_IFADDR_WUNLOCK(); @@ -533,12 +533,12 @@ in_aifaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) (*carp_detach_p)(&ia->ia_ifa, false); IF_ADDR_WLOCK(ifp); - TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); + CK_STAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifaddr, ifa_link); IF_ADDR_WUNLOCK(ifp); ifa_free(&ia->ia_ifa); /* if_addrhead */ IN_IFADDR_WLOCK(); - TAILQ_REMOVE(&V_in_ifaddrhead, ia, ia_link); + CK_STAILQ_REMOVE(&V_in_ifaddrhead, ia, in_ifaddr, ia_link); LIST_REMOVE(ia, ia_hash); IN_IFADDR_WUNLOCK(); ifa_free(&ia->ia_ifa); /* in_ifaddrhead */ @@ -572,7 +572,7 @@ in_difaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) iaIsLast = true; ia = NULL; IF_ADDR_WLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct in_ifaddr *it; if (ifa->ifa_addr->sa_family != AF_INET) @@ -597,12 +597,12 @@ in_difaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) return (EADDRNOTAVAIL); } - TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); + CK_STAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifaddr, ifa_link); IF_ADDR_WUNLOCK(ifp); ifa_free(&ia->ia_ifa); /* if_addrhead */ IN_IFADDR_WLOCK(); - TAILQ_REMOVE(&V_in_ifaddrhead, ia, ia_link); + CK_STAILQ_REMOVE(&V_in_ifaddrhead, ia, in_ifaddr, ia_link); LIST_REMOVE(ia, ia_hash); IN_IFADDR_WUNLOCK(); @@ -676,7 +676,7 @@ in_addprefix(struct in_ifaddr *target, int flags) IN_IFADDR_RLOCK(&in_ifa_tracker); /* Look for an existing address with the same prefix, mask, and fib */ - TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { + CK_STAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { if (rtinitflags(ia)) { p = ia->ia_dstaddr.sin_addr; @@ -836,7 +836,7 @@ in_scrubprefix(struct in_ifaddr *target, u_int flags) } IN_IFADDR_RLOCK(&in_ifa_tracker); - TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { + CK_STAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { if (rtinitflags(ia)) { p = ia->ia_dstaddr.sin_addr; @@ -915,7 +915,7 @@ in_ifscrub_all(void) TAILQ_FOREACH(ifp, &V_ifnet, if_link) { /* Cannot lock here - lock recursion. */ /* IF_ADDR_RLOCK(ifp); */ - TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, nifa) { + CK_STAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, nifa) { if (ifa->ifa_addr->sa_family != AF_INET) continue; @@ -976,7 +976,7 @@ in_broadcast(struct in_addr in, struct ifnet *ifp) * with a broadcast address. */ IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) if (ifa->ifa_addr->sa_family == AF_INET && in_ifaddr_broadcast(in, (struct in_ifaddr *)ifa)) { found = 1; @@ -1025,7 +1025,7 @@ in_purgemaddrs(struct ifnet *ifp) */ IF_ADDR_WLOCK(ifp); restart: - TAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) { + CK_STAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) continue; diff --git a/sys/netinet/in_debug.c b/sys/netinet/in_debug.c index 86c640199cb2..9d6733932821 100644 --- a/sys/netinet/in_debug.c +++ b/sys/netinet/in_debug.c @@ -93,9 +93,7 @@ in_show_in_ifaddr(struct in_ifaddr *ia) IA_DB_RPINTF("%p", ia_hash.le_next); IA_DB_RPINTF("%p", ia_hash.le_prev); IA_DB_RPINTF_DPTR("%p", ia_hash.le_prev); - IA_DB_RPINTF("%p", ia_link.tqe_next); - IA_DB_RPINTF("%p", ia_link.tqe_prev); - IA_DB_RPINTF_DPTR("%p", ia_link.tqe_prev); + IA_DB_RPINTF("%p", ia_link.stqe_next); IA_DB_RPINTF_PTR("%p", ia_addr); IA_DB_RPINTF_PTR("%p", ia_dstaddr); IA_DB_RPINTF_PTR("%p", ia_sockmask); diff --git a/sys/netinet/in_mcast.c b/sys/netinet/in_mcast.c index b880d793deeb..1c884cd2ec58 100644 --- a/sys/netinet/in_mcast.c +++ b/sys/netinet/in_mcast.c @@ -264,7 +264,7 @@ inm_disconnect(struct in_multi *inm) ifma = inm->inm_ifma; if_ref(ifp); - TAILQ_REMOVE(&ifp->if_multiaddrs, ifma, ifma_link); + CK_STAILQ_REMOVE(&ifp->if_multiaddrs, ifma, ifmultiaddr, ifma_link); MCDPRINTF("removed ifma: %p from %s\n", ifma, ifp->if_xname); if ((ll_ifma = ifma->ifma_llifma) != NULL) { MPASS(ifma != ll_ifma); @@ -272,7 +272,7 @@ inm_disconnect(struct in_multi *inm) MPASS(ll_ifma->ifma_llifma == NULL); MPASS(ll_ifma->ifma_ifp == ifp); if (--ll_ifma->ifma_refcount == 0) { - TAILQ_REMOVE(&ifp->if_multiaddrs, ll_ifma, ifma_link); + CK_STAILQ_REMOVE(&ifp->if_multiaddrs, ll_ifma, ifmultiaddr, ifma_link); MCDPRINTF("removed ll_ifma: %p from %s\n", ll_ifma, ifp->if_xname); if_freemulti(ll_ifma); ifma_restart = true; @@ -343,14 +343,14 @@ inm_lookup_locked(struct ifnet *ifp, const struct in_addr ina) IF_ADDR_LOCK_ASSERT(ifp); inm = NULL; - TAILQ_FOREACH(ifma, &((ifp)->if_multiaddrs), ifma_link) { + CK_STAILQ_FOREACH(ifma, &((ifp)->if_multiaddrs), ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || - ifma->ifma_protospec == NULL) + ifma->ifma_protospec == NULL) continue; - inm = (struct in_multi *)ifma->ifma_protospec; - if (inm->inm_addr.s_addr == ina.s_addr) - break; - inm = NULL; + inm = (struct in_multi *)ifma->ifma_protospec; + if (inm->inm_addr.s_addr == ina.s_addr) + break; + inm = NULL; } return (inm); } @@ -2016,7 +2016,7 @@ inp_lookup_mcast_ifp(const struct inpcb *inp, mifp = NULL; IN_IFADDR_RLOCK(&in_ifa_tracker); - TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { + CK_STAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { mifp = ia->ia_ifp; if (!(mifp->if_flags & IFF_LOOPBACK) && (mifp->if_flags & IFF_MULTICAST)) { @@ -3013,7 +3013,7 @@ sysctl_ip_mcast_filters(SYSCTL_HANDLER_ARGS) IN_MULTI_LIST_LOCK(); IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) continue; diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 215dd51e70ff..37c9f964866a 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -586,7 +586,7 @@ in_pcbbind_setup(struct inpcb *inp, struct sockaddr *nam, in_addr_t *laddrp, INP_LOCK_ASSERT(inp); INP_HASH_LOCK_ASSERT(pcbinfo); - if (TAILQ_EMPTY(&V_in_ifaddrhead)) /* XXX broken! */ + if (CK_STAILQ_EMPTY(&V_in_ifaddrhead)) /* XXX broken! */ return (EADDRNOTAVAIL); laddr.s_addr = *laddrp; if (nam != NULL && laddr.s_addr != INADDR_ANY) @@ -851,7 +851,7 @@ in_pcbladdr(struct inpcb *inp, struct in_addr *faddr, struct in_addr *laddr, ifa_free(&ia->ia_ifa); ia = NULL; IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sa = ifa->ifa_addr; if (sa->sa_family != AF_INET) @@ -910,7 +910,7 @@ in_pcbladdr(struct inpcb *inp, struct in_addr *faddr, struct in_addr *laddr, ia = NULL; ifp = sro.ro_rt->rt_ifp; IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sa = ifa->ifa_addr; if (sa->sa_family != AF_INET) continue; @@ -976,7 +976,7 @@ in_pcbladdr(struct inpcb *inp, struct in_addr *faddr, struct in_addr *laddr, ifa_free(&ia->ia_ifa); ia = NULL; IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sa = ifa->ifa_addr; if (sa->sa_family != AF_INET) @@ -1055,7 +1055,7 @@ in_pcbconnect_setup(struct inpcb *inp, struct sockaddr *nam, faddr = sin->sin_addr; fport = sin->sin_port; - if (!TAILQ_EMPTY(&V_in_ifaddrhead)) { + if (!CK_STAILQ_EMPTY(&V_in_ifaddrhead)) { /* * If the destination address is INADDR_ANY, * use the primary local address. @@ -1066,16 +1066,16 @@ in_pcbconnect_setup(struct inpcb *inp, struct sockaddr *nam, if (faddr.s_addr == INADDR_ANY) { IN_IFADDR_RLOCK(&in_ifa_tracker); faddr = - IA_SIN(TAILQ_FIRST(&V_in_ifaddrhead))->sin_addr; + IA_SIN(CK_STAILQ_FIRST(&V_in_ifaddrhead))->sin_addr; IN_IFADDR_RUNLOCK(&in_ifa_tracker); if (cred != NULL && (error = prison_get_ip4(cred, &faddr)) != 0) return (error); } else if (faddr.s_addr == (u_long)INADDR_BROADCAST) { IN_IFADDR_RLOCK(&in_ifa_tracker); - if (TAILQ_FIRST(&V_in_ifaddrhead)->ia_ifp->if_flags & + if (CK_STAILQ_FIRST(&V_in_ifaddrhead)->ia_ifp->if_flags & IFF_BROADCAST) - faddr = satosin(&TAILQ_FIRST( + faddr = satosin(&CK_STAILQ_FIRST( &V_in_ifaddrhead)->ia_broadaddr)->sin_addr; IN_IFADDR_RUNLOCK(&in_ifa_tracker); } @@ -1096,7 +1096,7 @@ in_pcbconnect_setup(struct inpcb *inp, struct sockaddr *nam, if (imo->imo_multicast_ifp != NULL) { ifp = imo->imo_multicast_ifp; IN_IFADDR_RLOCK(&in_ifa_tracker); - TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { + CK_STAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { if ((ia->ia_ifp == ifp) && (cred == NULL || prison_check_ip4(cred, diff --git a/sys/netinet/in_var.h b/sys/netinet/in_var.h index 89bab81b5e51..b674505fe932 100644 --- a/sys/netinet/in_var.h +++ b/sys/netinet/in_var.h @@ -80,7 +80,7 @@ struct in_ifaddr { u_long ia_subnet; /* subnet address */ u_long ia_subnetmask; /* mask of subnet */ LIST_ENTRY(in_ifaddr) ia_hash; /* entry in bucket of inet addresses */ - TAILQ_ENTRY(in_ifaddr) ia_link; /* list of internet addresses */ + CK_STAILQ_ENTRY(in_ifaddr) ia_link; /* list of internet addresses */ struct sockaddr_in ia_addr; /* reserve space for interface name */ struct sockaddr_in ia_dstaddr; /* reserve space for broadcast addr */ #define ia_broadaddr ia_dstaddr @@ -107,7 +107,7 @@ extern u_char inetctlerrmap[]; /* * Hash table for IP addresses. */ -TAILQ_HEAD(in_ifaddrhead, in_ifaddr); +CK_STAILQ_HEAD(in_ifaddrhead, in_ifaddr); LIST_HEAD(in_ifaddrhashhead, in_ifaddr); VNET_DECLARE(struct in_ifaddrhashhead *, in_ifaddrhashtbl); @@ -172,9 +172,9 @@ do { \ /* struct rm_priotracker *t; */ \ do { \ IN_IFADDR_RLOCK((t)); \ - for ((ia) = TAILQ_FIRST(&V_in_ifaddrhead); \ + for ((ia) = CK_STAILQ_FIRST(&V_in_ifaddrhead); \ (ia) != NULL && (ia)->ia_ifp != (ifp); \ - (ia) = TAILQ_NEXT((ia), ia_link)) \ + (ia) = CK_STAILQ_NEXT((ia), ia_link)) \ continue; \ if ((ia) != NULL) \ ifa_ref(&(ia)->ia_ifa); \ diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index 07dab7c9a91b..d9a619b06339 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -276,8 +276,7 @@ SYSCTL_VNET_PCPUSTAT(_net_inet_carp, OID_AUTO, stats, struct carpstats, } while (0) #define IFNET_FOREACH_IFA(ifp, ifa) \ - IF_ADDR_LOCK_ASSERT(ifp); \ - TAILQ_FOREACH((ifa), &(ifp)->if_addrhead, ifa_link) \ + CK_STAILQ_FOREACH((ifa), &(ifp)->if_addrhead, ifa_link) \ if ((ifa)->ifa_carp != NULL) #define CARP_FOREACH_IFA(sc, ifa) \ @@ -878,7 +877,7 @@ carp_best_ifa(int af, struct ifnet *ifp) return (NULL); best = NULL; IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family == af && (best == NULL || ifa_preferred(best, ifa))) best = ifa; @@ -1160,7 +1159,7 @@ carp_iamatch6(struct ifnet *ifp, struct in6_addr *taddr) ifa = NULL; IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; if (!IN6_ARE_ADDR_EQUAL(taddr, IFA_IN6(ifa))) diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index 5727b48dfe2e..c5cb1715c0bc 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -74,7 +74,6 @@ __FBSDID("$FreeBSD$"); #endif #include - /* * Divert sockets */ @@ -235,7 +234,7 @@ divert_packet(struct mbuf *m, int incoming) /* Find IP address for receive interface */ ifp = m->m_pkthdr.rcvif; if_addr_rlock(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET) continue; divsrc.sin_addr = diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index fb9d9a107acc..4bc6a354b2e1 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include + #ifdef INET #include @@ -760,7 +761,7 @@ icmp_reflect(struct mbuf *m) ifp = m->m_pkthdr.rcvif; if (ifp != NULL && ifp->if_flags & IFF_BROADCAST) { IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET) continue; ia = ifatoia(ifa); @@ -781,7 +782,7 @@ icmp_reflect(struct mbuf *m) */ if (V_icmp_rfi && ifp != NULL) { IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET) continue; ia = ifatoia(ifa); @@ -799,7 +800,7 @@ icmp_reflect(struct mbuf *m) */ if (V_reply_src[0] != '\0' && (ifp = ifunit(V_reply_src))) { IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET) continue; ia = ifatoia(ifa); diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 7aed544e16e2..fb13acfcc64c 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -304,7 +304,7 @@ ip_init(void) struct protosw *pr; int i; - TAILQ_INIT(&V_in_ifaddrhead); + CK_STAILQ_INIT(&V_in_ifaddrhead); V_in_ifaddrhashtbl = hashinit(INADDR_NHASH, M_IFADDR, &V_in_ifaddrhmask); /* Initialize IP reassembly queue. */ @@ -650,7 +650,7 @@ ip_input(struct mbuf *m) * we receive might be for us (and let the upper layers deal * with it). */ - if (TAILQ_EMPTY(&V_in_ifaddrhead) && + if (CK_STAILQ_EMPTY(&V_in_ifaddrhead) && (m->m_flags & (M_MCAST|M_BCAST)) == 0) goto ours; @@ -707,7 +707,7 @@ ip_input(struct mbuf *m) */ if (ifp != NULL && ifp->if_flags & IFF_BROADCAST) { IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET) continue; ia = ifatoia(ifa); diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 1e89af305721..e2a85fc128e0 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -743,7 +743,7 @@ rip_ctlinput(int cmd, struct sockaddr *sa, void *vip) switch (cmd) { case PRC_IFDOWN: IN_IFADDR_RLOCK(&in_ifa_tracker); - TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { + CK_STAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { if (ia->ia_ifa.ifa_addr == sa && (ia->ia_flags & IFA_ROUTE)) { ifa_ref(&ia->ia_ifa); @@ -769,7 +769,7 @@ rip_ctlinput(int cmd, struct sockaddr *sa, void *vip) case PRC_IFUP: IN_IFADDR_RLOCK(&in_ifa_tracker); - TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { + CK_STAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { if (ia->ia_ifa.ifa_addr == sa) break; } diff --git a/sys/netinet/sctp_bsd_addr.c b/sys/netinet/sctp_bsd_addr.c index f4101687e79d..2a25a5d2ec45 100644 --- a/sys/netinet/sctp_bsd_addr.c +++ b/sys/netinet/sctp_bsd_addr.c @@ -213,7 +213,7 @@ sctp_init_ifns_for_vrf(int vrfid) continue; } IF_ADDR_RLOCK(ifn); - TAILQ_FOREACH(ifa, &ifn->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifn->if_addrhead, ifa_link) { if (ifa->ifa_addr == NULL) { continue; } @@ -364,7 +364,7 @@ void if (!(*pred) (ifn)) { continue; } - TAILQ_FOREACH(ifa, &ifn->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifn->if_addrhead, ifa_link) { sctp_addr_change(ifa, add ? RTM_ADD : RTM_DELETE); } } diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 4b87d181b528..8c5026b41bf5 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1680,7 +1680,7 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, struct mbuf *m, struct ifnet **ifpp, TAILQ_FOREACH(ifp, &V_ifnet, if_link) { addrsofif = 0; IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; ifa6 = (struct in6_ifaddr *)ifa; @@ -1766,7 +1766,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *ni6, struct icmp6_nodeinfo *nni6, for (; ifp; ifp = TAILQ_NEXT(ifp, if_link)) { IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; ifa6 = (struct in6_ifaddr *)ifa; diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 39c3904eaf92..848fb8ad8cdd 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -112,6 +112,7 @@ __FBSDID("$FreeBSD$"); #include #include + /* * struct in6_ifreq and struct ifreq must be type punnable for common members * of ifr_ifru to allow accessors to be shared. @@ -1118,12 +1119,12 @@ in6_alloc_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, int flags) ia->ia_ifp = ifp; ifa_ref(&ia->ia_ifa); /* if_addrhead */ IF_ADDR_WLOCK(ifp); - TAILQ_INSERT_TAIL(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); + CK_STAILQ_INSERT_TAIL(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); IF_ADDR_WUNLOCK(ifp); ifa_ref(&ia->ia_ifa); /* in6_ifaddrhead */ IN6_IFADDR_WLOCK(); - TAILQ_INSERT_TAIL(&V_in6_ifaddrhead, ia, ia_link); + CK_STAILQ_INSERT_TAIL(&V_in6_ifaddrhead, ia, ia_link); LIST_INSERT_HEAD(IN6ADDR_HASH(&ia->ia_addr.sin6_addr), ia, ia6_hash); IN6_IFADDR_WUNLOCK(); @@ -1322,7 +1323,7 @@ in6_unlink_ifa(struct in6_ifaddr *ia, struct ifnet *ifp) int remove_lle; IF_ADDR_WLOCK(ifp); - TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); + CK_STAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifaddr, ifa_link); IF_ADDR_WUNLOCK(ifp); ifa_free(&ia->ia_ifa); /* if_addrhead */ @@ -1332,7 +1333,7 @@ in6_unlink_ifa(struct in6_ifaddr *ia, struct ifnet *ifp) * cleanup. */ IN6_IFADDR_WLOCK(); - TAILQ_REMOVE(&V_in6_ifaddrhead, ia, ia_link); + CK_STAILQ_REMOVE(&V_in6_ifaddrhead, ia, in6_ifaddr, ia_link); LIST_REMOVE(ia, ia6_hash); IN6_IFADDR_WUNLOCK(); @@ -1387,7 +1388,7 @@ in6_notify_ifa(struct ifnet *ifp, struct in6_ifaddr *ia, */ if (hostIsNew != 0) { IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; ifacount++; @@ -1470,7 +1471,7 @@ in6ifa_ifpforlinklocal(struct ifnet *ifp, int ignoreflags) struct ifaddr *ifa; IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; if (IN6_IS_ADDR_LINKLOCAL(IFA_IN6(ifa))) { @@ -1521,7 +1522,7 @@ in6ifa_ifpwithaddr(struct ifnet *ifp, const struct in6_addr *addr) struct ifaddr *ifa; IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; if (IN6_ARE_ADDR_EQUAL(addr, IFA_IN6(ifa))) { @@ -1546,7 +1547,7 @@ in6ifa_llaonifp(struct ifnet *ifp) if (ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) return (NULL); IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; sin6 = (struct sockaddr_in6 *)ifa->ifa_addr; @@ -1652,7 +1653,7 @@ in6_localaddr(struct in6_addr *in6) return 1; IN6_IFADDR_RLOCK(&in6_ifa_tracker); - TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { + CK_STAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { if (IN6_ARE_MASKED_ADDR_EQUAL(in6, &ia->ia_addr.sin6_addr, &ia->ia_prefixmask.sin6_addr)) { IN6_IFADDR_RUNLOCK(&in6_ifa_tracker); @@ -1701,7 +1702,7 @@ in6_ifhasaddr(struct ifnet *ifp, struct in6_addr *addr) in6_setscope(&in6, ifp, NULL); IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; ia6 = (struct in6_ifaddr *)ifa; @@ -1828,7 +1829,7 @@ in6_ifawithifp(struct ifnet *ifp, struct in6_addr *dst) * If none, return one of global addresses assigned other ifs. */ IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_ANYCAST) @@ -1865,7 +1866,7 @@ in6_ifawithifp(struct ifnet *ifp, struct in6_addr *dst) return (besta); } - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_ANYCAST) @@ -1912,7 +1913,7 @@ in6_if_up(struct ifnet *ifp) struct in6_ifaddr *ia; IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; ia = (struct in6_ifaddr *)ifa; diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index baff523207ec..b427aea84cc0 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -249,7 +249,7 @@ in6_get_hw_ifid(struct ifnet *ifp, struct in6_addr *in6) { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_LINK) continue; sdl = (struct sockaddr_dl *)ifa->ifa_addr; @@ -751,7 +751,7 @@ _in6_ifdetach(struct ifnet *ifp, int purgeulp) * nuke any of IPv6 addresses we have * XXX: all addresses should be already removed */ - TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, next) { + CK_STAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, next) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; in6_purgeaddr(ifa); @@ -859,7 +859,7 @@ in6_purgemaddrs(struct ifnet *ifp) * which the PF_INET6 layer is about to release. */ restart: - TAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) { + CK_STAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) { if (ifma->ifma_addr->sa_family != AF_INET6 || ifma->ifma_protospec == NULL) continue; diff --git a/sys/netinet6/in6_mcast.c b/sys/netinet6/in6_mcast.c index 3350a10e5890..873591b7d312 100644 --- a/sys/netinet6/in6_mcast.c +++ b/sys/netinet6/in6_mcast.c @@ -589,7 +589,7 @@ in6m_disconnect(struct in6_multi *inm) ifma = inm->in6m_ifma; if_ref(ifp); - TAILQ_REMOVE(&ifp->if_multiaddrs, ifma, ifma_link); + CK_STAILQ_REMOVE(&ifp->if_multiaddrs, ifma, ifmultiaddr, ifma_link); MCDPRINTF("removed ifma: %p from %s\n", ifma, ifp->if_xname); if ((ll_ifma = ifma->ifma_llifma) != NULL) { MPASS(ifma != ll_ifma); @@ -598,12 +598,12 @@ in6m_disconnect(struct in6_multi *inm) MPASS(ll_ifma->ifma_ifp == ifp); if (--ll_ifma->ifma_refcount == 0) { ifma6_restart = true; - TAILQ_REMOVE(&ifp->if_multiaddrs, ll_ifma, ifma_link); + CK_STAILQ_REMOVE(&ifp->if_multiaddrs, ll_ifma, ifmultiaddr, ifma_link); MCDPRINTF("removed ll_ifma: %p from %s\n", ll_ifma, ifp->if_xname); if_freemulti(ll_ifma); } } - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; ifa6 = (void *)ifa; @@ -1297,7 +1297,7 @@ in6_joingroup_locked(struct ifnet *ifp, const struct in6_addr *mcaddr, if (error) { CTR2(KTR_MLD, "%s: dropping ref on %p", __func__, inm); IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_protospec == inm) { ifma->ifma_protospec = NULL; break; @@ -2827,7 +2827,7 @@ sysctl_ip6_mcast_filters(SYSCTL_HANDLER_ARGS) IN6_MULTI_LOCK(); IN6_MULTI_LIST_LOCK(); IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET6 || ifma->ifma_protospec == NULL) continue; diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 8f0116d9d62b..da5201f07e3d 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -128,7 +128,7 @@ in6_pcbbind(struct inpcb *inp, struct sockaddr *nam, INP_WLOCK_ASSERT(inp); INP_HASH_WLOCK_ASSERT(pcbinfo); - if (TAILQ_EMPTY(&V_in6_ifaddrhead)) /* XXX broken! */ + if (CK_STAILQ_EMPTY(&V_in6_ifaddrhead)) /* XXX broken! */ return (EADDRNOTAVAIL); if (inp->inp_lport || !IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) return (EINVAL); @@ -349,7 +349,7 @@ in6_pcbladdr(struct inpcb *inp, struct sockaddr *nam, if ((error = sa6_embedscope(sin6, V_ip6_use_defzone)) != 0) return(error); - if (!TAILQ_EMPTY(&V_in6_ifaddrhead)) { + if (!CK_STAILQ_EMPTY(&V_in6_ifaddrhead)) { /* * If the destination address is UNSPECIFIED addr, * use the loopback addr, e.g ::1. diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c index 7b3b5553c2e8..2b4b985a2c44 100644 --- a/sys/netinet6/in6_src.c +++ b/sys/netinet6/in6_src.c @@ -309,7 +309,7 @@ in6_selectsrc(uint32_t fibnum, struct sockaddr_in6 *dstsock, return (error); IN6_IFADDR_RLOCK(&in6_ifa_tracker); - TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { + CK_STAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { int new_scope = -1, new_matchlen = -1; struct in6_addrpolicy *new_policy = NULL; u_int32_t srczone, osrczone, dstzone; diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h index ddf37d75869c..1b9eb7e57e15 100644 --- a/sys/netinet6/in6_var.h +++ b/sys/netinet6/in6_var.h @@ -127,7 +127,7 @@ struct in6_ifaddr { struct sockaddr_in6 ia_dstaddr; /* space for destination addr */ struct sockaddr_in6 ia_prefixmask; /* prefix mask */ u_int32_t ia_plen; /* prefix length */ - TAILQ_ENTRY(in6_ifaddr) ia_link; /* list of IPv6 addresses */ + STAILQ_ENTRY(in6_ifaddr) ia_link; /* list of IPv6 addresses */ int ia6_flags; struct in6_addrlifetime ia6_lifetime; @@ -146,7 +146,7 @@ struct in6_ifaddr { }; /* List of in6_ifaddr's. */ -TAILQ_HEAD(in6_ifaddrhead, in6_ifaddr); +STAILQ_HEAD(in6_ifaddrhead, in6_ifaddr); LIST_HEAD(in6_ifaddrlisthead, in6_ifaddr); #endif /* _KERNEL */ @@ -727,10 +727,8 @@ in6m_lookup_locked(struct ifnet *ifp, const struct in6_addr *mcaddr) struct ifmultiaddr *ifma; struct in6_multi *inm; - IF_ADDR_LOCK_ASSERT(ifp); - inm = NULL; - TAILQ_FOREACH(ifma, &((ifp)->if_multiaddrs), ifma_link) { + CK_STAILQ_FOREACH(ifma, &((ifp)->if_multiaddrs), ifma_link) { if (ifma->ifma_addr->sa_family == AF_INET6) { inm = (struct in6_multi *)ifma->ifma_protospec; if (inm == NULL) diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index ba44e4263196..49746179b16f 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -222,7 +222,7 @@ ip6_init(void) TUNABLE_INT_FETCH("net.inet6.ip6.accept_rtadv", &V_ip6_accept_rtadv); TUNABLE_INT_FETCH("net.inet6.ip6.no_radr", &V_ip6_no_radr); - TAILQ_INIT(&V_in6_ifaddrhead); + CK_STAILQ_INIT(&V_in6_ifaddrhead); V_in6_ifaddrhashtbl = hashinit(IN6ADDR_NHASH, M_IFADDR, &V_in6_ifaddrhmask); @@ -380,7 +380,7 @@ ip6_destroy(void *unused __unused) TAILQ_FOREACH(ifp, &V_ifnet, if_link) { /* Cannot lock here - lock recursion. */ /* IF_ADDR_LOCK(ifp); */ - TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, nifa) { + CK_STAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, nifa) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c index 567fedd1ec38..bc3231f09efd 100644 --- a/sys/netinet6/mld6.c +++ b/sys/netinet6/mld6.c @@ -551,7 +551,7 @@ mld_ifdetach(struct ifnet *ifp) if (mli->mli_version == MLD_VERSION_2) { IF_ADDR_WLOCK(ifp); restart: - TAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) { + CK_STAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) { if (ifma->ifma_addr->sa_family != AF_INET6 || ifma->ifma_protospec == NULL) continue; @@ -702,7 +702,7 @@ mld_v1_input_query(struct ifnet *ifp, const struct ip6_hdr *ip6, */ CTR2(KTR_MLD, "process v1 general query on ifp %p(%s)", ifp, if_name(ifp)); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET6 || ifma->ifma_protospec == NULL) continue; @@ -1395,7 +1395,7 @@ mld_fasttimo_vnet(void) IF_ADDR_WLOCK(ifp); restart: - TAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) { + CK_STAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) { if (ifma->ifma_addr->sa_family != AF_INET6 || ifma->ifma_protospec == NULL) continue; @@ -1678,7 +1678,7 @@ mld_v2_cancel_link_timers(struct mld_ifsoftc *mli) IF_ADDR_WLOCK(ifp); restart: - TAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) { + CK_STAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) { if (ifma->ifma_addr->sa_family != AF_INET6) continue; inm = (struct in6_multi *)ifma->ifma_protospec; @@ -2999,7 +2999,7 @@ mld_v2_dispatch_general_query(struct mld_ifsoftc *mli) ifp = mli->mli_ifp; IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET6 || ifma->ifma_protospec == NULL) continue; diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 09072b6c2c62..391c96c4c205 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -301,7 +301,7 @@ nd6_ifdetach(struct ifnet *ifp, struct nd_ifinfo *nd) struct ifaddr *ifa, *next; IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, next) { + CK_STAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, next) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; @@ -922,7 +922,7 @@ nd6_timer(void *arg) * XXXRW: in6_ifaddrhead locking. */ addrloop: - TAILQ_FOREACH_SAFE(ia6, &V_in6_ifaddrhead, ia_link, nia6) { + CK_STAILQ_FOREACH_SAFE(ia6, &V_in6_ifaddrhead, ia_link, nia6) { /* check address lifetime */ if (IFA6_IS_INVALID(ia6)) { int regen = 0; @@ -1068,7 +1068,7 @@ regen_tmpaddr(struct in6_ifaddr *ia6) ifp = ia6->ia_ifa.ifa_ifp; IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct in6_ifaddr *it6; if (ifa->ifa_addr->sa_family != AF_INET6) @@ -1344,7 +1344,7 @@ nd6_is_new_addr_neighbor(const struct sockaddr_in6 *addr, struct ifnet *ifp) */ if (ifp->if_flags & IFF_POINTOPOINT) { IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != addr->sin6_family) continue; if (ifa->ifa_dstaddr != NULL && @@ -1687,7 +1687,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) * See RFC 4862, Section 5.4.5. */ IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; ia = (struct in6_ifaddr *)ifa; @@ -1717,7 +1717,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) if (V_ip6_dad_count > 0 && (ND_IFINFO(ifp)->flags & ND6_IFF_NO_DAD) == 0) { IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) @@ -1745,7 +1745,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) * assign one. */ IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) @@ -1789,7 +1789,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) while ((pr = LIST_FIRST(&prl)) != NULL) { LIST_REMOVE(pr, ndpr_entry); /* XXXRW: in6_ifaddrhead locking. */ - TAILQ_FOREACH_SAFE(ia, &V_in6_ifaddrhead, ia_link, + CK_STAILQ_FOREACH_SAFE(ia, &V_in6_ifaddrhead, ia_link, ia_next) { if ((ia->ia6_flags & IN6_IFF_AUTOCONF) == 0) continue; diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 8f6c4209256f..4fa81cb750b3 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -478,7 +478,7 @@ nd6_rtmsg(int cmd, struct rtentry *rt) ifp = rt->rt_ifp; if (ifp != NULL) { IF_ADDR_RLOCK(ifp); - ifa = TAILQ_FIRST(&ifp->if_addrhead); + ifa = CK_STAILQ_FIRST(&ifp->if_addrhead); info.rti_info[RTAX_IFP] = ifa->ifa_addr; ifa_ref(ifa); IF_ADDR_RUNLOCK(ifp); @@ -1347,7 +1347,7 @@ prelist_update(struct nd_prefixctl *new, struct nd_defrouter *dr, * "address". */ IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct in6_ifaddr *ifa6; u_int32_t remaininglifetime; @@ -1719,7 +1719,7 @@ pfxlist_onlink_check(void) * The precise detection logic is same as the one for prefixes. */ IN6_IFADDR_RLOCK(&in6_ifa_tracker); - TAILQ_FOREACH(ifa, &V_in6_ifaddrhead, ia_link) { + CK_STAILQ_FOREACH(ifa, &V_in6_ifaddrhead, ia_link) { if (!(ifa->ia6_flags & IN6_IFF_AUTOCONF)) continue; @@ -1736,7 +1736,7 @@ pfxlist_onlink_check(void) break; } if (ifa) { - TAILQ_FOREACH(ifa, &V_in6_ifaddrhead, ia_link) { + CK_STAILQ_FOREACH(ifa, &V_in6_ifaddrhead, ia_link) { if ((ifa->ia6_flags & IN6_IFF_AUTOCONF) == 0) continue; @@ -1754,7 +1754,7 @@ pfxlist_onlink_check(void) } } } else { - TAILQ_FOREACH(ifa, &V_in6_ifaddrhead, ia_link) { + CK_STAILQ_FOREACH(ifa, &V_in6_ifaddrhead, ia_link) { if ((ifa->ia6_flags & IN6_IFF_AUTOCONF) == 0) continue; @@ -1908,7 +1908,7 @@ nd6_prefix_onlink(struct nd_prefix *pr) if (ifa == NULL) { /* XXX: freebsd does not have ifa_ifwithaf */ IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family == AF_INET6) { ifa_ref(ifa); break; diff --git a/sys/netpfil/ipfw/ip_fw2.c b/sys/netpfil/ipfw/ip_fw2.c index 1b3c4c52e7d4..c5604492872a 100644 --- a/sys/netpfil/ipfw/ip_fw2.c +++ b/sys/netpfil/ipfw/ip_fw2.c @@ -402,7 +402,7 @@ iface_match(struct ifnet *ifp, ipfw_insn_if *cmd, struct ip_fw_chain *chain, struct ifaddr *ia; if_addr_rlock(ifp); - TAILQ_FOREACH(ia, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ia, &ifp->if_addrhead, ifa_link) { if (ia->ifa_addr->sa_family != AF_INET) continue; if (cmd->p.ip.s_addr == ((struct sockaddr_in *) @@ -767,7 +767,7 @@ ipfw_localip6(struct in6_addr *in6) return (in6_localip(in6)); IN6_IFADDR_RLOCK(&in6_ifa_tracker); - TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { + CK_STAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { if (!IN6_IS_ADDR_LINKLOCAL(&ia->ia_addr.sin6_addr)) continue; if (IN6_ARE_MASKED_ADDR_EQUAL(&ia->ia_addr.sin6_addr, diff --git a/sys/netpfil/ipfw/ip_fw_dynamic.c b/sys/netpfil/ipfw/ip_fw_dynamic.c index 92cb3f634cf0..7eb0320df2a1 100644 --- a/sys/netpfil/ipfw/ip_fw_dynamic.c +++ b/sys/netpfil/ipfw/ip_fw_dynamic.c @@ -77,7 +77,6 @@ __FBSDID("$FreeBSD$"); #ifdef MAC #include #endif -#include /* * Description of dynamic states. diff --git a/sys/netpfil/ipfw/ip_fw_nat.c b/sys/netpfil/ipfw/ip_fw_nat.c index 1da03a8c6c0c..7cd1d33d5910 100644 --- a/sys/netpfil/ipfw/ip_fw_nat.c +++ b/sys/netpfil/ipfw/ip_fw_nat.c @@ -119,7 +119,7 @@ ifaddr_change(void *arg __unused, struct ifnet *ifp) if (strncmp(ptr->if_name, ifp->if_xname, IF_NAMESIZE) != 0) continue; if_addr_rlock(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr == NULL) continue; if (ifa->ifa_addr->sa_family != AF_INET) diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c index 6fdbc3b55a73..156dc73705ea 100644 --- a/sys/netpfil/pf/pf_if.c +++ b/sys/netpfil/pf/pf_if.c @@ -525,7 +525,7 @@ pfi_instance_add(struct ifnet *ifp, int net, int flags) int net2, af; IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ia, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ia, &ifp->if_addrhead, ifa_link) { if (ia->ifa_addr == NULL) continue; af = ia->ifa_addr->sa_family; diff --git a/sys/nfs/bootp_subr.c b/sys/nfs/bootp_subr.c index ca1c8dded57e..8bf89850fa5c 100644 --- a/sys/nfs/bootp_subr.c +++ b/sys/nfs/bootp_subr.c @@ -84,7 +84,6 @@ __FBSDID("$FreeBSD$"); #include #include - #define BOOTP_MIN_LEN 300 /* Minimum size of bootp udp packet */ #ifndef BOOTP_SETTLE_DELAY @@ -413,7 +412,7 @@ bootpboot_p_iflist(void) for (ifp = TAILQ_FIRST(&V_ifnet); ifp != NULL; ifp = TAILQ_NEXT(ifp, if_link)) { - for (ifa = TAILQ_FIRST(&ifp->if_addrhead); + for (ifa = CK_STAILQ_FIRST(&ifp->if_addrhead); ifa != NULL; ifa = TAILQ_NEXT(ifa, ifa_link)) if (ifa->ifa_addr->sa_family == AF_INET) @@ -1685,7 +1684,7 @@ bootpc_init(void) /* Get HW address */ sdl = NULL; - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) if (ifa->ifa_addr->sa_family == AF_LINK) { sdl = (struct sockaddr_dl *)ifa->ifa_addr; if (sdl->sdl_type == IFT_ETHER) diff --git a/sys/nfs/nfs_diskless.c b/sys/nfs/nfs_diskless.c index c6a6b9b300f1..a118e73ef75d 100644 --- a/sys/nfs/nfs_diskless.c +++ b/sys/nfs/nfs_diskless.c @@ -225,7 +225,7 @@ nfs_setup_diskless(void) CURVNET_SET(TD_TO_VNET(curthread)); IFNET_RLOCK(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family == AF_LINK) { sdl = (struct sockaddr_dl *)ifa->ifa_addr; if ((sdl->sdl_type == ourdl.sdl_type) && diff --git a/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c b/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c index 97e3e00712e9..b7717200cb96 100644 --- a/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c +++ b/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c @@ -202,7 +202,7 @@ roce_gid_update_addr_callback(struct ib_device *device, u8 port, /* clone address information for IPv4 and IPv6 */ IF_ADDR_RLOCK(idev); #if defined(INET) - TAILQ_FOREACH(ifa, &idev->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &idev->if_addrhead, ifa_link) { if (ifa->ifa_addr == NULL || ifa->ifa_addr->sa_family != AF_INET) continue; @@ -218,7 +218,7 @@ roce_gid_update_addr_callback(struct ib_device *device, u8 port, } #endif #if defined(INET6) - TAILQ_FOREACH(ifa, &idev->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &idev->if_addrhead, ifa_link) { if (ifa->ifa_addr == NULL || ifa->ifa_addr->sa_family != AF_INET6) continue; diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index 9cbca8eacc1b..c30d8ab7ec13 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c @@ -760,7 +760,7 @@ void ipoib_mcast_restart(struct ipoib_dev_priv *priv) /* Mark all of the entries that are found or don't exist */ - TAILQ_FOREACH(ifma, &dev->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(ifma, &dev->if_multiaddrs, ifma_link) { union ib_gid mgid; uint8_t *addr; diff --git a/sys/ofed/include/rdma/ib_addr.h b/sys/ofed/include/rdma/ib_addr.h index 7124f345735b..237117148730 100644 --- a/sys/ofed/include/rdma/ib_addr.h +++ b/sys/ofed/include/rdma/ib_addr.h @@ -52,6 +52,7 @@ #include #include + struct rdma_addr_client { atomic_t refcount; struct completion comp; @@ -219,7 +220,7 @@ static inline void iboe_addr_get_sgid(struct rdma_dev_addr *dev_addr, dev = dev_get_by_index(&init_net, dev_addr->bound_dev_if); if (dev) { - TAILQ_FOREACH(ifa, &dev->if_addrhead, ifa_link) { + CK_STAILQ_FOREACH(ifa, &dev->if_addrhead, ifa_link) { if (ifa->ifa_addr == NULL || ifa->ifa_addr->sa_family != AF_INET) continue; diff --git a/sys/powerpc/ps3/if_glc.c b/sys/powerpc/ps3/if_glc.c index d6982d26158b..5dbdcbd68c33 100644 --- a/sys/powerpc/ps3/if_glc.c +++ b/sys/powerpc/ps3/if_glc.c @@ -524,7 +524,7 @@ glc_set_multicast(struct glc_softc *sc) } else { if_maddr_rlock(ifp); naddrs = 1; /* Include broadcast */ - TAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { if (inm->ifma_addr->sa_family != AF_LINK) continue; addr = 0; diff --git a/sys/powerpc/pseries/phyp_llan.c b/sys/powerpc/pseries/phyp_llan.c index 134d56622b16..b21515e1d3da 100644 --- a/sys/powerpc/pseries/phyp_llan.c +++ b/sys/powerpc/pseries/phyp_llan.c @@ -509,7 +509,7 @@ llan_set_multicast(struct llan_softc *sc) phyp_hcall(H_MULTICAST_CTRL, sc->unit, LLAN_CLEAR_MULTICAST, 0); if_maddr_rlock(ifp); - TAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { + CK_STAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { if (inm->ifma_addr->sa_family != AF_LINK) continue;