Files
RedBear-OS/drivers/net/rtl8139d
Red Bear OS c71e518391 rtl8139d: DMA barriers on CAPR doorbell and TSD doorbell
Apply the same release/acquire fence pattern as e1000d and
rtl8168d:

- acquire fence before reading the RX status / length / data
  bytes, so the compiler does not reorder the buffer reads
  past the rxsts observation on weakly-ordered architectures.
- release fence before the CAPR write (RX doorbell) so the
  device sees the buffer reads before the doorbell signals
  the consumer is done with the ring.
- release fence before the TSD write (TX doorbell) so the
  device sees the buffer writes before claiming ownership of
  the descriptor.

The 8139 is a legacy 100 Mb/s chip with a 64 KB ring rather
than a 16-entry descriptor table, but the same hand-off
semantics apply: ownership bit is cleared on read, set on
write, and the device accesses buffer memory after the doorbell.
The fences are the same compiler-level ordering the Linux
8139too driver places around its MMIO writes; the 8139 chip
itself does not need anything more.
2026-07-26 20:19:29 +09:00
..