All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen-netfront: transmit fully GSO-sized packets
@ 2015-03-26 11:13 Jonathan Davies
  2015-03-26 12:05 ` Eric Dumazet
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Jonathan Davies @ 2015-03-26 11:13 UTC (permalink / raw)
  To: netdev, xen-devel, Konrad Rzeszutek Wilk, Boris Ostrovsky, David Vrabel
  Cc: Jonathan Davies, Wei Liu

xen-netfront limits transmitted skbs to be at most 44 segments in size. However,
GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448
bytes each. This slight reduction in the size of packets means a slight loss in
efficiency.

Since c/s 9ecd1a75d, xen-netfront sets gso_max_size to
    XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER,
where XEN_NETIF_MAX_TX_SIZE is 65535 bytes.

The calculation used by tcp_tso_autosize (and also tcp_xmit_size_goal since c/s
6c09fa09d) in determining when to split an skb into two is
    sk->sk_gso_max_size - 1 - MAX_TCP_HEADER.

So the maximum permitted size of an skb is calculated to be
    (XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER) - 1 - MAX_TCP_HEADER.

Intuitively, this looks like the wrong formula -- we don't need two TCP headers.
Instead, there is no need to deviate from the default gso_max_size of 65536 as
this already accommodates the size of the header.

Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments
of 1448 bytes each), as observed via tcpdump. This patch makes netfront send
skbs of up to 65160 bytes (45 segments of 1448 bytes each).

Fixes: 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header")
Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
---
 drivers/net/xen-netfront.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index e9b960f..fb6e978 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1279,8 +1279,6 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
 	netdev->ethtool_ops = &xennet_ethtool_ops;
 	SET_NETDEV_DEV(netdev, &dev->dev);
 
-	netif_set_gso_max_size(netdev, XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER);
-
 	np->netdev = netdev;
 
 	netif_carrier_off(netdev);
-- 
1.9.1

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

* Re: [PATCH] xen-netfront: transmit fully GSO-sized packets
  2015-03-26 11:13 [PATCH] xen-netfront: transmit fully GSO-sized packets Jonathan Davies
  2015-03-26 12:05 ` Eric Dumazet
