if (bp->flags & B44_FLAG_RX_RING_HACK) b44_sync_dma_desc_for_device(bp->pdev, bp->rx_ring_dma, dest_idx * sizeof(dp), DMA_BIDIRECTIONAL);  
static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked){	struct dma_desc *dp;	struct ring_info *src_map, *map;	struct rx_header *rh;	struct sk_buff *skb;	dma_addr_t mapping;	int dest_idx;	u32 ctrl;	src_map = NULL;	if (src_idx >= 0)		src_map = &bp->rx_buffers[src_idx];	dest_idx = dest_idx_unmasked & (B44_RX_RING_SIZE - 1);	map = &bp->rx_buffers[dest_idx];	skb = dev_alloc_skb(RX_PKT_BUF_SZ);	if (skb == NULL)		return -ENOMEM;	mapping = pci_map_single(bp->pdev, skb->data,				 RX_PKT_BUF_SZ,				 PCI_DMA_FROMDEVICE);	/* Hardware bug work-around, the chip is unable to do PCI DMA	   to/from anything above 1GB :-( */	if(mapping+RX_PKT_BUF_SZ > B44_DMA_MASK) {		/* Sigh... */		pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE);		dev_kfree_skb_any(skb);		skb = __dev_alloc_skb(RX_PKT_BUF_SZ,GFP_DMA);		if (skb == NULL)			return -ENOMEM;		mapping = pci_map_single(bp->pdev, skb->data,					 RX_PKT_BUF_SZ,					 PCI_DMA_FROMDEVICE);		if(mapping+RX_PKT_BUF_SZ > B44_DMA_MASK) {			pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE);			dev_kfree_skb_any(skb);			return -ENOMEM;		}	}	skb->dev = bp->dev;	skb_reserve(skb, bp->rx_offset);	rh = (struct rx_header *)		(skb->data - bp->rx_offset);	rh->len = 0;	rh->flags = 0;	map->skb = skb;	pci_unmap_addr_set(map, mapping, mapping);	if (src_map != NULL)		src_map->skb = NULL;	ctrl  = (DESC_CTRL_LEN & (RX_PKT_BUF_SZ - bp->rx_offset));	if (dest_idx == (B44_RX_RING_SIZE - 1))		ctrl |= DESC_CTRL_EOT;	dp = &bp->rx_ring[dest_idx];	dp->ctrl = cpu_to_le32(ctrl);	dp->addr = cpu_to_le32((u32) mapping + bp->rx_offset + bp->dma_offset);	return RX_PKT_BUF_SZ;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/9f38c636ababfb41e58c9ec1e9719492ef7f0479/b44.c/buggy/drivers/net/b44.c