diff options
author | Andrew Thompson <thompsa@FreeBSD.org> | 2005-11-08 20:08:34 +0000 |
---|---|---|
committer | Andrew Thompson <thompsa@FreeBSD.org> | 2005-11-08 20:08:34 +0000 |
commit | 4e7e0183e1884e2ea9beb2720b22610c0a9e83ba (patch) | |
tree | b5694a5381004aaef7ca02a29efbdb85ad370b4d /sys/net/if_stf.c | |
parent | 2a522eb9d329b84b7d8b479f3b3b3739762078b6 (diff) | |
download | src-4e7e0183e1884e2ea9beb2720b22610c0a9e83ba.tar.gz src-4e7e0183e1884e2ea9beb2720b22610c0a9e83ba.zip |
Move the cloned interface list management in to if_clone. For some drivers the
softc lists and associated mutex are now unused so these have been removed.
Calling if_clone_detach() will now destroy all the cloned interfaces for the
driver and in most cases is all thats needed to unload.
Idea by: brooks
Reviewed by: brooks
Notes
Notes:
svn path=/head/; revision=152209
Diffstat (limited to 'sys/net/if_stf.c')
-rw-r--r-- | sys/net/if_stf.c | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/sys/net/if_stf.c b/sys/net/if_stf.c index e779b17a8068..a08291a8a9cb 100644 --- a/sys/net/if_stf.c +++ b/sys/net/if_stf.c @@ -138,19 +138,14 @@ struct stf_softc { } __sc_ro46; #define sc_ro __sc_ro46.__sc_ro4 const struct encaptab *encap_cookie; - LIST_ENTRY(stf_softc) sc_list; /* all stf's are linked */ }; #define STF2IFP(sc) ((sc)->sc_ifp) /* - * All mutable global variables in if_stf.c are protected by stf_mtx. * XXXRW: Note that mutable fields in the softc are not currently locked: * in particular, sc_ro needs to be protected from concurrent entrance * of stf_output(). */ -static struct mtx stf_mtx; -static LIST_HEAD(, stf_softc) stf_softc_list; - static MALLOC_DEFINE(M_STF, STFNAME, "6to4 Tunnel Interface"); static const int ip_stf_ttl = 40; @@ -246,9 +241,6 @@ stf_clone_create(struct if_clone *ifc, char *name, size_t len) ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; if_attach(ifp); bpfattach(ifp, DLT_NULL, sizeof(u_int32_t)); - mtx_lock(&stf_mtx); - LIST_INSERT_HEAD(&stf_softc_list, sc, sc_list); - mtx_unlock(&stf_mtx); return (0); } @@ -258,10 +250,6 @@ stf_clone_destroy(struct if_clone *ifc, struct ifnet *ifp) struct stf_softc *sc = ifp->if_softc; int err; - mtx_lock(&stf_mtx); - LIST_REMOVE(sc, sc_list); - mtx_unlock(&stf_mtx); - err = encap_detach(sc->encap_cookie); KASSERT(err == 0, ("Unexpected error detaching encap_cookie")); bpfdetach(ifp); @@ -280,26 +268,13 @@ stfmodevent(mod, type, data) int type; void *data; { - struct stf_softc *sc; switch (type) { case MOD_LOAD: - mtx_init(&stf_mtx, "stf_mtx", NULL, MTX_DEF); - LIST_INIT(&stf_softc_list); if_clone_attach(&stf_cloner); - break; case MOD_UNLOAD: if_clone_detach(&stf_cloner); - - mtx_lock(&stf_mtx); - while ((sc = LIST_FIRST(&stf_softc_list)) != NULL) { - mtx_unlock(&stf_mtx); - stf_clone_destroy(&stf_cloner, STF2IFP(sc)); - mtx_lock(&stf_mtx); - } - mtx_unlock(&stf_mtx); - mtx_destroy(&stf_mtx); break; default: return (EOPNOTSUPP); |