diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2017-10-29 14:56:37 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2017-10-29 14:56:37 +0000 |
commit | 7b5436a077c81aa21598910cbd9f55634db28c1a (patch) | |
tree | d70e2c12f423f3e4d5b44cfdec4d28f216b327b6 | |
parent | c707a087273faf875fbe063929a72e595ec615dc (diff) |
Move NET_{,UN}LOCK into individual slowtimo functions.
Direction suggested by mpi
OK mpi, visa
-rw-r--r-- | sys/kern/uipc_domain.c | 6 | ||||
-rw-r--r-- | sys/netinet/igmp.c | 13 | ||||
-rw-r--r-- | sys/netinet/ip_input.c | 4 | ||||
-rw-r--r-- | sys/netinet/tcp_timer.c | 6 | ||||
-rw-r--r-- | sys/netinet6/frag6.c | 6 | ||||
-rw-r--r-- | sys/netinet6/mld6.c | 9 |
6 files changed, 28 insertions, 16 deletions
diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c index 4cfbe5de4ff..522fe1a9f01 100644 --- a/sys/kern/uipc_domain.c +++ b/sys/kern/uipc_domain.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_domain.c,v 1.53 2017/10/09 08:35:38 mpi Exp $ */ +/* $OpenBSD: uipc_domain.c,v 1.54 2017/10/29 14:56:36 florian Exp $ */ /* $NetBSD: uipc_domain.c,v 1.14 1996/02/09 19:00:44 christos Exp $ */ /* @@ -238,13 +238,11 @@ pfslowtimo(void *arg) struct protosw *pr; int i; - NET_LOCK(); for (i = 0; (dp = domains[i]) != NULL; i++) { for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) if (pr->pr_slowtimo) (*pr->pr_slowtimo)(); } - NET_UNLOCK(); timeout_add_msec(to, 500); } @@ -256,12 +254,10 @@ pffasttimo(void *arg) struct protosw *pr; int i; - NET_LOCK(); for (i = 0; (dp = domains[i]) != NULL; i++) { for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) if (pr->pr_fasttimo) (*pr->pr_fasttimo)(); } - NET_UNLOCK(); timeout_add_msec(to, 200); } diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c index a358e73c8c6..c9107cb58e8 100644 --- a/sys/netinet/igmp.c +++ b/sys/netinet/igmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: igmp.c,v 1.70 2017/10/09 08:35:38 mpi Exp $ */ +/* $OpenBSD: igmp.c,v 1.71 2017/10/29 14:56:36 florian Exp $ */ /* $NetBSD: igmp.c,v 1.15 1996/02/13 23:41:25 christos Exp $ */ /* @@ -550,18 +550,21 @@ igmp_fasttimo(void) { struct ifnet *ifp; - NET_ASSERT_LOCKED(); + NET_LOCK(); /* * Quick check to see if any work needs to be done, in order * to minimize the overhead of fasttimo processing. */ if (!igmp_timers_are_running) - return; + goto out; igmp_timers_are_running = 0; TAILQ_FOREACH(ifp, &ifnet, if_list) igmp_checktimer(ifp); + +out: + NET_UNLOCK(); } @@ -600,7 +603,7 @@ igmp_slowtimo(void) { struct router_info *rti; - NET_ASSERT_LOCKED(); + NET_LOCK(); for (rti = rti_head; rti != 0; rti = rti->rti_next) { if (rti->rti_type == IGMP_v1_ROUTER && @@ -608,6 +611,8 @@ igmp_slowtimo(void) rti->rti_type = IGMP_v2_ROUTER; } } + + NET_UNLOCK(); } void diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 95c9194efcb..8808d5cb2f0 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.324 2017/10/26 15:13:40 mpi Exp $ */ +/* $OpenBSD: ip_input.c,v 1.325 2017/10/29 14:56:36 florian Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -1028,6 +1028,7 @@ ip_slowtimo(void) { struct ipq *fp, *nfp; + NET_LOCK(); mtx_enter(&ipq_mutex); LIST_FOREACH_SAFE(fp, &ipq, ipq_q, nfp) { if (--fp->ipq_ttl == 0) { @@ -1036,6 +1037,7 @@ ip_slowtimo(void) } } mtx_leave(&ipq_mutex); + NET_UNLOCK(); } /* diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c index 91aa0cbe4dd..1260d14d53e 100644 --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_timer.c,v 1.59 2017/10/25 12:38:21 job Exp $ */ +/* $OpenBSD: tcp_timer.c,v 1.60 2017/10/29 14:56:36 florian Exp $ */ /* $NetBSD: tcp_timer.c,v 1.14 1996/02/13 23:44:09 christos Exp $ */ /* @@ -128,11 +128,13 @@ tcp_delack(void *arg) void tcp_slowtimo(void) { - NET_ASSERT_LOCKED(); + NET_LOCK(); tcp_maxidle = TCPTV_KEEPCNT * tcp_keepintvl; tcp_iss += TCP_ISSINCR2/PR_SLOWHZ; /* increment iss */ tcp_now++; /* for timestamps */ + + NET_UNLOCK(); } /* diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c index a51bfe96650..a5b8ae261be 100644 --- a/sys/netinet6/frag6.c +++ b/sys/netinet6/frag6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: frag6.c,v 1.76 2017/10/27 16:11:00 visa Exp $ */ +/* $OpenBSD: frag6.c,v 1.77 2017/10/29 14:56:36 florian Exp $ */ /* $KAME: frag6.c,v 1.40 2002/05/27 21:40:31 itojun Exp $ */ /* @@ -610,7 +610,7 @@ frag6_slowtimo(void) { struct ip6q *q6, *nq6; - NET_ASSERT_LOCKED(); + NET_LOCK(); IP6Q_LOCK(); TAILQ_FOREACH_SAFE(q6, &frag6_queue, ip6q_queue, nq6) @@ -630,6 +630,8 @@ frag6_slowtimo(void) frag6_freef(TAILQ_LAST(&frag6_queue, ip6q_head)); } IP6Q_UNLOCK(); + + NET_UNLOCK(); } /* diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c index 44e7cb17ce5..131cd7e1a83 100644 --- a/sys/netinet6/mld6.c +++ b/sys/netinet6/mld6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mld6.c,v 1.54 2017/05/16 12:24:02 mpi Exp $ */ +/* $OpenBSD: mld6.c,v 1.55 2017/10/29 14:56:36 florian Exp $ */ /* $KAME: mld6.c,v 1.26 2001/02/16 14:50:35 itojun Exp $ */ /* @@ -327,16 +327,21 @@ mld6_fasttimeo(void) { struct ifnet *ifp; + NET_LOCK(); + /* * Quick check to see if any work needs to be done, in order * to minimize the overhead of fasttimo processing. */ if (!mld_timers_are_running) - return; + goto out; mld_timers_are_running = 0; TAILQ_FOREACH(ifp, &ifnet, if_list) mld6_checktimer(ifp); + +out: + NET_UNLOCK(); } void |