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 3/4] virtio: net: Add ethtool ops for SG/GSO
Date: Tue, 29 Apr 2008 01:19:16 +1000 [thread overview]
Message-ID: <200804290119.17180.rusty@rustcorp.com.au> (raw)
In-Reply-To: <200804290117.45010.rusty@rustcorp.com.au>
Date: Fri, 18 Apr 2008 11:21:42 +0800
From: Herbert Xu <herbert@gondor.apana.org.au>
This patch adds some basic ethtool operations to virtio_net so
I could test SG without GSO (which was really useful because TSO
turned out to be buggy :)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (remove MTU setting)
---
drivers/net/virtio_net.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -19,6 +19,7 @@
//#define DEBUG
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
+#include <linux/ethtool.h>
#include <linux/module.h>
#include <linux/virtio.h>
#include <linux/virtio_net.h>
@@ -352,6 +353,22 @@ static int virtnet_close(struct net_devi
return 0;
}
+static int virtnet_set_tx_csum(struct net_device *dev, u32 data)
+{
+ struct virtnet_info *vi = netdev_priv(dev);
+ struct virtio_device *vdev = vi->vdev;
+
+ if (data && !virtio_has_feature(vdev, VIRTIO_NET_F_CSUM))
+ return -ENOSYS;
+
+ return ethtool_op_set_tx_hw_csum(dev, data);
+}
+
+static struct ethtool_ops virtnet_ethtool_ops = {
+ .set_tx_csum = virtnet_set_tx_csum,
+ .set_sg = ethtool_op_set_sg,
+};
+
static int virtnet_probe(struct virtio_device *vdev)
{
int err;
@@ -371,6 +389,7 @@ static int virtnet_probe(struct virtio_d
#ifdef CONFIG_NET_POLL_CONTROLLER
dev->poll_controller = virtnet_netpoll;
#endif
+ SET_ETHTOOL_OPS(dev, &virtnet_ethtool_ops);
SET_NETDEV_DEV(dev, &vdev->dev);
/* Do we support "hardware" checksums? */
next prev parent reply other threads:[~2008-04-28 15:19 UTC|newest]
Thread overview: 9+ 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 ` [PATCH 2/4] virtio: finer-grained features for virtio_net Rusty Russell
2008-04-28 15:19 ` [PATCH 3/4] virtio: net: Add ethtool ops for SG/GSO Rusty Russell
2008-04-28 15:19 ` Rusty Russell [this message]
2008-04-28 15:21 ` [PATCH 4/4] virtio: net: Allow receiving SG packets Rusty Russell
2008-04-28 15:21 ` Rusty Russell
2008-04-28 15:17 ` [PATCH 2/4] virtio: finer-grained features for virtio_net Rusty Russell
2008-04-29 5:06 ` [PATCH 1/4] virtio: wean net driver off NETDEV_TX_BUSY Herbert Xu
2008-04-29 5:06 ` 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=200804290119.17180.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.