Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a6b25da5 authored by Niklas Cassel's avatar Niklas Cassel Committed by David S. Miller
Browse files

net: stmmac: ensure that the device has released ownership before reading data



According to Documentation/memory-barriers.txt, we need to use a
dma_rmb() after reading the status/own bit, to ensure that all
descriptor fields are read after reading the own bit.

This way, we ensure that the DMA engine is done with the DMA
descriptor before we read the other descriptor fields, e.g. reading
the tx hardware timestamp (if PTP is enabled).

Signed-off-by: default avatarNiklas Cassel <niklas.cassel@axis.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 95eb930a
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1844,6 +1844,11 @@ static void stmmac_tx_clean(struct stmmac_priv *priv, u32 queue)
		if (unlikely(status & tx_dma_own))
			break;

		/* Make sure descriptor fields are read after reading
		 * the own bit.
		 */
		dma_rmb();

		/* Just consider the last segment and ...*/
		if (likely(!(status & tx_not_ls))) {
			/* ... verify the status error condition */