netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 net] macvlan: Add support for 'always_on' offload features
@ 2014-03-03 20:33 Vlad Yasevich
  2014-03-03 21:44 ` David Miller
  2014-03-03 23:49 ` Ben Greear
  0 siblings, 2 replies; 4+ messages in thread
From: Vlad Yasevich @ 2014-03-03 20:33 UTC (permalink / raw)
  To: netdev
  Cc: Vlad Yasevich, Florian Westphal, Christian Borntraeger,
	Jason Wang, Michael S. Tsirkin

Macvlan currently inherits all of its features from the lower
device.  When lower device disables offload support, this causes
macvlan to disable offload support as well.  This causes
performance regression when using macvlan/macvtap in bridge
mode.

It can be easily demonstrated by creating 2 namespaces using
macvlan in bridge mode and running netperf between them:

MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.0.0.1 () port 0 AF_INET
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

 87380  16384  16384    20.00    1204.61

To restore the performance, we add software offload features
to the list of "always_on" features for macvlan.  This way
when a namespace or a guest using macvtap initially sends a
packet, this packet will not be segmented at macvlan level.
It will only be segmented when macvlan sends the packet
to the lower device.

MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.0.0.1 () port 0 AF_INET
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

 87380  16384  16384    20.00    5507.35

Fixes: 6acf54f1cf0a6747bac9fea26f34cfc5a9029523 (macvtap: Add support of packet capture on macvtap device.)
Fixes: 797f87f83b60685ff8a13fa0572d2f10393c50d3 (macvlan: fix netdev feature propagation from lower device)
CC: Florian Westphal <fw@strlen.de>
CC: Christian Borntraeger <borntraeger@de.ibm.com>
CC: Jason Wang <jasowang@redhat.com>
CC: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
---
v1-v2: Fixed dumb spelling error introduced while moving patches around.

 drivers/net/macvlan.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index a5d2189..2625d2a 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -506,6 +506,9 @@ static int macvlan_change_mtu(struct net_device *dev, int new_mtu)
 static struct lock_class_key macvlan_netdev_xmit_lock_key;
 static struct lock_class_key macvlan_netdev_addr_lock_key;
 
