Cake - FQ_codel the next generation
 help / color / mirror / Atom feed
* [Cake] [PATCH net-next] net: account for encap headers in qdisc pkt len
@ 2025-07-02 16:07 Fengyuan Gong
  2025-07-02 16:53 ` Willem de Bruijn
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Fengyuan Gong @ 2025-07-02 16:07 UTC (permalink / raw)
  To: Jakub Kicinski, Paolo Abeni, Simon Horman, toke, edumazet,
	David S . Miller
  Cc: Jamal Hadi Salim, Cong Wang, Jiri Pirko, Stanislav Fomichev,
	Kuniyuki Iwashima, Ahmed Zaki, Alexander Lobakin, netdev,
	linux-kernel, cake, willemb, Fengyuan Gong

Refine qdisc_pkt_len_init to include headers up through
the inner transport header when computing header size
for encapsulations. Also refine net/sched/sch_cake.c
borrowed from qdisc_pkt_len_init().

Signed-off-by: Fengyuan Gong <gfengyuan@google.com>
---
 net/core/dev.c       | 5 ++++-
 net/sched/sch_cake.c | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 11da1e272ec20..dfec541f68e3a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3944,7 +3944,10 @@ static void qdisc_pkt_len_init(struct sk_buff *skb)
 		unsigned int hdr_len;
 
 		/* mac layer + network layer */
-		hdr_len = skb_transport_offset(skb);
+		if (!skb->encapsulation)
+			hdr_len = skb_transport_offset(skb);
+		else
+			hdr_len = skb_inner_transport_offset(skb);
 
 		/* + transport layer */
 		if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))) {
diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
index 48dd8c88903fe..dbcfb948c8670 100644
--- a/net/sched/sch_cake.c
+++ b/net/sched/sch_cake.c
@@ -1407,7 +1407,10 @@ static u32 cake_overhead(struct cake_sched_data *q, const struct sk_buff *skb)
 		return cake_calc_overhead(q, len, off);
 
 	/* borrowed from qdisc_pkt_len_init() */
-	hdr_len = skb_transport_offset(skb);
+	if (!skb->encapsulation)
+		hdr_len = skb_transport_offset(skb);
+	else
+		hdr_len = skb_inner_transport_offset(skb);
 
 	/* + transport layer */
 	if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 |
-- 
2.50.0.727.gbf7dc18ff4-goog


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

* Re: [Cake] [PATCH net-next] net: account for encap headers in qdisc pkt len
  2025-07-02 16:07 [Cake] [PATCH net-next] net: account for encap headers in qdisc pkt len Fengyuan Gong
@ 2025-07-02 16:53 ` Willem de Bruijn
  2025-07-02 17:23   ` Eric Dumazet
  2025-07-03 13:35 ` Toke Høiland-Jørgensen
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Willem de Bruijn @ 2025-07-02 16:53 UTC (permalink / raw)
  To: Fengyuan Gong, Jakub Kicinski, Paolo Abeni, Simon Horman, toke,
	edumazet, David S . Miller
  Cc: Jamal Hadi Salim, Cong Wang, Jiri Pirko, Stanislav Fomichev,
	Kuniyuki Iwashima, Ahmed Zaki, Alexander Lobakin, netdev,
	linux-kernel, cake, willemb, Fengyuan Gong

Fengyuan Gong wrote:
> Refine qdisc_pkt_len_init to include headers up through
> the inner transport header when computing header size
> for encapsulations. Also refine net/sched/sch_cake.c
> borrowed from qdisc_pkt_len_init().
> 
> Signed-off-by: Fengyuan Gong <gfengyuan@google.com>

Reviewed-by: Willem de Bruijn <willemb@google.com>

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

* Re: [Cake] [PATCH net-next] net: account for encap headers in qdisc pkt len
  2025-07-02 16:53 ` Willem de Bruijn
@ 2025-07-02 17:23   ` Eric Dumazet
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Dumazet @ 2025-07-02 17:23 UTC (permalink / raw)
  To: Willem de Bruijn
  Cc: Fengyuan Gong, Jakub Kicinski, Paolo Abeni, Simon Horman, toke,
	David S . Miller, Jamal Hadi Salim, Cong Wang, Jiri Pirko,
	Stanislav Fomichev, Kuniyuki Iwashima, Ahmed Zaki,
	Alexander Lobakin, netdev, linux-kernel, cake, willemb

