netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC net-next 0/2] net: two updates related to UDP GSO
@ 2020-07-08  3:48 Huazhong Tan
  2020-07-08  3:48 ` [RFC net-next 1/2] udp: add NETIF_F_GSO_UDP_L4 to NETIF_F_SOFTWARE_GSO Huazhong Tan
  2020-07-08  3:48 ` [RFC net-next 2/2] net: disable UDP GSO feature when CSUM is disabled Huazhong Tan
  0 siblings, 2 replies; 13+ messages in thread
From: Huazhong Tan @ 2020-07-08  3:48 UTC (permalink / raw)
  To: davem, willemb; +Cc: netdev, linuxarm, kuba, Huazhong Tan

There are two updates related to UDP GSO.
#1 adds NETIF_F_GSO_UDP_L4 to NETIF_F_SOFTWARE_GSO, then the virtual
device can postpone its UDP GSO to physical device, as extention to
commit 83aa025f535f ("udp: add gso support to virtual devices").
#2 disable UDP GSO feature when CSUM is disabled. Currently, when
disabled CSUM, sending a UDP packet who needs segmentation will will
fail, but from user-space the UDP GSO feature is enabled, so disble
UDP GSO feature when CSUM disabled just like what TSO does now.

Huazhong Tan (2):
  udp: add NETIF_F_GSO_UDP_L4 to NETIF_F_SOFTWARE_GSO
  net: disable UDP GSO feature when CSUM is disabled

 include/linux/netdev_features.h | 2 +-
 net/core/dev.c                  | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

-- 
2.7.4


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

* [RFC net-next 1/2] udp: add NETIF_F_GSO_UDP_L4 to NETIF_F_SOFTWARE_GSO
  2020-07-08  3:48 [RFC net-next 0/2] net: two updates related to UDP GSO Huazhong Tan
@ 2020-07-08  3:48 ` Huazhong Tan
  2020-07-08  5:26   ` Eric Dumazet
  2020-07-08 12:11   ` Willem de Bruijn
  2020-07-08  3:48 ` [RFC net-next 2/2] net: disable UDP GSO feature when CSUM is disabled Huazhong Tan
  1 sibling, 2 replies; 13+ messages in thread
From: Huazhong Tan @ 2020-07-08  3:48 UTC (permalink / raw)
  To: davem, willemb; +Cc: netdev, linuxarm, kuba, Huazhong Tan

Add NETIF_F_SOFTWARE_GSO to the the list of GSO features with
a software fallback.  This allows UDP GSO to be used even if
the hardware does not support it, and for virtual device such
as VxLAN device, this UDP segmentation will be postponed to
physical device.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
---
 include/linux/netdev_features.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 2cc3cf8..c7eef16 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -207,7 +207,7 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start)
 				 NETIF_F_FSO)
 
 /* List of features with software fallbacks. */
-#define NETIF_F_GSO_SOFTWARE	(NETIF_F_ALL_TSO | \
+#define NETIF_F_GSO_SOFTWARE	(NETIF_F_ALL_TSO | NETIF_F_GSO_UDP_L4 | \
 				 NETIF_F_GSO_SCTP)
 
 /*
-- 
2.7.4


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

* [RFC net-next 2/2] net: disable UDP GSO feature when CSUM is disabled
  2020-07-08  3:48 [RFC net-next 0/2] net: two updates related to UDP GSO Huazhong Tan
  2020-07-08  3:48 ` [RFC net-next 1/2] udp: add NETIF_F_GSO_UDP_L4 to NETIF_F_SOFTWARE_GSO Huazhong Tan
@ 2020-07-08  3:48 ` Huazhong Tan
  2020-07-08  5:36   ` Eric Dumazet
  1 sibling, 1 reply; 13+ messages in thread
From: Huazhong Tan @ 2020-07-08  3:48 UTC (permalink / raw)
  To: davem, willemb; +Cc: netdev, linuxarm, kuba, Huazhong Tan

Since UDP GSO feature is depended on checksum offload, so disable
UDP GSO feature when CSUM is disabled, then from user-space also
can see UDP GSO feature is disabled.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
---
 net/core/dev.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/core/dev.c b/net/core/dev.c
index c02bae9..dcb6b35 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -9095,6 +9095,12 @@ static netdev_features_t netdev_fix_features(struct net_device *dev,
 		features &= ~NETIF_F_TSO6;
 	}
 
+	if ((features & NETIF_F_GSO_UDP_L4) && !(features & NETIF_F_HW_CSUM) &&
+	    (!(features & NETIF_F_IP_CSUM) || !(features & NETIF_F_IPV6_CSUM))) {
+		netdev_dbg(dev, "Dropping UDP GSO features since no CSUM feature.\n");
+		features &= ~NETIF_F_GSO_UDP_L4;
+	}
+
 	/* TSO with IPv4 ID mangling requires IPv4 TSO be enabled */
 	if ((features & NETIF_F_TSO_MANGLEID) && !(features & NETIF_F_TSO))
 		features &= ~NETIF_F_TSO_MANGLEID;
