Re: init_etherdev() vs. register_netdev()

Paul Gortmaker (paul@rasty.anu.edu.au)
Mon, 31 Mar 1997 20:16:56 +1000 (EST)


> I just wanted to ask a question about these two system calls, because they
> are currently causing problems with the etherexpress 100 driver. The
> problem is that drivers that use init_etherdev (in 2.1.x kernels) do not
> get an "ifindex" -- I do not see it implemented in 2.1.29 (dunno about
> pre2.1.30). As a result, I cannot add routes to any NIC that uses this API
> as opposed to the register_netdev() API -- was it intentional that ifindex
> was not put in init_etherdev? Are init_etherdev() and register_netdev()
> mutually exclusive functions (they seem to be, because in the etherexpress
> 100 driver, there is an #ifdef that uses either init_etherdev() or another
> mechanism (including register_netdev()))... Is this an oversight or a
> feature?

The init_etherdev() was the original function, and has been around for
a long time. It is primarily used upon driver initialization at boot.
Then register_netdev() was introduced when modularization of the e'net
drivers became popular (and hence is primarily used by modules).

I suspect you can add dev->ifindex = dev_new_index(); into init_etherdev
without causing any large scale explosions. Add it into the routine
after the line "dev->next = 0;"

Paul.