The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@kernel.org>
To: "Paolo Abeni" <pabeni@redhat.com>,
	"Jonas Köppeler" <j.koeppeler@tu-berlin.de>,
	"Jamal Hadi Salim" <jhs@mojatatu.com>,
	"Jiri Pirko" <jiri@resnulli.us>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@kernel.org>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Simon Horman" <horms@kernel.org>,
	"Willem de Bruijn" <willemb@google.com>
Cc: cake@lists.bufferbloat.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net/sched: sch_cake: fix unintended tin override with cake_mq
Date: Tue, 24 Nov 2026 19:35:35 +0100	[thread overview]
Message-ID: <8733sqdqmg.fsf@toke.dk> (raw)
In-Reply-To: <34de8380-f2ea-42e2-87ff-97a52ec3200d@redhat.com>

Paolo Abeni <pabeni@redhat.com> writes:

> On 11/19/26 10:49, Toke Høiland-Jørgensen wrote:
>> Jonas Köppeler <j.koeppeler@tu-berlin.de> writes:
>> 
>>> CAKE allows overriding the tin selection through skb->priority: if the
>>> major number of skb->priority matches the qdisc handle, the minor number
>>> selects the tin. With cake_mq, the per-queue CAKE instances are created
>>> through qdisc_create_dflt() and never get a handle assigned, so
>>> sch->handle is 0 for all of them.
>>>
>>> For forwarded IPv4 traffic, ip_forward() sets skb->priority from the TOS
>>> byte via rt_tos2priority() when net.ipv4.ip_forward_update_priority is
>>> enabled, which is the default. rt_tos2priority() returns 0, 2, 4 or 6,
>>> all with a major number of 0, which matches the handle of the cake_mq
>>> children. The minor number is then taken as a tin override and the DSCP
>>> mapping is skipped.
>>>
>>> With diffserv4 and diffserv8 this puts packets into the wrong tins. For
>>> example, AF13 (TOS byte 0x38) under diffserv4:
>>>
>>>    ip_forward():
>>>      skb->priority = ip_tos2prio[(0x38 & 0x1E) >> 1]
>>>                    = ip_tos2prio[12] = TC_PRIO_INTERACTIVE_BULK = 4
>>>    cake_select_tin():
>>>      TC_H_MAJ(4) == 0 == sch->handle
>>>      tin = bulk_order[4 - 1] = 3                     -> Voice
>>>
>>> whereas the DSCP table gives diffserv4[0x38 >> 2] = diffserv4[14] = 0,
>>> i.e. Best Effort. Likewise, AF21, AF31 and AF41 are demoted from Video
>>> to Best Effort. diffserv3 happens to be unaffected, because the only
>>> reachable override (priority 2) agrees with its DSCP table.
>>>
>>> Fix this by matching skb->priority against the major number of the
>>> parent cake_mq qdisc when the instance is part of cake_mq.
>>>
>>> Fixes: ebc65a873eff ("net/sched: sch_cake: Add cake_mq qdisc for using cake on mq devices")
>>> Signed-off-by: Jonas Köppeler <j.koeppeler@tu-berlin.de>
>> 
>> Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
>
> FYI, since this was broken since the beginning and does not look
> ultra-critical, I'm moving the patch to net-next.

Fine with me :)

-Toke

  reply	other threads:[~2026-11-24 18:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  9:43 [PATCH net] net/sched: sch_cake: fix unintended tin override with cake_mq Jonas Köppeler
2026-11-19  9:49 ` Toke Høiland-Jørgensen
2026-11-24 14:05   ` Paolo Abeni
2026-11-24 18:35     ` Toke Høiland-Jørgensen [this message]
2026-11-24 14:10 ` patchwork-bot+netdevbpf

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=8733sqdqmg.fsf@toke.dk \
    --to=toke@kernel.org \
    --cc=cake@lists.bufferbloat.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=j.koeppeler@tu-berlin.de \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --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