Author: glebius
Date: Wed Jan 15 05:45:27 2020
New Revision: 356753
URL: https://svnweb.freebsd.org/changeset/base/356753

Log:
  Mechanically substitute assertion of in_epoch(net_epoch_preempt) to
  NET_EPOCH_ASSERT(). NFC

Modified:
  head/sys/net/if.c
  head/sys/net/if_ipsec.c
  head/sys/net/if_lagg.c
  head/sys/net/if_me.c
  head/sys/net/route.c
  head/sys/netinet/in_gif.c
  head/sys/netinet/ip_gre.c
  head/sys/netinet6/in6_gif.c
  head/sys/netinet6/ip6_gre.c

Modified: head/sys/net/if.c
==============================================================================
--- head/sys/net/if.c   Wed Jan 15 03:41:15 2020        (r356752)
+++ head/sys/net/if.c   Wed Jan 15 05:45:27 2020        (r356753)
@@ -1964,7 +1964,7 @@ ifa_ifwithbroadaddr(const struct sockaddr *addr, int f
        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 fib
        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_
        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 i
        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;

Modified: head/sys/net/if_ipsec.c
==============================================================================
--- head/sys/net/if_ipsec.c     Wed Jan 15 03:41:15 2020        (r356752)
+++ head/sys/net/if_ipsec.c     Wed Jan 15 05:45:27 2020        (r356753)
@@ -796,7 +796,7 @@ ipsec_srcaddr(void *arg __unused, const struct sockadd
        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;

Modified: head/sys/net/if_lagg.c
==============================================================================
--- head/sys/net/if_lagg.c      Wed Jan 15 03:41:15 2020        (r356752)
+++ head/sys/net/if_lagg.c      Wed Jan 15 05:45:27 2020        (r356753)
@@ -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")

Modified: head/sys/net/if_me.c
==============================================================================
--- head/sys/net/if_me.c        Wed Jan 15 03:41:15 2020        (r356752)
+++ head/sys/net/if_me.c        Wed Jan 15 05:45:27 2020        (r356753)
@@ -326,7 +326,7 @@ me_lookup(const struct mbuf *m, int off, int proto, vo
        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 *
        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)

Modified: head/sys/net/route.c
==============================================================================
--- head/sys/net/route.c        Wed Jan 15 03:41:15 2020        (r356752)
+++ head/sys/net/route.c        Wed Jan 15 05:45:27 2020        (r356753)
@@ -740,7 +740,7 @@ ifa_ifwithroute(int flags, const struct sockaddr *dst,
        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,

Modified: head/sys/netinet/in_gif.c
==============================================================================
--- head/sys/netinet/in_gif.c   Wed Jan 15 03:41:15 2020        (r356752)
+++ head/sys/netinet/in_gif.c   Wed Jan 15 05:45:27 2020        (r356753)
@@ -152,7 +152,7 @@ in_gif_srcaddr(void *arg __unused, const struct sockad
        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 p
        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 
        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
        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

Modified: head/sys/netinet/ip_gre.c
==============================================================================
--- head/sys/netinet/ip_gre.c   Wed Jan 15 03:41:15 2020        (r356752)
+++ head/sys/netinet/ip_gre.c   Wed Jan 15 05:45:27 2020        (r356753)
@@ -162,7 +162,7 @@ in_gre_lookup(const struct mbuf *m, int off, int proto
        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 sockad
        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)

Modified: head/sys/netinet6/in6_gif.c
==============================================================================
--- head/sys/netinet6/in6_gif.c Wed Jan 15 03:41:15 2020        (r356752)
+++ head/sys/netinet6/in6_gif.c Wed Jan 15 05:45:27 2020        (r356753)
@@ -157,7 +157,7 @@ in6_gif_srcaddr(void *arg __unused, const struct socka
        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 
        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
        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 prot
        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

Modified: head/sys/netinet6/ip6_gre.c
==============================================================================
--- head/sys/netinet6/ip6_gre.c Wed Jan 15 03:41:15 2020        (r356752)
+++ head/sys/netinet6/ip6_gre.c Wed Jan 15 05:45:27 2020        (r356753)
@@ -153,7 +153,7 @@ in6_gre_lookup(const struct mbuf *m, int off, int prot
        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 socka
        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,
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to