Alan Cox wrote:
> When you create ethfoo it creates a net_device initialised with ethfoo's
> parameters, so its also trivial to add
> eth_get_params(struct something *)
> to handle the other cases without breaking compatibility
Unfortunately there's an ordering problem. The driver doesn't
know its value of `foo' until the final act, where it calls
register_netdevice(). But it needs to know its setup
parameters a long time before that, and it needs `foo' for that.
And we can't call register_netdevice() earlier, because the
device isn't ready to be opened yet. And it can't be made
ready to be opened until it knows its setup parameters, ad
So to support `ether=' we need to know the interface's
actual name at the *start* of probing, not the end.
dev = alloc_etherdev();
eth_get_params(dev, dev->name); /* dev->name is "eth%d". oops */
register_netdevice(dev); /* "eth0" gets determined here. oops */
Which basically takes us back to the thing I did in
December: allocate and reserve the device name at the
start of probe, and publish it (ie: make it eligible for
open) at the end of probe.
alloc_etherdev() can do this. Allocate the name, then
populate *dev with it, then just reserve the interface number
in some little array, then call netdev_boot_setup_check().
Drivers need to be changed so that if xxx_probe() decides that it's
not going to register the interface after all, it will
need to call a new API function to clear the slot in the array.
This means that the availability of device names is stored in two
places: the current device list and the array. That's rather
unpleasant. Alternative is to always use the device list,
but add a "hidden" state. Deja Vu.
I can put that stuff back together over the weekend - I think
it'll be quite straightforward.