From: Marek Vasut Date: Thu, 19 Dec 2024 10:52:46 +0000 (+0100) Subject: net: rswitch: Add missing cache invalidate of TX descriptor X-Git-Url: http://git.dujemihanovic.xyz/%22/icons/right.gif/static/git-favicon.png?a=commitdiff_plain;h=fa0f9e83a0654360506321e38c6d92888cb6f7ff;p=u-boot.git net: rswitch: Add missing cache invalidate of TX descriptor TFTP transfers of large files, for example 128 MiB, can sporadically get stuck and the transfer slows down considerably. This happens because the TX DMA descriptor in DRAM becomes out of sync with the view of the TX DMA descriptor content from the CPU side, which is viewed through the CPU caches. In order to guarantee these two views are consistent, the cache over TX DMA descriptor that has possibly been written by the rswitch hardware must first be invalidated, only then can the descriptor be cleared and updated by the CPU, and finally the cache over that area must be flushed back into DRAM to make sure the rswitch hardware has consistent view of the updated descriptor content. The very first invalidation operation was missing, which led to sporadic corruption of the TX DMA descriptor. Fix it, add the missing invalidation operation. Reported-by: Enric Balletbo i Serra Signed-off-by: Marek Vasut Tested-by: Enric Balletbo i Serra --- diff --git a/drivers/net/rswitch.c b/drivers/net/rswitch.c index 8e1b6e2f6f..97b5d1b75c 100644 --- a/drivers/net/rswitch.c +++ b/drivers/net/rswitch.c @@ -837,6 +837,7 @@ static int rswitch_send(struct udevice *dev, void *packet, int len) /* Update TX descriptor */ rswitch_flush_dcache((uintptr_t)packet, len); + rswitch_invalidate_dcache((uintptr_t)desc, sizeof(*desc)); memset(desc, 0x0, sizeof(*desc)); desc->die_dt = DT_FSINGLE; desc->info_ds = len;