@ 2015-03-26 12:05 ` Eric Dumazet
  2015-03-26 15:08   ` Jonathan Davies
  2015-03-26 15:08   ` Jonathan Davies
  2015-03-26 14:14 ` Sergei Shtylyov
  2015-03-26 14:14 ` Sergei Shtylyov
  3 siblings, 2 replies; 12+ messages in thread
From: Eric Dumazet @ 2015-03-26 12:05 UTC (permalink / raw)
  To: Jonathan Davies
  Cc: netdev, xen-devel, Konrad Rzeszutek Wilk, Boris Ostrovsky,
	David Vrabel, Wei Liu

On Thu, 2015-03-26 at 11:13 +0000, Jonathan Davies wrote:
> xen-netfront limits transmitted skbs to be at most 44 segments in size. However,
> GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448
> bytes each. This slight reduction in the size of packets means a slight loss in
> efficiency.
> 
> Since c/s 9ecd1a75d, xen-netfront sets gso_max_size to
>     XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER,
> where XEN_NETIF_MAX_TX_SIZE is 65535 bytes.
> 
> The calculation used by tcp_tso_autosize (and also tcp_xmit_size_goal since c/s
> 6c09fa09d) in determining when to split an skb into two is
>     sk->sk_gso_max_size - 1 - MAX_TCP_HEADER.
> 
> So the maximum permitted size of an skb is calculated to be
>     (XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER) - 1 - MAX_TCP_HEADER.
> 
> Intuitively, this looks like the wrong formula -- we don't need two TCP headers.
> Instead, there is no need to deviate from the default gso_max_size of 65536 as
> this already accommodates the size of the header.
> 
> Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments
> of 1448 bytes each), as observed via tcpdump. This patch makes netfront send
> skbs of up to 65160 bytes (45 segments of 1448 bytes each).
> 
> Fixes: 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header")
> Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
> ---
>  drivers/net/xen-netfront.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
> index e9b960f..fb6e978 100644
> --- a/drivers/net/xen-netfront.c
> +++ b/drivers/net/xen-netfront.c
> @@ -1279,8 +1279,6 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
>  	netdev->ethtool_ops = &xennet_ethtool_ops;
>  	SET_NETDEV_DEV(netdev, &dev->dev);
>  
> -	netif_set_gso_max_size(netdev, XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER);
> -
>  	np->netdev = netdev;
>  
>  	netif_carrier_off(netdev);

Hmm, this partially reverts commit
9ecd1a75d977e2e8c48139c7d3efed183f898d94



Why xennet_change_mtu() is not changed by your patch ?

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

* Re: [PATCH] xen-netfront: transmit fully GSO-sized packets
  2015-03-26 11:13 [PATCH] xen-netfront: transmit fully GSO-sized packets Jonathan Davies
@ 2015-03-26 12:05 ` Eric Dumazet
  2015-03-26 12:05 ` Eric Dumazet
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Eric Dumazet @ 2015-03-26 12:05 UTC (permalink / raw)
  To: Jonathan Davies; +Cc: Wei Liu, netdev, David Vrabel, xen-devel, Boris Ostrovsky

On Thu, 2015-03-26 at 11:13 +0000, Jonathan Davies wrote:
> xen-netfront limits transmitted skbs to be at most 44 segments in size. However,
> GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448
> bytes each. This slight reduction in the size of packets means a slight loss in
> efficiency.
> 
> Since c/s 9ecd1a75d, xen-netfront sets gso_max_size to
>     XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER,
> where XEN_NETIF_MAX_TX_SIZE is 65535 bytes.
> 
> The calculation used by tcp_tso_autosize (and also tcp_xmit_size_goal since c/s
> 6c09fa09d) in determining when to split an skb into two is
>     sk->sk_gso_max_size - 1 - MAX_TCP_HEADER.
> 
> So the maximum permitted size of an skb is calculated to be
>     (XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER) - 1 - MAX_TCP_HEADER.
> 
> Intuitively, this looks like the wrong formula -- we don't need two TCP headers.
> Instead, there is no need to deviate from the default gso_max_size of 65536 as
> this already accommodates the size of the header.
> 
> Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments
> of 1448 bytes each), as observed via tcpdump. This patch makes netfront send
> skbs of up to 65160 bytes (45 segments of 1448 bytes each).
> 
> Fixes: 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header")
> Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
> ---
>  drivers/net/xen-netfront.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
> index e9b960f..fb6e978 100644
> --- a/drivers/net/xen-netfront.c
> +++ b/drivers/net/xen-netfront.c
> @@ -1279,8 +1279,6 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
>  	netdev->ethtool_ops = &xennet_ethtool_ops;
>  	SET_NETDEV_DEV(netdev, &dev->dev);
>  
> -	netif_set_gso_max_size(netdev, XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER);
> -
>  	np->netdev = netdev;
>  
>  	netif_carrier_off(netdev);

Hmm, this partially reverts commit
9ecd1a75d977e2e8c48139c7d3efed183f898d94



Why xennet_change_mtu() is not changed by your patch ?

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

* Re: [PATCH] xen-netfront: transmit fully GSO-sized packets
  2015-03-26 11:13 [PATCH] xen-netfront: transmit fully GSO-sized packets Jonathan Davies
                   ` (2 preceding siblings ...)
  2015-03-26 14:14 ` Sergei Shtylyov
@ 2015-03-26 14:14 ` Sergei Shtylyov
  3 siblings, 0 replies; 12+ messages in thread
From: Sergei Shtylyov @ 2015-03-26 14:14 UTC (permalink / raw)
  To: Jonathan Davies, netdev, xen-devel, Konrad Rzeszutek Wilk,
	Boris Ostrovsky, David Vrabel
  Cc: Wei Liu

Hello.

On 3/26/2015 2:13 PM, Jonathan Davies wrote:

> xen-netfront limits transmitted skbs to be at most 44 segments in size. However,
> GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448
> bytes each. This slight reduction in the size of packets means a slight loss in
> efficiency.

> Since c/s 9ecd1a75d, xen-netfront sets gso_max_size to

    c/s == commit?
    Please also specify that commit's summary line in parens.

>      XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER,
> where XEN_NETIF_MAX_TX_SIZE is 65535 bytes.

> The calculation used by tcp_tso_autosize (and also tcp_xmit_size_goal since c/s
> 6c09fa09d) in determining when to split an skb into two is

    Likewise.

>      sk->sk_gso_max_size - 1 - MAX_TCP_HEADER.

> So the maximum permitted size of an skb is calculated to be
>      (XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER) - 1 - MAX_TCP_HEADER.

> Intuitively, this looks like the wrong formula -- we don't need two TCP headers.
> Instead, there is no need to deviate from the default gso_max_size of 65536 as
> this already accommodates the size of the header.

> Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments
> of 1448 bytes each), as observed via tcpdump. This patch makes netfront send
> skbs of up to 65160 bytes (45 segments of 1448 bytes each).

