kernels/linux-2.4.0/drivers/net/pcmcia/xircom_tulip_cb.c
/* Initialize the Rx and Tx rings, along with various 'dev' bits. */
Initialize the Rx and Tx rings, along with various 'dev' bits.
Initialize the Rx and Tx rings along with various ' dev ' bits .
static void tulip_init_ring(struct net_device *dev)
{
	struct tulip_private *tp = (struct tulip_private *)dev->priv;
	int i;
	tp->tx_full = 0;
	tp->cur_rx = tp->cur_tx = 0;
	tp->dirty_rx = tp->dirty_tx = 0;
	for (i = 0; i < RX_RING_SIZE; i++) {
		tp->rx_ring[i].status = 0x00000000;
		tp->rx_ring[i].length = PKT_BUF_SZ;
		tp->rx_ring[i].buffer2 = virt_to_bus(&tp->rx_ring[i+1]);
		tp->rx_skbuff[i] = NULL;
	}
	tp->rx_ring[i-1].length = PKT_BUF_SZ | DESC_RING_WRAP;
	tp->rx_ring[i-1].buffer2 = virt_to_bus(&tp->rx_ring[0]);
	for (i = 0; i < RX_RING_SIZE; i++) {
		struct sk_buff *skb = dev_alloc_skb(PKT_BUF_SZ);
		tp->rx_skbuff[i] = skb;
		if (skb == NULL)
			break;
		skb->dev = dev;			
		tp->rx_ring[i].status = DescOwned;	
		tp->rx_ring[i].buffer1 = virt_to_bus(skb->tail);
	}
	tp->dirty_rx = (unsigned int)(i - RX_RING_SIZE);
	for (i = 0; i < TX_RING_SIZE; i++) {
		tp->tx_skbuff[i] = 0;
		tp->tx_ring[i].status = 0x00000000;
		tp->tx_ring[i].buffer2 = virt_to_bus(&tp->tx_ring[i+1]);
#ifdef CARDBUS
		if (tp->chip_id == X3201_3)
			tp->tx_aligned_skbuff[i] = dev_alloc_skb(PKT_BUF_SZ);
#endif CARDBUS
	}
	tp->tx_ring[i-1].buffer2 = virt_to_bus(&tp->tx_ring[0]);
}
static void tulip_init_ring ( struct net_device * dev ) { struct tulip_private * tp = ( struct tulip_private * ) dev -> priv ; int i ; tp -> tx_full = 0 ; tp -> cur_rx = tp -> cur_tx = 0 ; tp -> dirty_rx = tp -> dirty_tx = 0 ; for ( i = 0 ; i < RX_RING_SIZE ; i ++ ) { tp -> rx_ring [ i ] . status = 0x00000000 ; tp -> rx_ring [ i ] . length = PKT_BUF_SZ ; tp -> rx_ring [ i ] . buffer2 = virt_to_bus ( & tp -> rx_ring [ i + 1 ] ) ; tp -> rx_skbuff [ i ] = NULL ; } tp -> rx_ring [ i - 1 ] . length = PKT_BUF_SZ | DESC_RING_WRAP ; tp -> rx_ring [ i - 1 ] . buffer2 = virt_to_bus ( & tp -> rx_ring [ 0 ] ) ; for ( i = 0 ; i < RX_RING_SIZE ; i ++ ) { struct sk_buff * skb = dev_alloc_skb ( PKT_BUF_SZ ) ; tp -> rx_skbuff [ i ] = skb ; if ( skb == NULL ) break ; skb -> dev = dev ; tp -> rx_ring [ i ] . status = DescOwned ; tp -> rx_ring [ i ] . buffer1 = virt_to_bus ( skb -> tail ) ; } tp -> dirty_rx = ( unsigned int ) ( i - RX_RING_SIZE ) ; for ( i = 0 ; i < TX_RING_SIZE ; i ++ ) { tp -> tx_skbuff [ i ] = 0 ; tp -> tx_ring [ i ] . status = 0x00000000 ; tp -> tx_ring [ i ] . buffer2 = virt_to_bus ( & tp -> tx_ring [ i + 1 ] ) ; #ifdef CARDBUS if ( tp -> chip_id == X3201_3 ) tp -> tx_aligned_skbuff [ i ] = dev_alloc_skb ( PKT_BUF_SZ ) ; #endif CARDBUS } tp -> tx_ring [ i - 1 ] . buffer2 = virt_to_bus ( & tp -> tx_ring [ 0 ] ) ; }
Initialize the Rx and Tx rings, along with various 'dev' bits.
Initialize the Rx and Tx rings along with various ' dev ' bits .
/* Mark the last entry as wrapping the ring. */ /* Note the receive buffer must be longword aligned.
		   dev_alloc_skb() provides 16 byte alignment.  But do *not*
		   use skb_reserve() to align the IP header! */ /* Mark as being used by this device. */ /* Owned by Tulip chip */ /* The Tx buffer descriptor is filled in as needed, but we
	   do need to clear the ownership bit. */