if (bp->flags & B44_FLAG_TX_RING_HACK) b44_sync_dma_desc_for_device(bp->pdev, bp->tx_ring_dma, entry * sizeof(bp->tx_ring[0]), DMA_TO_DEVICE);  
static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev){	struct b44 *bp = netdev_priv(dev);	struct sk_buff *bounce_skb;	dma_addr_t mapping;	u32 len, entry, ctrl;	len = skb->len;	spin_lock_irq(&bp->lock);	/* This is a hard error, log it. */	if (unlikely(TX_BUFFS_AVAIL(bp) < 1)) {		netif_stop_queue(dev);		spin_unlock_irq(&bp->lock);		printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n",		       dev->name);		return 1;	}	mapping = pci_map_single(bp->pdev, skb->data, len, PCI_DMA_TODEVICE);	if(mapping+len > B44_DMA_MASK) {		/* Chip can't handle DMA to/from >1GB, use bounce buffer */		pci_unmap_single(bp->pdev, mapping, len, PCI_DMA_TODEVICE);		bounce_skb = __dev_alloc_skb(TX_PKT_BUF_SZ,					     GFP_ATOMIC|GFP_DMA);		if (!bounce_skb)			return NETDEV_TX_BUSY;		mapping = pci_map_single(bp->pdev, bounce_skb->data,					 len, PCI_DMA_TODEVICE);		if(mapping+len > B44_DMA_MASK) {			pci_unmap_single(bp->pdev, mapping,					 len, PCI_DMA_TODEVICE);			dev_kfree_skb_any(bounce_skb);			return NETDEV_TX_BUSY;		}		memcpy(skb_put(bounce_skb, len), skb->data, skb->len);		dev_kfree_skb_any(skb);		skb = bounce_skb;	}	entry = bp->tx_prod;	bp->tx_buffers[entry].skb = skb;	pci_unmap_addr_set(&bp->tx_buffers[entry], mapping, mapping);	ctrl  = (len & DESC_CTRL_LEN);	ctrl |= DESC_CTRL_IOC | DESC_CTRL_SOF | DESC_CTRL_EOF;	if (entry == (B44_TX_RING_SIZE - 1))		ctrl |= DESC_CTRL_EOT;	bp->tx_ring[entry].ctrl = cpu_to_le32(ctrl);	bp->tx_ring[entry].addr = cpu_to_le32((u32) mapping+bp->dma_offset);	entry = NEXT_TX(entry);	bp->tx_prod = entry;	wmb();	bw32(bp, B44_DMATX_PTR, entry * sizeof(struct dma_desc));	if (bp->flags & B44_FLAG_BUGGY_TXPTR)		bw32(bp, B44_DMATX_PTR, entry * sizeof(struct dma_desc));	if (bp->flags & B44_FLAG_REORDER_BUG)		br32(bp, B44_DMATX_PTR);	if (TX_BUFFS_AVAIL(bp) < 1)		netif_stop_queue(dev);	spin_unlock_irq(&bp->lock);	dev->trans_start = jiffies;	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/9f38c636ababfb41e58c9ec1e9719492ef7f0479/b44.c/buggy/drivers/net/b44.c