> Fixes: 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header")

    Ah, here's the summary for the first mentioned commit...

> Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>

WBR, Sergei

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

* Re: [PATCH] xen-netfront: transmit fully GSO-sized packets
  2015-03-26 11:13 [PATCH] xen-netfront: transmit fully GSO-sized packets Jonathan Davies
  2015-03-26 12:05 ` Eric Dumazet
  2015-03-26 12:05 ` Eric Dumazet
@ 2015-03-26 14:14 ` Sergei Shtylyov
  2015-03-26 14:14 ` Sergei Shtylyov
  3 siblings, 0 replies; 12+ messages in thread
From: Sergei Shtylyov @ 2015-03-26 14:14 UTC (permalink / raw)
  To: Jonathan Davies, netdev, xen-devel, Konrad Rzeszutek Wilk,
	Boris Ostrovsky, David Vrabel
  Cc: Wei Liu

Hello.

On 3/26/2015 2:13 PM, Jonathan Davies wrote:

> xen-netfront limits transmitted skbs to be at most 44 segments in size. However,
> GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448
> bytes each. This slight reduction in the size of packets means a slight loss in
> efficiency.

> Since c/s 9ecd1a75d, xen-netfront sets gso_max_size to

    c/s == commit?
    Please also specify that commit's summary line in parens.

>      XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER,
> where XEN_NETIF_MAX_TX_SIZE is 65535 bytes.

> The calculation used by tcp_tso_autosize (and also tcp_xmit_size_goal since c/s
> 6c09fa09d) in determining when to split an skb into two is

    Likewise.

>      sk->sk_gso_max_size - 1 - MAX_TCP_HEADER.

> So the maximum permitted size of an skb is calculated to be
>      (XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER) - 1 - MAX_TCP_HEADER.

> Intuitively, this looks like the wrong formula -- we don't need two TCP headers.
> Instead, there is no need to deviate from the default gso_max_size of 65536 as
> this already accommodates the size of the header.

> Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments
> of 1448 bytes each), as observed via tcpdump. This patch makes netfront send
> skbs of up to 65160 bytes (45 segments of 1448 bytes each).

> Fixes: 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header")

    Ah, here's the summary for the first mentioned commit...

> Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>

WBR, Sergei

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

* Re: [PATCH] xen-netfront: transmit fully GSO-sized packets
  2015-03-26 12:05 ` Eric Dumazet
  2015-03-26 15:08   ` Jonathan Davies
@ 2015-03-26 15:08   ` Jonathan Davies
  2015-03-30 13:46     ` Wei Liu
  2015-03-30 13:46     ` Wei Liu
  1 sibling, 2 replies; 12+ messages in thread
From: Jonathan Davies @ 2015-03-26 15:08 UTC (permalink / raw)
  To: Eric Dumazet, Wei Liu
  Cc: netdev, xen-devel, Konrad Rzeszutek Wilk, Boris Ostrovsky, David Vrabel


On 26/03/15 12:05, Eric Dumazet wrote:
> On Thu, 2015-03-26 at 11:13 +0000, Jonathan Davies wrote:
>> xen-netfront limits transmitted skbs to be at most 44 segments in size. However,
>> GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448
>> bytes each. This slight reduction in the size of packets means a slight loss in
>> efficiency.
>>
>> Since c/s 9ecd1a75d, xen-netfront sets gso_max_size to
>>      XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER,
>> where XEN_NETIF_MAX_TX_SIZE is 65535 bytes.
>>
>> The calculation used by tcp_tso_autosize (and also tcp_xmit_size_goal since c/s
>> 6c09fa09d) in determining when to split an skb into two is
>>      sk->sk_gso_max_size - 1 - MAX_TCP_HEADER.
>>
>> So the maximum permitted size of an skb is calculated to be
>>      (XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER) - 1 - MAX_TCP_HEADER.
>>
>> Intuitively, this looks like the wrong formula -- we don't need two TCP headers.
>> Instead, there is no need to deviate from the default gso_max_size of 65536 as
>> this already accommodates the size of the header.
>>
>> Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments
>> of 1448 bytes each), as observed via tcpdump. This patch makes netfront send
>> skbs of up to 65160 bytes (45 segments of 1448 bytes each).
>>
>> Fixes: 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header")
>> Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
>> ---
>>   drivers/net/xen-netfront.c | 2 --
>>   1 file changed, 2 deletions(-)
>>
>> diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
>> index e9b960f..fb6e978 100644
>> --- a/drivers/net/xen-netfront.c
>> +++ b/drivers/net/xen-netfront.c
>> @@ -1279,8 +1279,6 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
>>   	netdev->ethtool_ops = &xennet_ethtool_ops;
>>   	SET_NETDEV_DEV(netdev, &dev->dev);
>>
>> -	netif_set_gso_max_size(netdev, XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER);
>> -
>>   	np->netdev = netdev;
>>
>>   	netif_carrier_off(netdev);
>
> Hmm, this partially reverts commit
> 9ecd1a75d977e2e8c48139c7d3efed183f898d94
>
>
>
> Why xennet_change_mtu() is not changed by your patch ?

I think you are right: the mtu calculation suffers from the same 
problem. I believe the value of mtu relates to the size of the whole 
packet, including the header (which is why the value of dev->mtu is 
normally 1500 rather than 1448).

Wei, as the author of commit 9ecd1a75d977 ("xen-netfront: reduce 
gso_max_size to account for max TCP header"), do you agree that the max 
mtu formula should not need to subtract MAX_TCP_HEADER?

Regards,
Jonathan

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

* Re: [PATCH] xen-netfront: transmit fully GSO-sized packets
  2015-03-26 12:05 ` Eric Dumazet
