From patchwork Thu May 14 11:22:35 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark McLoughlin X-Patchwork-Id: 27204 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 354B0B7080 for ; Thu, 14 May 2009 21:23:14 +1000 (EST) Received: by ozlabs.org (Postfix) id 24F49DE032; Thu, 14 May 2009 21:23:14 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 9B26DDE00F for ; Thu, 14 May 2009 21:23:13 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754888AbZENLWr (ORCPT ); Thu, 14 May 2009 07:22:47 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757128AbZENLWq (ORCPT ); Thu, 14 May 2009 07:22:46 -0400 Received: from mx2.redhat.com ([66.187.237.31]:37567 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758635AbZENLWo (ORCPT ); Thu, 14 May 2009 07:22:44 -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 n4EBMePU024166; Thu, 14 May 2009 07:22:40 -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 n4EBMcgP010759; Thu, 14 May 2009 07:22:39 -0400 Received: from [127.0.0.1] (sebastian-int.corp.redhat.com [172.16.52.221]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n4EBMaQm018346; Thu, 14 May 2009 07:22:37 -0400 Subject: Re: user space virtio-net exits with "truncating packet" error From: Mark McLoughlin Reply-To: Mark McLoughlin To: Or Gerlitz Cc: Rusty Russell , Avi Kivity , netdev@vger.kernel.org, Gregory Haskins , qemu-devel In-Reply-To: References: Date: Thu, 14 May 2009 12:22:35 +0100 Message-Id: <1242300155.17366.20.camel@blaa> Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, 2009-05-14 at 13:07 +0300, Or Gerlitz wrote: > Hi, > > When running with jumbo frames (i.e set tap0 and guest nic mtu to 9k) > and using 8k sized packets with iperf, the qemu process exits with > "virtio-net truncating packet" which I see in the code of qemu/hw/virtio-net.c > :: virtio_net_receive(). This happens only when the VM is receiving, if I > send 8K packets from the VM things go fine. > > I use virtio based NIC in the VM and Linux 2.6.29.1 in both the VM and the host. > Qemu is the one provided by kvm release 84 That sounds like a bug in qemu's mergeable receive buffers implementation - the host is running out of buffers for the packet, even though it supposedly has already checked that there is enough buffers available on the ring. Hmm, I think I see the bug - does the patch below work? Please try several mtu values around the 9k mark to be sure Cheers, Mark. --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/hw/virtio-net.c b/hw/virtio-net.c index f125edc..3ffd2c0 100644 --- a/hw/virtio-net.c +++ b/hw/virtio-net.c @@ -438,16 +438,16 @@ static void virtio_net_receive(void *opaque, const uint8_t *buf, int size) struct virtio_net_hdr_mrg_rxbuf *mhdr = NULL; size_t hdr_len, offset, i; - if (!do_virtio_net_can_receive(n, size)) + /* hdr_len refers to the header we supply to the guest */ + hdr_len = n->mergeable_rx_bufs ? + sizeof(struct virtio_net_hdr_mrg_rxbuf) : sizeof(struct virtio_net_hdr); + + if (!do_virtio_net_can_receive(n, size + hdr_len)) return; if (!receive_filter(n, buf, size)) return; - /* hdr_len refers to the header we supply to the guest */ - hdr_len = n->mergeable_rx_bufs ? - sizeof(struct virtio_net_hdr_mrg_rxbuf) : sizeof(struct virtio_net_hdr); - offset = i = 0; while (offset < size) {