Skip to contentSkip to conversation

virtio-net: Set RXCSUM feature if GUEST_CSUM is available

PATCH In review Thomas Huth 3 participants 3 messages Aug 27, 2013 – Sep 2, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/net/virtio_net.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/virtio_net.c +2 -0
index f216002..defec2b 100644
@@ -1538,6 +1538,8 @@ static int virtnet_probe(struct virtio_device *vdev)
 			dev->features |= dev->hw_features & (NETIF_F_ALL_TSO|NETIF_F_UFO);
 		/* (!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;
 
Signature · 1 line
1.8.1.4
maintainer
#1 lore raw

From: Thomas Huth <[email protected]>
Date: Tue, 27 Aug 2013 17:09:02 +0200

Quoted 9 lines

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.

Can one of the virtio_net folks please review this?

Thanks.

Acked-by
#2 lore raw
Quoted 11 lines · David Miller

From: Thomas Huth <[email protected]>
Date: Tue, 27 Aug 2013 17:09:02 +0200

Quoted 8 lines

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.

Quoted 3 lines
Quoted 1 line

Can one of the virtio_net folks please review this?

Hmm, so NETIF_F_RXCSUM only exists for ethtool's benefit. Weird.

But this patch is correct:

Thanks,
Rusty.