From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [PATCH 10/12] kvm: qemu: Add a -net tap,fd=X,vnet_hdr=on option Date: Mon, 11 Aug 2008 15:30:36 -0500 Message-ID: <48A0A16C.4050501@codemonkey.ws> References: <1218485535-877-1-git-send-email-markmc@redhat.com> <1218485535-877-2-git-send-email-markmc@redhat.com> <1218485535-877-3-git-send-email-markmc@redhat.com> <1218485535-877-4-git-send-email-markmc@redhat.com> <1218485535-877-5-git-send-email-markmc@redhat.com> <1218485535-877-6-git-send-email-markmc@redhat.com> <1218485535-877-7-git-send-email-markmc@redhat.com> <1218485535-877-8-git-send-email-markmc@redhat.com> <1218485535-877-9-git-send-email-markmc@redhat.com> <1218485535-877-10-git-send-email-markmc@redhat.com> <1218485535-877-11-git-send-email-markmc@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Avi Kivity , kvm@vger.kernel.org To: Mark McLoughlin Return-path: Received: from wr-out-0506.google.com ([64.233.184.239]:49250 "EHLO wr-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753115AbYHKUb3 (ORCPT ); Mon, 11 Aug 2008 16:31:29 -0400 Received: by wr-out-0506.google.com with SMTP id 69so1541713wri.5 for ; Mon, 11 Aug 2008 13:31:28 -0700 (PDT) In-Reply-To: <1218485535-877-11-git-send-email-markmc@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Mark McLoughlin wrote: > Some management apps like libvirt creates a tap interface, > adds it to a bridge and then passes the fd to qemu-kvm. > > Since we have no way of querying whether the IFF_VNET_HDR > flag has been enabled on the interface, the app needs to > tell us if has enabled it. > Sounds like we should just patch the kernel to add a mechanism to query the IF_VNET_HDR flag. Regards, Anthony Liguori > Signed-off-by: Mark McLoughlin > --- > qemu/vl.c | 11 ++++++++++- > 1 files changed, 10 insertions(+), 1 deletions(-) > > diff --git a/qemu/vl.c b/qemu/vl.c > index 14a66e0..499d6f9 100644 > --- a/qemu/vl.c > +++ b/qemu/vl.c > @@ -5487,10 +5487,19 @@ int net_client_init(const char *device, const char *p) > int fd; > vlan->nb_host_devs++; > if (get_param_value(buf, sizeof(buf), "fd", p) > 0) { > + int vnet_hdr = 0; > fd = strtol(buf, NULL, 0); > fcntl(fd, F_SETFL, O_NONBLOCK); > + if (get_param_value(buf, sizeof(buf), "vnet_hdr", p) > 0) { > + if (strcmp(buf, "on") == 0) { > + vnet_hdr = 1; > + } else if (strcmp(buf, "off") != 0) { > + fprintf(stderr, "qemu: '%s' invalid vnet_hdr option\n", buf); > + return 0; > + } > + } > ret = -1; > - if (net_tap_fd_init(vlan, fd, 0)) > + if (net_tap_fd_init(vlan, fd, vnet_hdr)) > ret = 0; > } else { > if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) { >