Network Core
/linux/drivers/block/genhd.c
int __init device_init(void)
{
 rwlock_init(&gendisk_lock);
 blk_dev_init();
 sti();
#ifdef CONFIG_I2O
 i2o_init();
#endif
#ifdef CONFIG_FUSION_BOOT
 fusion_init();
#endif
#ifdef CONFIG_FC4_SOC
 /* This has to be done before scsi_dev_init */
 soc_probe();
#endif
#ifdef CONFIG_BLK_CPQ_DA
 cpqarray_init();
#endif
#ifdef CONFIG_NET
 net_dev_init();
#endif
#ifdef CONFIG_ATM
 (void) atmdev_init();
#endif
#ifdef CONFIG_VT
 console_map_init();
#endif
 return 0;
}
/linux/net/core/dev.c
int __init net_dev_init(void)
{
 struct net_device *dev, **dp;
 int i;
 if (!dev_boot_phase)
  return 0;
#ifdef CONFIG_NET_DIVERT
 dv_init();
#endif /* CONFIG_NET_DIVERT */
 
 /*
  * Initialise the packet receive queues.
  */
 for (i = 0; i < NR_CPUS; i++) {
  struct softnet_data *queue;
  queue = &softnet_data[i];
  skb_queue_head_init(&queue->input_pkt_queue);
  queue->throttle = 0;
  queue->cng_level = 0;
  queue->avg_blog = 10; /* arbitrary non-zero */
  queue->completion_queue = NULL;
 }
 
#ifdef CONFIG_NET_PROFILE
 net_profile_init();
 NET_PROFILE_REGISTER(dev_queue_xmit);
 NET_PROFILE_REGISTER(softnet_process);
#endif
#ifdef OFFLINE_SAMPLE
 samp_timer.expires = jiffies + (10 * HZ);
 add_timer(&samp_timer);
#endif
 /*
  * Add the devices.
  * If the call to dev->init fails, the dev is removed
  * from the chain disconnecting the device until the
  * next reboot.
  *
  * NB At boot phase networking is dead. No locking is required.
  * But we still preserve dev_base_lock for sanity.
  */
 dp = &dev_base;
 while ((dev = *dp) != NULL) {
  spin_lock_init(&dev->queue_lock);
  spin_lock_init(&dev->xmit_lock);
#ifdef CONFIG_NET_FASTROUTE
  dev->fastpath_lock = RW_LOCK_UNLOCKED;
#endif
  dev->xmit_lock_owner = -1;
  dev->iflink = -1;
  dev_hold(dev);
  /*
   * Allocate name. If the init() fails
   * the name will be reissued correctly.
   */
  if (strchr(dev->name, '%'))
   dev_alloc_name(dev, dev->name);
  /* 
   * Check boot time settings for the device.
   */
  netdev_boot_setup_check(dev);
  if (dev->init && dev->init(dev)) {
   /*
    * It failed to come up. It will be unhooked later.
    * dev_alloc_name can now advance to next suitable
    * name that is checked next.
    */
   dev->deadbeaf = 1;
   dp = &dev->next;
  } else {
   dp = &dev->next;
   dev->ifindex = dev_new_index();
   if (dev->iflink == -1)
    dev->iflink = dev->ifindex;
   if (dev->rebuild_header == NULL)
    dev->rebuild_header = default_rebuild_header;
   dev_init_scheduler(dev);
   set_bit(__LINK_STATE_PRESENT, &dev->state);
  }
 }
 /*
  * Unhook devices that failed to come up
  */
 dp = &dev_base;
 while ((dev = *dp) != NULL) {
  if (dev->deadbeaf) {
   write_lock_bh(&dev_base_lock);
   *dp = dev->next;
   write_unlock_bh(&dev_base_lock);
   dev_put(dev);
  } else {
   dp = &dev->next;
  }
 }
#ifdef CONFIG_PROC_FS
 proc_net_create("dev", 0, dev_get_info);
 create_proc_read_entry("net/softnet_stat", 0, 0, dev_proc_stats, NULL);
#ifdef WIRELESS_EXT
 proc_net_create("wireless", 0, dev_get_wireless_info);
#endif /* WIRELESS_EXT */
#endif /* CONFIG_PROC_FS */
dev_boot_phase = 0;
 open_softirq(NET_TX_SOFTIRQ, net_tx_action, NULL);
 open_softirq(NET_RX_SOFTIRQ, net_rx_action, NULL);
 dst_init();
 dev_mcast_init();
#ifdef CONFIG_NET_SCHED
 pktsched_init();
#endif
 /*
  * Initialise network devices
  */
  
 net_device_init();
 return 0;
}
/linux/drivers/net/Space.c
static struct net_device eth7_dev = {
    "eth%d", 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, NEXT_DEV, ethif_probe };
