From patchwork Wed Jul 8 08:47:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark McLoughlin X-Patchwork-Id: 34577 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n688m3va012342 for ; Wed, 8 Jul 2009 08:48:03 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758131AbZGHIr6 (ORCPT ); Wed, 8 Jul 2009 04:47:58 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757882AbZGHIr6 (ORCPT ); Wed, 8 Jul 2009 04:47:58 -0400 Received: from mx2.redhat.com ([66.187.237.31]:38071 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756702AbZGHIr6 (ORCPT ); Wed, 8 Jul 2009 04:47:58 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n688lwnw011592 for ; Wed, 8 Jul 2009 04:47:58 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n688luVS024837; Wed, 8 Jul 2009 04:47:57 -0400 Received: from [IPv6:::1] (sebastian-int.corp.redhat.com [172.16.52.221]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n688ltGi017982; Wed, 8 Jul 2009 04:47:56 -0400 Subject: [PATCH] net: re-instate some lost vnet_hdr code From: Mark McLoughlin Reply-To: Mark McLoughlin To: Avi Kivity Cc: kvm Date: Wed, 08 Jul 2009 09:47:38 +0100 Message-Id: <1247042858.3270.40.camel@blaa> Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 --- 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); }