🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #22027

Re: [PATCH net] net/sched: sch_cake: fix unintended tin override with cake_mq

#22027
From: Toke Høiland-Jørgensen
Date: Tue, 24 Nov 2026 18:35
51 lines
10091 bytes
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
Technical Details
Message-ID: <8733sqdqmg.fsf@toke.dk>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370684-linux-kernel-netdev=dewy.ru
References: <20261119-cake_mq_fix_incorrect_tin_override-v1-1-3238122d09ca@tu-berlin.de> <CAPB2EApXULDiMGXMS6qg17NJRyEruybWMfu_d35tjBPdk4ftSQ@mail.gmail.com> <34de8380-f2ea-42e2-87ff-97a52ec3200d@redhat.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370684-linux-kernel-netdev=dewy.ru
From: toke@kernel.org (Toke Høiland-Jørgensen)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] net/sched: sch_cake: fix unintended tin override
 with cake_mq
Date: Tue, 24 Nov 2026 19:35:35 +0100
Organization: Usenet Network
Message-ID: <8733sqdqmg.fsf@toke.dk>
References: <20261119-cake_mq_fix_incorrect_tin_override-v1-1-3238122d09ca@tu-berlin.de>
 <CAPB2EApXULDiMGXMS6qg17NJRyEruybWMfu_d35tjBPdk4ftSQ@mail.gmail.com>
 <34de8380-f2ea-42e2-87ff-97a52ec3200d@redhat.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="10704"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:RQ0v3ocqxcsec2kcMtw1ZHxgSoo= sha256:N1gx7pg/4EuPjZHsuVkjXbOiKGslF2MGUtvFMk1wF/0=
	sha1:8hucKXHcb5a1NYhJzTlVHJB9HXc= sha256:RahfwXAkcHPMoeO3Mw1s1/RebCCfhZl54UY363F5LiI=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id A9731125E2B; Tue, 24 Nov 2026 21:36:02 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id bjwZLLFRG8mi;
	Tue, 24 Nov 2026 21:35:59 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-370684-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 0B5AB125E29; Tue, 24 Nov 2026 21:35:50 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 8BE7326EDD; Tue, 24 Nov 2026 18:35:39 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795545339;
	b=lJk3j272dy+JQGkiWBGyHZJbgPC6cZewcLYvXOpxQBWkU6SH5bXezfxZLh8xmv5TJ01A
	 yKUVKUif8IW8cHg2va+Vn3qPKXYRcxE98eoqWKGZ+20K6PEWoKAK75QcDkvveC7i2Yjfi
	 mhnSjICXGBhUqyk3adItntkmEygTfex/I7PRI2UcgvXU3uAAM6om3lNs2chWqxO3SNIvQ
	 dzx0VKClhXFWoefCmWsAWxGXHDrAqIFu2epfY6FBIbWf/J0XUv8bj/zxFNrO0rpxe7Uba
	 3ycNWOdFPRQtSBfgtBG/zefKOVjrNoL0232PKMSyYz2sH8liO94WmPWWpd6lXCo5DoA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795545339;
	h=X-Original-To:Received:Received:DKIM-Signature:Received:From:To:Cc:
	 Subject:In-Reply-To:References:X-Clacks-Overhead:Date:Message-ID:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
	 Content-Transfer-Encoding;
	bh=fDl32fENKK5L6QSxy3ZJfcdRLbINbZoonP8NJB2nHWY=;
	b=L0WHYrG6qyOximfrzwv0h6D8rhkMDeDECHkklgjKr6H6zefZwCDbkZeiq7h5m6xHs15+
	 7bFzRGyhBE4dhDlp/hxGnfnKKzcVVwvJgwmpCF+6KoBMVm+SXkbjGZkDhzP4I8KhHacww
	 SX/oNXlvMTmg1Tvw4bEfEzkygfl3kaAGCK45hfB4+nvZM4GFcPDJ9bx3UiH8/6ozd79PN
	 4gvZiv/+cuvlyWfZvSlMHEcQHS0mcXHMeiynJqBJKONMFRO7exSUgJqIu0A3qBZz4BQZZ
	 EFbkvp7WHJKB1DFPnBV3DXLrGlPNcAtG1bp4+za3uvmPAgJCNbq6imx4GvqO6BO1h/Q==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=CR23Knin;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 64214606A331;
	Tue, 24 Nov 2026 18:35:39 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=CR23Knin
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795545338;
	b=vIjeVaXlR0SIS/3+QCF1ki64/waJxYqP/ydmKyzum6tMhVH+59ft7O0Tzu1YPSsSnrjN
	 cExqJl2x/tHZwFXjZoS/8bVvsCViMd8is7D89Zx7zlY2wzWKCMc/2RnAvrYV86pDED1y/
	 cpOSSoX4mqUXm6NVY39Gvj8TmIZKk6l8MGvLuHxUgkBHe/sLVjKzp6Uy3us6KoNssQxjv
	 kvFFkqQcdbijS2cZYhdjtEVut+X0XVpIQveodgj1XP+IN0EOWlayd2va3TIocBiUtYYbH
	 /OFZJ6S0RrtsyspTFamDVz8HEMt/xlJf5Rx3+F237xRVANtOQZOAvl5/DNFDDzHwlow==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795545338;
	h=Received:DKIM-Signature:Received:From:To:Cc:Subject:In-Reply-To:
	 References:X-Clacks-Overhead:Date:Message-ID:MIME-Version:
	 Content-Type:Content-Transfer-Encoding;
	bh=fDl32fENKK5L6QSxy3ZJfcdRLbINbZoonP8NJB2nHWY=;
	b=d6kh4IEslyTB5bHJSBKRHJtzirEt9r6A5eQEs+u1cpY1FWCrVyEBCpvQDOQNcgu2MXdM
	 5K5LpvUlCTAe1dRL/yO9X/X9YiZJFGEhy+mT9khrX9FG2hqgF+NmTr2Nxs/ju/ShVoIta
	 tz8LonilC3oCnujqVD92aqfCk5xPqE6fiJzKNZeNENWtpzP/+OWjTTl9muCl4SaSF+kHn
	 5rKS7Bhsi9VNX++3kGkXRwOn/cxgeX7lDL4j61V6UpaRYou8nHfBBGyJ3dNOK2zMIwYAl
	 5sDjnCazAzKdAhmgOcsV96O+4PyDeXX9nrl9GjfNGpf4lM1Jwt7osNKirX2iCuj7d1A==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=CR23Knin;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8368F606A321;
	Tue, 24 Nov 2026 18:35:38 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F1EA1F000D2;
	Tue, 24 Nov 2026 18:35:38 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795545338;
	bh=fDl32fENKK5L6QSxy3ZJfcdRLbINbZoonP8NJB2nHWY=;
	h=From:To:Cc:Subject:In-Reply-To:References:Date;
	b=CR23KninORhyGf7S+TNP7Ki98gQ5VSiZ4ENMQRYU1BnXrq2lUPjr3B0HZXB1CrBiN
	 kD8tFKvZPAsTnzzrpOIrqqA2OeT1Ca/YBtTkBR+7xiFKkX/4tpXkhZ8uiYae8Olbvu
	 J4LElesDsmkOPXQ/8y29hs45/m8DDTXH5p1azOMKVExkMIDa6DqvtBhHy/zoHx0S1n
	 zfFf8g0dewhdyj/TEc1uqTlTiT6F0rkD39IBT+/egdSBJsQPFEdNLaRGixUOGIlHkh
	 eHvrZ6AfQNfDI/lh66zUzfXvnyWLr+mktkyCULrY1od2SAD/KY/tEf+L+cDIB9jNYx
	 RcUB8LXJRSm0g==
X-Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000)
	id A0DC0B741C3; Tue, 24 Nov 2026 19:35:35 +0100 (CET)
X-Cc: cake@lists.bufferbloat.net, netdev@vger.kernel.org,
 linux-kernel@vger.kernel.org
X-In-Reply-To: <34de8380-f2ea-42e2-87ff-97a52ec3200d@redhat.com>
X-Clacks-Overhead: GNU Terry Pratchett
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list