@ 2015-03-26 15:08   ` Jonathan Davies
  2015-03-26 15:08   ` Jonathan Davies
  1 sibling, 0 replies; 12+ messages in thread
From: Jonathan Davies @ 2015-03-26 15:08 UTC (permalink / raw)
  To: Eric Dumazet, Wei Liu; +Cc: netdev, Boris Ostrovsky, David Vrabel, xen-devel


On 26/03/15 12:05, Eric Dumazet wrote:
> On Thu, 2015-03-26 at 11:13 +0000, Jonathan Davies wrote:
>> xen-netfront limits transmitted skbs to be at most 44 segments in size. However,
>> GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448
>> bytes each. This slight reduction in the size of packets means a slight loss in
>> efficiency.
>>
>> Since c/s 9ecd1a75d, xen-netfront sets gso_max_size to
>>      XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER,
>> where XEN_NETIF_MAX_TX_SIZE is 65535 bytes.
>>
>> The calculation used by tcp_tso_autosize (and also tcp_xmit_size_goal since c/s
>> 6c09fa09d) in determining when to split an skb into two is
>>      sk->sk_gso_max_size - 1 - MAX_TCP_HEADER.
>>
>> So the maximum permitted size of an skb is calculated to be
>>      (XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER) - 1 - MAX_TCP_HEADER.
>>
>> Intuitively, this looks like the wrong formula -- we don't need two TCP headers.
>> Instead, there is no need to deviate from the default gso_max_size of 65536 as
>> this already accommodates the size of the header.
>>
>> Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments
>> of 1448 bytes each), as observed via tcpdump. This patch makes netfront send
>> skbs of up to 65160 bytes (45 segments of 1448 bytes each).
>>
>> Fixes: 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header")
>> Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
>> ---
>>   drivers/net/xen-netfront.c | 2 --
>>   1 file changed, 2 deletions(-)
>>
>> diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
>> index e9b960f..fb6e978 100644
>> --- a/drivers/net/xen-netfront.c
>> +++ b/drivers/net/xen-netfront.c
>> @@ -1279,8 +1279,6 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
>>   	netdev->ethtool_ops = &xennet_ethtool_ops;
>>   	SET_NETDEV_DEV(netdev, &dev->dev);
>>
>> -	netif_set_gso_max_size(netdev, XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER);
>> -
>>   	np->netdev = netdev;
>>
>>   	netif_carrier_off(netdev);
>
> Hmm, this partially reverts commit
> 9ecd1a75d977e2e8c48139c7d3efed183f898d94
>
>
>
> Why xennet_change_mtu() is not changed by your patch ?

I think you are right: the mtu calculation suffers from the same 
problem. I believe the value of mtu relates to the size of the whole 
packet, including the header (which is why the value of dev->mtu is 
normally 1500 rather than 1448).

