]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
hw/net/allwinner-sun8i-emac: Flush queued packets when rx is enabled
author宋文武 <iyzsong@member.fsf.org>
Tue, 5 May 2026 08:25:21 +0000 (09:25 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 5 May 2026 08:25:21 +0000 (09:25 +0100)
The RX_CTL_0 register includes the RX_EN receive-enable bit,
which allwinner_sun8i_emac_can_receive() checks. That means that
if the guest sets it we need to call qemu_flush_queued_packets()
as we might now be able to handle them.

This fixes a bug where networking didn't work in u-boot on the
orangepi-pc machine.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3459
Signed-off-by: 宋文武 <iyzsong@member.fsf.org>
Message-id: 20260430040753.3337-1-iyzsong@envs.net
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
[PMM: expanded commit message, removed unneeded RX_EN test]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/net/allwinner-sun8i-emac.c

index 9b7c67ae8e4798b11ad0918b85e9767964427630..8ddaa6101ff623828d2fc0af0b6310e2e1fdc437 100644 (file)
@@ -727,6 +727,9 @@ static void allwinner_sun8i_emac_write(void *opaque, hwaddr offset,
         break;
     case REG_RX_CTL_0:          /* Receive Control 0 */
         s->rx_ctl0 = value;
+        if (allwinner_sun8i_emac_can_receive(nc)) {
+            qemu_flush_queued_packets(nc);
+        }
         break;
     case REG_RX_CTL_1:          /* Receive Control 1 */
         s->rx_ctl1 = value | RX_CTL1_RX_MD;