On Thu, Nov 10, 2022 at 07:31:34PM +0200, Yaron Micher wrote:

> The rx descriptor list is in cached memory, and there may be multiple
> descriptors per cache-line. After reclaim_rx_buffers marks a descriptor
> as unused it does a cache flush, which causes the entire cache-line to
> be written to memory, which may override other descriptors in the same
> cache-line that the controller may have written to.
> 
> The fix skips freeing descriptors that are not the last in a cache-line,
> and if the freed descriptor is the last one in a cache-line, it marks
> all the descriptors in the cache-line as unused.
> This is similarly to what is done in drivers/net/fec_mxc.c
> 
> In my case this bug caused tftpboot to fail some times when other
> packets are sent to u-boot in addition to the ongoing tftp (e.g. ping).
> The driver would stop receiving new packets because it is waiting
> on a descriptor that is marked unused, when in reality the descriptor
> contains a new unprocessed packet but while freeing the previous buffer
> descriptor & flushing the cache, the driver accidentally marked the
> descriptor as unused.
> 
> Signed-off-by: Yaron Micher <yar...@hailo.ai>

Applied to u-boot/master, thanks!

-- 
Tom

Attachment: signature.asc
Description: PGP signature

Reply via email to