From 3bfee5a4c8abc09d4dd215319fbaffcadbf6f40b Mon Sep 17 00:00:00 2001 From: Martin Pieuchot Date: Wed, 11 Jan 2017 08:47:49 +0000 Subject: No need for a splsoftnet()/splx() dance when the KERNEL_LOCK() is what serialize access to bridge(4) data structures. ok mikeb@ --- sys/net/bridgectl.c | 19 +++++-------------- sys/net/if_bridge.c | 4 ++-- sys/net/if_bridge.h | 4 ++-- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/sys/net/bridgectl.c b/sys/net/bridgectl.c index 40072451e35..9d80fb3fb1a 100644 --- a/sys/net/bridgectl.c +++ b/sys/net/bridgectl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bridgectl.c,v 1.4 2016/09/29 11:37:43 reyk Exp $ */ +/* $OpenBSD: bridgectl.c,v 1.5 2017/01/11 08:47:48 mpi Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -52,7 +52,6 @@ int bridge_rtfind(struct bridge_softc *, struct ifbaconf *); -void bridge_rtage(struct bridge_softc *); int bridge_rtdaddr(struct bridge_softc *, struct ether_addr *); u_int32_t bridge_hash(struct bridge_softc *, struct ether_addr *); @@ -304,26 +303,18 @@ bridge_hash(struct bridge_softc *sc, struct ether_addr *addr) BRIDGE_RTABLE_MASK; } -void -bridge_timer(void *vsc) -{ - struct bridge_softc *sc = vsc; - int s; - - s = splsoftnet(); - bridge_rtage(sc); - splx(s); -} - /* * Perform an aging cycle */ void -bridge_rtage(struct bridge_softc *sc) +bridge_rtage(void *vsc) { + struct bridge_softc *sc = vsc; struct bridge_rtnode *n, *p; int i; + KERNEL_ASSERT_LOCKED(); + for (i = 0; i < BRIDGE_RTABLE_SIZE; i++) { n = LIST_FIRST(&sc->sc_rts[i]); while (n != NULL) { diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index f099b1915ee..58c77cc5e95 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.c,v 1.290 2016/12/19 15:49:28 mpi Exp $ */ +/* $OpenBSD: if_bridge.c,v 1.291 2017/01/11 08:47:48 mpi Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -168,7 +168,7 @@ bridge_clone_create(struct if_clone *ifc, int unit) sc->sc_brtmax = BRIDGE_RTABLE_MAX; sc->sc_brttimeout = BRIDGE_RTABLE_TIMEOUT; - timeout_set(&sc->sc_brtimeout, bridge_timer, sc); + timeout_set(&sc->sc_brtimeout, bridge_rtage, sc); TAILQ_INIT(&sc->sc_iflist); TAILQ_INIT(&sc->sc_spanlist); for (i = 0; i < BRIDGE_RTABLE_SIZE; i++) diff --git a/sys/net/if_bridge.h b/sys/net/if_bridge.h index 608874034a4..092d025357e 100644 --- a/sys/net/if_bridge.h +++ b/sys/net/if_bridge.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.h,v 1.53 2016/10/03 12:26:13 rzalamena Exp $ */ +/* $OpenBSD: if_bridge.h,v 1.54 2017/01/11 08:47:48 mpi Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -483,7 +483,7 @@ struct ifnet *bridge_rtupdate(struct bridge_softc *, struct bridge_rtnode *bridge_rtlookup(struct bridge_softc *, struct ether_addr *); void bridge_rtflush(struct bridge_softc *, int); -void bridge_timer(void *); +void bridge_rtage(void *); u_int8_t bridge_filterrule(struct brl_head *, struct ether_header *, struct mbuf *); -- cgit v1.2.3