qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCHv2] tap: reset vnet header size on open
@ 2012-11-13 10:23 Michael S. Tsirkin
  2012-11-13 12:19 ` Stefan Hajnoczi
  2012-11-19 17:26 ` Alexander Graf
  0 siblings, 2 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2012-11-13 10:23 UTC (permalink / raw)
  To: qemu-devel, agraf; +Cc: Anthony Liguori, Stefan Hajnoczi

For tap, we currently assume the vnet header size is 10
(the default value) but that might not be the case
if tap is persistent and has been used by qemu previously.
To fix, set host header size in tap device on open.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---

This fixes the issue reported by Alexander Graf on the kvm forum.
Alexander, could you confirm please?
Thanks,

 net/tap.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/net/tap.c b/net/tap.c
index df89caa..1abfd44 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -341,6 +341,13 @@ static TAPState *net_tap_fd_init(NetClientState *peer,
     s->using_vnet_hdr = 0;
     s->has_ufo = tap_probe_has_ufo(s->fd);
     tap_set_offload(&s->nc, 0, 0, 0, 0, 0);
+    /*
+     * Make sure host header length is set correctly in tap:
+     * it might have been modified by another instance of qemu.
+     */
+    if (tap_probe_vnet_hdr_len(s->fd, s->host_vnet_hdr_len)) {
+        tap_fd_set_vnet_hdr_len(s->fd, s->host_vnet_hdr_len);
+    }
     tap_read_poll(s, 1);
     s->vhost_net = NULL;
     return s;
-- 
MST

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

* Re: [Qemu-devel] [PATCHv2] tap: reset vnet header size on open
  2012-11-13 10:23 [Qemu-devel] [PATCHv2] tap: reset vnet header size on open Michael S. Tsirkin
@ 2012-11-13 12:19 ` Stefan Hajnoczi
  2012-11-19 17:26 ` Alexander Graf
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2012-11-13 12:19 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: Anthony Liguori, qemu-devel, agraf

On Tue, Nov 13, 2012 at 12:23:23PM +0200, Michael S. Tsirkin wrote:
> For tap, we currently assume the vnet header size is 10
> (the default value) but that might not be the case
> if tap is persistent and has been used by qemu previously.
> To fix, set host header size in tap device on open.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> 
> This fixes the issue reported by Alexander Graf on the kvm forum.
> Alexander, could you confirm please?
> Thanks,
> 
>  net/tap.c | 7 +++++++
>  1 file changed, 7 insertions(+)

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

Stefan

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

* Re: [Qemu-devel] [PATCHv2] tap: reset vnet header size on open
  2012-11-13 10:23 [Qemu-devel] [PATCHv2] tap: reset vnet header size on open Michael S. Tsirkin
  2012-11-13 12:19 ` Stefan Hajnoczi
@ 2012-11-19 17:26 ` Alexander Graf
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander Graf @ 2012-11-19 17:26 UTC (permalink / raw)
  To: Michael S.Tsirkin; +Cc: Anthony Liguori, qemu-devel, Stefan Hajnoczi


On 13.11.2012, at 11:23, Michael S. Tsirkin wrote:

> For tap, we currently assume the vnet header size is 10
> (the default value) but that might not be the case
> if tap is persistent and has been used by qemu previously.
> To fix, set host header size in tap device on open.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> 
> This fixes the issue reported by Alexander Graf on the kvm forum.
> Alexander, could you confirm please?

Yup, works for me :).

Tested-by: Alexander Graf <agraf@suse.de>


Alex

> Thanks,
> 
> net/tap.c | 7 +++++++
> 1 file changed, 7 insertions(+)
> 
> diff --git a/net/tap.c b/net/tap.c
> index df89caa..1abfd44 100644
> --- a/net/tap.c
> +++ b/net/tap.c
> @@ -341,6 +341,13 @@ static TAPState *net_tap_fd_init(NetClientState *peer,
>     s->using_vnet_hdr = 0;
>     s->has_ufo = tap_probe_has_ufo(s->fd);
>     tap_set_offload(&s->nc, 0, 0, 0, 0, 0);
> +    /*
> +     * Make sure host header length is set correctly in tap:
> +     * it might have been modified by another instance of qemu.
> +     */
> +    if (tap_probe_vnet_hdr_len(s->fd, s->host_vnet_hdr_len)) {
> +        tap_fd_set_vnet_hdr_len(s->fd, s->host_vnet_hdr_len);
> +    }
>     tap_read_poll(s, 1);
>     s->vhost_net = NULL;
>     return s;
> -- 
> MST

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

end of thread, other threads:[~2012-11-19 17:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-13 10:23 [Qemu-devel] [PATCHv2] tap: reset vnet header size on open Michael S. Tsirkin
2012-11-13 12:19 ` Stefan Hajnoczi
2012-11-19 17:26 ` Alexander Graf

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).