[PATCH] net: cpsw: prevent stray cache writeback

Lucas Stach l.stach at pengutronix.de
Mon Mar 2 00:59:36 PST 2015


The cache should be invalidated when transfering ownership of a buffer
to the device. Otherwise the writeback of dirty cache lines can
corrupt the hardware written data.

Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
Tested-by: Jan Weitzel <j.weitzel at phytec.de>
---
Sascha, please apply this to master. It fixes a TFTP buffer corruption
issue reported by Jan.
---
 drivers/net/cpsw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
index 799fac89a2f3..301b8a9dfde5 100644
--- a/drivers/net/cpsw.c
+++ b/drivers/net/cpsw.c
@@ -888,6 +888,7 @@ static int cpsw_recv(struct eth_device *edev)
 	while (cpdma_process(priv, &priv->rx_chan, &buffer, &len) >= 0) {
 		dma_inv_range((ulong)buffer, (ulong)buffer + len);
 		net_receive(edev, buffer, len);
+		dma_inv_range((ulong)buffer, (ulong)buffer + len);
 		cpdma_submit(priv, &priv->rx_chan, buffer, PKTSIZE);
 	}
 
-- 
2.1.4




More information about the barebox mailing list