linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next PATCH 0/2] vlan TSO support for virtio-net
@ 2013-04-11  9:32 Jason Wang
  2013-04-11  9:32 ` [net-next PATCH 1/2] virtio-net: initialize vlan_features Jason Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jason Wang @ 2013-04-11  9:32 UTC (permalink / raw)
  To: davem, mst, netdev, linux-kernel; +Cc: Jason Wang

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(-)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [net-next PATCH 1/2] virtio-net: initialize vlan_features
  2013-04-11  9:32 [net-next PATCH 0/2] vlan TSO support for virtio-net Jason Wang
@ 2013-04-11  9:32 ` Jason Wang
  2013-04-11  9:55   ` Michael S. Tsirkin
  2013-04-11  9:32 ` [net-next PATCH 2/2] tuntap: " Jason Wang
  2013-04-11 20:22 ` [net-next PATCH 0/2] vlan TSO support for virtio-net David Miller
  2 siblings, 1 reply; 6+ messages in thread
From: Jason Wang @ 2013-04-11  9:32 UTC (permalink / raw)
  To: davem, mst, netdev, linux-kernel; +Cc: Jason Wang, Rusty Russell

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 <rusty@rustcorp.com.au>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 drivers/net/virtio_net.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index f7d67e8..8fdfde6 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -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),
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [net-next PATCH 2/2] tuntap: initialize vlan_features
  2013-04-11  9:32 [net-next PATCH 0/2] vlan TSO support for virtio-net Jason Wang
  2013-04-11  9:32 ` [net-next PATCH 1/2] virtio-net: initialize vlan_features Jason Wang
@ 2013-04-11  9:32 ` Jason Wang
  2013-04-11  9:55   ` Michael S. Tsirkin
  2013-04-11 20:22 ` [net-next PATCH 0/2] vlan TSO support for virtio-net David Miller
  2 siblings, 1 reply; 6+ messages in thread
From: Jason Wang @ 2013-04-11  9:32 UTC (permalink / raw)
  To: davem, mst, netdev, linux-kernel; +Cc: 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

Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 drivers/net/tun.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 29538e6..316c759 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -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);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [net-next PATCH 1/2] virtio-net: initialize vlan_features
  2013-04-11  9:32 ` [net-next PATCH 1/2] virtio-net: initialize vlan_features Jason Wang
@ 2013-04-11  9:55   ` Michael S. Tsirkin
  0 siblings, 0 replies; 6+ messages in thread
From: Michael S. Tsirkin @ 2013-04-11  9:55 UTC (permalink / raw)
  To: Jason Wang; +Cc: davem, netdev, linux-kernel, Rusty Russell

On Thu, Apr 11, 2013 at 05:32:21PM +0800, Jason Wang wrote:
> 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 <rusty@rustcorp.com.au>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  drivers/net/virtio_net.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index f7d67e8..8fdfde6 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -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),
> -- 
> 1.7.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [net-next PATCH 2/2] tuntap: initialize vlan_features
  2013-04-11  9:32 ` [net-next PATCH 2/2] tuntap: " Jason Wang
@ 2013-04-11  9:55   ` Michael S. Tsirkin
  0 siblings, 0 replies; 6+ messages in thread
From: Michael S. Tsirkin @ 2013-04-11  9:55 UTC (permalink / raw)
  To: Jason Wang; +Cc: davem, netdev, linux-kernel

On Thu, Apr 11, 2013 at 05:32:22PM +0800, Jason Wang wrote:
> 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
> 
> Signed-off-by: Jason Wang <jasowang@redhat.com>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  drivers/net/tun.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 29538e6..316c759 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -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);
> -- 
> 1.7.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [net-next PATCH 0/2] vlan TSO support for virtio-net
  2013-04-11  9:32 [net-next PATCH 0/2] vlan TSO support for virtio-net Jason Wang
  2013-04-11  9:32 ` [net-next PATCH 1/2] virtio-net: initialize vlan_features Jason Wang
  2013-04-11  9:32 ` [net-next PATCH 2/2] tuntap: " Jason Wang
@ 2013-04-11 20:22 ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2013-04-11 20:22 UTC (permalink / raw)
  To: jasowang; +Cc: mst, netdev, linux-kernel

From: Jason Wang <jasowang@redhat.com>
Date: Thu, 11 Apr 2013 17:32:20 +0800

> 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-04-11 20:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-11  9:32 [net-next PATCH 0/2] vlan TSO support for virtio-net Jason Wang
2013-04-11  9:32 ` [net-next PATCH 1/2] virtio-net: initialize vlan_features Jason Wang
2013-04-11  9:55   ` Michael S. Tsirkin
2013-04-11  9:32 ` [net-next PATCH 2/2] tuntap: " Jason Wang
2013-04-11  9:55   ` Michael S. Tsirkin
2013-04-11 20:22 ` [net-next PATCH 0/2] vlan TSO support for virtio-net David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).