Wei, as the author of commit 9ecd1a75d977 ("xen-netfront: reduce 
gso_max_size to account for max TCP header"), do you agree that the max 
mtu formula should not need to subtract MAX_TCP_HEADER?

Regards,
Jonathan

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

* Re: [PATCH] xen-netfront: transmit fully GSO-sized packets
  2015-03-26 15:08   ` Jonathan Davies
@ 2015-03-30 13:46     ` Wei Liu
  2015-03-31  9:16       ` Jonathan Davies
  2015-03-31  9:16       ` Jonathan Davies
  2015-03-30 13:46     ` Wei Liu
  1 sibling, 2 replies; 12+ messages in thread
From: Wei Liu @ 2015-03-30 13:46 UTC (permalink / raw)
  To: Jonathan Davies
  Cc: Eric Dumazet, Wei Liu, netdev, xen-devel, Konrad Rzeszutek Wilk,
	Boris Ostrovsky, David Vrabel

On Thu, Mar 26, 2015 at 03:08:58PM +0000, Jonathan Davies wrote:
> 
> On 26/03/15 12:05, Eric Dumazet wrote:
> >On Thu, 2015-03-26 at 11:13 +0000, Jonathan Davies wrote:
> >>xen-netfront limits transmitted skbs to be at most 44 segments in size. However,
> >>GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448
> >>bytes each. This slight reduction in the size of packets means a slight loss in
> >>efficiency.
> >>
> >>Since c/s 9ecd1a75d, xen-netfront sets gso_max_size to
> >>     XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER,
> >>where XEN_NETIF_MAX_TX_SIZE is 65535 bytes.
> >>
> >>The calculation used by tcp_tso_autosize (and also tcp_xmit_size_goal since c/s
> >>6c09fa09d) in determining when to split an skb into two is
> >>     sk->sk_gso_max_size - 1 - MAX_TCP_HEADER.
> >>
> >>So the maximum permitted size of an skb is calculated to be
> >>     (XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER) - 1 - MAX_TCP_HEADER.
> >>
> >>Intuitively, this looks like the wrong formula -- we don't need two TCP headers.
> >>Instead, there is no need to deviate from the default gso_max_size of 65536 as
> >>this already accommodates the size of the header.
> >>
> >>Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments
> >>of 1448 bytes each), as observed via tcpdump. This patch makes netfront send
> >>skbs of up to 65160 bytes (45 segments of 1448 bytes each).
> >>
> >>Fixes: 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header")
> >>Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
> >>---
> >>  drivers/net/xen-netfront.c | 2 --
> >>  1 file changed, 2 deletions(-)
> >>
> >>diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
> >>index e9b960f..fb6e978 100644
> >>--- a/drivers/net/xen-netfront.c
> >>+++ b/drivers/net/xen-netfront.c
> >>@@ -1279,8 +1279,6 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
> >>  	netdev->ethtool_ops = &xennet_ethtool_ops;
> >>  	SET_NETDEV_DEV(netdev, &dev->dev);
> >>
> >>-	netif_set_gso_max_size(netdev, XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER);
> >>-
> >>  	np->netdev = netdev;
> >>
> >>  	netif_carrier_off(netdev);
> >
> >Hmm, this partially reverts commit
> >9ecd1a75d977e2e8c48139c7d3efed183f898d94
> >
> >
> >
> >Why xennet_change_mtu() is not changed by your patch ?
> 
> I think you are right: the mtu calculation suffers from the same problem. I
> believe the value of mtu relates to the size of the whole packet, including
> the header (which is why the value of dev->mtu is normally 1500 rather than
> 1448).
> 
> Wei, as the author of commit 9ecd1a75d977 ("xen-netfront: reduce
> gso_max_size to account for max TCP header"), do you agree that the max mtu
> formula should not need to subtract MAX_TCP_HEADER?
> 

IIRC at the time I wrote that patch I needed to subtract MAX_TCP_HEADER
otherwise netfront would generate oversized packets then get marked as
malicious by backend.

I think your reasoning is straightforward. Probably other core driver
changes have somehow mitigated the issues I saw.

Presuming you tested this change and saw no problems, I'm of course
happy with making netfront more efficient. :-)

Wei.

> Regards,
> Jonathan

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

* Re: [PATCH] xen-netfront: transmit fully GSO-sized packets
  2015-03-26 15:08   ` Jonathan Davies
  2015-03-30 13:46     ` Wei Liu
@ 2015-03-30 13:46     ` Wei Liu
  1 sibling, 0 replies; 12+ messages in thread
From: Wei Liu @ 2015-03-30 13:46 UTC (permalink / raw)
  To: Jonathan Davies
  Cc: Wei Liu, Eric Dumazet, netdev, David Vrabel, xen-devel, Boris Ostrovsky

On Thu, Mar 26, 2015 at 03:08:58PM +0000, Jonathan Davies wrote:
> 
> On 26/03/15 12:05, Eric Dumazet wrote:
> >On Thu, 2015-03-26 at 11:13 +0000, Jonathan Davies wrote:
> >>xen-netfront limits transmitted skbs to be at most 44 segments in size. However,
> >>GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448
> >>bytes each. This slight reduction in the size of packets means a slight loss in
> >>efficiency.
> >>
> >>Since c/s 9ecd1a75d, xen-netfront sets gso_max_size to
> >>     XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER,
> >>where XEN_NETIF_MAX_TX_SIZE is 65535 bytes.
> >>
> >>The calculation used by tcp_tso_autosize (and also tcp_xmit_size_goal since c/s
> >>6c09fa09d) in determining when to split an skb into two is
> >>     sk->sk_gso_max_size - 1 - MAX_TCP_HEADER.
> >>
> >>So the maximum permitted size of an skb is calculated to be
> >>     (XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER) - 1 - MAX_TCP_HEADER.
> >>
> >>Intuitively, this looks like the wrong formula -- we don't need two TCP headers.
> >>Instead, there is no need to deviate from the default gso_max_size of 65536 as
> >>this already accommodates the size of the header.
> >>
> >>Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments
> >>of 1448 bytes each), as observed via tcpdump. This patch makes netfront send
> >>skbs of up to 65160 bytes (45 segments of 1448 bytes each).
> >>
> >>Fixes: 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header")
> >>Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
> >>---
> >>  drivers/net/xen-netfront.c | 2 --
> >>  1 file changed, 2 deletions(-)
> >>
> >>diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
> >>index e9b960f..fb6e978 100644
> >>--- a/drivers/net/xen-netfront.c
> >>+++ b/drivers/net/xen-netfront.c
> >>@@ -1279,8 +1279,6 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
> >>  	netdev->ethtool_ops = &xennet_ethtool_ops;
> >>  	SET_NETDEV_DEV(netdev, &dev->dev);
> >>
> >>-	netif_set_gso_max_size(netdev, XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER);
> >>-
> >>  	np->netdev = netdev;
> >>
> >>  	netif_carrier_off(netdev);
> >
> >Hmm, this partially reverts commit
> >9ecd1a75d977e2e8c48139c7d3efed183f898d94
> >
> >
> >
> >Why xennet_change_mtu() is not changed by your patch ?
> 
> I think you are right: the mtu calculation suffers from the same problem. I
> believe the value of mtu relates to the size of the whole packet, including
> the header (which is why the value of dev->mtu is normally 1500 rather than
> 1448).
> 
> Wei, as the author of commit 9ecd1a75d977 ("xen-netfront: reduce
> gso_max_size to account for max TCP header"), do you agree that the max mtu
> formula should not need to subtract MAX_TCP_HEADER?
> 

IIRC at the time I wrote that patch I needed to subtract MAX_TCP_HEADER
otherwise netfront would generate oversized packets then get marked as
malicious by backend.

I think your reasoning is straightforward. Probably other core driver
changes have somehow mitigated the issues I saw.

Presuming you tested this change and saw no problems, I'm of course
happy with making netfront more efficient. :-)

