Based-on: <[email protected]>

Two fixes for the BCM2838 GENET model of "[PATCH v6 00/17]
hw/arm/raspi4b: working PCIe and GENET (real networking)", which is in
target-arm.next. They apply to target-arm.next; if that is simpler,
they can also be folded into patch 12/17 (implement GENET TX path) and
patch 13/17 (implement GENET RX path) of that series.

- The TX consumer index counted past 16 bits, so the first transmit
  across the wrap never ended: the device sent the ring's descriptors
  forever with the BQL held, and the guest and the monitor hung. A
  guest sending a sustained stream hung after about 65k descriptors.
- The RX path wrote frames past the consumer index of a full ring and
  overwrote frames the guest had not read. The fix keeps them queued
  in the net layer until the guest frees descriptors, as e1000 does;
  real GENET drops them and counts them in DISCARD_CNT.

Patch 1 adds tests/qtest/bcm2838-genet-test.c. Each test fails with
only its fix reverted (the TX test hangs).

I found these bugs while running Raspberry Pi OS images on a model of
the Compute Module 4: https://github.com/LorandMarton/boardtwin. Its
QEMU changes are on the boardtwin-develop branch of
https://github.com/LorandMarton/qemu. I intend to send the board model
(raspicm4) after the 11.2 release.

Checked: each patch builds and passes the test; the aarch64 qtests
pass (33, 3 skipped: the slow cdrom test and the two swtpm tests).

Lorand Marton (2):
  hw/net/bcm2838_genet: wrap the TX consumer index at 16 bits
  hw/net/bcm2838_genet: hold RX frames while the ring is full

 hw/net/bcm2838_genet.c           |  42 ++++++-
 tests/qtest/bcm2838-genet-test.c | 204 +++++++++++++++++++++++++++++++
 tests/qtest/meson.build          |   2 +
 3 files changed, 247 insertions(+), 1 deletion(-)
 create mode 100644 tests/qtest/bcm2838-genet-test.c


base-commit: eb5ac4b5bb4e221771cef0c53004f99499133f3e
-- 
2.56.0


Reply via email to