-- 
2.7.4


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

* Re: [RFC net-next 1/2] udp: add NETIF_F_GSO_UDP_L4 to NETIF_F_SOFTWARE_GSO
  2020-07-08  3:48 ` [RFC net-next 1/2] udp: add NETIF_F_GSO_UDP_L4 to NETIF_F_SOFTWARE_GSO Huazhong Tan
@ 2020-07-08  5:26   ` Eric Dumazet
  2020-07-09  2:16     ` tanhuazhong
  2020-07-08 12:11   ` Willem de Bruijn
  1 sibling, 1 reply; 13+ messages in thread
From: Eric Dumazet @ 2020-07-08  5:26 UTC (permalink / raw)
  To: Huazhong Tan, davem, willemb; +Cc: netdev, linuxarm, kuba



On 7/7/20 8:48 PM, Huazhong Tan wrote:
> Add NETIF_F_SOFTWARE_GSO to the the list of GSO features with


s/NETIF_F_SOFTWARE_GSO/NETIF_F_GSO_UDP_L4/

> a software fallback.  This allows UDP GSO to be used even if
> the hardware does not support it, and for virtual device such
> as VxLAN device, this UDP segmentation will be postponed to
> physical device.

Is GSO stack or hardware USO able to perform this segmentation,
with vxlan (or other) added encapsulation ?

What about code in net/core/tso.c (in net-next tree) ?

> 
> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
> ---
>  include/linux/netdev_features.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
> index 2cc3cf8..c7eef16 100644
> --- a/include/linux/netdev_features.h
> +++ b/include/linux/netdev_features.h
> @@ -207,7 +207,7 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start)
>  				 NETIF_F_FSO)
>  
>  /* List of features with software fallbacks. */
> -#define NETIF_F_GSO_SOFTWARE	(NETIF_F_ALL_TSO | \
> +#define NETIF_F_GSO_SOFTWARE	(NETIF_F_ALL_TSO | NETIF_F_GSO_UDP_L4 | \
>  				 NETIF_F_GSO_SCTP)
>  
>  /*
> 

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

* Re: [RFC net-next 2/2] net: disable UDP GSO feature when CSUM is disabled
  2020-07-08  3:48 ` [RFC net-next 2/2] net: disable UDP GSO feature when CSUM is disabled Huazhong Tan
@ 2020-07-08  5:36   ` Eric Dumazet
  2020-07-09  2:30     ` tanhuazhong
  0 siblings, 1 reply; 13+ messages in thread
From: Eric Dumazet @ 2020-07-08  5:36 UTC (permalink / raw)
  To: Huazhong Tan, davem, willemb; +Cc: netdev, linuxarm, kuba



On 7/7/20 8:48 PM, Huazhong Tan wrote:
> Since UDP GSO feature is depended on checksum offload, so disable
> UDP GSO feature when CSUM is disabled, then from user-space also
> can see UDP GSO feature is disabled.
> 
> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
> ---
>  net/core/dev.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index c02bae9..dcb6b35 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -9095,6 +9095,12 @@ static netdev_features_t netdev_fix_features(struct net_device *dev,
>  		features &= ~NETIF_F_TSO6;
>  	}
>  
> +	if ((features & NETIF_F_GSO_UDP_L4) && !(features & NETIF_F_HW_CSUM) &&
> +	    (!(features & NETIF_F_IP_CSUM) || !(features & NETIF_F_IPV6_CSUM))) {

This would prevent a device providing IPv4 checksum only (no IPv6 csum support) from sending IPv4 UDP GSO packets ?

> +		netdev_dbg(dev, "Dropping UDP GSO features since no CSUM feature.\n");
> +		features &= ~NETIF_F_GSO_UDP_L4;
> +	}
> +
>  	/* TSO with IPv4 ID mangling requires IPv4 TSO be enabled */
>  	if ((features & NETIF_F_TSO_MANGLEID) && !(features & NETIF_F_TSO))
>  		features &= ~NETIF_F_TSO_MANGLEID;
> 

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

