From patchwork Fri May 15 05:18:49 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rusty Russell X-Patchwork-Id: 27237 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 5CDECB7081 for ; Fri, 15 May 2009 15:20:00 +1000 (EST) Received: by ozlabs.org (Postfix) id 4FCD2DE078; Fri, 15 May 2009 15:20:00 +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 E90C2DE072 for ; Fri, 15 May 2009 15:19:59 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760535AbZEOFTK (ORCPT ); Fri, 15 May 2009 01:19:10 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759566AbZEOFTJ (ORCPT ); Fri, 15 May 2009 01:19:09 -0400 Received: from ozlabs.org ([203.10.76.45]:52598 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751219AbZEOFTI (ORCPT ); Fri, 15 May 2009 01:19:08 -0400 Received: from vivaldi.localnet (unknown [150.101.102.135]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPSA id 92284DE076; Fri, 15 May 2009 15:19:06 +1000 (EST) From: Rusty Russell To: Or Gerlitz Subject: Re: user space virtio-net exits with "truncating packet" error Date: Fri, 15 May 2009 14:48:49 +0930 User-Agent: KMail/1.11.2 (Linux/2.6.28-11-generic; KDE/4.2.2; i686; ; ) Cc: Avi Kivity , netdev@vger.kernel.org, Gregory Haskins , Anthony Liguori References: <200905142128.58111.rusty@rustcorp.com.au> <4A0C2500.7090709@Voltaire.com> In-Reply-To: <4A0C2500.7090709@Voltaire.com> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200905151448.49851.rusty@rustcorp.com.au> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, 14 May 2009 11:34:48 pm Or Gerlitz wrote: > Rusty Russell wrote: > > The answer is that virtio_net by default only supports 1500 > > MTU; I've not tried larger MTUs. > > Rusty, > > I hoped to get some performance boost from using checksum and large-send > offloads as an alternative to jumbo frames. Looking in the virtio-net > kernel driver, I see that the probe function checks if virtio_has_feature > VIRTIO_NET_F_CSUM ... VIRTIO_NET_F_HOST_TSO ... and if yes sets the > relevant bits in the NIC features mask. Looking in the virtio qemu code, I > also see some offload related code. Yes, which is why MTU is a bit misleading. This patch may help diagnostics tho. Cheers, Rusty. virtio: expose features in sysfs Each device negotiates feature bits; expose these in sysfs to help diagnostics and debugging. Signed-off-by: Rusty Russell --- drivers/virtio/virtio.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) -- 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/drivers/virtio/virtio.c b/drivers/virtio/virtio.c --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c @@ -31,11 +31,27 @@ static ssize_t modalias_show(struct devi return sprintf(buf, "virtio:d%08Xv%08X\n", dev->id.device, dev->id.vendor); } +static ssize_t features_show(struct device *_d, + struct device_attribute *attr, char *buf) +{ + struct virtio_device *dev = container_of(_d, struct virtio_device, dev); + unsigned int i; + ssize_t len = 0; + + /* We actually represent this as a bitstring, as it could be + * arbitrary length in future. */ + for (i = 0; i < ARRAY_SIZE(dev->features)*BITS_PER_LONG; i++) + len += sprintf(buf+len, "%c", + test_bit(i, dev->features) ? '1' : '0'); + len += sprintf(buf+len, "\n"); + return len; +} static struct device_attribute virtio_dev_attrs[] = { __ATTR_RO(device), __ATTR_RO(vendor), __ATTR_RO(status), __ATTR_RO(modalias), + __ATTR_RO(features), __ATTR_NULL };