public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] zynq-gem: Flush cache before handing RX packet to receive handler
@ 2018-12-13 10:18 Stefan Theil
  2018-12-13 13:12 ` Bin Meng
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Stefan Theil @ 2018-12-13 10:18 UTC (permalink / raw)
  To: u-boot

The cache was only flushed before *transmitting* packets, but not
when receiving them, leading to an issue where new packets were
handed to the receive handler with old contents in cache. This
only happens when a lot of packets are received without sending
packages every now and then.

Signed-off-by: Stefan Theil <stefan.theil@mixed-mode.de>
---
 drivers/net/zynq_gem.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index 9bd79b198a..5825b6dd99 100644
--- a/drivers/net/zynq_gem.c
+++ b/drivers/net/zynq_gem.c
@@ -621,6 +621,9 @@ static int zynq_gem_recv(struct udevice *dev, int flags, uchar **packetp)
 
 	*packetp = (uchar *)(uintptr_t)addr;
 
+	flush_dcache_range(addr, addr + roundup(PKTSIZE_ALIGN, ARCH_DMA_MINALIGN));
+	barrier();
+
 	return frame_len;
 }
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-12-20  8:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-13 10:18 [U-Boot] [PATCH] zynq-gem: Flush cache before handing RX packet to receive handler Stefan Theil
2018-12-13 13:12 ` Bin Meng
2018-12-17  7:49 ` [U-Boot] [PATCH v4] zynq-gem: Use appropriate cache flush/invalidate for RX and TX Stefan Theil
2018-12-17  7:52   ` Bin Meng
2018-12-17  7:57     ` Stefan Theil
2018-12-17  8:05       ` Bin Meng
2018-12-17  8:08         ` Stefan Theil
2018-12-17  8:12 ` [U-Boot] [PATCH v5] " Stefan Theil
2018-12-17  8:25   ` Bin Meng
2018-12-20  8:52   ` Michal Simek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox