Re: what is equivalent to ether_setup in 8139too.c as given in LDD page 504

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Tapas,

On Fri, Nov 5, 2010 at 2:05 PM, Tapas Mishra <mightydreams@xxxxxxxxx> wrote:
> I am trying to understand how network drivers can be written.
> In LDD page 504 Chapter 17,
> what is equivalent to ether_setup in 8139too.c as given in LDD page 504
> a function ether_setup has been explained what is equivalent to that
> function in the driver
> 8139too.c

Understanding your question was harder than finding the answer :).

As LDD3 describes in Chapter 17, one step in writing a network driver
is allocating a structure called net_dev. This structure is associated
with a specific interface and must be properly initialized before registering
it with the kernel.

Allocating a net_dev object can be performed in general by calling the
function alloc_netdev(..,.., setup) [1]. After allocating a net_dev object
this function will call setup to finish the initialization.

Anyhow, alloc_netdev is a generic function and you must have your
own setup implementation. In order to speed up the implementation
the kernel offers some helper functions for the most common interface types.

One of the helper functions is for Ethernet interfaces - alloc_etherdev ([2]).
This function has its own setup function called ether_setup ([3]).

Now the answer to your question:

The equivalent of ether_setup from LDD page 504, inside the 8139too.c file
is ether_setup :).

The only difference is that in LDD ether_setup is called manually inside
snull_init, while in 8139too.c ether_setup is wrapped in the call for
alloc_etherdev.

thanks,
Daniel

[1] http://lxr.linux.no/#linux+v2.6.36/include/linux/netdevice.h#L2078
[2] http://lxr.linux.no/#linux+v2.6.36/include/linux/etherdevice.h#L52
[3] http://lxr.linux.no/#linux+v2.6.36/net/ethernet/eth.c#L334

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux