Skip to content

esp-emac 0.4.1 — disable HW checksum offload (TX+RX) on ESP32 rev v3.1

Choose a tag to compare

@adeepn adeepn released this 20 May 08:14
· 6 commits to main since this release

Patch release — disable broken Synopsys GMAC checksum offload in both
directions on ESP32 rev v3.1.

The v0.3.0 release relied on the hardware checksum engine (TDES0.CIC = 0b11
for TX insertion, GMACCONFIG.IPC = 1 for RX verification) and told
smoltcp to skip software computation. Both sides turn out to be unreliable
on at least rev v3.1 silicon:

  • TX: only the first 60-byte iperf2 control header reaches the peer
    intact; every bulk segment that follows carries a wrong TCP/UDP checksum
    and is dropped by the receiver, so the connection collapses after ~15 s.
  • RX: GMACCONFIG.IPC = 1 symmetrically marks incoming valid TCP/UDP
    frames as checksum-errored, which the DMA then silently drops at
    DMAOPERATION.DT = 0 before they reach the CPU descriptor ring.
    Empirical signature: iperf2 downlink throughput collapsing to 0 Mbps
    while uplink still passes data through at a reduced rate.

Both bits are now 0. Driver::capabilities() advertises
ChecksumCapabilities::default(), so smoltcp computes and verifies
IPv4/TCP/UDP/ICMP checksums in software in both directions. A few extra
cycles per frame in exchange for correct frames.

Verified

iperf2 -s against the production server (Linux, iperf 2.1.9) on a
LAN8720A RMII board:

[iperf] done: UP=13 Mbps (16 MB) DN=10 Mbps (11 MB)

i.e. equivalent to the v0.3.0 baseline measured under HW-offload but
now reliable end to end.

Other fixes in this release

  • Layout invariants for TxDescriptor covered by const_assert! +
    offset_of! checks (back-port from rebased descriptor work).
  • Acquire / Release memory fences around DMA descriptor ownership
    flips in dma::engine.
  • current_speed / current_duplex cached fields with idempotency
    guards in Emac::set_link_*.
  • Conditional Checksum import (test-only) — removes a clippy unused-
    import warning under --lib.

Compatibility

No API breaks vs 0.4.0. Drop-in replacement.

Not yet on crates.io

Per the eth-crate publication gate (eth-mdio-phy + eth-phy-lan87xx +
eth-phy-lan867x + esp-emac ship together after a coordinated
review), this tag is git-only. Use a submodule / git dependency until
the bundle is published.

Full changelog: https://github.com/jethub-iot/esp-emac-rs/blob/v0.4.1/CHANGELOG.md