netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Or Gerlitz <ogerlitz@voltaire.com>
Cc: Avi Kivity <avi@redhat.com>,
	netdev@vger.kernel.org, Gregory Haskins <ghaskins@novell.com>,
	Anthony Liguori <anthony@codemonkey.ws>
Subject: Re: user space virtio-net exits with "truncating packet" error
Date: Fri, 15 May 2009 14:48:49 +0930	[thread overview]
Message-ID: <200905151448.49851.rusty@rustcorp.com.au> (raw)
In-Reply-To: <4A0C2500.7090709@Voltaire.com>

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 <rusty@rustcorp.com.au>
---
 drivers/virtio/virtio.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

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
 };
 


  parent reply	other threads:[~2009-05-15  5:19 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-14 10:07 user space virtio-net exits with "truncating packet" error Or Gerlitz
2009-05-14 11:22 ` Mark McLoughlin
2009-05-14 12:25   ` Or Gerlitz
2009-05-14 11:58 ` Rusty Russell
2009-05-14 14:04   ` Or Gerlitz
2009-05-14 18:04     ` Or Gerlitz
2009-05-15  5:18     ` Rusty Russell [this message]
2009-05-19 12:19       ` Or Gerlitz
2009-05-20  2:47         ` Rusty Russell
2009-05-20  6:20           ` Or Gerlitz
2009-05-20  6:59             ` Avi Kivity
2009-05-21  5:53             ` Rusty Russell
2009-05-15  7:07     ` Michael Tokarev
2009-05-19 10:00       ` Or Gerlitz
2009-05-19 10:13         ` Avi Kivity
2009-05-14 15:34   ` Sridhar Samudrala

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=200905151448.49851.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=ghaskins@novell.com \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@voltaire.com \
    /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;
as well as URLs for NNTP newsgroup(s).