* Re: [RFC net-next 1/2] udp: add NETIF_F_GSO_UDP_L4 to NETIF_F_SOFTWARE_GSO
  2020-07-08  3:48 ` [RFC net-next 1/2] udp: add NETIF_F_GSO_UDP_L4 to NETIF_F_SOFTWARE_GSO Huazhong Tan
  2020-07-08  5:26   ` Eric Dumazet
@ 2020-07-08 12:11   ` Willem de Bruijn
  2020-07-09  2:49     ` tanhuazhong
  1 sibling, 1 reply; 13+ messages in thread
From: Willem de Bruijn @ 2020-07-08 12:11 UTC (permalink / raw)
  To: Huazhong Tan; +Cc: David Miller, Network Development, linuxarm, Jakub Kicinski

On Tue, Jul 7, 2020 at 11:50 PM Huazhong Tan <tanhuazhong@huawei.com> wrote:
>
> Add NETIF_F_SOFTWARE_GSO to the the list of GSO features with
> a software fallback.  This allows UDP GSO to be used even if
> the hardware does not support it,

That is already the case if just calling UDP_SEGMENT.

It seems the specific goal here is to postpone segmentation when
going through a vxlan device?

> and for virtual device such
> as VxLAN device, this UDP segmentation will be postponed to
> physical device.

See previous commits

commit 83aa025f535f76733e334e3d2a4d8577c8441a7e
Author: Willem de Bruijn <willemb@google.com>
Date:   Thu Apr 26 13:42:21 2018 -0400

    udp: add gso support to virtual devices

    Virtual devices such as tunnels and bonding can handle large packets.
    Only segment packets when reaching a physical or loopback device.

    Signed-off-by: Willem de Bruijn <willemb@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

and

commit 8eea1ca82be90a7e7a4624ab9cb323574a5f71df
Author: Willem de Bruijn <willemb@google.com>
Date:   Tue May 22 11:34:40 2018 -0400

    gso: limit udp gso to egress-only virtual devices

    Until the udp receive stack supports large packets (UDP GRO), GSO
    packets must not loop from the egress to the ingress path.

    Revert the change that added NETIF_F_GSO_UDP_L4 to various virtual
    devices through NETIF_F_GSO_ENCAP_ALL as this included devices that
    may loop packets, such as veth and macvlan.

    Instead add it to specific devices that forward to another device's
    egress path, bonding and team.

    Fixes: 83aa025f535f ("udp: add gso support to virtual devices")
    CC: Alexander Duyck <alexander.duyck@gmail.com>
    Signed-off-by: Willem de Bruijn <willemb@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Though with UDP_GRO this specific loop concern is addressed.



> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
> ---
>  include/linux/netdev_features.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
> index 2cc3cf8..c7eef16 100644
> --- a/include/linux/netdev_features.h
> +++ b/include/linux/netdev_features.h
> @@ -207,7 +207,7 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start)
>                                  NETIF_F_FSO)
>
>  /* List of features with software fallbacks. */
> -#define NETIF_F_GSO_SOFTWARE   (NETIF_F_ALL_TSO | \
> +#define NETIF_F_GSO_SOFTWARE   (NETIF_F_ALL_TSO | NETIF_F_GSO_UDP_L4 | \
>                                  NETIF_F_GSO_SCTP)
>
>  /*
> --
> 2.7.4
>

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

* Re: [RFC net-next 1/2] udp: add NETIF_F_GSO_UDP_L4 to NETIF_F_SOFTWARE_GSO
  2020-07-08  5:26   ` Eric Dumazet
@ 2020-07-09  2:16     ` tanhuazhong
  2020-07-09  2:28       ` Eric Dumazet
  0 siblings, 1 reply; 13+ messages in thread
From: tanhuazhong @ 2020-07-09  2:16 UTC (permalink / raw)
  To: Eric Dumazet, davem, willemb; +Cc: netdev, linuxarm, kuba



On 2020/7/8 13:26, Eric Dumazet wrote:
> 
> 
> On 7/7/20 8:48 PM, Huazhong Tan wrote:
>> Add NETIF_F_SOFTWARE_GSO to the the list of GSO features with
> 
> 
> s/NETIF_F_SOFTWARE_GSO/NETIF_F_GSO_UDP_L4/
> 

yes, thanks.

>> a software fallback.  This allows UDP GSO to be used even if
>> the hardware does not support it, and for virtual device such
>> as VxLAN device, this UDP segmentation will be postponed to
>> physical device.
> 
> Is GSO stack or hardware USO able to perform this segmentation,
> with vxlan (or other) added encapsulation ?
> 

I have tested this patch with vxlan and vlan in i40e, the driver
of vxlan and vlan uses  NETIF_F_SOFTWARE_GSO.
case 1:
tx-udp-segmentation of virtual device and i40e is on, then the
UDP GSO is handled by hardware.
case 2:
tx-udp-segmentation of virual device is on, i40e is off, then
the UDP GSO is handled between xmit of virtual device and physical device.
case 3:
tx-udp-segmentation of virtual device and i40e is off, then
the UDP GSO is handled before calling virtual device's xmit.

the packet captured on receiver is same for the above cases.
so the behavior of UDP is similar to TCP (which has already been supported)?

> What about code in net/core/tso.c (in net-next tree) ?
> 

by reading the code, i can not find anything related to the
tunnel header. Is there any way to verify it?

Thanks for reviewing:)

>>
>> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
>> ---
>>   include/linux/netdev_features.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
>> index 2cc3cf8..c7eef16 100644
>> --- a/include/linux/netdev_features.h
>> +++ b/include/linux/netdev_features.h
>> @@ -207,7 +207,7 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start)
>>   				 NETIF_F_FSO)
>>   
>>   /* List of features with software fallbacks. */
>> -#define NETIF_F_GSO_SOFTWARE	(NETIF_F_ALL_TSO | \
>> +#define NETIF_F_GSO_SOFTWARE	(NETIF_F_ALL_TSO | NETIF_F_GSO_UDP_L4 | \
>>   				 NETIF_F_GSO_SCTP)
>>   
>>   /*
>>
> 
> 


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

* Re: [RFC net-next 1/2] udp: add NETIF_F_GSO_UDP_L4 to NETIF_F_SOFTWARE_GSO
  2020-07-09  2:16     ` tanhuazhong
@ 2020-07-09  2:28       ` Eric Dumazet
  0 siblings, 0 replies; 13+ messages in thread
From: Eric Dumazet @ 2020-07-09  2:28 UTC (permalink / raw)
  To: tanhuazhong, Eric Dumazet, davem, willemb; +Cc: netdev, linuxarm, kuba



On 7/8/20 7:16 PM, tanhuazhong wrote:
> 
> 
> On 2020/7/8 13:26, Eric Dumazet wrote:
>>
>>
>> On 7/7/20 8:48 PM, Huazhong Tan wrote:
>>> Add NETIF_F_SOFTWARE_GSO to the the list of GSO features with
>>
>>
>> s/NETIF_F_SOFTWARE_GSO/NETIF_F_GSO_UDP_L4/
>>
> 
> yes, thanks.
> 
>>> a software fallback.  This allows UDP GSO to be used even if
>>> the hardware does not support it, and for virtual device such
>>> as VxLAN device, this UDP segmentation will be postponed to
>>> physical device.
>>
>> Is GSO stack or hardware USO able to perform this segmentation,
>> with vxlan (or other) added encapsulation ?
>>
> 
> I have tested this patch with vxlan and vlan in i40e, the driver
> of vxlan and vlan uses  NETIF_F_SOFTWARE_GSO.
> case 1:
> tx-udp-segmentation of virtual device and i40e is on, then the
> UDP GSO is handled by hardware.
> case 2:
> tx-udp-segmentation of virual device is on, i40e is off, then
> the UDP GSO is handled between xmit of virtual device and physical device.
> case 3:
> tx-udp-segmentation of virtual device and i40e is off, then
> the UDP GSO is handled before calling virtual device's xmit.
> 
> the packet captured on receiver is same for the above cases.
> so the behavior of UDP is similar to TCP (which has already been supported)?
> 
>> What about code in net/core/tso.c (in net-next tree) ?
>>
> 
> by reading the code, i can not find anything related to the
> tunnel header. Is there any way to verify it?
>

TSO is supposed to be native ipv4 + TCP
TSO6 is supposed to be native ipv6 + TCP


Variants with added encapsulation need other GSO bits
(SKB_GSO_GRE, SKB_GSO_IPXIP4, SKB_GSO_IPXIP6 ...)

net/core/tso.c does not yet support the variants. Only native TCP/UDP

I do not see vxlan adding a bit in gso_type, so I am kind-of-confused.




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

* Re: [RFC net-next 2/2] net: disable UDP GSO feature when CSUM is disabled
  2020-07-08  5:36   ` Eric Dumazet
@ 2020-07-09  2:30     ` tanhuazhong
  2020-07-09  2:47       ` Eric Dumazet
  0 siblings, 1 reply; 13+ messages in thread
From: tanhuazhong @ 2020-07-09  2:30 UTC (permalink / raw)
  To: Eric Dumazet, davem, willemb; +Cc: netdev, linuxarm, kuba



On 2020/7/8 13:36, Eric Dumazet wrote:
> 
> 
> On 7/7/20 8:48 PM, Huazhong Tan wrote:
>> Since UDP GSO feature is depended on checksum offload, so disable
>> UDP GSO feature when CSUM is disabled, then from user-space also
>> can see UDP GSO feature is disabled.
>>
>> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
>> ---
>>   net/core/dev.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/net/core/dev.c b/net/core/dev.c
>> index c02bae9..dcb6b35 100644
>> --- a/net/core/dev.c
>> +++ b/net/core/dev.c
>> @@ -9095,6 +9095,12 @@ static netdev_features_t netdev_fix_features(struct net_device *dev,
>>   		features &= ~NETIF_F_TSO6;
>>   	}
>>   
>> +	if ((features & NETIF_F_GSO_UDP_L4) && !(features & NETIF_F_HW_CSUM) &&
>> +	    (!(features & NETIF_F_IP_CSUM) || !(features & NETIF_F_IPV6_CSUM))) {
> 
> This would prevent a device providing IPv4 checksum only (no IPv6 csum support) from sending IPv4 UDP GSO packets ?
> 

Yes, not like TCP (who uses NETIF_F_TSO for IPv4 and NETIF_F_TSO6 for IPv6),
UDP only has a NETIF_F_GSO_UDP_L4 for both IPv4 and IPv6.
I cannot find a better way to do it with combined IPv4 and IPv6 csum 
together.
For this issue, is there any good idea to fix it?

>> +		netdev_dbg(dev, "Dropping UDP GSO features since no CSUM feature.\n");
>> +		features &= ~NETIF_F_GSO_UDP_L4;
>> +	}
>> +
>>   	/* TSO with IPv4 ID mangling requires IPv4 TSO be enabled */
>>   	if ((features & NETIF_F_TSO_MANGLEID) && !(features & NETIF_F_TSO))
>>   		features &= ~NETIF_F_TSO_MANGLEID;
>>
> 
> 


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

