Index: sys/dev/cxgbe/tom/t4_tom.c =================================================================== --- sys/dev/cxgbe/tom/t4_tom.c +++ sys/dev/cxgbe/tom/t4_tom.c @@ -36,9 +36,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -762,6 +764,7 @@ static void update_clip_table(struct adapter *sc, struct tom_data *td) { + IN6_IFADDR_RLOCK_TRACKER; struct in6_ifaddr *ia; struct in6_addr *lip, tlip; struct clip_head stale; Index: sys/net/if_spppsubr.c =================================================================== --- sys/net/if_spppsubr.c +++ sys/net/if_spppsubr.c @@ -28,7 +28,9 @@ #include #include +#include #include +#include #include #include #include Index: sys/net/if_stf.c =================================================================== --- sys/net/if_stf.c +++ sys/net/if_stf.c @@ -84,10 +84,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include @@ -530,6 +532,7 @@ struct in_addr *in; struct ifnet *inifp; /* incoming interface */ { + IN_IFADDR_RLOCK_TRACKER; struct in_ifaddr *ia4; /* Index: sys/netinet/if_ether.c =================================================================== --- sys/netinet/if_ether.c +++ sys/netinet/if_ether.c @@ -42,12 +42,14 @@ #include #include +#include #include #include #include #include #include #include +#include #include #include @@ -563,6 +565,7 @@ static void in_arpinput(struct mbuf *m) { + IN_IFADDR_RLOCK_TRACKER; struct arphdr *ah; struct ifnet *ifp = m->m_pkthdr.rcvif; struct llentry *la = NULL; Index: sys/netinet/igmp.c =================================================================== --- sys/netinet/igmp.c +++ sys/netinet/igmp.c @@ -58,6 +58,8 @@ #include #include #include +#include +#include #include #include #include @@ -1215,6 +1217,7 @@ igmp_input_v1_report(struct ifnet *ifp, /*const*/ struct ip *ip, /*const*/ struct igmp *igmp) { + IN_IFADDR_RLOCK_TRACKER; /* IFP_TO_IA uses it */ struct in_ifaddr *ia; struct in_multi *inm; @@ -1323,6 +1326,7 @@ igmp_input_v2_report(struct ifnet *ifp, /*const*/ struct ip *ip, /*const*/ struct igmp *igmp) { + IN_IFADDR_RLOCK_TRACKER; /* IFP_TO_IA uses it */ struct in_ifaddr *ia; struct in_multi *inm; @@ -3487,6 +3491,7 @@ static struct mbuf * igmp_v3_encap_report(struct ifnet *ifp, struct mbuf *m) { + IN_IFADDR_RLOCK_TRACKER; /* IFP_TO_IA uses it */ struct igmp_report *igmp; struct ip *ip; int hdrlen, igmpreclen; Index: sys/netinet/in.c =================================================================== --- sys/netinet/in.c +++ sys/netinet/in.c @@ -44,7 +44,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -93,6 +95,7 @@ int in_localaddr(struct in_addr in) { + IN_IFADDR_RLOCK_TRACKER; register u_long i = ntohl(in.s_addr); register struct in_ifaddr *ia; @@ -114,6 +117,7 @@ int in_localip(struct in_addr in) { + IN_IFADDR_RLOCK_TRACKER; struct in_ifaddr *ia; IN_IFADDR_RLOCK(); @@ -158,6 +162,7 @@ static struct in_ifaddr * in_localip_more(struct in_ifaddr *ia) { + IN_IFADDR_RLOCK_TRACKER; in_addr_t in = IA_SIN(ia)->sin_addr.s_addr; struct in_ifaddr *it; @@ -646,6 +651,7 @@ int in_addprefix(struct in_ifaddr *target, int flags) { + IN_IFADDR_RLOCK_TRACKER; struct in_ifaddr *ia; struct in_addr prefix, mask, p, m; int error; @@ -725,6 +731,7 @@ int in_scrubprefix(struct in_ifaddr *target, u_int flags) { + IN_IFADDR_RLOCK_TRACKER; struct in_ifaddr *ia; struct in_addr prefix, mask, p, m; int error = 0; Index: sys/netinet/in_mcast.c =================================================================== --- sys/netinet/in_mcast.c +++ sys/netinet/in_mcast.c @@ -38,9 +38,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -1748,6 +1750,7 @@ int inp_getmoptions(struct inpcb *inp, struct sockopt *sopt) { + IN_IFADDR_RLOCK_TRACKER; /* IFP_TO_IA uses it */ struct ip_mreqn mreqn; struct ip_moptions *imo; struct ifnet *ifp; @@ -1878,6 +1881,7 @@ inp_lookup_mcast_ifp(const struct inpcb *inp, const struct sockaddr_in *gsin, const struct in_addr ina) { + IN_IFADDR_RLOCK_TRACKER; struct ifnet *ifp; KASSERT(gsin->sin_family == AF_INET, ("%s: not AF_INET", __func__)); Index: sys/netinet/in_pcb.c =================================================================== --- sys/netinet/in_pcb.c +++ sys/netinet/in_pcb.c @@ -47,11 +47,13 @@ #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -992,6 +994,7 @@ in_addr_t *laddrp, u_short *lportp, in_addr_t *faddrp, u_short *fportp, struct inpcb **oinpp, struct ucred *cred) { + IN_IFADDR_RLOCK_TRACKER; struct sockaddr_in *sin = (struct sockaddr_in *)nam; struct in_ifaddr *ia; struct inpcb *oinp; Index: sys/netinet/in_var.h =================================================================== --- sys/netinet/in_var.h +++ sys/netinet/in_var.h @@ -119,15 +119,16 @@ #define INADDR_HASH(x) \ (&V_in_ifaddrhashtbl[INADDR_HASHVAL(x) & V_in_ifaddrhmask]) -extern struct rwlock in_ifaddr_lock; +extern struct rmlock in_ifaddr_lock; -#define IN_IFADDR_LOCK_ASSERT() rw_assert(&in_ifaddr_lock, RA_LOCKED) -#define IN_IFADDR_RLOCK() rw_rlock(&in_ifaddr_lock) -#define IN_IFADDR_RLOCK_ASSERT() rw_assert(&in_ifaddr_lock, RA_RLOCKED) -#define IN_IFADDR_RUNLOCK() rw_runlock(&in_ifaddr_lock) -#define IN_IFADDR_WLOCK() rw_wlock(&in_ifaddr_lock) -#define IN_IFADDR_WLOCK_ASSERT() rw_assert(&in_ifaddr_lock, RA_WLOCKED) -#define IN_IFADDR_WUNLOCK() rw_wunlock(&in_ifaddr_lock) +#define IN_IFADDR_LOCK_ASSERT() rm_assert(&in_ifaddr_lock, RA_LOCKED) +#define IN_IFADDR_RLOCK_TRACKER struct rm_priotracker _in_ifa_tracker; +#define IN_IFADDR_RLOCK() rm_rlock(&in_ifaddr_lock, &_in_ifa_tracker) +#define IN_IFADDR_RLOCK_ASSERT() rm_assert(&in_ifaddr_lock, RA_RLOCKED) +#define IN_IFADDR_RUNLOCK() rm_runlock(&in_ifaddr_lock, &_in_ifa_tracker) +#define IN_IFADDR_WLOCK() rm_wlock(&in_ifaddr_lock) +#define IN_IFADDR_WLOCK_ASSERT() rm_assert(&in_ifaddr_lock, RA_WLOCKED) +#define IN_IFADDR_WUNLOCK() rm_wunlock(&in_ifaddr_lock) /* * Macro for finding the internet address structure (in_ifaddr) Index: sys/netinet/ip_icmp.c =================================================================== --- sys/netinet/ip_icmp.c +++ sys/netinet/ip_icmp.c @@ -41,6 +41,8 @@ #include #include #include +#include +#include #include #include @@ -647,6 +649,7 @@ static void icmp_reflect(struct mbuf *m) { + IN_IFADDR_RLOCK_TRACKER; struct ip *ip = mtod(m, struct ip *); struct ifaddr *ifa; struct ifnet *ifp; Index: sys/netinet/ip_input.c =================================================================== --- sys/netinet/ip_input.c +++ sys/netinet/ip_input.c @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -97,8 +98,8 @@ extern void ipreass_destroy(void); #endif -struct rwlock in_ifaddr_lock; -RW_SYSINIT(in_ifaddr_lock, &in_ifaddr_lock, "in_ifaddr_lock"); +struct rmlock in_ifaddr_lock; +RM_SYSINIT(in_ifaddr_lock, &in_ifaddr_lock, "in_ifaddr_lock"); VNET_DEFINE(int, rsvp_on); Index: sys/netinet/ip_output.c =================================================================== --- sys/netinet/ip_output.c +++ sys/netinet/ip_output.c @@ -44,11 +44,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -120,6 +122,7 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags, struct ip_moptions *imo, struct inpcb *inp) { + IN_IFADDR_RLOCK_TRACKER; /* IFP_TO_IA uses it */ struct ip *ip; struct ifnet *ifp = NULL; /* keep compiler happy */ struct mbuf *m0; Index: sys/netinet/raw_ip.c =================================================================== --- sys/netinet/raw_ip.c +++ sys/netinet/raw_ip.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -724,6 +725,7 @@ void rip_ctlinput(int cmd, struct sockaddr *sa, void *vip) { + IN_IFADDR_RLOCK_TRACKER; struct in_ifaddr *ia; struct ifnet *ifp; int err; Index: sys/netinet6/in6.c =================================================================== --- sys/netinet6/in6.c +++ sys/netinet6/in6.c @@ -80,6 +80,8 @@ #include #include #include +#include +#include #include #include @@ -1499,6 +1501,7 @@ struct in6_ifaddr * in6ifa_ifwithaddr(const struct in6_addr *addr, uint32_t zoneid) { + IN6_IFADDR_RLOCK_TRACKER; struct in6_ifaddr *ia; IN6_IFADDR_RLOCK(); @@ -1649,6 +1652,7 @@ int in6_localaddr(struct in6_addr *in6) { + IN6_IFADDR_RLOCK_TRACKER; struct in6_ifaddr *ia; if (IN6_IS_ADDR_LOOPBACK(in6) || IN6_IS_ADDR_LINKLOCAL(in6)) @@ -1674,6 +1678,7 @@ int in6_localip(struct in6_addr *in6) { + IN6_IFADDR_RLOCK_TRACKER; struct in6_ifaddr *ia; IN6_IFADDR_RLOCK(); @@ -1720,6 +1725,7 @@ int in6_is_addr_deprecated(struct sockaddr_in6 *sa6) { + IN6_IFADDR_RLOCK_TRACKER; struct in6_ifaddr *ia; IN6_IFADDR_RLOCK(); Index: sys/netinet6/in6_ifattach.c =================================================================== --- sys/netinet6/in6_ifattach.c +++ sys/netinet6/in6_ifattach.c @@ -39,7 +39,9 @@ #include #include #include +#include #include +#include #include #include Index: sys/netinet6/in6_src.c =================================================================== --- sys/netinet6/in6_src.c +++ sys/netinet6/in6_src.c @@ -82,6 +82,7 @@ #include #include #include +#include #include #include @@ -178,6 +179,7 @@ struct inpcb *inp, struct route_in6 *ro, struct ucred *cred, struct ifnet **ifpp, struct in6_addr *srcp) { + IN6_IFADDR_RLOCK_TRACKER; struct in6_addr dst, tmp; struct ifnet *ifp = NULL, *oifp = NULL; struct in6_ifaddr *ia = NULL, *ia_best = NULL; Index: sys/netinet6/in6_var.h =================================================================== --- sys/netinet6/in6_var.h +++ sys/netinet6/in6_var.h @@ -535,14 +535,17 @@ return (fnv_32_buf(&x, sizeof(x), FNV1_32_INIT)); } -extern struct rwlock in6_ifaddr_lock; -#define IN6_IFADDR_LOCK_ASSERT( ) rw_assert(&in6_ifaddr_lock, RA_LOCKED) -#define IN6_IFADDR_RLOCK() rw_rlock(&in6_ifaddr_lock) -#define IN6_IFADDR_RLOCK_ASSERT() rw_assert(&in6_ifaddr_lock, RA_RLOCKED) -#define IN6_IFADDR_RUNLOCK() rw_runlock(&in6_ifaddr_lock) -#define IN6_IFADDR_WLOCK() rw_wlock(&in6_ifaddr_lock) -#define IN6_IFADDR_WLOCK_ASSERT() rw_assert(&in6_ifaddr_lock, RA_WLOCKED) -#define IN6_IFADDR_WUNLOCK() rw_wunlock(&in6_ifaddr_lock) +extern struct rmlock in6_ifaddr_lock; +#define IN6_IFADDR_LOCK_ASSERT( ) rm_assert(&in6_ifaddr_lock, RA_LOCKED) +#define IN6_IFADDR_RLOCK_TRACKER struct rm_priotracker _in6_ifa_tracker +#define IN6_IFADDR_RLOCK() rm_rlock(&in6_ifaddr_lock,\ + &_in6_ifa_tracker) +#define IN6_IFADDR_RLOCK_ASSERT() rm_assert(&in6_ifaddr_lock, RA_RLOCKED) +#define IN6_IFADDR_RUNLOCK() rm_runlock(&in6_ifaddr_lock,\ + &_in6_ifa_tracker) +#define IN6_IFADDR_WLOCK() rm_wlock(&in6_ifaddr_lock) +#define IN6_IFADDR_WLOCK_ASSERT() rm_assert(&in6_ifaddr_lock, RA_WLOCKED) +#define IN6_IFADDR_WUNLOCK() rm_wunlock(&in6_ifaddr_lock) #define in6_ifstat_inc(ifp, tag) \ do { \ Index: sys/netinet6/ip6_input.c =================================================================== --- sys/netinet6/ip6_input.c +++ sys/netinet6/ip6_input.c @@ -82,6 +82,8 @@ #include #include #include +#include +#include #include #include @@ -144,8 +146,8 @@ VNET_PCPUSTAT_SYSUNINIT(ip6stat); #endif /* VIMAGE */ -struct rwlock in6_ifaddr_lock; -RW_SYSINIT(in6_ifaddr_lock, &in6_ifaddr_lock, "in6_ifaddr_lock"); +struct rmlock in6_ifaddr_lock; +RM_SYSINIT(in6_ifaddr_lock, &in6_ifaddr_lock, "in6_ifaddr_lock"); static void ip6_init2(void *); static int ip6_hopopts_input(u_int32_t *, u_int32_t *, struct mbuf **, int *);