diff options
author | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2019-06-30 18:21:50 +0100 |
---|---|---|
committer | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2019-07-02 22:49:08 +0100 |
commit | 1058e1a377680e17bc8b56d5e9cab9559d47a3c1 (patch) | |
tree | 8dc7f40be2ac22d4fdc58f69260db52dcd93b72d /hw/net/sunhme.c | |
parent | 076489c043a22fe9be8f3458fbc9012b1fc0606f (diff) |
sunhme: flush any queued packets when HME_MAC_RXCFG_ENABLE bit is raised
Some client drivers use this bit to pause and resume the driver so make sure
that queued packets are flushed when the MAC is disabled and then reactivated.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Diffstat (limited to 'hw/net/sunhme.c')
-rw-r--r-- | hw/net/sunhme.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/hw/net/sunhme.c b/hw/net/sunhme.c index e3a488ee1d..14e7effb88 100644 --- a/hw/net/sunhme.c +++ b/hw/net/sunhme.c @@ -373,10 +373,20 @@ static void sunhme_mac_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { SunHMEState *s = SUNHME(opaque); + uint64_t oldval = s->macregs[addr >> 2]; trace_sunhme_mac_write(addr, val); s->macregs[addr >> 2] = val; + + switch (addr) { + case HME_MACI_RXCFG: + if (!(oldval & HME_MAC_RXCFG_ENABLE) && + (val & HME_MAC_RXCFG_ENABLE)) { + qemu_flush_queued_packets(qemu_get_queue(s->nic)); + } + break; + } } static uint64_t sunhme_mac_read(void *opaque, hwaddr addr, |