Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Mark McLoughlin <markmc@redhat.com>
To: Avi Kivity <akivity@redhat.com>
Cc: kvm <kvm@vger.kernel.org>
Subject: [PATCH] net: re-instate some lost vnet_hdr code
Date: Wed, 08 Jul 2009 09:47:38 +0100	[thread overview]
Message-ID: <1247042858.3270.40.camel@blaa> (raw)

Merge commit 211eb5f301 lost the code we had in tap_send_packet() to
handle the case of the tapfd having IF_VNET_HDR enabled, but the
NIC code not having support for virtio_net_hdr. In this case, we just
strip off the header before passing it to the NIC.

Fixes:

  http://sourceforge.net/tracker/?func=detail&atid=893831&aid=2817367&group_id=180599
    Network doesn't work anymore switching from kvm-86 to kvm-87

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---
 net.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/net.c b/net.c
index ac06ea1..19e00e0 100644
--- a/net.c
+++ b/net.c
@@ -1460,12 +1460,21 @@ static void tap_send(void *opaque)
     int size;
 
     do {
+        uint8_t *buf = s->buf;
+
         size = tap_read_packet(s->fd, s->buf, sizeof(s->buf));
         if (size <= 0) {
             break;
         }
 
-        size = qemu_send_packet_async(s->vc, s->buf, size, tap_send_completed);
+#ifdef IFF_VNET_HDR
+        if (s->has_vnet_hdr && !s->using_vnet_hdr) {
+            buf += sizeof(struct virtio_net_hdr);
+            size -= sizeof(struct virtio_net_hdr);
+        }
+#endif
+
+        size = qemu_send_packet_async(s->vc, buf, size, tap_send_completed);
         if (size == 0) {
             tap_read_poll(s, 0);
         }
-- 
1.6.3.3


             reply	other threads:[~2009-07-08  8:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-08  8:47 Mark McLoughlin [this message]
2009-07-08 10:20 ` [PATCH] net: re-instate some lost vnet_hdr code Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1247042858.3270.40.camel@blaa \
    --to=markmc@redhat.com \
    --cc=akivity@redhat.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox