virtio-net: Set RXCSUM feature if GUEST_CSUM is available

If the VIRTIO_NET_F_GUEST_CSUM virtio feature is available, the guest
does not have to calculate the checksums on all received packets. This
is pretty much the same feature as RX checksum offloading on real
network cards, so the virtio-net driver should report this by setting
the NETIF_F_RXCSUM flag. When the user now runs "ethtool -k", he or she
can see whether the virtio-net interface has to calculate RX checksums
or not.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Thomas Huth 2013-08-27 17:09:02 +02:00 committed by David S. Miller
parent 61c8106e29
commit 4f49129be6
1 changed files with 2 additions and 0 deletions

View File

@ -1538,6 +1538,8 @@ static int virtnet_probe(struct virtio_device *vdev)
dev->features |= dev->hw_features & (NETIF_F_ALL_TSO|NETIF_F_UFO); dev->features |= dev->hw_features & (NETIF_F_ALL_TSO|NETIF_F_UFO);
/* (!csum && gso) case will be fixed by register_netdev() */ /* (!csum && gso) case will be fixed by register_netdev() */
} }
if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_CSUM))
dev->features |= NETIF_F_RXCSUM;
dev->vlan_features = dev->features; dev->vlan_features = dev->features;