From: bluhm Date: Fri, 7 Apr 2023 22:02:58 +0000 (+0000) Subject: Remove kernel locks from the ARP input path. Caller if_netisr() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ccf4d05a4934071260420df6ad19e6629af985ac;p=openbsd Remove kernel locks from the ARP input path. Caller if_netisr() grabs the exclusive netlock and that is sufficent for in_arpinput() and arpcache(). with kn@; OK mvs@; tested by Hrvoje Popovski --- diff --git a/sys/net/if.c b/sys/net/if.c index dbd9890531f..ab0ec63c61a 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.686 2023/04/05 19:35:23 bluhm Exp $ */ +/* $OpenBSD: if.c,v 1.687 2023/04/07 22:02:58 bluhm Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -927,11 +927,8 @@ if_netisr(void *unused) atomic_clearbits_int(&netisr, n); #if NETHER > 0 - if (n & (1 << NETISR_ARP)) { - KERNEL_LOCK(); + if (n & (1 << NETISR_ARP)) arpintr(); - KERNEL_UNLOCK(); - } #endif if (n & (1 << NETISR_IP)) ipintr(); diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 46aa3c26acb..56146365e5f 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.c,v 1.260 2023/04/05 21:51:47 bluhm Exp $ */ +/* $OpenBSD: if_ether.c,v 1.261 2023/04/07 22:02:58 bluhm Exp $ */ /* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */ /* @@ -609,12 +609,7 @@ in_arpinput(struct ifnet *ifp, struct mbuf *m) "address %s\n", addr, ether_sprintf(ea->arp_sha)); itaddr = isaddr; } else if (rt != NULL) { - int error; - - KERNEL_LOCK(); - error = arpcache(ifp, ea, rt); - KERNEL_UNLOCK(); - if (error) + if (arpcache(ifp, ea, rt)) goto out; } @@ -656,7 +651,7 @@ arpcache(struct ifnet *ifp, struct ether_arp *ea, struct rtentry *rt) time_t uptime; int changed = 0; - KERNEL_ASSERT_LOCKED(); + NET_ASSERT_LOCKED_EXCLUSIVE(); KASSERT(sdl != NULL); /*