Wei.

> Regards,
> Jonathan

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

* Re: [PATCH] xen-netfront: transmit fully GSO-sized packets
  2015-03-30 13:46     ` Wei Liu
@ 2015-03-31  9:16       ` Jonathan Davies
  2015-03-31  9:16       ` Jonathan Davies
  1 sibling, 0 replies; 12+ messages in thread
From: Jonathan Davies @ 2015-03-31  9:16 UTC (permalink / raw)
  To: Wei Liu
  Cc: Eric Dumazet, netdev, xen-devel, Konrad Rzeszutek Wilk,
	Boris Ostrovsky, David Vrabel

On 30/03/15 14:46, Wei Liu wrote:
> On Thu, Mar 26, 2015 at 03:08:58PM +0000, Jonathan Davies wrote:
>>
>> On 26/03/15 12:05, Eric Dumazet wrote:
>>> On Thu, 2015-03-26 at 11:13 +0000, Jonathan Davies wrote:
>>>> xen-netfront limits transmitted skbs to be at most 44 segments in size. However,
>>>> GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448
>>>> bytes each. This slight reduction in the size of packets means a slight loss in
>>>> efficiency.
>>>>
>>>> Since c/s 9ecd1a75d, xen-netfront sets gso_max_size to
>>>>      XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER,
>>>> where XEN_NETIF_MAX_TX_SIZE is 65535 bytes.
>>>>
>>>> The calculation used by tcp_tso_autosize (and also tcp_xmit_size_goal since c/s
>>>> 6c09fa09d) in determining when to split an skb into two is
>>>>      sk->sk_gso_max_size - 1 - MAX_TCP_HEADER.
>>>>
>>>> So the maximum permitted size of an skb is calculated to be
>>>>      (XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER) - 1 - MAX_TCP_HEADER.
>>>>
>>>> Intuitively, this looks like the wrong formula -- we don't need two TCP headers.
>>>> Instead, there is no need to deviate from the default gso_max_size of 65536 as
>>>> this already accommodates the size of the header.
>>>>
>>>> Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments
>>>> of 1448 bytes each), as observed via tcpdump. This patch makes netfront send
>>>> skbs of up to 65160 bytes (45 segments of 1448 bytes each).
>>>>
>>>> Fixes: 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header")
>>>> Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
>>>> ---
>>>>   drivers/net/xen-netfront.c | 2 --
>>>>   1 file changed, 2 deletions(-)
>>>>
>>>> diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
>>>> index e9b960f..fb6e978 100644
>>>> --- a/drivers/net/xen-netfront.c
>>>> +++ b/drivers/net/xen-netfront.c
>>>> @@ -1279,8 +1279,6 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
>>>>   	netdev->ethtool_ops = &xennet_ethtool_ops;
>>>>   	SET_NETDEV_DEV(netdev, &dev->dev);
>>>>
>>>> -	netif_set_gso_max_size(netdev, XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER);
>>>> -
>>>>   	np->netdev = netdev;
>>>>
>>>>   	netif_carrier_off(netdev);
>>>
>>> Hmm, this partially reverts commit
>>> 9ecd1a75d977e2e8c48139c7d3efed183f898d94
>>>
>>>
>>>
>>> Why xennet_change_mtu() is not changed by your patch ?
>>
>> I think you are right: the mtu calculation suffers from the same problem. I
>> believe the value of mtu relates to the size of the whole packet, including
>> the header (which is why the value of dev->mtu is normally 1500 rather than
>> 1448).
>>
>> Wei, as the author of commit 9ecd1a75d977 ("xen-netfront: reduce
>> gso_max_size to account for max TCP header"), do you agree that the max mtu
>> formula should not need to subtract MAX_TCP_HEADER?
>>
>
> IIRC at the time I wrote that patch I needed to subtract MAX_TCP_HEADER
> otherwise netfront would generate oversized packets then get marked as
> malicious by backend.
>
> I think your reasoning is straightforward. Probably other core driver
> changes have somehow mitigated the issues I saw.
>
> Presuming you tested this change and saw no problems, I'm of course
> happy with making netfront more efficient. :-)

Okay, thanks for confirming.

I'll post a v2 including the change to xennet_change_mtu.

Jonathan

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

* Re: [PATCH] xen-netfront: transmit fully GSO-sized packets
  2015-03-30 13:46     ` Wei Liu
  2015-03-31  9:16       ` Jonathan Davies
@ 2015-03-31  9:16       ` Jonathan Davies
  1 sibling, 0 replies; 12+ messages in thread
