diff options
author | thompsa <thompsa@FreeBSD.org> | 2005-11-08 20:08:34 +0000 |
---|---|---|
committer | thompsa <thompsa@FreeBSD.org> | 2005-11-08 20:08:34 +0000 |
commit | 48c0bcb5c218c021c1da0e53702d2e83708a471a (patch) | |
tree | b5694a5381004aaef7ca02a29efbdb85ad370b4d /sys/net/if_faith.c | |
parent | 7b0555d4591f77539a864cf4d9ca449610fd188c (diff) | |
download | FreeBSD-src-48c0bcb5c218c021c1da0e53702d2e83708a471a.zip FreeBSD-src-48c0bcb5c218c021c1da0e53702d2e83708a471a.tar.gz |
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
Diffstat (limited to 'sys/net/if_faith.c')
-rw-r--r-- | sys/net/if_faith.c | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/sys/net/if_faith.c b/sys/net/if_faith.c index 677e1b2..71b8c35 100644 --- a/sys/net/if_faith.c +++ b/sys/net/if_faith.c @@ -84,7 +84,6 @@ struct faith_softc { struct ifnet *sc_ifp; - LIST_ENTRY(faith_softc) sc_list; }; static int faithioctl(struct ifnet *, u_long, caddr_t); @@ -97,9 +96,7 @@ static int faithprefix(struct in6_addr *); static int faithmodevent(module_t, int, void *); -static struct mtx faith_mtx; static MALLOC_DEFINE(M_FAITH, FAITHNAME, "Firewall Assisted Tunnel Interface"); -static LIST_HEAD(, faith_softc) faith_softc_list; static int faith_clone_create(struct if_clone *, int); static void faith_clone_destroy(struct ifnet *); @@ -114,12 +111,9 @@ faithmodevent(mod, type, data) int type; void *data; { - struct faith_softc *sc; switch (type) { case MOD_LOAD: - mtx_init(&faith_mtx, "faith_mtx", NULL, MTX_DEF); - LIST_INIT(&faith_softc_list); if_clone_attach(&faith_cloner); #ifdef INET6 @@ -133,15 +127,6 @@ faithmodevent(mod, type, data) #endif if_clone_detach(&faith_cloner); - - mtx_lock(&faith_mtx); - while ((sc = LIST_FIRST(&faith_softc_list)) != NULL) { - mtx_unlock(&faith_mtx); - ifc_simple_destroy(&faith_cloner, sc->sc_ifp); - mtx_lock(&faith_mtx); - } - mtx_unlock(&faith_mtx); - mtx_destroy(&faith_mtx); break; default: return EOPNOTSUPP; @@ -186,9 +171,6 @@ faith_clone_create(ifc, unit) ifp->if_snd.ifq_maxlen = ifqmaxlen; if_attach(ifp); bpfattach(ifp, DLT_NULL, sizeof(u_int32_t)); - mtx_lock(&faith_mtx); - LIST_INSERT_HEAD(&faith_softc_list, sc, sc_list); - mtx_unlock(&faith_mtx); return (0); } @@ -198,10 +180,6 @@ faith_clone_destroy(ifp) { struct faith_softc *sc = ifp->if_softc; - mtx_lock(&faith_mtx); - LIST_REMOVE(sc, sc_list); - mtx_unlock(&faith_mtx); - bpfdetach(ifp); if_detach(ifp); if_free(ifp); |