kernels/linux-2.4.0/drivers/net/wan/sdla_fr.c
/*============================================================================
 * Initialize Linux network interface.
 *
 * This routine is called only once for each interface, during Linux network
 * interface registration.  Returning anything but zero will fail interface
 * registration.
 */
Initialize Linux network interface.
This routine is called only once for each interface, during Linux network
interface registration.  Returning anything but zero will fail interface
registration.
Initialize Linux network interface . This routine is called only once for each interface during Linux network interface registration . Returning anything but zero will fail interface registration .
static int if_init (struct net_device* dev)
{
	fr_channel_t* chan = dev->priv;
	sdla_t* card = chan->card;
	wan_device_t* wandev = &card->wandev;
	dev->open		= &if_open;
	dev->stop		= &if_close;
	dev->hard_header	= &if_header;
	dev->rebuild_header	= &if_rebuild_hdr;
	dev->hard_start_xmit	= &if_send;
	dev->get_stats		= &if_stats;
	dev->tx_timeout		= &if_tx_timeout;
	dev->watchdog_timeo	= TX_TIMEOUT;
	dev->type		= ARPHRD_DLCI;	
	dev->flags		|= IFF_POINTOPOINT;	
	if (chan->mc == WANOPT_YES){
		dev->flags 	|= IFF_MULTICAST;
	}
	dev->mtu		= wandev->mtu - FR_HEADER_LEN;
	if(chan->usedby == API) {
		dev->mtu += (sizeof(api_tx_hdr_t) - FR_HEADER_LEN);
	}
	dev->hard_header_len	= FR_HEADER_LEN;
	dev->addr_len		= 2; 		
	*(unsigned short*)dev->dev_addr = htons(chan->dlci);
	dev->irq	= wandev->irq;
	dev->dma	= wandev->dma;
	dev->base_addr	= wandev->ioport;
	dev->mem_start	= wandev->maddr;
	dev->mem_end	= wandev->maddr + wandev->msize - 1;
        dev->tx_queue_len = 100;
	dev_init_buffers(dev);
	set_chan_state(dev, WAN_DISCONNECTED);
	return 0;
}
static int if_init ( struct net_device * dev ) { fr_channel_t * chan = dev -> priv ; sdla_t * card = chan -> card ; wan_device_t * wandev = & card -> wandev ; dev -> open = & if_open ; dev -> stop = & if_close ; dev -> hard_header = & if_header ; dev -> rebuild_header = & if_rebuild_hdr ; dev -> hard_start_xmit = & if_send ; dev -> get_stats = & if_stats ; dev -> tx_timeout = & if_tx_timeout ; dev -> watchdog_timeo = TX_TIMEOUT ; dev -> type = ARPHRD_DLCI ; dev -> flags |= IFF_POINTOPOINT ; if ( chan -> mc == WANOPT_YES ) { dev -> flags |= IFF_MULTICAST ; } dev -> mtu = wandev -> mtu - FR_HEADER_LEN ; if ( chan -> usedby == API ) { dev -> mtu += ( sizeof ( api_tx_hdr_t ) - FR_HEADER_LEN ) ; } dev -> hard_header_len = FR_HEADER_LEN ; dev -> addr_len = 2 ; * ( unsigned short * ) dev -> dev_addr = htons ( chan -> dlci ) ; dev -> irq = wandev -> irq ; dev -> dma = wandev -> dma ; dev -> base_addr = wandev -> ioport ; dev -> mem_start = wandev -> maddr ; dev -> mem_end = wandev -> maddr + wandev -> msize - 1 ; dev -> tx_queue_len = 100 ; dev_init_buffers ( dev ) ; set_chan_state ( dev , WAN_DISCONNECTED ) ; return 0 ; }
Initialize Linux network interface.
Initialize Linux network interface .
/* Initialize device driver entry points */ /* Initialize media-specific parameters */ /* ARP h/w type */ /* Enable Multicast addressing */ /* For an API, the maximum number of bytes that the stack will pass
	   to the driver is (dev->mtu + dev->hard_header_len). So, adjust the
	   mtu so that a frame of maximum size can be transmitted by the API. 
	*/ /* media header length */ /* hardware address length */ /* Initialize hardware parameters (just for reference) */ /* Set transmit buffer queue length */ /* Initialize socket buffers */