netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 1/2] udp: using datalen to cap ipv6 udp max gso segments
@ 2021-12-23 22:24 Coco Li
  2021-12-23 22:24 ` [PATCH net 2/2] selftests: Calculate udpgso segment count without header adjustment Coco Li
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Coco Li @ 2021-12-23 22:24 UTC (permalink / raw)
  To: netdev; +Cc: David S . Miller, Coco Li, Willem de Bruijn

The max number of UDP gso segments is intended to cap to
UDP_MAX_SEGMENTS, this is checked in udp_send_skb().

skb->len contains network and transport header len here, we should use
only data len instead.

This is the ipv6 counterpart to the below referenced commit,
which missed the ipv6 change

Fixes: 158390e45612 ("udp: using datalen to cap max gso segments")
Signed-off-by: Coco Li <lixiaoyan@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
---
 net/ipv6/udp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index a2caca6ccf11..8cde9efd7919 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1204,7 +1204,7 @@ static int udp_v6_send_skb(struct sk_buff *skb, struct flowi6 *fl6,
 			kfree_skb(skb);
 			return -EINVAL;
 		}
-		if (skb->len > cork->gso_size * UDP_MAX_SEGMENTS) {
+		if (datalen > cork->gso_size * UDP_MAX_SEGMENTS) {
 			kfree_skb(skb);
 			return -EINVAL;
 		}
-- 
2.34.1.448.ga2b2bfdf31-goog


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

* [PATCH net 2/2] selftests: Calculate udpgso segment count without header adjustment
  2021-12-23 22:24 [PATCH net 1/2] udp: using datalen to cap ipv6 udp max gso segments Coco Li
@ 2021-12-23 22:24 ` Coco Li
  2021-12-24  3:19 ` [PATCH net 1/2] udp: using datalen to cap ipv6 udp max gso segments Jakub Kicinski
  2021-12-24  3:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 6+ messages in thread
From: Coco Li @ 2021-12-23 22:24 UTC (permalink / raw)
  To: netdev; +Cc: David S . Miller, Coco Li, Willem de Bruijn

The below referenced commit correctly updated the computation of number
of segments (gso_size) by using only the gso payload size and
removing the header lengths.

With this change the regression test started failing. Update
the tests to match this new behavior.

Both IPv4 and IPv6 tests are updated, as a separate patch in this series
will update udp_v6_send_skb to match this change in udp_send_skb.

Fixes: 158390e45612 ("udp: using datalen to cap max gso segments")
Signed-off-by: Coco Li <lixiaoyan@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
---
 tools/testing/selftests/net/udpgso.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/net/udpgso.c b/tools/testing/selftests/net/udpgso.c
index c66da6ffd6d8..7badaf215de2 100644
--- a/tools/testing/selftests/net/udpgso.c
+++ b/tools/testing/selftests/net/udpgso.c
@@ -156,13 +156,13 @@ struct testcase testcases_v4[] = {
 	},
 	{
 		/* send max number of min sized segments */
-		.tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V4,
+		.tlen = UDP_MAX_SEGMENTS,
 		.gso_len = 1,
-		.r_num_mss = UDP_MAX_SEGMENTS - CONST_HDRLEN_V4,
+		.r_num_mss = UDP_MAX_SEGMENTS,
 	},
 	{
 		/* send max number + 1 of min sized segments: fail */
-		.tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V4 + 1,
+		.tlen = UDP_MAX_SEGMENTS + 1,
 		.gso_len = 1,
 		.tfail = true,
 	},
@@ -259,13 +259,13 @@ struct testcase testcases_v6[] = {
 	},
 	{
 		/* send max number of min sized segments */
-		.tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V6,
+		.tlen = UDP_MAX_SEGMENTS,
 		.gso_len = 1,
-		.r_num_mss = UDP_MAX_SEGMENTS - CONST_HDRLEN_V6,
+		.r_num_mss = UDP_MAX_SEGMENTS,
 	},
 	{
 		/* send max number + 1 of min sized segments: fail */
-		.tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V6 + 1,
+		.tlen = UDP_MAX_SEGMENTS + 1,
 		.gso_len = 1,
 		.tfail = true,
 	},
-- 
2.34.1.448.ga2b2bfdf31-goog


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

* Re: [PATCH net 1/2] udp: using datalen to cap ipv6 udp max gso segments
  2021-12-23 22:24 [PATCH net 1/2] udp: using datalen to cap ipv6 udp max gso segments Coco Li
  2021-12-23 22:24 ` [PATCH net 2/2] selftests: Calculate udpgso segment count without header adjustment Coco Li
@ 2021-12-24  3:19 ` Jakub Kicinski
  2021-12-24  3:22   ` Jakub Kicinski
  2021-12-24  3:30 ` patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Jakub Kicinski @ 2021-12-24  3:19 UTC (permalink / raw)
  To: Coco Li, Willem de Bruijn; +Cc: netdev, David S . Miller

On Thu, 23 Dec 2021 22:24:40 +0000 Coco Li wrote:
> The max number of UDP gso segments is intended to cap to
> UDP_MAX_SEGMENTS, this is checked in udp_send_skb().
> 
> skb->len contains network and transport header len here, we should use
> only data len instead.
> 
> This is the ipv6 counterpart to the below referenced commit,
> which missed the ipv6 change
> 
> Fixes: 158390e45612 ("udp: using datalen to cap max gso segments")

I'm gonna replace the Fixes tag with:

Fixes: bec1f6f69736 ("udp: generate gso with UDP_SEGMENT")

hope that's okay.

> Signed-off-by: Coco Li <lixiaoyan@google.com>
> Reviewed-by: Willem de Bruijn <willemb@google.com>
> ---
>  net/ipv6/udp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
> index a2caca6ccf11..8cde9efd7919 100644
> --- a/net/ipv6/udp.c
> +++ b/net/ipv6/udp.c
> @@ -1204,7 +1204,7 @@ static int udp_v6_send_skb(struct sk_buff *skb, struct flowi6 *fl6,
>  			kfree_skb(skb);
>  			return -EINVAL;
>  		}
> -		if (skb->len > cork->gso_size * UDP_MAX_SEGMENTS) {
> +		if (datalen > cork->gso_size * UDP_MAX_SEGMENTS) {
>  			kfree_skb(skb);
>  			return -EINVAL;
>  		}


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

* Re: [PATCH net 1/2] udp: using datalen to cap ipv6 udp max gso segments
  2021-12-24  3:19 ` [PATCH net 1/2] udp: using datalen to cap ipv6 udp max gso segments Jakub Kicinski
