Skip to content

hw/net/bcm2838_genet: TX index wrap and full RX ring

Lorand Marton qemu-arm qemu-devel 1 version Applied

Status from this message: Applied to target-arm.next, thanks.

Get series with b4
b4 am cover.1793613972.genet-ring-fixes-v1.git.lorandmarton.dev@gmail.com

Versions newest first

  1. v1 Latest2 patches 4 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/2hw/net/bcm2838_genet: wrap the TX consumer index at 16 bitshw/net/bcm2838_genet.c tests/qtest/bcm2838-genet-test.c tests/qtest/meson.build+106 -11 reply
2/2hw/net/bcm2838_genet: hold RX frames while the ring is fullhw/net/bcm2838_genet.c tests/qtest/bcm2838-genet-test.c+143 -21 reply

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchMarcelo Manzo
1/2R-b T-b
2/2T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] hw/net/bcm2838_genet: TX index wrap and full RX ring

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

Signature · 1 line
2.56.0