From: Jonathan Davies @ 2015-03-31  9:16 UTC (permalink / raw)
  To: Wei Liu; +Cc: Eric Dumazet, netdev, David Vrabel, xen-devel, Boris Ostrovsky

On 30/03/15 14:46, Wei Liu wrote:
> On Thu, Mar 26, 2015 at 03:08:58PM +0000, Jonathan Davies wrote:
>>
>> On 26/03/15 12:05, Eric Dumazet wrote:
>>> On Thu, 2015-03-26 at 11:13 +0000, Jonathan Davies wrote:
>>>> xen-netfront limits transmitted skbs to be at most 44 segments in size. However,
>>>> GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448
>>>> bytes each. This slight reduction in the size of packets means a slight loss in
>>>> efficiency.
>>>>
>>>> Since c/s 9ecd1a75d, xen-netfront sets gso_max_size to
>>>>      XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER,
>>>> where XEN_NETIF_MAX_TX_SIZE is 65535 bytes.
>>>>
>>>> The calculation used by tcp_tso_autosize (and also tcp_xmit_size_goal since c/s
>>>> 6c09fa09d) in determining when to split an skb into two is
>>>>      sk->sk_gso_max_size - 1 - MAX_TCP_HEADER.
>>>>
>>>> So the maximum permitted size of an skb is calculated to be
>>>>      (XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER) - 1 - MAX_TCP_HEADER.
>>>>
>>>> Intuitively, this looks like the wrong formula -- we don't need two TCP headers.
>>>> Instead, there is no need to deviate from the default gso_max_size of 65536 as
>>>> this already accommodates the size of the header.
>>>>
>>>> Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments
>>>> of 1448 bytes each), as observed via tcpdump. This patch makes netfront send
>>>> skbs of up to 65160 bytes (45 segments of 1448 bytes each).
>>>>
>>>> Fixes: 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header")
>>>> Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
>>>> ---
>>>>   drivers/net/xen-netfront.c | 2 --
>>>>   1 file changed, 2 deletions(-)
>>>>
>>>> diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
>>>> index e9b960f..fb6e978 100644
>>>> --- a/drivers/net/xen-netfront.c
>>>> +++ b/drivers/net/xen-netfront.c
>>>> @@ -1279,8 +1279,6 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
>>>>   	netdev->ethtool_ops = &xennet_ethtool_ops;
>>>>   	SET_NETDEV_DEV(netdev, &dev->dev);
>>>>
>>>> -	netif_set_gso_max_size(netdev, XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER);
>>>> -
>>>>   	np->netdev = netdev;
>>>>
>>>>   	netif_carrier_off(netdev);
>>>
>>> Hmm, this partially reverts commit
>>> 9ecd1a75d977e2e8c48139c7d3efed183f898d94
>>>
>>>
>>>
>>> Why xennet_change_mtu() is not changed by your patch ?
>>
>> I think you are right: the mtu calculation suffers from the same problem. I
>> believe the value of mtu relates to the size of the whole packet, including
>> the header (which is why the value of dev->mtu is normally 1500 rather than
>> 1448).
>>
>> Wei, as the author of commit 9ecd1a75d977 ("xen-netfront: reduce
>> gso_max_size to account for max TCP header"), do you agree that the max mtu
>> formula should not need to subtract MAX_TCP_HEADER?
>>
>
> IIRC at the time I wrote that patch I needed to subtract MAX_TCP_HEADER
> otherwise netfront would generate oversized packets then get marked as
> malicious by backend.
>
> I think your reasoning is straightforward. Probably other core driver
> changes have somehow mitigated the issues I saw.
>
> Presuming you tested this change and saw no problems, I'm of course
> happy with making netfront more efficient. :-)