@ 2021-12-24  3:22   ` Jakub Kicinski
  2021-12-24  3:48     ` Willem de Bruijn
  0 siblings, 1 reply; 6+ messages in thread
From: Jakub Kicinski @ 2021-12-24  3:22 UTC (permalink / raw)
  To: Coco Li, Willem de Bruijn; +Cc: netdev, David S . Miller

On Thu, 23 Dec 2021 19:19:22 -0800 Jakub Kicinski wrote:
> On Thu, 23 Dec 2021 22:24:40 +0000 Coco Li wrote:
> > The max number of UDP gso segments is intended to cap to
> > UDP_MAX_SEGMENTS, this is checked in udp_send_skb().
> > 
> > skb->len contains network and transport header len here, we should use
> > only data len instead.
> > 
> > This is the ipv6 counterpart to the below referenced commit,
> > which missed the ipv6 change
> > 
> > Fixes: 158390e45612 ("udp: using datalen to cap max gso segments")  
> 
> I'm gonna replace the Fixes tag with:
> 
> Fixes: bec1f6f69736 ("udp: generate gso with UDP_SEGMENT")
> 
> hope that's okay.

Or I'll fumble the git command and accidentally push as is... Whatever.

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

* Re: [PATCH net 1/2] udp: using datalen to cap ipv6 udp max gso segments
  2021-12-23 22:24 [PATCH net 1/2] udp: using datalen to cap ipv6 udp max gso segments Coco Li
  2021-12-23 22:24 ` [PATCH net 2/2] selftests: Calculate udpgso segment count without header adjustment Coco Li
  2021-12-24  3:19 ` [PATCH net 1/2] udp: using datalen to cap ipv6 udp max gso segments Jakub Kicinski
@ 2021-12-24  3:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-12-24  3:30 UTC (permalink / raw)
  To: Coco Li; +Cc: netdev, davem, willemb

Hello:

This series was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 23 Dec 2021 22:24:40 +0000 you wrote:
> The max number of UDP gso segments is intended to cap to
> UDP_MAX_SEGMENTS, this is checked in udp_send_skb().
> 
> skb->len contains network and transport header len here, we should use
> only data len instead.
> 
> This is the ipv6 counterpart to the below referenced commit,
> which missed the ipv6 change
> 
> [...]

Here is the summary with links:
  - [net,1/2] udp: using datalen to cap ipv6 udp max gso segments
    https://git.kernel.org/netdev/net/c/736ef37fd9a4
  - [net,2/2] selftests: Calculate udpgso segment count without header adjustment
    https://git.kernel.org/netdev/net/c/5471d5226c3b

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH net 1/2] udp: using datalen to cap ipv6 udp max gso segments
  2021-12-24  3:22   ` Jakub Kicinski
@ 2021-12-24  3:48     ` Willem de Bruijn
  0 siblings, 0 replies; 6+ messages in thread
From: Willem de Bruijn @ 2021-12-24  3:48 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: Coco Li, netdev, David S . Miller

On Thu, Dec 23, 2021 at 10:23 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Thu, 23 Dec 2021 19:19:22 -0800 Jakub Kicinski wrote:
> > On Thu, 23 Dec 2021 22:24:40 +0000 Coco Li wrote:
> > > The max number of UDP gso segments is intended to cap to
> > > UDP_MAX_SEGMENTS, this is checked in udp_send_skb().
> > >
> > > skb->len contains network and transport header len here, we should use
> > > only data len instead.
> > >
> > > This is the ipv6 counterpart to the below referenced commit,
> > > which missed the ipv6 change
> > >
> > > Fixes: 158390e45612 ("udp: using datalen to cap max gso segments")
> >
> > I'm gonna replace the Fixes tag with:
> >
> > Fixes: bec1f6f69736 ("udp: generate gso with UDP_SEGMENT")
> >
> > hope that's okay.
>
> Or I'll fumble the git command and accidentally push as is... Whatever.

Thanks. I was in two minds which commit to use. From a backport to
stable point of view, it should not matter in practice.

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

end of thread, other threads:[~2021-12-24  3:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-23 22:24 [PATCH net 1/2] udp: using datalen to cap ipv6 udp max gso segments Coco Li
2021-12-23 22:24 ` [PATCH net 2/2] selftests: Calculate udpgso segment count without header adjustment Coco Li
2021-12-24  3:19 ` [PATCH net 1/2] udp: using datalen to cap ipv6 udp max gso segments Jakub Kicinski
2021-12-24  3:22   ` Jakub Kicinski
2021-12-24  3:48     ` Willem de Bruijn
2021-12-24  3:30 ` patchwork-bot+netdevbpf

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