Skip to contentSkip to conversation

vlan TSO support for virtio-net

PATCH In review Jason Wang 3 participants 6 messages Apr 11, 2013

Subsystems (4)
lore
Share & tools
lore

Jason Wang

author
#0 lore raw

cover vlan TSO support for virtio-net

This series simply enable the vlan TSO support for virtio-net by just initialize vlan_features for virtio-net and tun which allows vlan TSO packets to be processed in both TX and RX path for virtio-net.

Netperf shows great improvements on stream tests:

Before:

Guest sending:   4162.35 10^6bits/sec
Guest receiving: 2786.67 10^6bit/sec

After:

Guest sending:   9365.42 10^6bits/sec
Guest receiving: 8085.49 10^6bit/sec

Jason Wang (2):
virtio-net: initialize vlan_features
tuntap: initialize vlan_features

 drivers/net/tun.c        |    1 +
 drivers/net/virtio_net.c |    2 ++
 2 files changed, 3 insertions(+), 0 deletions(-)
author
#1 lore raw

PATCH 1/2 virtio-net: initialize vlan_features

There's nothing that prevent passing the device features of virtio_net to its vlan device. So this patch simply passes those to vlan device to benefit from advanced features.

Netperf shows better sending performance for vlan device since TSO can work on vlan now.

before:
netperf -H 192.168.5.2
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.5.2 () port 0 AF_INET : demo

Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

87380 16384 16384 10.00 4162.35

after:
netperf -H 192.168.5.2
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.5.2 () port 0 AF_INET : demo

Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

87380 16384 16384 10.00 9365.42

Cc Rusty Russell <[email protected]>
Cc "Michael S. Tsirkin" <[email protected]>
---
 drivers/net/virtio_net.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/virtio_net.c +2 -0
index f7d67e8..8fdfde6 100644
@@ -1511,6 +1511,8 @@ static int virtnet_probe(struct virtio_device *vdev)
 		/* (!csum && gso) case will be fixed by register_netdev() */
 	}
 
+	dev->vlan_features = dev->features;
+
 	/* Configuration may specify what MAC to use.  Otherwise random. */
 	if (virtio_config_val_len(vdev, VIRTIO_NET_F_MAC,
 				  offsetof(struct virtio_net_config, mac),
Signature · 1 line
1.7.1
author
#3 lore raw

PATCH 2/2 tuntap: initialize vlan_features

In reply to Jason Wang

The vlan_features was zero which prevents vlan GSO packets to be transmitted to userspace. This is suboptimal so enable this by initialize vlan_features for tuntap.

Netperf shows better performance of guest receiving since vlan TSO works for tuntap:

before:
netperf -H 192.168.5.4
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.5.4 () port 0 AF_INET : demo

Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

87380 16384 16384 10.01 2786.67

after:
netperf -H 192.168.5.4
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.5.4 () port 0 AF_INET : demo

Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

87380 16384 16384 10.00 8085.49

---
 drivers/net/tun.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/tun.c +1 -0
index 29538e6..316c759 100644
@@ -1656,6 +1656,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
 		dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST |
 			TUN_USER_FEATURES;
 		dev->features = dev->hw_features;
+		dev->vlan_features = dev->features;
 
 		INIT_LIST_HEAD(&tun->disabled);
 		err = tun_attach(tun, file);
Signature · 1 line
1.7.1
maintainer Acked-by on v1 1/2
#2 lore raw

Re: [net-next PATCH 1/2] virtio-net: initialize vlan_features

In reply to Jason Wang
Quoted 27 lines · Jason Wang

There's nothing that prevent passing the device features of virtio_net to its vlan device. So this patch simply passes those to vlan device to benefit from advanced features.

Netperf shows better sending performance for vlan device since TSO can work on vlan now.

before:
netperf -H 192.168.5.2
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.5.2 () port 0 AF_INET : demo

Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

87380 16384 16384 10.00 4162.35

after:
netperf -H 192.168.5.2
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.5.2 () port 0 AF_INET : demo

Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec
Quoted 5 lines

87380 16384 16384 10.00 9365.42

Cc Rusty Russell <[email protected]>
Cc "Michael S. Tsirkin" <[email protected]>
Quoted 19 lines
---
 drivers/net/virtio_net.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/virtio_net.c +2 -0
index f7d67e8..8fdfde6 100644
@@ -1511,6 +1511,8 @@ static int virtnet_probe(struct virtio_device *vdev)
 		/* (!csum && gso) case will be fixed by register_netdev() */
 	}
 
+	dev->vlan_features = dev->features;
+
 	/* Configuration may specify what MAC to use.  Otherwise random. */
 	if (virtio_config_val_len(vdev, VIRTIO_NET_F_MAC,
 				  offsetof(struct virtio_net_config, mac),
Signature · 1 line
1.7.1
maintainer Acked-by on v1 2/2
#4 lore raw

Re: [net-next PATCH 2/2] tuntap: initialize vlan_features

In reply to Jason Wang
Quoted 22 lines · Jason Wang

The vlan_features was zero which prevents vlan GSO packets to be transmitted to userspace. This is suboptimal so enable this by initialize vlan_features for tuntap.

Netperf shows better performance of guest receiving since vlan TSO works for tuntap:

before:
netperf -H 192.168.5.4
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.5.4 () port 0 AF_INET : demo

Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

87380 16384 16384 10.01 2786.67

after:
netperf -H 192.168.5.4
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.5.4 () port 0 AF_INET : demo

Quoted 8 lines
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

87380 16384 16384 10.00 8085.49

Quoted 18 lines
---
 drivers/net/tun.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/tun.c +1 -0
index 29538e6..316c759 100644
@@ -1656,6 +1656,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
 		dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST |
 			TUN_USER_FEATURES;
 		dev->features = dev->hw_features;
+		dev->vlan_features = dev->features;
 
 		INIT_LIST_HEAD(&tun->disabled);
 		err = tun_attach(tun, file);
Signature · 1 line
1.7.1
maintainer
#5 lore raw
In reply to Jason Wang

From: Jason Wang <[email protected]>
Date: Thu, 11 Apr 2013 17:32:20 +0800

Quoted 5 lines

This series simply enable the vlan TSO support for virtio-net by just initialize vlan_features for virtio-net and tun which allows vlan TSO packets to be processed in both TX and RX path for virtio-net.

Netperf shows great improvements on stream tests:

Both applied to net-next, thanks.