qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/2] Net patches
@ 2013-05-24 14:38 Stefan Hajnoczi
  2013-05-24 14:38 ` [Qemu-devel] [PATCH 1/2] net: support for bridged networking on Mac OS X Stefan Hajnoczi
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2013-05-24 14:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, Stefan Hajnoczi

The following changes since commit 64afc2b4d48fb21e085517c38a59a3f61a11283c:

  Merge remote-tracking branch 'luiz/queue/qmp' into staging (2013-05-23 14:16:35 -0500)

are available in the git repository at:


  git://github.com/stefanha/qemu.git net

for you to fetch changes up to 00b7ade807b5ce6779ddd86ce29c5521ec5c529a:

  rtl8139: flush queued packets when RxBufPtr is written (2013-05-24 16:34:13 +0200)

----------------------------------------------------------------
Alasdair McLeay (1):
      net: support for bridged networking on Mac OS X

Stefan Hajnoczi (1):
      rtl8139: flush queued packets when RxBufPtr is written

 hw/net/rtl8139.c | 3 +++
 net/tap-bsd.c    | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 1/2] net: support for bridged networking on Mac OS X
  2013-05-24 14:38 [Qemu-devel] [PULL 0/2] Net patches Stefan Hajnoczi
@ 2013-05-24 14:38 ` Stefan Hajnoczi
  2013-05-24 14:38 ` [Qemu-devel] [PATCH 2/2] rtl8139: flush queued packets when RxBufPtr is written Stefan Hajnoczi
  2013-06-17 21:18 ` [Qemu-devel] [PULL 0/2] Net patches Anthony Liguori
  2 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2013-05-24 14:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alasdair McLeay, Anthony Liguori, Stefan Hajnoczi

From: Alasdair McLeay <alasdair.mcleay@me.com>

tun tap can be implemented on Mac OS X using
http://tuntaposx.sourceforge.net

It behaves in the same way as FreeBSD/OpenBSD implementations, but Qemu
needs a patch to use the OpenBS/FreeBSD code.

As per the patch listed in this forum thread:
http://forum.gns3.net/post17679.html#p17679

And also as used in the MacPorts installation:
https://trac.macports.org/browser/trunk/dports/emulators/qemu/files/patch-net-tap-interface.diff

Signed-off-by: Alasdair McLeay <alasdair.mcleay@me.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 net/tap-bsd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/tap-bsd.c b/net/tap-bsd.c
index bcdb268..f61d580 100644
--- a/net/tap-bsd.c
+++ b/net/tap-bsd.c
@@ -44,7 +44,8 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
     struct stat s;
 #endif
 
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
+    defined(__OpenBSD__) || defined(__APPLE__)
     /* if no ifname is given, always start the search from tap0/tun0. */
     int i;
     char dname[100];
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 2/2] rtl8139: flush queued packets when RxBufPtr is written
  2013-05-24 14:38 [Qemu-devel] [PULL 0/2] Net patches Stefan Hajnoczi
  2013-05-24 14:38 ` [Qemu-devel] [PATCH 1/2] net: support for bridged networking on Mac OS X Stefan Hajnoczi
@ 2013-05-24 14:38 ` Stefan Hajnoczi
  2013-05-24 15:18   ` Paolo Bonzini
  2013-06-17 21:18 ` [Qemu-devel] [PULL 0/2] Net patches Anthony Liguori
  2 siblings, 1 reply; 6+ messages in thread
From: Stefan Hajnoczi @ 2013-05-24 14:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, Stefan Hajnoczi

Net queues support efficient "receive disable".  For example, tap's file
descriptor will not be polled while its peer has receive disabled.  This
saves CPU cycles for needlessly copying and then dropping packets which
the peer cannot receive.

rtl8139 is missing the qemu_flush_queued_packets() call that wakes the
queue up when receive becomes possible again.

As a result, the Windows 7 guest driver reaches a state where the
rtl8139 cannot receive packets.  The driver has actually refilled the
receive buffer but we never resume reception.

The bug can be reproduced by running a large FTP 'get' inside a Windows
7 guest:

  $ qemu -netdev tap,id=tap0,...
         -device rtl8139,netdev=tap0

The Linux guest driver does not trigger the bug, probably due to a
different buffer management strategy.

Reported-by: Oliver Francke <oliver.francke@filoo.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/net/rtl8139.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
index 9369507..7993f9f 100644
--- a/hw/net/rtl8139.c
+++ b/hw/net/rtl8139.c
@@ -2575,6 +2575,9 @@ static void rtl8139_RxBufPtr_write(RTL8139State *s, uint32_t val)
     /* this value is off by 16 */
     s->RxBufPtr = MOD2(val + 0x10, s->RxBufferSize);
 
