Skip to content

Commit 1a03b8a

Browse files
hao022davem330
authored andcommitted
virtio-net: don't disable guest csum when disable LRO
Open vSwitch and Linux bridge will disable LRO of the interface when this interface added to them. Now when disable the LRO, the virtio-net csum is disable too. That drops the forwarding performance. Fixes: a02e896 ("virtio-net: ethtool configurable LRO") Cc: Michael S. Tsirkin <[email protected]> Cc: Jason Wang <[email protected]> Cc: Willem de Bruijn <[email protected]> Signed-off-by: Tonghao Zhang <[email protected]> Acked-by: Willem de Bruijn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 78b7015 commit 1a03b8a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/net/virtio_net.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ static const unsigned long guest_offloads[] = {
6363
VIRTIO_NET_F_GUEST_CSUM
6464
};
6565

66+
#define GUEST_OFFLOAD_LRO_MASK ((1ULL << VIRTIO_NET_F_GUEST_TSO4) | \
67+
(1ULL << VIRTIO_NET_F_GUEST_TSO6) | \
68+
(1ULL << VIRTIO_NET_F_GUEST_ECN) | \
69+
(1ULL << VIRTIO_NET_F_GUEST_UFO))
70+
6671
struct virtnet_stat_desc {
6772
char desc[ETH_GSTRING_LEN];
6873
size_t offset;
@@ -2531,7 +2536,8 @@ static int virtnet_set_features(struct net_device *dev,
25312536
if (features & NETIF_F_LRO)
25322537
offloads = vi->guest_offloads_capable;
25332538
else
2534-
offloads = 0;
2539+
offloads = vi->guest_offloads_capable &
2540+
~GUEST_OFFLOAD_LRO_MASK;
25352541

25362542
err = virtnet_set_guest_offloads(vi, offloads);
25372543
if (err)

0 commit comments

Comments
 (0)