[Top] [All Lists]

Re: modular net drivers

To: Andrew Morton <andrewm@xxxxxxxxxx>
Subject: Re: modular net drivers
From: Jeff Garzik <jgarzik@xxxxxxxxxxxxxxxx>
Date: Thu, 22 Jun 2000 08:44:29 -0400
Cc: Rusty Russell <rusty@xxxxxxxxxxxxxxxx>, Keith Owens <kaos@xxxxxxxxxx>, "netdev@xxxxxxxxxxx" <netdev@xxxxxxxxxxx>
Organization: MandrakeSoft
References: Your message of "Wed, 21 Jun 2000 07:49:40 +1000." <4450.961537780@ocs3.ocs-net> <20000621065644.4B30A8154@halfway> <>
Sender: owner-netdev@xxxxxxxxxxx
Andrew Morton wrote:
> Rusty Russell wrote:
> >
> > module_cleanup should unregister everything first, before doing other
> > cleaning up (which might sleep).
> Yup.  module_cleanup() calls unregister_netdev().
> It would be better to do the unregister_netdev(), then to wait for everyone 
> to stop using the device (but how?) and to then reap the module.

Two things to remember:  one, module_cleanup is called only when module
use count (and hence user count) drops to zero, and two
unregister_netdev closes the net device, so any users that slipped in
and opened the net device during module_cleanup during (is that even
possible?) are booted when the net device is closed.  This also takes
care of any wacky hardware cleanup that needs to be done in dev->stop(),
so module_cleanup can simply concern itself with unregistered and
freeing stuff and then exiting.


Jeff Garzik              |
Building 1024            | Free beer tomorrow.
MandrakeSoft, Inc.       |

<Prev in Thread] Current Thread [Next in Thread>