From 4267d7ffe6dd3e9693513b2c5cabec195a4b5605 Mon Sep 17 00:00:00 2001 From: Vitaliy Makkoveev Date: Sat, 21 Jan 2023 17:35:02 +0000 Subject: Introduce `rt_lock' rwlock(9) and use it instead of kernel lock to serialize arpcache() and arpresolve(). In fact, net stack already has sleep points, so the rwlock(9) is better here because we avoid intersection with the rest of kernel locked paths. Also this new lock assumed to use to route layer protection instead of netlock. Hrvoje Popovski had tested this diff and found no visible performance impact. ok bluhm@ --- sys/net/route.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'sys/net/route.h') diff --git a/sys/net/route.h b/sys/net/route.h index 2178e401731..4c0c38577dc 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -1,4 +1,4 @@ -/* $OpenBSD: route.h,v 1.196 2022/06/28 10:01:13 bluhm Exp $ */ +/* $OpenBSD: route.h,v 1.197 2023/01/21 17:35:01 mvs Exp $ */ /* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */ /* @@ -383,6 +383,13 @@ struct rt_addrinfo { #ifdef _KERNEL #include +#include + +extern struct rwlock rt_lock; + +#define RT_LOCK() rw_enter_write(&rt_lock) +#define RT_UNLOCK() rw_exit_write(&rt_lock) +#define RT_ASSERT_LOCKED() rw_assert_wrlock(&rt_lock) enum rtstat_counters { rts_badredirect, /* bogus redirect calls */ -- cgit v1.2.3