@samitouri / QOSamiQemu / commits / a7f27d6903

hw/net/allwinner-sun8i-emac: Flush queued packets when rx is enabled

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>

宋文武 committed May 5, 2026 at 09:25 UTC a7f27d6903b30bcea21c46986cb7507edcbc970c
1 file changed +3
hw/net/allwinner-sun8i-emac.c
+3
@@ -727,6 +727,9 @@ static void allwinner_sun8i_emac_write(void *opaque, hwaddr offset,
727 break;
728 case REG_RX_CTL_0: /* Receive Control 0 */
729 s->rx_ctl0 = value;
730 + if (allwinner_sun8i_emac_can_receive(nc)) {
731 + qemu_flush_queued_packets(nc);
732 + }
733 break;
734 case REG_RX_CTL_1: /* Receive Control 1 */
735 s->rx_ctl1 = value | RX_CTL1_RX_MD;