aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/virtio_net.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r--drivers/net/virtio_net.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 06d5c43bb207..ce37a7e9541c 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -19,6 +19,7 @@
19//#define DEBUG 19//#define DEBUG
20#include <linux/netdevice.h> 20#include <linux/netdevice.h>
21#include <linux/etherdevice.h> 21#include <linux/etherdevice.h>
22#include <linux/ethtool.h>
22#include <linux/module.h> 23#include <linux/module.h>
23#include <linux/virtio.h> 24#include <linux/virtio.h>
24#include <linux/virtio_net.h> 25#include <linux/virtio_net.h>
@@ -408,6 +409,22 @@ static int virtnet_close(struct net_device *dev)
408 return 0; 409 return 0;
409} 410}
410 411
412static int virtnet_set_tx_csum(struct net_device *dev, u32 data)
413{
414 struct virtnet_info *vi = netdev_priv(dev);
415 struct virtio_device *vdev = vi->vdev;
416
417 if (data && !virtio_has_feature(vdev, VIRTIO_NET_F_CSUM))
418 return -ENOSYS;
419
420 return ethtool_op_set_tx_hw_csum(dev, data);
421}
422
423static struct ethtool_ops virtnet_ethtool_ops = {
424 .set_tx_csum = virtnet_set_tx_csum,
425 .set_sg = ethtool_op_set_sg,
426};
427
411static int virtnet_probe(struct virtio_device *vdev) 428static int virtnet_probe(struct virtio_device *vdev)
412{ 429{
413 int err; 430 int err;
@@ -427,6 +444,7 @@ static int virtnet_probe(struct virtio_device *vdev)
427#ifdef CONFIG_NET_POLL_CONTROLLER 444#ifdef CONFIG_NET_POLL_CONTROLLER
428 dev->poll_controller = virtnet_netpoll; 445 dev->poll_controller = virtnet_netpoll;
429#endif 446#endif
447 SET_ETHTOOL_OPS(dev, &virtnet_ethtool_ops);
430 SET_NETDEV_DEV(dev, &vdev->dev); 448 SET_NETDEV_DEV(dev, &vdev->dev);
431 449
432 /* Do we support "hardware" checksums? */ 450 /* Do we support "hardware" checksums? */