dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0187-e1000-flush-queue-whenever-can_receive-can-go-from-f.patch

5544c1
From a71b6050a88402c3f388b8f13afed51e6ba6f41a Mon Sep 17 00:00:00 2001
5544c1
From: Paolo Bonzini <pbonzini@redhat.com>
5544c1
Date: Thu, 9 Aug 2012 16:45:56 +0200
5544c1
Subject: [PATCH] e1000: flush queue whenever can_receive can go from false to
5544c1
 true
5544c1
5544c1
When the guests replenish the receive ring buffer, the network device
5544c1
should flush its queue of pending packets.  This is done with
5544c1
qemu_flush_queued_packets.
5544c1
5544c1
e1000's can_receive can go from false to true when RCTL or RDT are
5544c1
modified.
5544c1
5544c1
Reported-by: Luigi Rizzo <rizzo@iet.unipi.it>
5544c1
Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
5544c1
Cc: Jan Kiszka <jan.kiszka@siemens.de>
5544c1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5544c1
Reviewed-by: Amos Kong <akong@redhat.com>
5544c1
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
5544c1
(cherry picked from commit e8b4c680b41bd960ecccd9ff076b7b058e0afcd4)
5544c1
5544c1
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5544c1
---
5544c1
 hw/e1000.c | 4 ++++
5544c1
 1 file changed, 4 insertions(+)
5544c1
5544c1
diff --git a/hw/e1000.c b/hw/e1000.c
5544c1
index ae8a6c5..ec3a7c4 100644
5544c1
--- a/hw/e1000.c
5544c1
+++ b/hw/e1000.c
5544c1
@@ -295,6 +295,7 @@ set_rx_control(E1000State *s, int index, uint32_t val)
5544c1
     s->rxbuf_min_shift = ((val / E1000_RCTL_RDMTS_QUAT) & 3) + 1;
5544c1
     DBGOUT(RX, "RCTL: %d, mac_reg[RCTL] = 0x%x\n", s->mac_reg[RDT],
5544c1
            s->mac_reg[RCTL]);
5544c1
+    qemu_flush_queued_packets(&s->nic->nc);
5544c1
 }
5544c1
 
5544c1
 static void
5544c1
@@ -926,6 +927,9 @@ set_rdt(E1000State *s, int index, uint32_t val)
5544c1
 {
5544c1
     s->check_rxov = 0;
5544c1
     s->mac_reg[index] = val & 0xffff;
5544c1
+    if (e1000_has_rxbufs(s, 1)) {
5544c1
+        qemu_flush_queued_packets(&s->nic->nc);
5544c1
+    }
5544c1
 }
5544c1
 
5544c1
 static void
5544c1
-- 
5544c1
1.7.12.1
5544c1