1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-02 08:42:48 +00:00

Mechanically substitute assertion of in_epoch(net_epoch_preempt) to

NET_EPOCH_ASSERT(). NFC
This commit is contained in:
Gleb Smirnoff 2020-01-15 05:45:27 +00:00
parent fae994f636
commit 97168be809
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=356753
9 changed files with 21 additions and 21 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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")

View File

@ -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)

View File

@ -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,

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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,