shithub: front

Download patch

ref: fc859af624883111ad21311d50dd5ebfaad3b741
parent: 3598b7cf366368f25dcd9036bf8d36040a5e9e17
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Jul 21 13:35:18 EDT 2024

etherimx: fix missing barrier for doorbell (thanks sigrid)

the symptom is that ping is apparently skipping
transmits which recover with the next send,
resulting in exactly send-period spikes in
the ping rtt.

It appears that the core seems to reorder writes
to uncached memory, which can result in the doorbell
being written before the descriptor status bits
are written.

put a coherence() barrier before writing doorbell
fixes it.

thanks sigrid for reporting the issue!

--- a/sys/src/9/imx8/etherimx.c
+++ b/sys/src/9/imx8/etherimx.c
@@ -362,6 +362,7 @@
 			d->status = BLEN(b) | TD_OWN | TD_R | TD_L | TD_TC;
 			i++;
 		}
+		coherence();
 		wr(ctlr, ENET_TDAR, TDAR_ACTIVE);
 	}
 }
@@ -453,6 +454,7 @@
 			d->status = RD_E;
 			i++;
 		}
+		coherence();
 		wr(ctlr, ENET_RDAR, RDAR_ACTIVE);
 	}
 }
--