+    /* more buffer space may be available so try to receive */
+    qemu_flush_queued_packets(qemu_get_queue(s->nic));
+
     DPRINTF(" CAPR write: rx buffer length %d head 0x%04x read 0x%04x\n",
         s->RxBufferSize, s->RxBufAddr, s->RxBufPtr);
 }
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] rtl8139: flush queued packets when RxBufPtr is written
  2013-05-24 14:38 ` [Qemu-devel] [PATCH 2/2] rtl8139: flush queued packets when RxBufPtr is written Stefan Hajnoczi
@ 2013-05-24 15:18   ` Paolo Bonzini
  2013-05-27  9:00     ` Stefan Hajnoczi
  0 siblings, 1 reply; 6+ messages in thread
From: Paolo Bonzini @ 2013-05-24 15:18 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Anthony Liguori, qemu-devel

Il 24/05/2013 16:38, Stefan Hajnoczi ha scritto:
> Net queues support efficient "receive disable".  For example, tap's file
> descriptor will not be polled while its peer has receive disabled.  This
> saves CPU cycles for needlessly copying and then dropping packets which
> the peer cannot receive.
> 
> rtl8139 is missing the qemu_flush_queued_packets() call that wakes the
> queue up when receive becomes possible again.
> 
> As a result, the Windows 7 guest driver reaches a state where the
> rtl8139 cannot receive packets.  The driver has actually refilled the
> receive buffer but we never resume reception.
> 
> The bug can be reproduced by running a large FTP 'get' inside a Windows
> 7 guest:
> 
>   $ qemu -netdev tap,id=tap0,...
>          -device rtl8139,netdev=tap0
> 
> The Linux guest driver does not trigger the bug, probably due to a
> different buffer management strategy.
> 
> Reported-by: Oliver Francke <oliver.francke@filoo.de>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  hw/net/rtl8139.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
> index 9369507..7993f9f 100644
> --- a/hw/net/rtl8139.c
> +++ b/hw/net/rtl8139.c
> @@ -2575,6 +2575,9 @@ static void rtl8139_RxBufPtr_write(RTL8139State *s, uint32_t val)
>      /* this value is off by 16 */
>      s->RxBufPtr = MOD2(val + 0x10, s->RxBufferSize);
>  
> +    /* more buffer space may be available so try to receive */
> +    qemu_flush_queued_packets(qemu_get_queue(s->nic));
> +
>      DPRINTF(" CAPR write: rx buffer length %d head 0x%04x read 0x%04x\n",
>          s->RxBufferSize, s->RxBufAddr, s->RxBufPtr);
>  }
> 

Do you have time to update the branch with a "Cc: qemu-stable@nongnu.org"?

Paolo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] rtl8139: flush queued packets when RxBufPtr is written
  2013-05-24 15:18   ` Paolo Bonzini
@ 2013-05-27  9:00     ` Stefan Hajnoczi
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2013-05-27  9:00 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Anthony Liguori, qemu-devel

On Fri, May 24, 2013 at 05:18:09PM +0200, Paolo Bonzini wrote:
> Il 24/05/2013 16:38, Stefan Hajnoczi ha scritto:
> > diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
> > index 9369507..7993f9f 100644
> > --- a/hw/net/rtl8139.c
> > +++ b/hw/net/rtl8139.c
> > @@ -2575,6 +2575,9 @@ static void rtl8139_RxBufPtr_write(RTL8139State *s, uint32_t val)
> >      /* this value is off by 16 */
> >      s->RxBufPtr = MOD2(val + 0x10, s->RxBufferSize);
> >  
> > +    /* more buffer space may be available so try to receive */
> > +    qemu_flush_queued_packets(qemu_get_queue(s->nic));
> > +
> >      DPRINTF(" CAPR write: rx buffer length %d head 0x%04x read 0x%04x\n",
> >          s->RxBufferSize, s->RxBufAddr, s->RxBufPtr);
> >  }
> > 
> 
> Do you have time to update the branch with a "Cc: qemu-stable@nongnu.org"?

It has been merged.  Will try to CC qemu-stable in the future.

Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PULL 0/2] Net patches
  2013-05-24 14:38 [Qemu-devel] [PULL 0/2] Net patches Stefan Hajnoczi
  2013-05-24 14:38 ` [Qemu-devel] [PATCH 1/2] net: support for bridged networking on Mac OS X Stefan Hajnoczi
  2013-05-24 14:38 ` [Qemu-devel] [PATCH 2/2] rtl8139: flush queued packets when RxBufPtr is written Stefan Hajnoczi
@ 2013-06-17 21:18 ` Anthony Liguori
  2 siblings, 0 replies; 6+ messages in thread
From: Anthony Liguori @ 2013-06-17 21:18 UTC (permalink / raw)
  To: Stefan Hajnoczi, qemu-devel; +Cc: Anthony Liguori

Pulled.  Thanks.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-06-17 21:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-24 14:38 [Qemu-devel] [PULL 0/2] Net patches Stefan Hajnoczi
2013-05-24 14:38 ` [Qemu-devel] [PATCH 1/2] net: support for bridged networking on Mac OS X Stefan Hajnoczi
2013-05-24 14:38 ` [Qemu-devel] [PATCH 2/2] rtl8139: flush queued packets when RxBufPtr is written Stefan Hajnoczi
2013-05-24 15:18   ` Paolo Bonzini
2013-05-27  9:00     ` Stefan Hajnoczi
2013-06-17 21:18 ` [Qemu-devel] [PULL 0/2] Net patches Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).