From 044cd3b935f0e3e1ae6964c74d4f3cb54c562de0 Mon Sep 17 00:00:00 2001 From: glebius Date: Wed, 15 Jan 2020 05:45:27 +0000 Subject: [PATCH] Mechanically substitute assertion of in_epoch(net_epoch_preempt) to NET_EPOCH_ASSERT(). NFC --- sys/net/if.c | 8 ++++---- sys/net/if_ipsec.c | 2 +- sys/net/if_lagg.c | 2 +- sys/net/if_me.c | 4 ++-- sys/net/route.c | 2 +- sys/netinet/in_gif.c | 8 ++++---- sys/netinet/ip_gre.c | 4 ++-- sys/netinet6/in6_gif.c | 8 ++++---- sys/netinet6/ip6_gre.c | 4 ++-- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index 8517b0bc07d..8960416b1a8 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1964,7 +1964,7 @@ ifa_ifwithbroadaddr(const struct sockaddr *addr, int fibnum) struct ifnet *ifp; struct ifaddr *ifa; - MPASS(in_epoch(net_epoch_preempt)); + NET_EPOCH_ASSERT(); CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) { if ((fibnum != RT_ALL_FIBS) && (ifp->if_fib != fibnum)) continue; @@ -1994,7 +1994,7 @@ ifa_ifwithdstaddr(const struct sockaddr *addr, int fibnum) struct ifnet *ifp; struct ifaddr *ifa; - MPASS(in_epoch(net_epoch_preempt)); + NET_EPOCH_ASSERT(); CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) { if ((ifp->if_flags & IFF_POINTOPOINT) == 0) continue; @@ -2027,7 +2027,7 @@ ifa_ifwithnet(const struct sockaddr *addr, int ignore_ptp, int fibnum) u_int af = addr->sa_family; const char *addr_data = addr->sa_data, *cplim; - MPASS(in_epoch(net_epoch_preempt)); + NET_EPOCH_ASSERT(); /* * AF_LINK addresses can be looked up directly by their index number, * so do that if we can. @@ -2121,7 +2121,7 @@ ifaof_ifpforaddr(const struct sockaddr *addr, struct ifnet *ifp) if (af >= AF_MAX) return (NULL); - MPASS(in_epoch(net_epoch_preempt)); + NET_EPOCH_ASSERT(); CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != af) continue; diff --git a/sys/net/if_ipsec.c b/sys/net/if_ipsec.c index 5e2e77a6c97..0b2a2d48daa 100644 --- a/sys/net/if_ipsec.c +++ b/sys/net/if_ipsec.c @@ -796,7 +796,7 @@ ipsec_srcaddr(void *arg __unused, const struct sockaddr *sa, if (V_ipsec_idhtbl == NULL) return; - MPASS(in_epoch(net_epoch_preempt)); + NET_EPOCH_ASSERT(); CK_LIST_FOREACH(sc, ipsec_srchash(sa), srchash) { if (sc->family == 0) continue; diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c index e434c0f663c..047908e1a50 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$"); #define LAGG_RLOCK() struct epoch_tracker lagg_et; epoch_enter_preempt(net_epoch_preempt, &lagg_et) #define LAGG_RUNLOCK() epoch_exit_preempt(net_epoch_preempt, &lagg_et) -#define LAGG_RLOCK_ASSERT() MPASS(in_epoch(net_epoch_preempt)) +#define LAGG_RLOCK_ASSERT() NET_EPOCH_ASSERT() #define LAGG_UNLOCK_ASSERT() MPASS(!in_epoch(net_epoch_preempt)) #define LAGG_SX_INIT(_sc) sx_init(&(_sc)->sc_sx, "if_lagg sx") diff --git a/sys/net/if_me.c b/sys/net/if_me.c index 05bc50cfb91..4d11b593084 100644 --- a/sys/net/if_me.c +++ b/sys/net/if_me.c @@ -326,7 +326,7 @@ me_lookup(const struct mbuf *m, int off, int proto, void **arg) if (V_me_hashtbl == NULL) return (0); - MPASS(in_epoch(net_epoch_preempt)); + NET_EPOCH_ASSERT(); ip = mtod(m, const struct ip *); CK_LIST_FOREACH(sc, &ME_HASH(ip->ip_dst.s_addr, ip->ip_src.s_addr), chain) { @@ -370,7 +370,7 @@ me_srcaddr(void *arg __unused, const struct sockaddr *sa, if (V_me_hashtbl == NULL) return; - MPASS(in_epoch(net_epoch_preempt)); + NET_EPOCH_ASSERT(); sin = (const struct sockaddr_in *)sa; CK_LIST_FOREACH(sc, &ME_SRCHASH(sin->sin_addr.s_addr), srchash) { if (sc->me_src.s_addr != sin->sin_addr.s_addr) diff --git a/sys/net/route.c b/sys/net/route.c index d3ce9761880..434f514764d 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -740,7 +740,7 @@ ifa_ifwithroute(int flags, const struct sockaddr *dst, struct sockaddr *gateway, struct ifaddr *ifa; int not_found = 0; - MPASS(in_epoch(net_epoch_preempt)); + NET_EPOCH_ASSERT(); if ((flags & RTF_GATEWAY) == 0) { /* * If we are adding a route to an interface, diff --git a/sys/netinet/in_gif.c b/sys/netinet/in_gif.c index 9cb8d280e77..b1167054cb0 100644 --- a/sys/netinet/in_gif.c +++ b/sys/netinet/in_gif.c @@ -152,7 +152,7 @@ in_gif_srcaddr(void *arg __unused, const struct sockaddr *sa, if (V_ipv4_hashtbl == NULL) return; - MPASS(in_epoch(net_epoch_preempt)); + NET_EPOCH_ASSERT(); sin = (const struct sockaddr_in *)sa; CK_LIST_FOREACH(sc, &GIF_SRCHASH(sin->sin_addr.s_addr), srchash) { if (sc->gif_iphdr->ip_src.s_addr != sin->sin_addr.s_addr) @@ -275,7 +275,7 @@ in_gif_output(struct ifnet *ifp, struct mbuf *m, int proto, uint8_t ecn) int len; /* prepend new IP header */ - MPASS(in_epoch(net_epoch_preempt)); + NET_EPOCH_ASSERT(); len = sizeof(struct ip); #ifndef __NO_STRICT_ALIGNMENT if (proto == IPPROTO_ETHERIP) @@ -314,7 +314,7 @@ in_gif_input(struct mbuf *m, int off, int proto, void *arg) struct ip *ip; uint8_t ecn; - MPASS(in_epoch(net_epoch_preempt)); + NET_EPOCH_ASSERT(); if (sc == NULL) { m_freem(m); KMOD_IPSTAT_INC(ips_nogif); @@ -343,7 +343,7 @@ in_gif_lookup(const struct mbuf *m, int off, int proto, void **arg) if (V_ipv4_hashtbl == NULL) return (0); - MPASS(in_epoch(net_epoch_preempt)); + NET_EPOCH_ASSERT(); ip = mtod(m, const struct ip *); /* * NOTE: it is safe to iterate without any locking here, because softc diff --git a/sys/netinet/ip_gre.c b/sys/netinet/ip_gre.c index 238290fc984..d0db758bfec 100644 --- a/sys/netinet/ip_gre.c +++ b/sys/netinet/ip_gre.c @@ -162,7 +162,7 @@ in_gre_lookup(const struct mbuf *m, int off, int proto, void **arg) if (V_ipv4_hashtbl == NULL) return (0); - MPASS(in_epoch(net_epoch_preempt)); + NET_EPOCH_ASSERT(); ip = mtod(m, const struct ip *); CK_LIST_FOREACH(sc, &GRE_HASH(ip->ip_dst.s_addr, ip->ip_src.s_addr), chain) { @@ -210,7 +210,7 @@ in_gre_srcaddr(void *arg __unused, const struct sockaddr *sa, if (V_ipv4_hashtbl == NULL) return; - MPASS(in_epoch(net_epoch_preempt)); + NET_EPOCH_ASSERT(); sin = (const struct sockaddr_in *)sa; CK_LIST_FOREACH(sc, &GRE_SRCHASH(sin->sin_addr.s_addr), srchash) { if (sc->gre_oip.ip_src.s_addr != sin->sin_addr.s_addr) diff --git a/sys/netinet6/in6_gif.c b/sys/netinet6/in6_gif.c index 3756944ecc7..4bd2dc9d594 100644 --- a/sys/netinet6/in6_gif.c +++ b/sys/netinet6/in6_gif.c @@ -157,7 +157,7 @@ in6_gif_srcaddr(void *arg __unused, const struct sockaddr *sa, int event) if (V_ipv6_hashtbl == NULL) return; - MPASS(in_epoch(net_epoch_preempt)); + NET_EPOCH_ASSERT(); sin = (const struct sockaddr_in6 *)sa; CK_LIST_FOREACH(sc, &GIF_SRCHASH(&sin->sin6_addr), srchash) { if (IN6_ARE_ADDR_EQUAL(&sc->gif_ip6hdr->ip6_src, @@ -293,7 +293,7 @@ in6_gif_output(struct ifnet *ifp, struct mbuf *m, int proto, uint8_t ecn) int len; /* prepend new IP header */ - MPASS(in_epoch(net_epoch_preempt)); + NET_EPOCH_ASSERT(); len = sizeof(struct ip6_hdr); #ifndef __NO_STRICT_ALIGNMENT if (proto == IPPROTO_ETHERIP) @@ -335,7 +335,7 @@ in6_gif_input(struct mbuf *m, int off, int proto, void *arg) struct ip6_hdr *ip6; uint8_t ecn; - MPASS(in_epoch(net_epoch_preempt)); + NET_EPOCH_ASSERT(); if (sc == NULL) { m_freem(m); IP6STAT_INC(ip6s_nogif); @@ -364,7 +364,7 @@ in6_gif_lookup(const struct mbuf *m, int off, int proto, void **arg) if (V_ipv6_hashtbl == NULL) return (0); - MPASS(in_epoch(net_epoch_preempt)); + NET_EPOCH_ASSERT(); /* * NOTE: it is safe to iterate without any locking here, because softc * can be reclaimed only when we are not within net_epoch_preempt diff --git a/sys/netinet6/ip6_gre.c b/sys/netinet6/ip6_gre.c index ca3bd7e9f87..37f2046592d 100644 --- a/sys/netinet6/ip6_gre.c +++ b/sys/netinet6/ip6_gre.c @@ -153,7 +153,7 @@ in6_gre_lookup(const struct mbuf *m, int off, int proto, void **arg) if (V_ipv6_hashtbl == NULL) return (0); - MPASS(in_epoch(net_epoch_preempt)); + NET_EPOCH_ASSERT(); ip6 = mtod(m, const struct ip6_hdr *); CK_LIST_FOREACH(sc, &GRE_HASH(&ip6->ip6_dst, &ip6->ip6_src), chain) { /* @@ -202,7 +202,7 @@ in6_gre_srcaddr(void *arg __unused, const struct sockaddr *sa, if (V_ipv6_hashtbl == NULL) return; - MPASS(in_epoch(net_epoch_preempt)); + NET_EPOCH_ASSERT(); sin = (const struct sockaddr_in6 *)sa; CK_LIST_FOREACH(sc, &GRE_SRCHASH(&sin->sin6_addr), srchash) { if (IN6_ARE_ADDR_EQUAL(&sc->gre_oip6.ip6_src, -- 2.45.2