Re: skb_pull()

From: Rask Ingemann Lambertsen (rask@sygehus.dk)
Date: Wed May 21 2003 - 12:56:44 EST


On Wed, 21 May 2003 18:45:53 +0100, Rask Ingemann Lambertsen wrote
> All of the above assumed that you use PIO transfers. With a DMA
> device, you'll need to manage the pointers yourself on the receive
> side when dealing with the chunks. Something like:
>
> skb = dev_alloc_skb (4K + alignment);
> skb_reserve (skb, alignment);
> dma_pointer = pci_map_single (pdev, skb->head, 4K, PCI_DMA_FROMDEVICE);
> /* await completion of DMA */
> skb_put (skb, length_of_whole_packet);
> pci_unmap_single (pdev, dma_pointer, skb->head, 4K, PCI_DMA_FROMDEVICE);

Second try, hopefully correct this time:

skb = dev_alloc_skb (4K + alignment);
skb_reserve (skb, alignment);
dma_pointer = pci_map_single (pdev, skb->tail, 4K, PCI_DMA_FROMDEVICE);
/* await completion of DMA */
pci_unmap_single (pdev, dma_pointer, 4K, PCI_DMA_FROMDEVICE);
skb_put (skb, length_of_whole_packet);

(Note: skb->tail instead of skb->head!)

-- 
Regards,
Rask Ingemann Lambertsen

- To unsubscribe from this list: send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html



This archive was generated by hypermail 2b29 : Fri May 23 2003 - 22:00:03 EST