[lkml]   [2004]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [Patch] dma_sync_to_device
On Feb 10 2004, at 18:31, Martin Diehl was caught saying:
> --- linux-2.6.0-test8/Documentation/DMA-mapping.txt Wed Oct 8 21:24:06 2003
> +++ v2.6.0-test8-md/Documentation/DMA-mapping.txt Tue Oct 21 11:27:17 2003
> @@ -543,8 +543,11 @@
> all bus addresses.
> If you need to use the same streaming DMA region multiple times and touch
> -the data in between the DMA transfers, just map it with
> -pci_map_{single,sg}, and after each DMA transfer call either:
> +the data in between the DMA transfers, the buffer needs to be synced
> +depending on the transfer direction.
> +
> +When reading from the device, just map it with pci_map_{single,sg},
> +and after each DMA transfer call either:
> pci_dma_sync_single(dev, dma_handle, size, direction);
> @@ -553,6 +556,20 @@
> pci_dma_sync_sg(dev, sglist, nents, direction);
> as appropriate.
> +
> +When writing to the mapped the buffer, prepare the data and
> +then before giving the buffer to the hardware call either:
> +
> + pci_dma_sync_to_device_single(dev, dma_handle, size, direction);
> +
> +or:
> +
> + pci_dma_sync_to_device_sg(dev, sglist, nents, direction);

Maybe I am missunderstanding something, but how is this
any different than simply doing:

pci_dma_sync_single(dev, dma_handle, size, DMA_TO_DEVICE);

My understanding of the API is that I can map a buffer
as DMA_BIDIRECTIONAL and then specify the direction. An
existing working example is in the eepro100 driver
in speedo_init_rx_ring():

sp->rx_ring_dma[i] = pci_map_single(sp->pdev, rxf,

later in the same function:

pci_dma_sync_single(sp->pdev, sp->rx_ring_dma[i],
sizeof(struct RxFD), PCI_DMA_TODEVICE);

If this is not allowed, then the docs and this driver
(along with any others using it) need to be updated.
If this acceptable, why add an existing function to
achieve the same goal?


Deepak Saxena - dsaxena at plexity dot net -
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 14:00    [W:0.101 / U:2.884 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site