Re: Patch to change net_device.name from char* to char[].

From: Nick Holloway (Nick.Holloway@alfie.demon.co.uk)
Date: Mon May 01 2000 - 14:41:13 EST


randy.dunlap@intel.com (Dunlap, Randy) wrote:
> or USB net drivers. Please give us a small bit of warning if/when
> drivers need to be modified...or is this the notification?

I must confess I had missed the USB net drivers when going through making
the changes.

I don't know what plans Linus has for including the changes or not,
so I don't know if this is the notification.

I've now looked at the USB network drivers (and found two). The pegasus
driver appears to be fine and would not need changing, as it uses
"init_etherdev" to allocate the "struct net_device", and does not set
"dev->name" directly.

The plusb driver would need to change, as this allocates space for
"dev->name". The complication is that the plusb overloads "net_dev.name"
as a flag to show whether the device is registered or not, and I can't see
if that is really required. It nearly mirrors the flag "s->connected",
unless you have managed to call plusb_disconnect before plusb_net_stop.

[Thinks...]

The interaction of "s->opened", "s->connected", "s->net_dev.name" is
very difficult to follow, and appears to be tied to finding a static
structure available for use, and dealing with the USB insertion/removal
and net reg/unreg happening in an undefined order.

Would it be simpler if the plusb driver dynamically allocated the "struct
plusb_t" in the probe routine, rather than finding an unused element in
the static array? The probe routine would then always register the device
(using "dev_alloc_name" and "register_netdev"). The disconnect routine
would always call "unregister_netdev" (which stops the interface if it
is still up) and free the "struct plusb_t". This makes it much simpler,
and is in the style of the pegasus driver.

Furthermore, if the plusb driver were changed to use "dev_alloc" to create
the "struct netdevice", instead of it being allocated as a member of
"plusb_t", then the driver would then not need updating if this change
is included in the kernel.

As an aside, it looks to me like there is a potential bug in the pegasus
driver as a module. If someone downs the pegasus device, the module usage
will become zero, and the module could be unloaded. However, the USB core
could still attempt to call "pegasus_disconnect". I don't know if it
is sufficient to move the module inc/dec to the probe/disconnect rather
than netdev open/close, or if you need to have them in both (as in the
plusb driver). In addition, I can't see where "pegasus->net" is freed.

-- 
 `O O'  | Nick.Holloway@alfie.demon.co.uk
// ^ \\ | http://www.alfie.demon.co.uk/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun May 07 2000 - 21:00:09 EST