From: Rusty Russell <rusty@rustcorp.com.au>
To: virtualization@lists.linux-foundation.org
Cc: netdev@vger.kernel.org, Herbert Xu <herbert@gondor.apana.org.au>
Subject: [PATCH 2/4] virtio: finer-grained features for virtio_net
Date: Tue, 29 Apr 2008 01:17:44 +1000 [thread overview]
Message-ID: <200804290117.45010.rusty@rustcorp.com.au> (raw)
In-Reply-To: <200804290116.05951.rusty@rustcorp.com.au>
So, we previously had a 'VIRTIO_NET_F_GSO' bit which meant that 'the
host can handle csum offload, and any TSO (v4&v6 incl ECN) or UFO
packets you might want to send. I thought this was good enough for
Linux, but it actually isn't, since we don't do UFO in software.
So, add separate feature bits for what the host can handle. Add
equivalent ones for the guest to say what it can handle, because LRO
is coming too (thanks Herbert!).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
drivers/net/virtio_net.c | 9 +++++++++
include/linux/virtio_net.h | 13 +++++++++++--
2 files changed, 20 insertions(+), 2 deletions(-)
diff -r effa8facedf1 drivers/net/virtio_net.c
--- a/drivers/net/virtio_net.c Tue Apr 22 07:59:24 2008 +1000
+++ b/drivers/net/virtio_net.c Tue Apr 22 10:31:05 2008 +1000
@@ -381,6 +381,15 @@ static int virtnet_probe(struct virtio_d
dev->features |= NETIF_F_TSO | NETIF_F_UFO
| NETIF_F_TSO_ECN | NETIF_F_TSO6;
}
+ /* Individual feature bits: what can host handle? */
+ if (gso && vdev->config->feature(vdev, VIRTIO_NET_F_HOST_TSO4))
+ dev->features |= NETIF_F_TSO;
+ if (gso && vdev->config->feature(vdev, VIRTIO_NET_F_HOST_TSO6))
+ dev->features |= NETIF_F_TSO6;
+ if (gso && vdev->config->feature(vdev, VIRTIO_NET_F_HOST_ECN))
+ dev->features |= NETIF_F_TSO_ECN;
+ if (gso && vdev->config->feature(vdev, VIRTIO_NET_F_HOST_UFO))
+ dev->features |= NETIF_F_UFO;
}
/* Configuration may specify what MAC to use. Otherwise random. */
diff -r effa8facedf1 include/linux/virtio_net.h
--- a/include/linux/virtio_net.h Tue Apr 22 07:59:24 2008 +1000
+++ b/include/linux/virtio_net.h Tue Apr 22 10:31:05 2008 +1000
@@ -6,9 +6,18 @@
#define VIRTIO_ID_NET 1
/* The feature bitmap for virtio net */
-#define VIRTIO_NET_F_CSUM 0 /* Can handle pkts w/ partial csum */
+#define VIRTIO_NET_F_CSUM 0 /* Host handles pkts w/ partial csum */
+#define VIRTIO_NET_F_GUEST_CSUM 1 /* Guest handles pkts w/ partial csum */
#define VIRTIO_NET_F_MAC 5 /* Host has given MAC address. */
-#define VIRTIO_NET_F_GSO 6 /* Can handle pkts w/ any GSO type */
+#define VIRTIO_NET_F_GSO 6 /* Host handles pkts w/ any GSO type */
+#define VIRTIO_NET_F_GUEST_TSO4 7 /* Guest can handle TSOv4 in. */
+#define VIRTIO_NET_F_GUEST_TSO6 8 /* Guest can handle TSOv6 in. */
+#define VIRTIO_NET_F_GUEST_ECN 9 /* Guest can handle TSO[6] w/ ECN in. */
+#define VIRTIO_NET_F_GUEST_UFO 10 /* Guest can handle UFO in. */
+#define VIRTIO_NET_F_HOST_TSO4 11 /* Host can handle TSOv4 in. */
+#define VIRTIO_NET_F_HOST_TSO6 12 /* Host can handle TSOv6 in. */
+#define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */
+#define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */
struct virtio_net_config
{
next prev parent reply other threads:[~2008-04-28 15:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-28 15:16 [PATCH 1/4] virtio: wean net driver off NETDEV_TX_BUSY Rusty Russell
2008-04-28 15:17 ` Rusty Russell [this message]
2008-04-28 15:19 ` [PATCH 3/4] virtio: net: Add ethtool ops for SG/GSO Rusty Russell
2008-04-28 15:21 ` [PATCH 4/4] virtio: net: Allow receiving SG packets Rusty Russell
2008-04-29 5:06 ` [PATCH 1/4] virtio: wean net driver off NETDEV_TX_BUSY Herbert Xu
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=200804290117.45010.rusty@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.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;
as well as URLs for NNTP newsgroup(s).