Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: julius@bairaktaris.de
Cc: toke@toke.dk, netdev@vger.kernel.org, jhs@mojatatu.com,
	jiri@resnulli.us, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, pabeni@redhat.com, willemb@google.com,
	horms@kernel.org
Subject: Re: [PATCH net 2/2] net/sched: sch_cake: charge an SCTP GSO packet by its own segments
Date: Sun, 06 Dec 2026 16:06:22 +0000	[thread overview]
Message-ID: <179657318220.3148.12465726452993772879@kernel.org> (raw)
In-Reply-To: <20261205151201.2705110-3-julius@bairaktaris.de>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] net/sched: cake_overhead() returns 0 for GSO_BY_FRAGS with
  NULL frag_list

--

> diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
> --- a/net/sched/sch_cake.c
> +++ b/net/sched/sch_cake.c
> @@ -1426,6 +1426,20 @@ static u32 cake_overhead(struct cake_sched_data *q, const struct sk_buff *skb)
>  	if (segs == 1)
>  		return cake_calc_overhead(q, len, off);
>  
> +	/* SCTP: each skb on the frag list is one packet, sent behind the
> +	 * headers of the head
> +	 */
> +	if (shinfo->gso_size == GSO_BY_FRAGS) {
> +		const struct sk_buff *frag;
> +		u32 hdr = skb->len, adjlen = 0;
> +
> +		skb_walk_frags(skb, frag)
> +			hdr -= frag->len;
> +		skb_walk_frags(skb, frag)
> +			adjlen += cake_calc_overhead(q, hdr + frag->len, off);
> +		return adjlen;
> +	}
> +
>  	/* borrowed from qdisc_pkt_len_segs_init() */
>  	if (!skb->encapsulation)
>  		hdr_len = skb_transport_offset(skb);

[Severity: Medium]
If this branch is entered with skb_shinfo(skb)->frag_list == NULL,
both skb_walk_frags() loops run zero times and cake_overhead()
returns 0. Before this patch the function always went through
cake_calc_overhead(), so it could never return 0.

gso_size == GSO_BY_FRAGS together with qdisc_pkt_segs() != 1 does
not guarantee a frag list, though.

A cls_bpf program calling bpf_skb_pull_data(skb, skb->len), or
act_pedit through skb_ensure_writable(), ends up in
__pskb_pull_tail(). That pulls the frag_list skbs into the head and
clears frag_list, but leaves gso_size and the pkt_segs value cached
by qdisc_pkt_len_segs_init() alone. With no-split-gso on a device
that advertises NETIF_F_GSO_SCTP (veth, lo, ifb, ...), that skb
reaches cake_overhead() unsegmented.

xen-netback also accepts a guest-supplied gso.size of 0xffff on TCP
frames, which never have a frag list there. For header-only frames
gso_segs comes out as 0, so even the default split-gso path does not
catch it.

With adjusted_len == 0:

- cake_advance_shaper() charges nothing to the tin, global and
  failsafe shapers.
- cake_dequeue() takes nothing out of flow->deficit or
  b->tin_deficit.
- The mpu, overhead and ATM/PTM handling in cake_calc_overhead(),
  and the netlen and adjlen statistics, are skipped entirely.

Such packets are sent for free and their flow is never made to
yield.

Could this path be limited to skb_has_frag_list(skb), with anything
else charged as a single packet via cake_calc_overhead(q, len, off)?
Or do you see a better way to account for how such an skb will
actually go out? Either way, cake_overhead() should not be able to
return 0 here.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261205151201.2705110-1-julius%40bairaktaris.de

      reply	other threads:[~2026-12-06 16:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05 15:11 [PATCH net 0/2] net/sched: sch_cake: two shaper accounting fixes Julius Bairaktaris
2026-12-05 15:12 ` [PATCH net 1/2] net/sched: sch_cake: count the arriving packet in the autorate window Julius Bairaktaris
2026-12-05 15:12 ` [PATCH net 2/2] net/sched: sch_cake: charge an SCTP GSO packet by its own segments Julius Bairaktaris
2026-12-06 16:06   ` netdev-bot+sashiko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179657318220.3148.12465726452993772879@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=julius@bairaktaris.de \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=toke@toke.dk \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox