diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-12-19 08:36:51 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-12-19 08:36:51 +0000 |
commit | 347b9bada49618963c84880ec8c3c23c96aa0017 (patch) | |
tree | d431218ec3017a484e7de695c002a79a0e68cc86 /sys/netinet/ip_input.c | |
parent | c22be17b5bebb223df391aa82dfc7704004aafa7 (diff) |
Introduce the NET_LOCK() a rwlock used to serialize accesses to the parts
of the network stack that are not yet ready to be executed in parallel or
where new sleeping points are not possible.
This first pass replace all the entry points leading to ip_output(). This
is done to not introduce new sleeping points when trying to acquire ART's
write lock, needed when a new L2 entry is created via the RT_RESOLVE.
Inputs from and ok bluhm@, ok dlg@
Diffstat (limited to 'sys/netinet/ip_input.c')
-rw-r--r-- | sys/netinet/ip_input.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index ee73d6ad3fa..57251a79b4c 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.288 2016/11/28 23:15:31 bluhm Exp $ */ +/* $OpenBSD: ip_input.c,v 1.289 2016/12/19 08:36:49 mpi Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -1587,20 +1587,20 @@ ip_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, ip_mtudisc_timeout_q = rt_timer_queue_create(ip_mtudisc_timeout); } else if (ip_mtudisc == 0 && ip_mtudisc_timeout_q != NULL) { - s = splsoftnet(); + NET_LOCK(s); rt_timer_queue_destroy(ip_mtudisc_timeout_q); ip_mtudisc_timeout_q = NULL; - splx(s); + NET_UNLOCK(s); } return error; case IPCTL_MTUDISCTIMEOUT: error = sysctl_int(oldp, oldlenp, newp, newlen, &ip_mtudisc_timeout); if (ip_mtudisc_timeout_q != NULL) { - s = splsoftnet(); + NET_LOCK(s); rt_timer_queue_change(ip_mtudisc_timeout_q, ip_mtudisc_timeout); - splx(s); + NET_UNLOCK(s); } return (error); case IPCTL_IPSEC_ENC_ALGORITHM: @@ -1758,12 +1758,15 @@ ip_send_dispatch(void *xmq) int s; mq_delist(mq, &ml); + if (ml_empty(&ml)) + return; + KERNEL_LOCK(); - s = splsoftnet(); + NET_LOCK(s); while ((m = ml_dequeue(&ml)) != NULL) { ip_output(m, NULL, NULL, 0, NULL, NULL, 0); } - splx(s); + NET_UNLOCK(s); KERNEL_UNLOCK(); } |