[U-Boot] [PATCH] zynq-gem: Flush cache before handing RX packet to receive handler

Bin Meng bmeng.cn at gmail.com
Thu Dec 13 13:12:34 UTC 2018


On Thu, Dec 13, 2018 at 6:18 PM Stefan Theil <stefan.theil at mixed-mode.de> wrote:
>
> 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 at 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));

Shouldn't it be invalidate_dcache_range()?

> +       barrier();
> +
>         return frame_len;
>  }
>

Regards,
Bin


More information about the U-Boot mailing list