🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #5607

Re: [PATCH net-next v8 4/4] net/sched: cake: hash before segmenting and reject an overlong split

#5607
From: Toke Høiland-Jørgensen
Date: Tue, 20 Oct 2026 17:42
43 lines
9406 bytes
Jamal Hadi Salim <jhs@mojatatu.com> writes:

> The Fix:
> with CAKE_FLAG_SPLIT_GSO, cake computes the flow/host hash keys, then
> splits a GSO skb into segments it accounts individually. Key extraction
> must run on the unsegmented skb -- skb_gso_segment() can rewrite an
> encapsulated packet's headers to the inner ones -- and the resolution
> must wait until the packet is admitted, since it commits the
> set-associative tags, host indices and way counters that a later
> rejection would leave mutated (a GSO skb whose segmentation fails was
> dropped with that state already committed).
>
> Split cake_hash() into a side-effect-free cake_hash_keys(), run on the
> unsegmented skb, and cake_hash_resolve(), run only once the packet is
> admitted. Move the split-GSO path ahead of the resolution: sum the
> segment list, test the total against the ceiling before linking any
> segment, and drop the whole list on rejection so no persistent state is
> committed. The list is deferred to to_free so the tail segment's
> sock_wfree() never runs under the qdisc lock.
>
> Tag every deferred segment with QDISC_DROP_OVERLIMIT: __skb_gso_segment()
> keeps SKB_GSO_CB at cb offset 32, aliasing tc_skb_cb.drop_reason, and
> __copy_skb_header() copies it into every segment, so tagging only the
> head left the rest with GSO scratch (a headroom-sized value) as their
> drop reason, which __tcf_kfree_skb_list() would report as an unrelated
> core reason.
>
> Read q->config->flow_mode once with READ_ONCE() in cake_enqueue() and
> pass that value to both cake_hash_keys() and cake_hash_resolve().
> cake_config_change() writes the mode before cake_change() takes
> sch_tree_lock(), and the split introduced two separate loads with the
> segmentation work between them; a concurrent reconfiguration could
> extract keys in one mode and resolve them in another.
>
> Link: https://lore.kernel.org/netdev/179231933068.3135.80340792633077986@kernel.org/
> Reviewed-by: Victor Nogueira <victor@mojatatu.com>
> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>

Thank you for sticking with the series! :)

Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Technical Details
Message-ID: <87fqy0tgip.fsf@toke.dk>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349444-linux-kernel-netdev=dewy.ru
References: <QDISC-BA27.v8.r0.20261020063241@mojatatu.com> <QDISC-BA27.v8.r0.20261020063241-4@mojatatu.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349444-linux-kernel-netdev=dewy.ru
From: toke@toke.dk (Toke Høiland-Jørgensen)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v8 4/4] net/sched: cake: hash before segmenting
 and reject an overlong split