+#define ALWAYS_ON_FEATURES \
+	(NETIF_F_SG | NETIF_F_GEN_CSUM | NETIF_F_GSO_SOFTWARE | NETIF_F_LLTX)
+
 #define MACVLAN_FEATURES \
 	(NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \
 	 NETIF_F_GSO | NETIF_F_TSO | NETIF_F_UFO | NETIF_F_GSO_ROBUST | \
@@ -539,7 +542,7 @@ static int macvlan_init(struct net_device *dev)
 	dev->state		= (dev->state & ~MACVLAN_STATE_MASK) |
 				  (lowerdev->state & MACVLAN_STATE_MASK);
 	dev->features 		= lowerdev->features & MACVLAN_FEATURES;
-	dev->features		|= NETIF_F_LLTX;
+	dev->features		|= ALWAYS_ON_FEATURES;
 	dev->gso_max_size	= lowerdev->gso_max_size;
 	dev->iflink		= lowerdev->ifindex;
 	dev->hard_header_len	= lowerdev->hard_header_len;
@@ -699,7 +702,7 @@ static netdev_features_t macvlan_fix_features(struct net_device *dev,
 	features = netdev_increment_features(vlan->lowerdev->features,
 					     features,
 					     mask);
-	features |= NETIF_F_LLTX;
+	features |= ALWAYS_ON_FEATURES;
 
 	return features;
 }
-- 
1.8.5.3

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

* Re: [PATCH v2 net] macvlan: Add support for 'always_on' offload features
  2014-03-03 20:33 [PATCH v2 net] macvlan: Add support for 'always_on' offload features Vlad Yasevich
@ 2014-03-03 21:44 ` David Miller
  2014-03-03 23:49 ` Ben Greear
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2014-03-03 21:44 UTC (permalink / raw)
  To: vyasevic; +Cc: netdev, fw, borntraeger, jasowang, mst

From: Vlad Yasevich <vyasevic@redhat.com>
Date: Mon,  3 Mar 2014 15:33:53 -0500

> Macvlan currently inherits all of its features from the lower
> device.  When lower device disables offload support, this causes
> macvlan to disable offload support as well.  This causes
> performance regression when using macvlan/macvtap in bridge
> mode.
> 
> It can be easily demonstrated by creating 2 namespaces using
> macvlan in bridge mode and running netperf between them:
> 
> MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.0.0.1 () port 0 AF_INET
> Recv   Send    Send
> Socket Socket  Message  Elapsed
> Size   Size    Size     Time     Throughput
> bytes  bytes   bytes    secs.    10^6bits/sec
> 
>  87380  16384  16384    20.00    1204.61
> 
> To restore the performance, we add software offload features
> to the list of "always_on" features for macvlan.  This way
> when a namespace or a guest using macvtap initially sends a
> packet, this packet will not be segmented at macvlan level.
> It will only be segmented when macvlan sends the packet
> to the lower device.
> 
> MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.0.0.1 () port 0 AF_INET
> Recv   Send    Send
> Socket Socket  Message  Elapsed
> Size   Size    Size     Time     Throughput
> bytes  bytes   bytes    secs.    10^6bits/sec
> 
>  87380  16384  16384    20.00    5507.35
> 
> Fixes: 6acf54f1cf0a6747bac9fea26f34cfc5a9029523 (macvtap: Add support of packet capture on macvtap device.)
> Fixes: 797f87f83b60685ff8a13fa0572d2f10393c50d3 (macvlan: fix netdev feature propagation from lower device)
> CC: Florian Westphal <fw@strlen.de>
> CC: Christian Borntraeger <borntraeger@de.ibm.com>
> CC: Jason Wang <jasowang@redhat.com>
> CC: Michael S. Tsirkin <mst@redhat.com>
> Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
> Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>

Applied, thanks Vlad.

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

* Re: [PATCH v2 net] macvlan: Add support for 'always_on' offload features
  2014-03-03 20:33 [PATCH v2 net] macvlan: Add support for 'always_on' offload features Vlad Yasevich
  2014-03-03 21:44 ` David Miller
@ 2014-03-03 23:49 ` Ben Greear
  2014-03-04 13:44   ` Vlad Yasevich
  1 sibling, 1 reply; 4+ messages in thread
From: Ben Greear @ 2014-03-03 23:49 UTC (permalink / raw)
  To: Vlad Yasevich
  Cc: netdev, Florian Westphal, Christian Borntraeger, Jason Wang,
	Michael S. Tsirkin

On 03/03/2014 12:33 PM, Vlad Yasevich wrote:
> Macvlan currently inherits all of its features from the lower
> device.  When lower device disables offload support, this causes
> macvlan to disable offload support as well.  This causes
> performance regression when using macvlan/macvtap in bridge
> mode.
> 
> It can be easily demonstrated by creating 2 namespaces using
> macvlan in bridge mode and running netperf between them:
> 
> MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.0.0.1 () port 0 AF_INET
> Recv   Send    Send
> Socket Socket  Message  Elapsed
> Size   Size    Size     Time     Throughput
> bytes  bytes   bytes    secs.    10^6bits/sec
> 
>  87380  16384  16384    20.00    1204.61
> 
> To restore the performance, we add software offload features
> to the list of "always_on" features for macvlan.  This way
> when a namespace or a guest using macvtap initially sends a
> packet, this packet will not be segmented at macvlan level.
> It will only be segmented when macvlan sends the packet
> to the lower device.

If users specifically disable the offload features on the macvlan using ethtool,
will they be turned off?  If not, then I think that logic should
be kept somehow?

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

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

* Re: [PATCH v2 net] macvlan: Add support for 'always_on' offload features
  2014-03-03 23:49 ` Ben Greear
@ 2014-03-04 13:44   ` Vlad Yasevich
  0 siblings, 0 replies; 4+ messages in thread
From: Vlad Yasevich @ 2014-03-04 13:44 UTC (permalink / raw)
  To: Ben Greear
  Cc: netdev, Florian Westphal, Christian Borntraeger, Jason Wang,
	Michael S. Tsirkin

On 03/03/2014 06:49 PM, Ben Greear wrote:
> On 03/03/2014 12:33 PM, Vlad Yasevich wrote:
>> Macvlan currently inherits all of its features from the lower
>> device.  When lower device disables offload support, this causes
>> macvlan to disable offload support as well.  This causes
>> performance regression when using macvlan/macvtap in bridge
>> mode.
>>
>> It can be easily demonstrated by creating 2 namespaces using
>> macvlan in bridge mode and running netperf between them:
>>
>> MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.0.0.1 () port 0 AF_INET
>> Recv   Send    Send
>> Socket Socket  Message  Elapsed
>> Size   Size    Size     Time     Throughput
>> bytes  bytes   bytes    secs.    10^6bits/sec
>>
>>  87380  16384  16384    20.00    1204.61
>>
>> To restore the performance, we add software offload features
>> to the list of "always_on" features for macvlan.  This way
>> when a namespace or a guest using macvtap initially sends a
>> packet, this packet will not be segmented at macvlan level.
>> It will only be segmented when macvlan sends the packet
>> to the lower device.
> 
> If users specifically disable the offload features on the macvlan using ethtool,
> will they be turned off?  If not, then I think that logic should
> be kept somehow?

Just looked and offloads on macvlan are fixed even before this patch,
so a user can't disable them.

Looks like the only way to disable them prior to this patch was to
change the features of the lower device.  However, that introduces
an issue when running in bridged mode that this patch fixes.

-vlad

> 
> Thanks,
> Ben
> 

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

end of thread, other threads:[~2014-03-04 13:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-03 20:33 [PATCH v2 net] macvlan: Add support for 'always_on' offload features Vlad Yasevich
2014-03-03 21:44 ` David Miller
2014-03-03 23:49 ` Ben Greear
2014-03-04 13:44   ` Vlad Yasevich

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