ether_setup()函数的实现如下:


void ether_setup(struct device *dev)
{
 int i;
 /* Fill in the fields of the device structure with ethernet-generic values.
    This should be in a common file instead of per-driver.  */
 for (i = 0; i < DEV_NUMBUFFS; i++)
  skb_queue_head_init(&dev->buffs[i]);//缓冲队列初始化

 /* register boot-defined "eth" devices */
 if (dev->name && (strncmp(dev->name, "eth", 3) == 0)) {//定义eth网卡的名称
  i = simple_strtoul(dev->name + 3, NULL, 0);
  if (ethdev_index[i] == NULL) {
   ethdev_index[i] = dev;
  }
  else if (dev != ethdev_index[i]) {
   /* Really shouldn't happen! */
   printk("ether_setup: Ouch! Someone else took %s ",
    dev->name);
  }
 }

 dev->hard_header = eth_header;//该函数的作用是创建链路层首部,定义在eth.c中
 dev->rebuild_header = eth_rebuild_header;//该函数的作用是重建链路层首部,用于ARP协议
 dev->type_trans = eth_type_trans;

 dev->type  = ARPHRD_ETHER;
 dev->hard_header_len = ETH_HLEN;
 dev->mtu  = 1500; /* eth_mtu */
 dev->addr_len = ETH_ALEN;
 for (i = 0; i < ETH_ALEN; i++) {
  dev->broadcast[i]=0xff;
 }

 /* New-style flags. */
 dev->flags  = IFF_BROADCAST|IFF_MULTICAST;
 dev->family  = AF_INET;
 dev->pa_addr = 0;
 dev->pa_brdaddr = 0;
 dev->pa_mask = 0;
 dev->pa_alen = sizeof(unsigned long);
}
 


  这样,网络设备的初始化工作完成了。

  在drivers/net/8390.c中实现了该网卡的设备的基本操作函数,