From 72512ac1ef405a7319c09c301777606b2c4b6621 Mon Sep 17 00:00:00 2001 From: Amos Kong Date: Thu, 30 Aug 2012 03:03:45 -0300 Subject: [RHEL6 qemu-kvm PATCH 2/6] e1000: flush queue whenever can_receive can go from false to true RH-Author: Amos Kong Message-id: <1346295825-510-3-git-send-email-akong@redhat.com> Patchwork-id: 41489 O-Subject: [RHEL-6.4 qemu-kvm PATCH 2/2] e1000: flush queue whenever can_receive can go from false to true Bugzilla: 852665 RH-Acked-by: Paolo Bonzini RH-Acked-by: Michael S. Tsirkin RH-Acked-by: Xiao Wang From: Paolo Bonzini When the guests replenish the receive ring buffer, the network device should flush its queue of pending packets. This is done with qemu_flush_queued_packets. e1000's can_receive can go from false to true when RCTL or RDT are modified. Reported-by: Luigi Rizzo Cc: Stefan Hajnoczi Cc: Jan Kiszka Signed-off-by: Paolo Bonzini --- hw/e1000.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) Signed-off-by: Eduardo Habkost --- hw/e1000.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/e1000.c b/hw/e1000.c index a992d57..0ccf13e 100644 --- a/hw/e1000.c +++ b/hw/e1000.c @@ -296,6 +296,7 @@ set_rx_control(E1000State *s, int index, uint32_t val) s->rxbuf_min_shift = ((val / E1000_RCTL_RDMTS_QUAT) & 3) + 1; DBGOUT(RX, "RCTL: %d, mac_reg[RCTL] = 0x%x\n", s->mac_reg[RDT], s->mac_reg[RCTL]); + qemu_flush_queued_packets(&s->nic->nc); } static void @@ -889,6 +890,9 @@ set_rdt(E1000State *s, int index, uint32_t val) { s->check_rxov = 0; s->mac_reg[index] = val & 0xffff; + if (e1000_has_rxbufs(s, 1)) { + qemu_flush_queued_packets(&s->nic->nc); + } } static void -- 1.7.11.4