aboutsummaryrefslogtreecommitdiff
path: root/sys/net/if_disc.c
diff options
context:
space:
mode:
authorAndrew Thompson <thompsa@FreeBSD.org>2005-11-08 20:08:34 +0000
committerAndrew Thompson <thompsa@FreeBSD.org>2005-11-08 20:08:34 +0000
commit4e7e0183e1884e2ea9beb2720b22610c0a9e83ba (patch)
treeb5694a5381004aaef7ca02a29efbdb85ad370b4d /sys/net/if_disc.c
parent2a522eb9d329b84b7d8b479f3b3b3739762078b6 (diff)
downloadsrc-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_disc.c')
-rw-r--r--sys/net/if_disc.c21
1 files changed, 0 insertions, 21 deletions
diff --git a/sys/net/if_disc.c b/sys/net/if_disc.c
index 3b0804e5cb3a..0a138dfb63ae 100644
--- a/sys/net/if_disc.c
+++ b/sys/net/if_disc.c
@@ -63,7 +63,6 @@
struct disc_softc {
struct ifnet *sc_ifp; /* must be first */
- LIST_ENTRY(disc_softc) sc_list;
};
static int discoutput(struct ifnet *, struct mbuf *,
@@ -73,9 +72,7 @@ static int discioctl(struct ifnet *, u_long, caddr_t);
static int disc_clone_create(struct if_clone *, int);
static void disc_clone_destroy(struct ifnet *);
-static struct mtx disc_mtx;
static MALLOC_DEFINE(M_DISC, DISCNAME, "Discard interface");
-static LIST_HEAD(, disc_softc) disc_softc_list;
IFC_SIMPLE_DECLARE(disc, 0);
@@ -103,9 +100,6 @@ disc_clone_create(struct if_clone *ifc, int unit)
ifp->if_snd.ifq_maxlen = 20;
if_attach(ifp);
bpfattach(ifp, DLT_NULL, sizeof(u_int32_t));
- mtx_lock(&disc_mtx);
- LIST_INSERT_HEAD(&disc_softc_list, sc, sc_list);
- mtx_unlock(&disc_mtx);
return (0);
}
@@ -116,9 +110,6 @@ disc_clone_destroy(struct ifnet *ifp)
struct disc_softc *sc;
sc = ifp->if_softc;
- mtx_lock(&disc_mtx);
- LIST_REMOVE(sc, sc_list);
- mtx_unlock(&disc_mtx);
bpfdetach(ifp);
if_detach(ifp);
@@ -130,25 +121,13 @@ disc_clone_destroy(struct ifnet *ifp)
static int
disc_modevent(module_t mod, int type, void *data)
{
- struct disc_softc *sc;
switch (type) {
case MOD_LOAD:
- mtx_init(&disc_mtx, "disc_mtx", NULL, MTX_DEF);
- LIST_INIT(&disc_softc_list);
if_clone_attach(&disc_cloner);
break;
case MOD_UNLOAD:
if_clone_detach(&disc_cloner);
-
- mtx_lock(&disc_mtx);
- while ((sc = LIST_FIRST(&disc_softc_list)) != NULL) {
- mtx_unlock(&disc_mtx);
- ifc_simple_destroy(&disc_cloner, sc->sc_ifp);
- mtx_lock(&disc_mtx);
- }
- mtx_unlock(&disc_mtx);
- mtx_destroy(&disc_mtx);
break;
default:
return (EOPNOTSUPP);