On Wed, Jul 2, 2025 at 9:53 AM Willem de Bruijn
<willemdebruijn.kernel@gmail.com> wrote:
>
> Fengyuan Gong wrote:
> > Refine qdisc_pkt_len_init to include headers up through
> > the inner transport header when computing header size
> > for encapsulations. Also refine net/sched/sch_cake.c
> > borrowed from qdisc_pkt_len_init().
> >
> > Signed-off-by: Fengyuan Gong <gfengyuan@google.com>
>
> Reviewed-by: Willem de Bruijn <willemb@google.com>

Reviewed-by: Eric Dumazet <edumazet@google.com>

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

* Re: [Cake] [PATCH net-next] net: account for encap headers in qdisc pkt len
  2025-07-02 16:07 [Cake] [PATCH net-next] net: account for encap headers in qdisc pkt len Fengyuan Gong
  2025-07-02 16:53 ` Willem de Bruijn
@ 2025-07-03 13:35 ` Toke Høiland-Jørgensen
  2025-07-04  4:31 ` Cong Wang
  2025-07-08 16:10 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 7+ messages in thread
From: Toke Høiland-Jørgensen @ 2025-07-03 13:35 UTC (permalink / raw)
  To: Fengyuan Gong, Jakub Kicinski, Paolo Abeni, Simon Horman,
	edumazet, David S . Miller
  Cc: Jamal Hadi Salim, Cong Wang, Jiri Pirko, Stanislav Fomichev,
	Kuniyuki Iwashima, Ahmed Zaki, Alexander Lobakin, netdev,
	linux-kernel, cake, willemb, Fengyuan Gong

Fengyuan Gong <gfengyuan@google.com> writes:

> Refine qdisc_pkt_len_init to include headers up through
> the inner transport header when computing header size
> for encapsulations. Also refine net/sched/sch_cake.c
> borrowed from qdisc_pkt_len_init().
>
> Signed-off-by: Fengyuan Gong <gfengyuan@google.com>

Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>


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

* Re: [Cake] [PATCH net-next] net: account for encap headers in qdisc pkt len
  2025-07-02 16:07 [Cake] [PATCH net-next] net: account for encap headers in qdisc pkt len Fengyuan Gong
  2025-07-02 16:53 ` Willem de Bruijn
  2025-07-03 13:35 ` Toke Høiland-Jørgensen
@ 2025-07-04  4:31 ` Cong Wang
  2025-07-06 14:30   ` Willem de Bruijn
  2025-07-08 16:10 ` patchwork-bot+netdevbpf
  3 siblings, 1 reply; 7+ messages in thread
From: Cong Wang @ 2025-07-04  4:31 UTC (permalink / raw)
  To: Fengyuan Gong
  Cc: Jakub Kicinski, Paolo Abeni, Simon Horman, toke, edumazet,
	David S . Miller, Jamal Hadi Salim, Jiri Pirko,
	Stanislav Fomichev, Kuniyuki Iwashima, Ahmed Zaki,
	Alexander Lobakin, netdev, linux-kernel, cake, willemb

On Wed, Jul 02, 2025 at 04:07:41PM +0000, Fengyuan Gong wrote:
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 11da1e272ec20..dfec541f68e3a 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -3944,7 +3944,10 @@ static void qdisc_pkt_len_init(struct sk_buff *skb)
>  		unsigned int hdr_len;
>  
>  		/* mac layer + network layer */
> -		hdr_len = skb_transport_offset(skb);
> +		if (!skb->encapsulation)
> +			hdr_len = skb_transport_offset(skb);
> +		else
> +			hdr_len = skb_inner_transport_offset(skb);

This pattern seems repeated in a few places, other than the two you are
patching, I saw another one:

