Ethernet driver teardown

John Baldwin jhb at FreeBSD.org
Mon Oct 3 09:44:55 PDT 2005


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 at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the freebsd-arch mailing list