summaryrefslogtreecommitdiff
path: root/hw/net/dp8393x.c
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2015-07-15 18:19:12 +0800
committerStefan Hajnoczi <stefanha@redhat.com>2015-07-27 14:12:18 +0100
commit4594f93a732f1f5936c3a5225481586e24bffa9e (patch)
tree090bc45dedad1ddaeefa6e9e54a95024fab1449a /hw/net/dp8393x.c
parent1ef4a6069f8b4c09c3383cd4b8e27b6ff25b2d41 (diff)
downloadqemu-4594f93a732f1f5936c3a5225481586e24bffa9e.zip
dp8393x: Flush packets when link comes up
.can_receive callback changes semantics that once return 0, backend will try sending again until explicitly flushed, change the device to meet that. dp8393x_can_receive checks SONIC_CR_RXEN bit in SONIC_CR register and SONIC_ISR_RBE bit in SONIC_ISR register, try flushing the queue when either bit is being updated. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Jason Wang <jasowang@redhat.com> Message-id: 1436955553-22791-12-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'hw/net/dp8393x.c')
-rw-r--r--hw/net/dp8393x.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c
index cd889bce86..451ff72e50 100644
--- a/hw/net/dp8393x.c
+++ b/hw/net/dp8393x.c
@@ -327,9 +327,14 @@ static void dp8393x_do_stop_timer(dp8393xState *s)
dp8393x_update_wt_regs(s);
}
+static int dp8393x_can_receive(NetClientState *nc);
+
static void dp8393x_do_receiver_enable(dp8393xState *s)
{
s->regs[SONIC_CR] &= ~SONIC_CR_RXDIS;
+ if (dp8393x_can_receive(s->nic->ncs)) {
+ qemu_flush_queued_packets(qemu_get_queue(s->nic));
+ }
}
static void dp8393x_do_receiver_disable(dp8393xState *s)
@@ -569,6 +574,9 @@ static void dp8393x_write(void *opaque, hwaddr addr, uint64_t data,
dp8393x_do_read_rra(s);
}
dp8393x_update_irq(s);
+ if (dp8393x_can_receive(s->nic->ncs)) {
+ qemu_flush_queued_packets(qemu_get_queue(s->nic));
+ }
break;
/* Ignore least significant bit */
case SONIC_RSA: