aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/virtio_net.c
diff options
context:
space:
mode:
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>2011-03-30 21:01:35 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-01 23:53:35 -0400
commit98e778c9aa4f4f75550fa3a31358304e4ce67b96 (patch)
tree9294270ea7032777f02aebd78f2ca765fe5307b0 /drivers/net/virtio_net.c
parent9b12c75bf4d58dd85c987ee7b6a4356fdc7c1222 (diff)
virtio_net: convert to hw_features
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r--drivers/net/virtio_net.c46
1 files changed, 19 insertions, 27 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 82dba5aaf423..0cb0b0632672 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -710,17 +710,6 @@ static int virtnet_close(struct net_device *dev)
710 return 0; 710 return 0;
711} 711}
712 712
713static int virtnet_set_tx_csum(struct net_device *dev, u32 data)
714{
715 struct virtnet_info *vi = netdev_priv(dev);
716 struct virtio_device *vdev = vi->vdev;
717
718 if (data && !virtio_has_feature(vdev, VIRTIO_NET_F_CSUM))
719 return -ENOSYS;
720
721 return ethtool_op_set_tx_hw_csum(dev, data);
722}
723
724static void virtnet_set_rx_mode(struct net_device *dev) 713static void virtnet_set_rx_mode(struct net_device *dev)
725{ 714{
726 struct virtnet_info *vi = netdev_priv(dev); 715 struct virtnet_info *vi = netdev_priv(dev);
@@ -822,10 +811,6 @@ static void virtnet_vlan_rx_kill_vid(struct net_device *dev, u16 vid)
822} 811}
823 812
824static const struct ethtool_ops virtnet_ethtool_ops = { 813static const struct ethtool_ops virtnet_ethtool_ops = {
825 .set_tx_csum = virtnet_set_tx_csum,
826 .set_sg = ethtool_op_set_sg,
827 .set_tso = ethtool_op_set_tso,
828 .set_ufo = ethtool_op_set_ufo,
829 .get_link = ethtool_op_get_link, 814 .get_link = ethtool_op_get_link,
830}; 815};
831 816
@@ -912,22 +897,29 @@ static int virtnet_probe(struct virtio_device *vdev)
912 SET_NETDEV_DEV(dev, &vdev->dev); 897 SET_NETDEV_DEV(dev, &vdev->dev);
913 898
914 /* Do we support "hardware" checksums? */ 899 /* Do we support "hardware" checksums? */
915 if (csum && virtio_has_feature(vdev, VIRTIO_NET_F_CSUM)) { 900 if (virtio_has_feature(vdev, VIRTIO_NET_F_CSUM)) {
916 /* This opens up the world of extra features. */ 901 /* This opens up the world of extra features. */
917 dev->features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST; 902 dev->hw_features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST;
918 if (gso && virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) { 903 if (csum)
919 dev->features |= NETIF_F_TSO | NETIF_F_UFO 904 dev->features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST;
905
906 if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) {
907 dev->hw_features |= NETIF_F_TSO | NETIF_F_UFO
920 | NETIF_F_TSO_ECN | NETIF_F_TSO6; 908 | NETIF_F_TSO_ECN | NETIF_F_TSO6;
921 } 909 }
922 /* Individual feature bits: what can host handle? */ 910 /* Individual feature bits: what can host handle? */
923 if (gso && virtio_has_feature(vdev, VIRTIO_NET_F_HOST_TSO4)) 911 if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_TSO4))
924 dev->features |= NETIF_F_TSO; 912 dev->hw_features |= NETIF_F_TSO;
925 if (gso && virtio_has_feature(vdev, VIRTIO_NET_F_HOST_TSO6)) 913 if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_TSO6))
926 dev->features |= NETIF_F_TSO6; 914 dev->hw_features |= NETIF_F_TSO6;
927 if (gso && virtio_has_feature(vdev, VIRTIO_NET_F_HOST_ECN)) 915 if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_ECN))
928 dev->features |= NETIF_F_TSO_ECN; 916 dev->hw_features |= NETIF_F_TSO_ECN;
929 if (gso && virtio_has_feature(vdev, VIRTIO_NET_F_HOST_UFO)) 917 if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_UFO))
930 dev->features |= NETIF_F_UFO; 918 dev->hw_features |= NETIF_F_UFO;
919
920 if (gso)
921 dev->features |= dev->hw_features & (NETIF_F_ALL_TSO|NETIF_F_UFO);
922 /* (!csum && gso) case will be fixed by register_netdev() */
931 } 923 }
932 924
933 /* Configuration may specify what MAC to use. Otherwise random. */ 925 /* Configuration may specify what MAC to use. Otherwise random. */