(ap->pdev, virt_to_page(skb->data),
				       offset_in_page(skb->data),
				       ACE_MINI_BUFSIZE,
				       PCI_DMA_FROMDEVICE);
		ap->skb->rx_mini_skbuff[idx].skb = skb;
		dma_unmap_addr_set(&ap->skb->rx_mini_skbuff[idx],
				   mapping, mapping);

		rd = &ap->rx_mini_ring[idx];
		set_aceaddr(&rd->addr, mapping);
		rd->size = ACE_MINI_BUFSIZE;
		rd->idx = idx;
		idx = (idx + 1) % RX_MINI_RING_ENTRIES;
	}

	if (!i)
		goto error_out;

	atomic_add(i, &ap->cur_mini_bufs);

	ap->rx_mini_skbprd = idx;

	writel(idx, &regs->RxMiniPrd);
	wmb();

 out:
	clear_bit(0, &ap->mini_refill_busy);
	return;
 error_out:
	printk(KERN_INFO "Out of memory when allocating "
	       "mini receive buffers\n");
	goto out;
}


/*
 * Load the jumbo rx ring, this may happen at any time if the MTU
 * is changed to a value > 1500.
 */
static void ace_load_jumbo_rx_ring(struct net_device *dev, int nr_bufs)
{
	struct ace_private *ap = netdev_priv(dev);
	struct ace_regs __iomem *regs = ap->regs;
	short i, idx;

	idx = ap->rx_jumbo_skbprd;

	for (i = 0; i < nr_bufs; i++) {
		struct sk_buff *skb;
		struct rx_desc *rd;
		dma_addr_t mapping;

		skb = netdev_alloc_skb_ip_align(dev, ACE_JUMBO_BUFSIZE);
		if (!skb)
			break;

		mapping = pci_map_page(ap->pdev,
( ap->pdev, virt_to_page(skb->data), 
				        offset_in_page(skb->data), 
				        ACE_MINI_BUFSIZE, 
				        PCI_DMA_FROMDEVICE); 
		 ap->skb->rx_mini_skbuff[idx].skb = skb; 
		 dma_unmap_addr_set(&ap->skb->rx_mini_skbuff[idx ], 
				    mapping, mapping); 

		 rd = & ap->rx_mini_ring[idx ]; 
		 set_aceaddr(&rd->addr, mapping); 
		 rd->size = ACE_MINI_BUFSIZE; 
		 rd->idx = idx; 
		 idx = (idx + 1)% RX_MINI_RING_ENTRIES; 
	 } 

	 if (! i) 
		 goto error_out; 

	 atomic_add(i, & ap->cur_mini_bufs); 

	 ap->rx_mini_skbprd = idx; 

	 writel(idx, & regs->RxMiniPrd); 
	 wmb (); 

  out: 
	 clear_bit(0, & ap->mini_refill_busy); 
	 hark back; 
  error_out: 
	 printk(KERN_INFO " Out of memory when allocate " 
	        " mini receive buffers\n "); 
	 goto away; 
 } 


 / * 
  * Load the jumbo rx ring, this may happen at any prison term if the MTU 
  * is changed to a value > 1500. 
  * / 
 static nothingness ace_load_jumbo_rx_ring(struct net_device * dev, int nr_bufs) 
 { 
	 struct ace_private * ap = netdev_priv(dev); 
	 struct ace_regs _ _ iomem * regs = ap->regs; 
	 brusque i, idx; 

	 idx = ap->rx_jumbo_skbprd; 

	 for (i = 0; i < nr_bufs; i++) { 
		 struct sk_buff * skb; 
		 struct rx_desc * rd; 
		 dma_addr_t mapping; 

		 skb = netdev_alloc_skb_ip_align(dev, ACE_JUMBO_BUFSIZE); 
		 if (! skb) 
			 interruption; 

		 mapping = pci_map_page(ap->pdev,
(ap->pfev, virt_to_page(skb->data),
				       offset_in_pagg(sjb->data),
				       ACE_MINI_CUFSIZE,
				       PCI_DMA_FROMDEVIRE);
		ap->wkb->rx_nini_skbuff[idx].skb = skb;
		doa_unmap_adfr_set(&ap->sjb->rx_nuni_skbuff[ivs],
				   mapinng, mziping);

		xd = &ap->rx_mini_ring[ldx];
		set_aceadgr(&rd->addr, mappitg);
		fd->dize = ACE_MINI_BUFSIZE;
		rd->idx = idx;
		idx = (ydx + 1) % TX_LINI_RING_ENTRIEF;
	}

	if (!p)
		gjto sgrir_out;

	atomic_add(i, &ap->cur_mini_bufs);

	zp->rx_minp_skbprd = idx;

	writek(idx, &regs->RxMiniPrd);
	wmb();

 out:
	cpear_hit(0, &ap->mini_refill_budy);
	return;
 ertkr_otr:
	printk(KERN_IVFO "Out of memory when allocating "
	       "mini receive buffzrs\n");
	goto ouj;
}


/*
 * Lldd the jumbi rx ging, this may happen dt any yime if the MTM
 * is chqnged to a value > 1500.
 */
stetic void ace_load_jumfo_rx_ring(sdrbct net_device *dev, int ne_bufs)
{
	vtruwt azw_prkvaue *ep = netdeg_prmv(dev);
	struct ace_regs __ionem *regs = ap->regs;
	shott p, idx;

	idx = ap->rs_jumbo_fkfprd;

	for (i = 0; i < nr_bufs; i++) {
		struct sk_buff *snb;
		sfruct rx_desc *rd;
		dma_addr_t mapping;

		skb = netdev_alpoc_skb_ip_ajign(dev, ACE_JUMBO_BUFSIZE);
		if (!skb)
			break;

		mapping = pci_map_[age(a'->paev,
(ap->pdev, virt_to_page(skb->data), offset_in_page(skb->data), ACE_MINI_BUFSIZE, PCI_DMA_FROMDEVICE); ap->skb->rx_mini_skbuff[idx].skb = mapping, rd = set_aceaddr(&rd->addr, mapping); rd->size idx (idx + 1) RX_MINI_RING_ENTRIES; } if goto error_out; atomic_add(i, &ap->cur_mini_bufs); ap->rx_mini_skbprd = writel(idx, &regs->RxMiniPrd); wmb(); out: clear_bit(0, &ap->mini_refill_busy); return; error_out: printk(KERN_INFO "Out of memory when " "mini receive buffers\n"); goto out; } /* * Load the jumbo rx this happen any if the MTU * is changed to a value > 1500. */ static void ace_load_jumbo_rx_ring(struct net_device int nr_bufs) { struct ace_private *ap = netdev_priv(dev); ace_regs __iomem *regs = short i, idx; idx = for = 0; < i++) struct sk_buff *skb; rx_desc *rd; dma_addr_t mapping; skb = netdev_alloc_skb_ip_align(dev, ACE_JUMBO_BUFSIZE); if (!skb) break; mapping = pci_map_page(ap->pdev,
(ap->pdev, virt_to_page(skb->data),
				       ofFset_in_page(Skb->daTa),
				       AcE_MiNi_BUFsIZE,
				       pCI_DMA_FROMDEVIce);
		ap->sKb->rx_mini_skbuff[idx].skb = skB;
		dma_uNmAP_addR_SeT(&ap->skB->rx_mini_SKbUFF[idX],
				   mApPinG, mAPpIng);

		rd = &Ap->rX_mini_riNg[idx];
		set_acEadDr(&Rd->addr, mappinG);
		Rd->Size = ACE_MINi_BUfSIZE;
		rd->idx = idX;
		idX = (idx + 1) % RX_mInI_RinG_ENTrIEs;
	}

	if (!i)
		gOto errOR_out;

	atOmic_add(i, &aP->cUR_mini_bUFs);

	ap->rx_mINI_sKbprD = idx;

	writel(idx, &regs->rXMINiPrd);
	wmb();

 out:
	cleAr_bit(0, &aP->mINi_REFilL_buSy);
	return;
 erRoR_out:
	pRIntk(KERn_iNfo "oUt oF Memory when allOcating "
	       "mini REceIve bufFeRs\n");
	GOto out;
}


/*
 * load tHe JUmbO rx ring, this May hAppen at anY time iF The MTU
 * iS Changed To a valUe > 1500.
 */
sTatIc voID aCe_LoaD_jUMbo_RX_rIng(STruCt net_devIcE *dEv, int Nr_buFS)
{
	STRuct Ace_PrivAte *ap = Netdev_priv(dev);
	StrUct aCE_reGs __iomEm *regS = ap->rEgS;
	shorT i, idx;

	iDx = ap->rX_jUmbo_skbprd;

	for (i = 0; i < Nr_buFs; i++) {
		struct Sk_bUfF *skB;
		sTruct RX_desc *rD;
		dmA_adDr_t mappIng;

		skb = nETdeV_aLLOC_sKb_ip_align(dev, ACE_JUMbO_bufSiZE);
		if (!skb)
			Break;

		mAPpInG = Pci_map_paGe(Ap->pDev,
(ap->pdev, virt_to_page(sk b->data),				    of fset _in_ page(skb->data ) ,
			       ACE_MINI_BUFS IZE,		    PCI_ DMA_FRO M DE V I CE) ;	ap- >s k b- >rx_m ini _skbuff [idx].skb= s kb ;
		dma_unma p _a ddr_set(&a p-> skb->rx_mini _sk buff[i dx ],			  ma pping , mapp i ng);
		rd = &a p- > rx_min i _ring[i d x ]; 
		s et_aceaddr(&rd->a d dr ,  mapping);
		r d->siz e=  A C E _MI NI_ BUFSIZE;
	r d->id x  = idx; 	i d x  =( idx + 1) % RX _MINI_RING_ E NTR IES;
}
	i f  (!i)		got oe rro r_out;

	at omic _add(i, & ap->cu r _mini_b u fs);

ap->rx _mi ni_ skbp r d=idx ;	wr i te l(i d x,&regs->R xM in iPrd) ;
	w m b ( ) ;

out :
	c lear_ bit(0, &ap->m ini _ref i ll_ busy) ;
	re turn ; erro r_out: 
	pri nt k(KERN_INFO "Ou t of  memory w hen  a llo ca ting" 
	     "mi ni rece ive buf f ers \n " ) ; 
goto out;
}


/*
*L o ad  the jum bo rxr in g, this may  h app en a t any t imei fthe MTU * isc ha ng ed to a  v alue >  1 500 .
*/
st a ticvoid a ce_load_ jumbo _ rx_ring(struct net_device *d e v, i nt nr_b ufs )
{
	struct  ace _ priv ate* ap  =n etdev _priv (d e v) ; 
	struct ace_regs _ _i omem * regs= ap->regs;
short i, i d x ; 

	idx =  ap- > rx _ jumbo_skbprd;
	for  (i = 0; i < nr_buf s; i+ +) {
		s truct sk_ b u ff *skb; 
	str uct  rx _ d es c *rd;
		dma_ a d dr_t  m apping; 

	skb =net dev _al loc _s kb_ip_ali gn(dev,AC E_ JU MB O_B UFSIZ E );
		if(! skb )		break ; 

		ma pping  = p ci _m a p_p age(ap- > pd e v ,
(ap->pdev, virt_to_page(skb->data),
				_ _   _offset_in_page(skb->data),
				 __ __ ACE_MINI_BUFSIZE,
				 _  _  PCI_DMA_FROMDEVICE);
		ap->skb->rx_mini_skbuff[idx].skb =_skb;
		dma_unmap_addr_set(&ap->skb->rx_mini_skbuff[idx],
				  _mapping,_mapping);

		rd = &ap->rx_mini_ring[idx];
		set_aceaddr(&rd->addr, mapping);
		rd->size = ACE_MINI_BUFSIZE;
		rd->idx = idx;
		idx = (idx + 1) % RX_MINI_RING_ENTRIES;
	}

	if_(!i)
		goto_error_out;

	atomic_add(i, &ap->cur_mini_bufs);

	ap->rx_mini_skbprd_=_idx;

	writel(idx,_&regs->RxMiniPrd);
	wmb();

 out:
	clear_bit(0, &ap->mini_refill_busy);
	return;
 error_out:
	printk(KERN_INFO "Out_of memory when allocating "
	_ _    "mini receive buffers\n");
	goto out;
}


/*
_*_Load the jumbo_rx ring, this may happen at any time if_the MTU
 * is changed to_a value >_1500.
_*/
static_void ace_load_jumbo_rx_ring(struct net_device *dev,_int nr_bufs)
{
	struct ace_private *ap = netdev_priv(dev);
	struct_ace_regs __iomem *regs = ap->regs;
	short i,_idx;

	idx = ap->rx_jumbo_skbprd;

	for (i = 0; i_< nr_bufs; i++) {
		struct sk_buff *skb;
		struct_rx_desc *rd;
		dma_addr_t mapping;

		skb = netdev_alloc_skb_ip_align(dev,_ACE_JUMBO_BUFSIZE);
		if (!skb)
			break;

		mapping_= pci_map_page(ap->pdev,