* Re: [RFC net-next 2/2] net: disable UDP GSO feature when CSUM is disabled
  2020-07-09  2:30     ` tanhuazhong
@ 2020-07-09  2:47       ` Eric Dumazet
  2020-07-09  2:55         ` tanhuazhong
  0 siblings, 1 reply; 13+ messages in thread
From: Eric Dumazet @ 2020-07-09  2:47 UTC (permalink / raw)
  To: tanhuazhong, Eric Dumazet, davem, willemb; +Cc: netdev, linuxarm, kuba



On 7/8/20 7:30 PM, tanhuazhong wrote:
> 
> 
> On 2020/7/8 13:36, Eric Dumazet wrote:
>>
>>
>> On 7/7/20 8:48 PM, Huazhong Tan wrote:
>>> Since UDP GSO feature is depended on checksum offload, so disable
>>> UDP GSO feature when CSUM is disabled, then from user-space also
>>> can see UDP GSO feature is disabled.
>>>
>>> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
>>> ---
>>>   net/core/dev.c | 6 ++++++
>>>   1 file changed, 6 insertions(+)
>>>
>>> diff --git a/net/core/dev.c b/net/core/dev.c
>>> index c02bae9..dcb6b35 100644
>>> --- a/net/core/dev.c
>>> +++ b/net/core/dev.c
>>> @@ -9095,6 +9095,12 @@ static netdev_features_t netdev_fix_features(struct net_device *dev,
>>>           features &= ~NETIF_F_TSO6;
>>>       }
>>>   +    if ((features & NETIF_F_GSO_UDP_L4) && !(features & NETIF_F_HW_CSUM) &&
>>> +        (!(features & NETIF_F_IP_CSUM) || !(features & NETIF_F_IPV6_CSUM))) {
>>
>> This would prevent a device providing IPv4 checksum only (no IPv6 csum support) from sending IPv4 UDP GSO packets ?
>>
> 
> Yes, not like TCP (who uses NETIF_F_TSO for IPv4 and NETIF_F_TSO6 for IPv6),
> UDP only has a NETIF_F_GSO_UDP_L4 for both IPv4 and IPv6.
> I cannot find a better way to do it with combined IPv4 and IPv6 csum together.
> For this issue, is there any good idea to fix it?

This could be done in an ndo_fix_features(), or ndo_features_check()

Or maybe we do not care, but this should probably be documented.


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

* Re: [RFC net-next 1/2] udp: add NETIF_F_GSO_UDP_L4 to NETIF_F_SOFTWARE_GSO
  2020-07-08 12:11   ` Willem de Bruijn
