* [PATCH v6 3/4] net: moxa: synchronize DMA memory
@ 2014-08-25 14:22 Jonas Jensen
2014-08-26 0:26 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Jonas Jensen @ 2014-08-25 14:22 UTC (permalink / raw)
To: linux-arm-kernel
DMA memory should be synchronized before data is passed
to/from controller.
Add dma_sync_single_for_cpu(.., DMA_FROM_DEVICE) to RX path
and dma_sync_single_for_device(.., DMA_TO_DEVICE) to TX path.
Signed-off-by: Jonas Jensen <jonas.jensen@gmail.com>
---
Notes:
Applies to next-20140825
drivers/net/ethernet/moxa/moxart_ether.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c
index d66058d..983d019 100644
--- a/drivers/net/ethernet/moxa/moxart_ether.c
+++ b/drivers/net/ethernet/moxa/moxart_ether.c
@@ -226,6 +226,9 @@ static int moxart_rx_poll(struct napi_struct *napi, int budget)
if (len > RX_BUF_SIZE)
len = RX_BUF_SIZE;
+ dma_sync_single_for_cpu(&ndev->dev,
+ priv->rx_mapping[rx_head],
+ priv->rx_buf_size, DMA_FROM_DEVICE);
skb = netdev_alloc_skb_ip_align(ndev, len);
if (unlikely(!skb)) {
@@ -348,6 +351,9 @@ static int moxart_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
len = ETH_ZLEN;
}
+ dma_sync_single_for_device(&ndev->dev, priv->tx_mapping[tx_head],
+ priv->tx_buf_size, DMA_TO_DEVICE);
+
txdes1 = TX_DESC1_LTS | TX_DESC1_FTS | (len & TX_DESC1_BUF_SIZE_MASK);
if (tx_head == TX_DESC_NUM_MASK)
txdes1 |= TX_DESC1_END;
--
1.8.2.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH v6 3/4] net: moxa: synchronize DMA memory
2014-08-25 14:22 [PATCH v6 3/4] net: moxa: synchronize DMA memory Jonas Jensen
@ 2014-08-26 0:26 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-08-26 0:26 UTC (permalink / raw)
To: linux-arm-kernel
From: Jonas Jensen <jonas.jensen@gmail.com>
Date: Mon, 25 Aug 2014 16:22:32 +0200
> DMA memory should be synchronized before data is passed
> to/from controller.
>
> Add dma_sync_single_for_cpu(.., DMA_FROM_DEVICE) to RX path
> and dma_sync_single_for_device(.., DMA_TO_DEVICE) to TX path.
>
> Signed-off-by: Jonas Jensen <jonas.jensen@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-08-26 0:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-25 14:22 [PATCH v6 3/4] net: moxa: synchronize DMA memory Jonas Jensen
2014-08-26 0:26 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).