Date: Tue, 20 Oct 2026 19:42:54 +0200
Organization: Usenet Network
Message-ID: <87fqy0tgip.fsf@toke.dk>
References: <QDISC-BA27.v8.r0.20261020063241@mojatatu.com>
 <QDISC-BA27.v8.r0.20261020063241-4@mojatatu.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="3911569"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:nfr7eD+pn+Hjxeg1nedeD+Tbx7I= sha256:ToCAv/2wwx/oelNAUZby5dN1J6Xu3nXCUi38nCEiEBo=
	sha1:HgKKWalOMp8KJxsOHQ9qE0ceAYs= sha256:OTDZOXRvX/IlFRYD36pbs02rwtLOAn7wIOo1iX/A0Uc=
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 78A54110DAD; Tue, 20 Oct 2026 20:48:09 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.85
X-Spam-Status: No, score=-1.85 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_ADSP_ALL=1.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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-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 DAWOD5miHeVE;
	Tue, 20 Oct 2026 20:48:06 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-349444-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=toke.dk
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id DA3B6110DAA; Tue, 20 Oct 2026 20:48:02 +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 8D7CC36A20; Tue, 20 Oct 2026 17:42:59 +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=1792518179;
	b=BeVaa56tJCOK7CZbCzTnboFDgUL9otF2EqXlOc7GkFH/kRgrS6syw3YSYFzuo0AywGXW
	 hDEwAn+VpMVNqkAVukJFrAS9kA3K+fxXVkEbelwrAkFosUB5yZo+3GT2Op/jxNotKtmJq
	 Fz8yTsfe325+afutenRLFWHsKeTMI2LhczPNlr/Ex8x4LrKlbV5SDbteYvjieL5g1hnvj
	 xQCEVrSwuzqFDYfPCXMEYMeJM0eZb2p86CGl8ViWTUfBWutaGoBqYYx2F9ge9PCPQjIau
	 p+jlmB0gQ9yuW36fRp7/3/0hPVmgo+I0KYgNuvhGsE3EStVLrdvHrashnfY22tDoZFQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792518179;
	h=X-Original-To:Received:DMARC-Filter:From:To:Cc:Subject:In-Reply-To:
	 References:Date:X-Clacks-Overhead: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=EWYQHSdXSBcCbe7Yu0WqEtQUDsnPPm5Pe7P1Fry4b2k=;
	b=Tj/QPS7M2F6FbqFWEc+LjSHf1U9CDDf3JxE7jiUpwMRPXXA9hQiznAwZFB4rDgOKs2MO
	 ma/gMvPRFZlyn5RWED0fgnSfPSodKbGQoBKdQ1m0v1/Tm6WhpeuzZ0Ct09rBkUNxQT/j7
	 39oYWJ6N7ZD/oM7FydKitnqvuVuwH4BGpNzovWIVGlCCxT3BL8/XGbxf5pJbLSKcrxbzD
	 9Et7Fbu7gEUMPUgo/6I4ZwDY/0vBEBgmz1nVgdT2TNhfPGE8RHoAh0wzVHFPsNmomOUZU
	 /jNyHZnWMlxiw2NTF0R8/sTDvqLg5/w5jC2B/uS10eR8DLHd5KosyTIJc2PVlLfICWg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dmarc=pass header.from=toke.dk;
	spf=pass smtp.mailfrom=toke.dk;
	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 12E9B606A326;
	Tue, 20 Oct 2026 17:42:59 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=45.145.95.4
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792518178;
	b=mH8vgoyXzB5CxJYbRHr6IPxeg32E0aZqC6NEUpxGOlq5a4fvPcBKBzedelQi1UJIwCbX
	 rFOk7b2Ahz8TnhlIIOOdAQ1qt577LYiTKeQNaKgL9RdRYVKCCe773UoyWG5T+8TA04s4e
	 KSz1k+58xL3FNwCegm/A9RR1n1W11ALjiLVvf26G+mavliFtUpVrtRynG/UMPbsS2w3PF
	 n8isNOCp8UMMCFbDpetDCL1OaUHzK/yK+2YOsnU9Dcky1DAJ0JE9eSBKs9Q5yCWH5Ki6B
	 pENPcM3asA80PHoYbJIEm6zf8f2igToILlGPCUa5jRpvxJjNYkwtu5pycCwVtzP2c7w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792518178;
	h=DMARC-Filter:From:To:Cc:Subject:In-Reply-To:References:Date:
	 X-Clacks-Overhead:Message-ID:MIME-Version:Content-Type:
	 Content-Transfer-Encoding;
	bh=EWYQHSdXSBcCbe7Yu0WqEtQUDsnPPm5Pe7P1Fry4b2k=;
	b=dnM8Buczp99X1p+6QsmT1hBlHGc28rw2tvyy7F/5SJueh3LcRNh6XuoqBHTE3CAYLmcn
	 iBnQYlmqFhxzJybFqmPU/pQKctULTRLy2xvmnOiaa1fxg4cWhEVuFf0U85gCJV6WwvLLg
	 i0X8KIsImIilT3jvuXlncfW8ShnKxTRT8U8Afn6zBqCasjugDjgsotV7SXnFG2iRm/Cs5
	 JHHnFb8rcuxq6HkGuKVBa+r1RWch1PVFU5q/gfPB41NppDL4bx6pxjZHZ7v1eEenRvWgp
	 GLBCYKr/97KIj47Dp3XI24reueuuyGTtYf+lyhyGJMqEnWAN5satG+ONK4zMBMrnSUw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=toke.dk;
	spf=pass smtp.mailfrom=toke.dk;
	arc=none smtp.remote-ip=45.145.95.4
X-Received: from mail.toke.dk (mail.toke.dk [45.145.95.4])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E630606A32C
	for <netdev@vger.kernel.org>; Tue, 20 Oct 2026 17:42:57 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4E630606A32C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toke.dk
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toke.dk
X-Authentication-Results: mail.toke.dk; dkim=none
X-Cc: 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>, Paolo Abeni
 <pabeni@redhat.com>, Simon Horman <horms@kernel.org>, Victor Nogueira
 <victor@mojatatu.com>, Björn Töpel <bjorn@kernel.org>,
 cake@lists.bufferbloat.net, Sashiko <sashiko-bot@kernel.org>
X-In-Reply-To: <QDISC-BA27.v8.r0.20261020063241-4@mojatatu.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