diff options
author | thompsa <thompsa@FreeBSD.org> | 2005-08-18 20:17:00 +0000 |
---|---|---|
committer | thompsa <thompsa@FreeBSD.org> | 2005-08-18 20:17:00 +0000 |
commit | 805a9715f8678d8ebbe70fe705dfc123c6821126 (patch) | |
tree | e71502fcaac7244133de0bef1a0c265b5f621ef0 | |
parent | f905920cb9de60ab1b2da196da82c6678ea145ff (diff) | |
download | FreeBSD-src-805a9715f8678d8ebbe70fe705dfc123c6821126.zip FreeBSD-src-805a9715f8678d8ebbe70fe705dfc123c6821126.tar.gz |
Mark the callouts as MPSAFE as if_bridge has been giant-free since day 1.
Use the SMP friendly callout_init_mtx() while we are here.
Approved by: mlaier (mentor)
MFC after: 3 days
-rw-r--r-- | sys/net/bridgestp.c | 4 | ||||
-rw-r--r-- | sys/net/if_bridge.c | 13 |
2 files changed, 9 insertions, 8 deletions
diff --git a/sys/net/bridgestp.c b/sys/net/bridgestp.c index 6e8f0a1..582d5a6 100644 --- a/sys/net/bridgestp.c +++ b/sys/net/bridgestp.c @@ -1092,7 +1092,7 @@ bstp_tick(void *arg) struct bridge_softc *sc = arg; struct bridge_iflist *bif; - BRIDGE_LOCK(sc); + BRIDGE_LOCK_ASSERT(sc); #if 0 LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { @@ -1141,8 +1141,6 @@ bstp_tick(void *arg) if (sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING) callout_reset(&sc->sc_bstpcallout, hz, bstp_tick, sc); - - BRIDGE_UNLOCK(sc); } void diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 06cd8f0..b35f7aa 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -439,8 +439,8 @@ bridge_clone_create(struct if_clone *ifc, int unit) /* Initialize our routing table. */ bridge_rtable_init(sc); - callout_init(&sc->sc_brcallout, 0); - callout_init(&sc->sc_bstpcallout, 0); + callout_init_mtx(&sc->sc_brcallout, &sc->sc_mtx, 0); + callout_init_mtx(&sc->sc_bstpcallout, &sc->sc_mtx, 0); LIST_INIT(&sc->sc_iflist); @@ -498,6 +498,9 @@ bridge_clone_destroy(struct ifnet *ifp) BRIDGE_UNLOCK(sc); + callout_drain(&sc->sc_brcallout); + callout_drain(&sc->sc_bstpcallout); + mtx_lock(&bridge_list_mtx); LIST_REMOVE(sc, sc_list); mtx_unlock(&bridge_list_mtx); @@ -1212,10 +1215,10 @@ bridge_init(void *xsc) if (ifp->if_drv_flags & IFF_DRV_RUNNING) return; + BRIDGE_LOCK(sc); callout_reset(&sc->sc_brcallout, bridge_rtable_prune_period * hz, bridge_timer, sc); - BRIDGE_LOCK(sc); ifp->if_drv_flags |= IFF_DRV_RUNNING; bstp_initialization(sc); BRIDGE_UNLOCK(sc); @@ -1988,9 +1991,9 @@ bridge_timer(void *arg) { struct bridge_softc *sc = arg; - BRIDGE_LOCK(sc); + BRIDGE_LOCK_ASSERT(sc); + bridge_rtage(sc); - BRIDGE_UNLOCK(sc); if (sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING) callout_reset(&sc->sc_brcallout, |