vlan TSO support for virtio-net
Subsystems (4)
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(-)
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
--- drivers/net/virtio_net.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/virtio_net.c +2 -0
@@ -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
PATCH 2/2 tuntap: initialize vlan_features
In reply to Jason WangThe 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
@@ -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
Re: [net-next PATCH 1/2] virtio-net: initialize vlan_features
In reply to Jason WangQuoted 27 lines · Jason Wang
There's nothing that prevent passing the device features of
virtio_netto 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 0AF_INETto 192.168.5.2 () port 0AF_INET: demoRecv Send Send Socket Socket Message Elapsed Size Size Size Time Throughput bytes bytes bytes secs. 10^6bits/sec87380 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 0AF_INETto 192.168.5.2 () port 0AF_INET: demoRecv 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]>Signed-off-by Jason Wang <[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@@ -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
Re: [net-next PATCH 2/2] tuntap: initialize vlan_features
In reply to Jason WangQuoted 22 lines · Jason Wang
The
vlan_featureswas zero which prevents vlan GSO packets to be transmitted to userspace. This is suboptimal so enable this by initializevlan_featuresfor 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 0AF_INETto 192.168.5.4 () port 0AF_INET: demoRecv Send Send Socket Socket Message Elapsed Size Size Size Time Throughput bytes bytes bytes secs. 10^6bits/sec87380 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 0AF_INETto 192.168.5.4 () port 0AF_INET: demo
Quoted 8 lines
Recv Send Send Socket Socket Message Elapsed Size Size Size Time Throughput bytes bytes bytes secs. 10^6bits/sec87380 16384 16384 10.00 8085.49
Signed-off-by Jason Wang <[email protected]>
Quoted 18 lines
--- drivers/net/tun.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)drivers/net/tun.c +1
-0@@ -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
David Miller
maintainerFrom: 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_featuresfor 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.