Okay, thanks for confirming.

I'll post a v2 including the change to xennet_change_mtu.

Jonathan

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

* [PATCH] xen-netfront: transmit fully GSO-sized packets
@ 2015-03-26 11:13 Jonathan Davies
  0 siblings, 0 replies; 12+ messages in thread
From: Jonathan Davies @ 2015-03-26 11:13 UTC (permalink / raw)
  To: netdev, xen-devel, Konrad Rzeszutek Wilk, Boris Ostrovsky, David Vrabel
  Cc: Jonathan Davies, Wei Liu

xen-netfront limits transmitted skbs to be at most 44 segments in size. However,
GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448
bytes each. This slight reduction in the size of packets means a slight loss in
efficiency.

Since c/s 9ecd1a75d, xen-netfront sets gso_max_size to
    XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER,
where XEN_NETIF_MAX_TX_SIZE is 65535 bytes.

The calculation used by tcp_tso_autosize (and also tcp_xmit_size_goal since c/s
6c09fa09d) in determining when to split an skb into two is
    sk->sk_gso_max_size - 1 - MAX_TCP_HEADER.

So the maximum permitted size of an skb is calculated to be
    (XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER) - 1 - MAX_TCP_HEADER.

Intuitively, this looks like the wrong formula -- we don't need two TCP headers.
Instead, there is no need to deviate from the default gso_max_size of 65536 as
this already accommodates the size of the header.

Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments
of 1448 bytes each), as observed via tcpdump. This patch makes netfront send
skbs of up to 65160 bytes (45 segments of 1448 bytes each).

Fixes: 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header")
Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
---
 drivers/net/xen-netfront.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index e9b960f..fb6e978 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1279,8 +1279,6 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
 	netdev->ethtool_ops = &xennet_ethtool_ops;
 	SET_NETDEV_DEV(netdev, &dev->dev);
 
-	netif_set_gso_max_size(netdev, XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER);
-
 	np->netdev = netdev;
 
 	netif_carrier_off(netdev);
-- 
1.9.1

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

end of thread, other threads:[~2015-03-31  9:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-26 11:13 [PATCH] xen-netfront: transmit fully GSO-sized packets Jonathan Davies
2015-03-26 12:05 ` Eric Dumazet
2015-03-26 12:05 ` Eric Dumazet
2015-03-26 15:08   ` Jonathan Davies
2015-03-26 15:08   ` Jonathan Davies
2015-03-30 13:46     ` Wei Liu
2015-03-31  9:16       ` Jonathan Davies
2015-03-31  9:16       ` Jonathan Davies
2015-03-30 13:46     ` Wei Liu
2015-03-26 14:14 ` Sergei Shtylyov
2015-03-26 14:14 ` Sergei Shtylyov
  -- strict thread matches above, loose matches on Subject: below --
2015-03-26 11:13 Jonathan Davies

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.