kernels/linux-2.4.0/drivers/net/3c527.c
/**
 *	mc32_load_rx_ring:
 *	@dev: 3c527 to build the ring for
 *
 *	The card setups up the receive ring for us. We are required to
 *	use the ring it provides although we can change the size of the
 *	ring.
 *
 *	We allocate an sk_buff for each ring entry in turn and set the entry
 *	up for a single non s/g buffer. The first buffer we mark with the
 *	end marker bits. Finally we clear the rx mailbox.
 */
@dev: 3c527 to build the ring for

The card setups up the receive ring for us. We are required to
use the ring it provides although we can change the size of the
ring.

We allocate an sk_buff for each ring entry in turn and set the entry
up for a single non s/g buffer. The first buffer we mark with the
end marker bits. Finally we clear the rx mailbox.
@dev : 3c527 to build the ring for The card setups up the receive ring for us . We are required to use the ring it provides although we can change the size of the ring . We allocate an sk_buff for each ring entry in turn and set the entry up for a single non s / g buffer . The first buffer we mark with the end marker bits . Finally we clear the rx mailbox .
static int mc32_load_rx_ring(struct net_device *dev)
{
	struct mc32_local *lp = (struct mc32_local *)dev->priv;
	int i;
	u16 base;
	volatile struct skb_header *p;
	base = lp->rx_box->data[0];
	for(i=0;i<RX_RING_MAX;i++)
	{
		lp->rx_skb[i]=alloc_skb(1532, GFP_KERNEL);
		if(lp->rx_skb[i]==NULL)
		{
			for(;i>=0;i--)
				kfree_skb(lp->rx_skb[i]);
			return -ENOBUFS;
		}
		lp->rx_ptr[i]=lp->rx_skb[i]->data+18;
		p=bus_to_virt(lp->base+base);
		p->control=0;
		p->data = virt_to_bus(lp->rx_ptr[i]);
		p->status=0;
		p->length = 1532;
		base = p->next;
	}
	p->control = (1<<6);
	lp->rx_box->mbox = 0;
	return 0;
}
static int mc32_load_rx_ring ( struct net_device * dev ) { struct mc32_local * lp = ( struct mc32_local * ) dev -> priv ; int i ; u16 base ; volatile struct skb_header * p ; base = lp -> rx_box -> data [ 0 ] ; for ( i = 0 ; i < RX_RING_MAX ; i ++ ) { lp -> rx_skb [ i ] = alloc_skb ( 1532 , GFP_KERNEL ) ; if ( lp -> rx_skb [ i ] == NULL ) { for ( ; i >= 0 ; i -- ) kfree_skb ( lp -> rx_skb [ i ] ) ; return - ENOBUFS ; } lp -> rx_ptr [ i ] = lp -> rx_skb [ i ] -> data + 18 ; p = bus_to_virt ( lp -> base + base ) ; p -> control = 0 ; p -> data = virt_to_bus ( lp -> rx_ptr [ i ] ) ; p -> status = 0 ; p -> length = 1532 ; base = p -> next ; } p -> control = ( 1 << 6 ) ; lp -> rx_box -> mbox = 0 ; return 0 ; }
mc32_load_rx_ring:
      @dev: 3c527 to build the ring for
mc32_load_rx_ring : @dev : 3c527 to build the ring for
/* Fix me - should use card size - also fix flush ! */