diff mbox

pcnet: Flush queued packets on end of STOP state

Message ID 51FC0D02.6030107@web.de
State New
Headers show

Commit Message

Jan Kiszka Aug. 2, 2013, 7:48 p.m. UTC
From: Jan Kiszka <jan.kiszka@siemens.com>

Analogously to other NICs, we have to inform the network layer when
the can_receive handler will no longer report 0. Without this, we may
get stuck waiting on queued incoming packets.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 hw/net/pcnet.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Comments

Stefan Hajnoczi Aug. 5, 2013, 12:13 p.m. UTC | #1
On Fri, Aug 02, 2013 at 09:48:18PM +0200, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> Analogously to other NICs, we have to inform the network layer when
> the can_receive handler will no longer report 0. Without this, we may
> get stuck waiting on queued incoming packets.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  hw/net/pcnet.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)

Great, let's get this into the next QEMU 1.6-rc.

Thanks, applied to my net tree:
https://github.com/stefanha/qemu/commits/net

Stefan
diff mbox

Patch

diff --git a/hw/net/pcnet.c b/hw/net/pcnet.c
index b606d2b..63aa73a 100644
--- a/hw/net/pcnet.c
+++ b/hw/net/pcnet.c
@@ -861,6 +861,8 @@  static void pcnet_init(PCNetState *s)
 
     s->csr[0] |= 0x0101;
     s->csr[0] &= ~0x0004;       /* clear STOP bit */
+
+    qemu_flush_queued_packets(qemu_get_queue(s->nic));
 }
 
 static void pcnet_start(PCNetState *s)
@@ -878,6 +880,8 @@  static void pcnet_start(PCNetState *s)
     s->csr[0] &= ~0x0004;       /* clear STOP bit */
     s->csr[0] |= 0x0002;
     pcnet_poll_timer(s);
+
+    qemu_flush_queued_packets(qemu_get_queue(s->nic));
 }
 
 static void pcnet_stop(PCNetState *s)