dmabuf = pci_map_single(tp->pdev, skb->data, length, PCI_DMA_TODEVICE); 
dmabuf = dma_map_single(tp->pdev, skb->data, length, DMA_TO_DEVICE); 
static int tms380tr_hardware_send_packet(struct sk_buff *skb, struct net_device *dev){	TPL *tpl;	short length;	unsigned char *buf;	unsigned long flags;	int i;	dma_addr_t dmabuf, newbuf;	struct net_local *tp = netdev_priv(dev);   	/* Try to get a free TPL from the chain.	 *	 * NOTE: We *must* always leave one unused TPL in the chain,	 * because otherwise the adapter might send frames twice.	 */	spin_lock_irqsave(&tp->lock, flags);	if(tp->TplFree->NextTPLPtr->BusyFlag)  { /* No free TPL */		if (tms380tr_debug > 0)			printk(KERN_DEBUG "%s: No free TPL\n", dev->name);		spin_unlock_irqrestore(&tp->lock, flags);		return 1;	}	dmabuf = 0;	/* Is buffer reachable for Busmaster-DMA? */	length	= skb->len;	dmabuf = pci_map_single(tp->pdev, skb->data, length, PCI_DMA_TODEVICE);	if(tp->dmalimit && (dmabuf + length > tp->dmalimit)) {		/* Copy frame to local buffer */		pci_unmap_single(tp->pdev, dmabuf, length, PCI_DMA_TODEVICE);		dmabuf  = 0;		i 	= tp->TplFree->TPLIndex;		buf 	= tp->LocalTxBuffers[i];		memcpy(buf, skb->data, length);		newbuf 	= ((char *)buf - (char *)tp) + tp->dmabuffer;	}	else {		/* Send direct from skb->data */		newbuf	= dmabuf;		buf	= skb->data;	}	/* Source address in packet? */	tms380tr_chk_src_addr(buf, dev->dev_addr);	tp->LastSendTime	= jiffies;	tpl 			= tp->TplFree;	/* Get the "free" TPL */	tpl->BusyFlag 		= 1;		/* Mark TPL as busy */	tp->TplFree 		= tpl->NextTPLPtr;    	/* Save the skb for delayed return of skb to system */	tpl->Skb = skb;	tpl->DMABuff = dmabuf;	tpl->FragList[0].DataCount = cpu_to_be16((unsigned short)length);	tpl->FragList[0].DataAddr  = htonl(newbuf);	/* Write the data length in the transmit list. */	tpl->FrameSize 	= cpu_to_be16((unsigned short)length);	tpl->MData 	= buf;	/* Transmit the frame and set the status values. */	tms380tr_write_tpl_status(tpl, TX_VALID | TX_START_FRAME				| TX_END_FRAME | TX_PASS_SRC_ADDR				| TX_FRAME_IRQ);	/* Let adapter send the frame. */	tms380tr_exec_sifcmd(dev, CMD_TX_VALID);	spin_unlock_irqrestore(&tp->lock, flags);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/504ff16cecf2a788181eddc9d6e47d94ce50a9f6/tms380tr.c/clean/drivers/net/tokenring/tms380tr.c