diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2018-01-09 17:50:58 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2018-01-09 17:50:58 +0000 |
commit | a1a8b42b1af35dd41967a55f46bdf5539edb4cdd (patch) | |
tree | 52141bf70b9b544d635caecb9fc6a7e37532eeb8 | |
parent | 630ce3acafb6c26deb5d91610e9d8875a6b6bc61 (diff) |
Stop grabing the KERNEL_LOCK() for running protocol input routines.
The NET_LOCK() is already held in this thread and is now enough.
People interested in ARP/bridge(4)/switch(4)/pipex(4)/pppoe(4)
performances can now push the KERNEL_LOCK() without depending on
other subsystems/drivers.
Tested by Hrvoje Popovski.
ok bluhm@, visa@
-rw-r--r-- | sys/net/if.c | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index 5dc00bd0340..0c2517a6171 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.535 2018/01/09 06:24:14 dlg Exp $ */ +/* $OpenBSD: if.c,v 1.536 2018/01/09 17:50:57 mpi Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -920,7 +920,6 @@ if_netisr(void *unused) { int n, t = 0; - KERNEL_LOCK(); NET_LOCK(); while ((n = netisr) != 0) { @@ -934,8 +933,11 @@ if_netisr(void *unused) atomic_clearbits_int(&netisr, n); #if NETHER > 0 - if (n & (1 << NETISR_ARP)) + if (n & (1 << NETISR_ARP)) { + KERNEL_LOCK(); arpintr(); + KERNEL_UNLOCK(); + } #endif if (n & (1 << NETISR_IP)) ipintr(); @@ -944,35 +946,52 @@ if_netisr(void *unused) ip6intr(); #endif #if NPPP > 0 - if (n & (1 << NETISR_PPP)) + if (n & (1 << NETISR_PPP)) { + KERNEL_LOCK(); pppintr(); + KERNEL_UNLOCK(); + } #endif #if NBRIDGE > 0 - if (n & (1 << NETISR_BRIDGE)) + if (n & (1 << NETISR_BRIDGE)) { + KERNEL_LOCK(); bridgeintr(); + KERNEL_UNLOCK(); + } #endif #if NSWITCH > 0 - if (n & (1 << NETISR_SWITCH)) + if (n & (1 << NETISR_SWITCH)) { + KERNEL_LOCK(); switchintr(); + KERNEL_UNLOCK(); + } #endif #if NPPPOE > 0 - if (n & (1 << NETISR_PPPOE)) + if (n & (1 << NETISR_PPPOE)) { + KERNEL_LOCK(); pppoeintr(); + KERNEL_UNLOCK(); + } #endif #ifdef PIPEX - if (n & (1 << NETISR_PIPEX)) + if (n & (1 << NETISR_PIPEX)) { + KERNEL_LOCK(); pipexintr(); + KERNEL_UNLOCK(); + } #endif t |= n; } #if NPFSYNC > 0 - if (t & (1 << NETISR_PFSYNC)) + if (t & (1 << NETISR_PFSYNC)) { + KERNEL_LOCK(); pfsyncintr(); + KERNEL_UNLOCK(); + } #endif NET_UNLOCK(); - KERNEL_UNLOCK(); } void |