@ 2020-07-09  2:49     ` tanhuazhong
  2020-07-09 13:34       ` Willem de Bruijn
  0 siblings, 1 reply; 13+ messages in thread
From: tanhuazhong @ 2020-07-09  2:49 UTC (permalink / raw)
  To: Willem de Bruijn
  Cc: David Miller, Network Development, linuxarm, Jakub Kicinski



On 2020/7/8 20:11, Willem de Bruijn wrote:
> On Tue, Jul 7, 2020 at 11:50 PM Huazhong Tan <tanhuazhong@huawei.com> wrote:
>>
>> Add NETIF_F_SOFTWARE_GSO to the the list of GSO features with
>> a software fallback.  This allows UDP GSO to be used even if
>> the hardware does not support it,
> 
> That is already the case if just calling UDP_SEGMENT.
> 
> It seems the specific goal here is to postpone segmentation when
> going through a vxlan device?
> 

yes. without this patch, the segmentation is handled before calling
virtual device's .ndo_start_xmit.
Like TSO, UDP GSO also should be handle as later as possible?

>> and for virtual device such
>> as VxLAN device, this UDP segmentation will be postponed to
>> physical device.
> 
> See previous commits
> 
> commit 83aa025f535f76733e334e3d2a4d8577c8441a7e
> Author: Willem de Bruijn <willemb@google.com>
> Date:   Thu Apr 26 13:42:21 2018 -0400
> 
>      udp: add gso support to virtual devices
> 
>      Virtual devices such as tunnels and bonding can handle large packets.
>      Only segment packets when reaching a physical or loopback device.
> 
>      Signed-off-by: Willem de Bruijn <willemb@google.com>
>      Signed-off-by: David S. Miller <davem@davemloft.net>
> 
> and
> 
> commit 8eea1ca82be90a7e7a4624ab9cb323574a5f71df
> Author: Willem de Bruijn <willemb@google.com>
> Date:   Tue May 22 11:34:40 2018 -0400
> 
>      gso: limit udp gso to egress-only virtual devices
> 
>      Until the udp receive stack supports large packets (UDP GRO), GSO
>      packets must not loop from the egress to the ingress path.
> 
>      Revert the change that added NETIF_F_GSO_UDP_L4 to various virtual
>      devices through NETIF_F_GSO_ENCAP_ALL as this included devices that
>      may loop packets, such as veth and macvlan.
> 
>      Instead add it to specific devices that forward to another device's
>      egress path, bonding and team.
> 
>      Fixes: 83aa025f535f ("udp: add gso support to virtual devices")
>      CC: Alexander Duyck <alexander.duyck@gmail.com>
>      Signed-off-by: Willem de Bruijn <willemb@google.com>
>      Signed-off-by: David S. Miller <davem@davemloft.net>
> 
> Though with UDP_GRO this specific loop concern is addressed.
> 
> 
> 
>> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
>> ---
>>   include/linux/netdev_features.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
>> index 2cc3cf8..c7eef16 100644
>> --- a/include/linux/netdev_features.h
>> +++ b/include/linux/netdev_features.h
>> @@ -207,7 +207,7 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start)
>>                                   NETIF_F_FSO)
>>
>>   /* List of features with software fallbacks. */
>> -#define NETIF_F_GSO_SOFTWARE   (NETIF_F_ALL_TSO | \
>> +#define NETIF_F_GSO_SOFTWARE   (NETIF_F_ALL_TSO | NETIF_F_GSO_UDP_L4 | \
>>                                   NETIF_F_GSO_SCTP)
>>
>>   /*
>> --
>> 2.7.4
>>
> 
> .
> 


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

* Re: [RFC net-next 2/2] net: disable UDP GSO feature when CSUM is disabled
  2020-07-09  2:47       ` Eric Dumazet
@ 2020-07-09  2:55         ` tanhuazhong
  0 siblings, 0 replies; 13+ messages in thread
From: tanhuazhong @ 2020-07-09  2:55 UTC (permalink / raw)
  To: Eric Dumazet, davem, willemb; +Cc: netdev, linuxarm, kuba



On 2020/7/9 10:47, Eric Dumazet wrote:
> 
> 
> On 7/8/20 7:30 PM, tanhuazhong wrote:
>>
>>
>> On 2020/7/8 13:36, Eric Dumazet wrote:
>>>
>>>
>>> On 7/7/20 8:48 PM, Huazhong Tan wrote:
>>>> Since UDP GSO feature is depended on checksum offload, so disable
>>>> UDP GSO feature when CSUM is disabled, then from user-space also
>>>> can see UDP GSO feature is disabled.
>>>>
>>>> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
>>>> ---
>>>>    net/core/dev.c | 6 ++++++
>>>>    1 file changed, 6 insertions(+)
>>>>
>>>> diff --git a/net/core/dev.c b/net/core/dev.c
>>>> index c02bae9..dcb6b35 100644
>>>> --- a/net/core/dev.c
>>>> +++ b/net/core/dev.c
>>>> @@ -9095,6 +9095,12 @@ static netdev_features_t netdev_fix_features(struct net_device *dev,
>>>>            features &= ~NETIF_F_TSO6;
>>>>        }
>>>>    +    if ((features & NETIF_F_GSO_UDP_L4) && !(features & NETIF_F_HW_CSUM) &&
>>>> +        (!(features & NETIF_F_IP_CSUM) || !(features & NETIF_F_IPV6_CSUM))) {
>>>
>>> This would prevent a device providing IPv4 checksum only (no IPv6 csum support) from sending IPv4 UDP GSO packets ?
>>>
>>
>> Yes, not like TCP (who uses NETIF_F_TSO for IPv4 and NETIF_F_TSO6 for IPv6),
>> UDP only has a NETIF_F_GSO_UDP_L4 for both IPv4 and IPv6.
>> I cannot find a better way to do it with combined IPv4 and IPv6 csum together.
>> For this issue, is there any good idea to fix it?
> 
> This could be done in an ndo_fix_features(), or ndo_features_check()
> 
> Or maybe we do not care, but this should probably be documented.
> 

Thanks for your suggestion.
If only check NETIF_F_HW_CSUM here is more acceptable?

> 
> 


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

* Re: [RFC net-next 1/2] udp: add NETIF_F_GSO_UDP_L4 to NETIF_F_SOFTWARE_GSO
  2020-07-09  2:49     ` tanhuazhong
@ 2020-07-09 13:34       ` Willem de Bruijn
  0 siblings, 0 replies; 13+ messages in thread
From: Willem de Bruijn @ 2020-07-09 13:34 UTC (permalink / raw)
  To: tanhuazhong
  Cc: Willem de Bruijn, David Miller, Network Development, linuxarm,
	Jakub Kicinski

On Wed, Jul 8, 2020 at 10:49 PM tanhuazhong <tanhuazhong@huawei.com> wrote:
>
>
>
> On 2020/7/8 20:11, Willem de Bruijn wrote:
> > On Tue, Jul 7, 2020 at 11:50 PM Huazhong Tan <tanhuazhong@huawei.com> wrote:
> >>
> >> Add NETIF_F_SOFTWARE_GSO to the the list of GSO features with
> >> a software fallback.  This allows UDP GSO to be used even if
> >> the hardware does not support it,
> >
> > That is already the case if just calling UDP_SEGMENT.
> >
> > It seems the specific goal here is to postpone segmentation when
> > going through a vxlan device?
> >
>
> yes. without this patch, the segmentation is handled before calling
> virtual device's .ndo_start_xmit.
> Like TSO, UDP GSO also should be handle as later as possible?

Sure, but the commit message makes it sounds as if UDP GSO cannot be
used if hardware does not support it right now.

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

end of thread, other threads:[~2020-07-09 13:35 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-08  3:48 [RFC net-next 0/2] net: two updates related to UDP GSO Huazhong Tan
2020-07-08  3:48 ` [RFC net-next 1/2] udp: add NETIF_F_GSO_UDP_L4 to NETIF_F_SOFTWARE_GSO Huazhong Tan
2020-07-08  5:26   ` Eric Dumazet
2020-07-09  2:16     ` tanhuazhong
2020-07-09  2:28       ` Eric Dumazet
2020-07-08 12:11   ` Willem de Bruijn
2020-07-09  2:49     ` tanhuazhong
2020-07-09 13:34       ` Willem de Bruijn
2020-07-08  3:48 ` [RFC net-next 2/2] net: disable UDP GSO feature when CSUM is disabled Huazhong Tan
2020-07-08  5:36   ` Eric Dumazet
2020-07-09  2:30     ` tanhuazhong
2020-07-09  2:47       ` Eric Dumazet
2020-07-09  2:55         ` tanhuazhong

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