Mika Westerberg f1c089e319 net: ep93xx_eth: fix DMA API violations
Russell King said:
>
> So, to summarize what its doing:
>
> 1. It allocates buffers for rx and tx.
> 2. It maps them with dma_map_single().
>       This transfers ownership of the buffer to the DMA device.
> 3. In ep93xx_xmit,
> 3a. It copies the data into the buffer with skb_copy_and_csum_dev()
>       This violates the DMA buffer ownership rules - the CPU should
>       not be writing to this buffer while it is (in principle) owned
>       by the DMA device.
> 3b. It then calls dma_sync_single_for_cpu() for the buffer.
>       This transfers ownership of the buffer to the CPU, which surely
>       is the wrong direction.
> 4. In ep93xx_rx,
> 4a. It calls dma_sync_single_for_cpu() for the buffer.
>       This at least transfers the DMA buffer ownership to the CPU
>       before the CPU reads the buffer
> 4b. It then uses skb_copy_to_linear_data() to copy the data out.
>       At no point does it transfer ownership back to the DMA device.
> 5. When the driver is removed, it dma_unmap_single()'s the buffer.
>       This transfers ownership of the buffer to the CPU.
> 6. It frees the buffer.
>
> While it may work on ep93xx, it's not respecting the DMA API rules,
> and with DMA debugging enabled it will probably encounter quite a few
> warnings.

This patch fixes these violations.

Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Tested-by: Petr Stetiar <ynezz@true.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-06-11 16:25:16 -07:00
..
2011-03-05 10:55:57 +01:00
2011-06-07 14:22:57 -07:00
2011-05-27 20:06:53 -07:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-05-31 19:28:32 -07:00
2011-03-31 11:26:23 -03:00
2010-12-21 02:16:08 -08:00
2010-12-21 02:16:08 -08:00
2011-05-31 19:28:32 -07:00
2010-11-09 09:17:56 -08:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-04-10 18:55:19 -07:00
2010-11-09 09:17:56 -08:00
2010-07-11 18:15:08 -07:00
2011-03-31 11:26:23 -03:00
2010-08-24 12:24:07 -07:00
2010-09-26 18:34:29 -07:00
2011-04-10 18:55:21 -07:00
2011-03-31 11:26:23 -03:00
2010-12-23 11:44:34 -08:00
2010-07-14 13:40:36 -07:00
2010-09-26 18:34:29 -07:00
2010-09-26 18:34:29 -07:00
2011-05-31 19:28:32 -07:00
2011-05-07 03:08:38 -07:00
2010-12-21 02:16:08 -08:00
2010-12-21 02:16:08 -08:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-06-09 00:12:57 -07:00
2011-06-09 00:12:57 -07:00
2011-04-17 17:47:36 -07:00
2011-04-17 17:47:36 -07:00
2011-05-07 22:31:35 -07:00
2011-05-31 19:28:32 -07:00
2011-03-31 11:26:23 -03:00
2010-12-21 02:16:08 -08:00
2011-05-31 19:28:32 -07:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-05-19 09:55:43 +01:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2010-11-09 09:17:56 -08:00
2011-03-31 11:26:23 -03:00
2010-11-09 09:17:56 -08:00
2011-03-31 11:26:23 -03:00
2010-09-26 18:34:29 -07:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-05-31 19:28:32 -07:00
2010-12-21 02:16:08 -08:00
2010-12-21 02:16:08 -08:00
2011-04-06 14:35:23 -07:00
2011-03-31 11:26:23 -03:00
2010-09-15 22:06:05 -07:00
2011-03-31 11:26:23 -03:00
2010-09-21 18:04:47 -07:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2010-07-15 20:46:22 -07:00
2011-04-26 10:22:59 +02:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-04-12 14:50:42 -07:00
2010-10-24 16:25:39 -07:00
2011-06-05 17:02:51 -07:00
2011-03-31 11:26:23 -03:00
2011-05-31 19:28:32 -07:00
2010-12-21 02:16:08 -08:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-06-03 00:01:30 -07:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-05-30 11:14:16 +09:30
2010-12-21 02:16:08 -08:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00