2465 static netdev_features_t hns3_features_check(struct sk_buff *skb,
2466                                              struct net_device *dev,
2467                                              netdev_features_t features)
2468 {
2469 #define HNS3_MAX_HDR_LEN        480U
2470 #define HNS3_MAX_L4_HDR_LEN     60U
2471 
2472         size_t len;
2473 
2474         if (skb->ip_summed != CHECKSUM_PARTIAL)
2475                 return features;
2476 
2477         if (skb->encapsulation)
2478                 len = skb_inner_transport_offset(skb);
2479         else
2480                 len = skb_transport_offset(skb);


Maybe worth a helper now?

Thanks!

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

* Re: [Cake] [PATCH net-next] net: account for encap headers in qdisc pkt len
  2025-07-04  4:31 ` Cong Wang
@ 2025-07-06 14:30   ` Willem de Bruijn
  0 siblings, 0 replies; 7+ messages in thread
From: Willem de Bruijn @ 2025-07-06 14:30 UTC (permalink / raw)
  To: Cong Wang, Fengyuan Gong
  Cc: Jakub Kicinski, Paolo Abeni, Simon Horman, toke, edumazet,
	David S . Miller, Jamal Hadi Salim, Jiri Pirko,
	Stanislav Fomichev, Kuniyuki Iwashima, Ahmed Zaki,
	Alexander Lobakin, netdev, linux-kernel, cake, willemb

Cong Wang wrote:
> On Wed, Jul 02, 2025 at 04:07:41PM +0000, Fengyuan Gong wrote:
> > diff --git a/net/core/dev.c b/net/core/dev.c
> > index 11da1e272ec20..dfec541f68e3a 100644
> > --- a/net/core/dev.c
> > +++ b/net/core/dev.c
> > @@ -3944,7 +3944,10 @@ static void qdisc_pkt_len_init(struct sk_buff *skb)
> >  		unsigned int hdr_len;
> >  
> >  		/* mac layer + network layer */
> > -		hdr_len = skb_transport_offset(skb);
> > +		if (!skb->encapsulation)
> > +			hdr_len = skb_transport_offset(skb);
> > +		else
> > +			hdr_len = skb_inner_transport_offset(skb);
> 
> This pattern seems repeated in a few places, other than the two you are
> patching, I saw another one:
> 
> 2465 static netdev_features_t hns3_features_check(struct sk_buff *skb,
> 2466                                              struct net_device *dev,
> 2467                                              netdev_features_t features)
> 2468 {
> 2469 #define HNS3_MAX_HDR_LEN        480U
> 2470 #define HNS3_MAX_L4_HDR_LEN     60U
> 2471 
> 2472         size_t len;
> 2473 
> 2474         if (skb->ip_summed != CHECKSUM_PARTIAL)
> 2475                 return features;
> 2476 
> 2477         if (skb->encapsulation)
> 2478                 len = skb_inner_transport_offset(skb);
> 2479         else
> 2480                 len = skb_transport_offset(skb);

From a quick grep, this is the only other case, right?
 
> Maybe worth a helper now?

If only one more, I wouldn't respin for that.

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

* Re: [Cake] [PATCH net-next] net: account for encap headers in qdisc pkt len
  2025-07-02 16:07 [Cake] [PATCH net-next] net: account for encap headers in qdisc pkt len Fengyuan Gong
                   ` (2 preceding siblings ...)
  2025-07-04  4:31 ` Cong Wang
@ 2025-07-08 16:10 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-07-08 16:10 UTC (permalink / raw)
  To: Fengyuan Gong
  Cc: kuba, pabeni, horms, toke, edumazet, davem, jhs, xiyou.wangcong,
	jiri, sdf, kuniyu, ahmed.zaki, aleksander.lobakin, netdev,
	linux-kernel, cake, willemb

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed,  2 Jul 2025 16:07:41 +0000 you wrote:
> Refine qdisc_pkt_len_init to include headers up through
> the inner transport header when computing header size
> for encapsulations. Also refine net/sched/sch_cake.c
> borrowed from qdisc_pkt_len_init().
> 
> Signed-off-by: Fengyuan Gong <gfengyuan@google.com>
> 
> [...]

Here is the summary with links:
  - [net-next] net: account for encap headers in qdisc pkt len
    https://git.kernel.org/netdev/net-next/c/a41851bea7bf

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] 7+ messages in thread

end of thread, other threads:[~2025-07-08 16:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-02 16:07 [Cake] [PATCH net-next] net: account for encap headers in qdisc pkt len Fengyuan Gong
2025-07-02 16:53 ` Willem de Bruijn
2025-07-02 17:23   ` Eric Dumazet
2025-07-03 13:35 ` Toke Høiland-Jørgensen
2025-07-04  4:31 ` Cong Wang
2025-07-06 14:30   ` Willem de Bruijn
2025-07-08 16:10 ` 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