Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: jhs@mojatatu.com
Cc: netdev@vger.kernel.org, jiri@resnulli.us, davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
	horms@kernel.org, victor@mojatatu.com, toke@toke.dk,
	bjorn@kernel.org, sashiko-bot@kernel.org
Subject: Re: [PATCH net-next v8 1/4] net/sched: cake: return the classifier result to the caller
Date: Sat, 24 Oct 2026 17:30:38 +0000	[thread overview]
Message-ID: <179286303840.3134.16646155289449371572@kernel.org> (raw)
In-Reply-To: <QDISC-BA27.v8.r0.20261020063241-1@mojatatu.com>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] Two new comments in net/sched/sch_cake.c say the TC action has
  consumed the packet when the helper returns true.

--

net/sched: cake: return the classifier result to the caller

This commit splits the external classifier out of cake_classify() into a
new helper, cake_tcf_classify(). The helper now returns the filter's
flow and host overrides, and cake_enqueue() does the tin selection and
flow hashing itself. It is described as preparation for later
accounting changes, with no change to classification behaviour.

> diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
> index dc93267029e70..6432d10c992e5 100644
> --- a/net/sched/sch_cake.c
> +++ b/net/sched/sch_cake.c
> @@ -1712,18 +1712,24 @@ static struct cake_tin_data *cake_select_tin(struct Qdisc *sch,
>  	return &qd->tins[tin];
>  }
>  
> -static u32 cake_classify(struct Qdisc *sch, struct cake_tin_data **t,
> -			 struct sk_buff *skb, int flow_mode, int *qerr)
> +/* Run the qdisc's optional external classifier. Returns true when a
> + * terminal TC action consumed the packet, with the reason in *qerr;
> + * otherwise *flow and *host hold the filter's overrides (0 if none).
> + */

[Severity: Low]
This isn't a bug, but is "consumed the packet" accurate here?

For TC_ACT_SHOT the action does not take ownership of the skb.
tcf_gact_act() in net/sched/act_gact.c only updates its stats and
returns the verdict:

	if (action == TC_ACT_SHOT)
		tcf_action_inc_drop_qstats(&gact->common);

	tcf_lastuse_update(&gact->tcf_tm);

	return action;

Even so, cake_tcf_classify() returns true for it. The
STOLEN/QUEUED/TRAP cases work the same way, because the qdisc still
drops its own reference.

[ ... ]

> @@ -1758,20 +1762,25 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch,

[ ... ]

> -	/* choose flow to insert into */
> -	idx = cake_classify(sch, &b, skb, q->config->flow_mode, &ret);
> -	if (idx == 0) {
> +	/* Classify first: a terminal TC action consumes the packet. */
> +	if (cake_tcf_classify(sch, skb, &flow_override, &host_override, &ret)) {
>  		if (ret & __NET_XMIT_BYPASS)
>  			qdisc_qstats_drop(sch);
>  		__qdisc_drop(skb, to_free);
>  		return ret;
>  	}

[Severity: Low]
This comment has the same wording. The very next lines still have to
free the skb with __qdisc_drop(skb, to_free), so the action has not
consumed it.

A true return really means "do not enqueue, the caller must drop the
skb". Could both comments say that instead?

If a later caller trusted the current wording, it could skip the free
and leak the skb. Both comments are unchanged at the end of the
series.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/QDISC-BA27.v8.r0.20261020063241%40mojatatu.com

  parent reply	other threads:[~2026-10-24 17:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20 16:57 [PATCH net-next v8 0/4] net/sched: cap the accounted backlog before it can wrap Jamal Hadi Salim
2026-10-20 16:57 ` [PATCH net-next v8 1/4] net/sched: cake: return the classifier result to the caller Jamal Hadi Salim
2026-10-20 17:45   ` Toke Høiland-Jørgensen
2026-10-20 18:59     ` Jamal Hadi Salim
2026-10-24 17:30   ` netdev-bot+sashiko [this message]
2026-10-20 16:57 ` [PATCH net-next v8 2/4] net/sched: cake: use a dedicated split-GSO list iterator Jamal Hadi Salim
2026-10-20 16:57 ` [PATCH net-next v8 3/4] net/sched: cap the accounted backlog before it can wrap Jamal Hadi Salim
2026-10-24 17:30   ` netdev-bot+sashiko
2026-10-20 16:57 ` [PATCH net-next v8 4/4] net/sched: cake: hash before segmenting and reject an overlong split Jamal Hadi Salim
2026-10-20 17:42   ` Toke Høiland-Jørgensen
2026-10-24 17:30   ` netdev-bot+sashiko
2026-10-27  9:48     ` Paolo Abeni
2026-10-27 11:42       ` Jamal Hadi Salim

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=179286303840.3134.16646155289449371572@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=bjorn@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sashiko-bot@kernel.org \
    --cc=toke@toke.dk \
    --cc=victor@mojatatu.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