[Top] [All Lists]

Re: modular net drivers

To: "netdev@xxxxxxxxxxx" <netdev@xxxxxxxxxxx>
Subject: Re: modular net drivers
From: Andrew Morton <andrewm@xxxxxxxxxx>
Date: Fri, 23 Jun 2000 00:01:16 +1000
References: Your message of "Thu, 22 Jun 2000 08:44:29 -0400." <> <2460.961679037@ocs3.ocs-net>
Sender: owner-netdev@xxxxxxxxxxx
Keith Owens wrote:
> Other calls to module functions do not run under the big kernel lock.
> Instead they are meant to call open() first which bumps the reference
> count.

The problem with the net drivers is that they are "opened" within the
module constructor, "closed" with the module destructor and their "open"
and "close" methods don't (can't) manipulate the refcounts.

You see, is a misnomer.  It simply switches an
existing, already-open netdevice from 'down' to 'up'.  It should be
called 'start' (cf netdevice.stop).

It's register_netdevice() which registers a device with the kernel and
makes all its entry points available for use.  register_netdevice is
called from within module_init().

Seen in this light, incrementing the refcount within is
kinda arbitrary.  All the other netdevice methods should also increment
the refcount (yes, racy).


rm /sbin/rmmod.  There.  Fixed.

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