static struct net_device eth6_dev = {
    "eth%d", 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð7_dev, ethif_probe };
static struct net_device eth5_dev = {
    "eth%d", 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð6_dev, ethif_probe };
static struct net_device eth4_dev = {
    "eth%d", 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð5_dev, ethif_probe };
static struct net_device eth3_dev = {
    "eth%d", 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð4_dev, ethif_probe };
static struct net_device eth2_dev = {
    "eth%d", 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð3_dev, ethif_probe };
static struct net_device eth1_dev = {
    "eth%d", 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð2_dev, ethif_probe };
static struct net_device eth0_dev = {
    "eth%d", 0, 0, 0, 0, ETH0_ADDR, ETH0_IRQ, 0, 0, 0, ð1_dev, ethif_probe };
#   undef NEXT_DEV
#   define NEXT_DEV (ð0_dev)
extern int loopback_init(struct net_device *dev);
struct net_device loopback_dev = 
 {"lo", 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, loopback_init};
struct net_device *dev_base = &loopback_dev;
static struct devprobe isa_probes[] __initdata = {
#ifdef CONFIG_EL3  /* ISA, EISA, MCA 3c5x9 */
 {el3_probe, 0},
#endif
#ifdef CONFIG_HP100   /* ISA, EISA & PCI */
 {hp100_probe, 0},
#endif 
#ifdef CONFIG_3C515
 {tc515_probe, 0},
#endif
#ifdef CONFIG_ULTRA 
 {ultra_probe, 0},
#endif
#ifdef CONFIG_WD80x3 
 {wd_probe, 0},
#endif
#ifdef CONFIG_EL2   /* 3c503 */
 {el2_probe, 0},
#endif
#ifdef CONFIG_HPLAN
 {hp_probe, 0},
#endif
#ifdef CONFIG_HPLAN_PLUS
 {hp_plus_probe, 0},
#endif
#ifdef CONFIG_E2100  /* Cabletron E21xx series. */
 {e2100_probe, 0},
#endif
#ifdef CONFIG_NE2000  /* ISA (use ne2k-pci for PCI cards) */
 {ne_probe, 0},
#endif
#ifdef CONFIG_LANCE  /* ISA/VLB (use pcnet32 for PCI cards) */
 {lance_probe, 0},
#endif
#ifdef CONFIG_SMC9194
 {smc_init, 0},
#endif
#ifdef CONFIG_SEEQ8005 
 {seeq8005_probe, 0},
#endif
#ifdef CONFIG_AT1500
 {at1500_probe, 0},
#endif
#ifdef CONFIG_CS89x0
  {cs89x0_probe, 0},
#endif
#ifdef CONFIG_AT1700
 {at1700_probe, 0},
#endif
#ifdef CONFIG_FMV18X  /* Fujitsu FMV-181/182 */
 {fmv18x_probe, 0},
#endif
#ifdef CONFIG_ETH16I
 {eth16i_probe, 0}, /* ICL EtherTeam 16i/32 */
#endif
#ifdef CONFIG_ZNET  /* Zenith Z-Note and some IBM Thinkpads. */
 {znet_probe, 0},
#endif
#ifdef CONFIG_EEXPRESS  /* Intel EtherExpress */
 {express_probe, 0},
#endif
#ifdef CONFIG_EEXPRESS_PRO /* Intel EtherExpress Pro/10 */
 {eepro_probe, 0},
#endif
#ifdef CONFIG_DEPCA  /* DEC DEPCA */
 {depca_probe, 0},
#endif
#ifdef CONFIG_EWRK3             /* DEC EtherWORKS 3 */
     {ewrk3_probe, 0},
#endif
#if defined(CONFIG_APRICOT) || defined(CONFIG_MVME16x_NET) || defined(CONFIG_BVME6000_NET) /* Intel I82596 */
 {i82596_probe, 0},
#endif
#ifdef CONFIG_EL1  /* 3c501 */
 {el1_probe, 0},
#endif
#ifdef CONFIG_WAVELAN  /* WaveLAN */
 {wavelan_probe, 0},
#endif
#ifdef CONFIG_ARLAN  /* Aironet */
 {arlan_probe, 0},
#endif
#ifdef CONFIG_EL16  /* 3c507 */
 {el16_probe, 0},
#endif
#ifdef CONFIG_ELPLUS  /* 3c505 */
 {elplus_probe, 0},
#endif
#ifdef CONFIG_SK_G16
 {SK_init, 0},
#endif
#ifdef CONFIG_NI5010
 {ni5010_probe, 0},
#endif
#ifdef CONFIG_NI52
 {ni52_probe, 0},
#endif
#ifdef CONFIG_NI65
 {ni65_probe, 0},
#endif
 {NULL, 0},
};
 



0 意見:
張貼留言