Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Oct 2005 12:46:13 -0400
From:      John Baldwin <jhb@FreeBSD.org>
To:        arch@FreeBSD.org
Cc:        ru@FreeBSD.org, M.@WarnerLosh
Subject:   Ethernet driver teardown
Message-ID:  <200510031246.14835.jhb@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
So, I was thinking about the problem with ethernet driver detach races this 
morning and had an idea.  What if the sequence for detach() was altered such 
that we called ether_ifdetach() before the driver's stop() routine?  Thus, 
you would end up with something like this:

foo_detach()
{

	ether_ifdetach(sc->foo_ifp);
	FOO_LOCK(sc);
	foo_stop(sc);
	FOO_UNLOCK(sc);
	callout_drain(...);
	bus_teardown_intr(...);
	if_free(sc->foo_ifp);
	bus_release_resources(...);
	...
}

Would that solve the various races including letting BPF turn off promiscuous 
mode cleanly without requiring detaching flags in each driver to bail out of 
foo_ioctl()?

-- 
John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200510031246.14835.jhb>