🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23567

Re: [PATCH bpf-next v10 1/2] bpf: tcp: add ecn_init callback to bpf_tcp_ops for per-connection ECN

#23567
From: bot+bpf-ci
Date: Fri, 27 Nov 2026 14:04
89 lines
11734 bytes
--===============1281668951458116797==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

> bpf: tcp: add ecn_init callback to bpf_tcp_ops for per-connection ECN

TL;DR:
- Commit message may misdescribe why syncookies skip ecn_init (no listener,
  not no request sock); a comment is suggested
- Design question: Kuniyuki's v9 concerns (route attribute, callback cost) may
  be unresolved

>     bpf: tcp: add ecn_init callback to bpf_tcp_ops for per-connection ECN
>
>     [ ... ]
>     the default via bpf_get_retval(); an out-of-range return keeps it. With
>     syncookies no request_sock is created, so the program is not invoked and
>     the sysctl and route decide as before. No negotiated-mode state is
>     stored; the decision taken at handshake time stands for the connection.
>     [ ... ]

Is this accurate?  In tcp_conn_request() a request sock is still allocated
when syncookies are in use, and tcp_ecn_create_request() still runs on it
and reaches tcp_ecn_init_bpf():

    req = inet_reqsk_alloc(rsk_ops, sk, !want_cookie);
    ...
    tcp_ecn_create_request(req, skb, sk, dst);

The program appears to be skipped only because a syncookie request sock is
allocated without a listener (attach_listener is false, so rsk_listener is
NULL).  That makes sk_to_full_sk() return NULL inside bpf_tcp_ops_call_int():

    struct sock *__sk = sk_to_full_sk(sk);
    ...
    if (__sk) {

If the program did run on a cookie SYN, its ecn_ok decision would be encoded
in the cookie timestamp, but the ACK path re-validates it with
cookie_ecn_ok(), which reads only the sysctl and the route.

Could the commit message describe the actual mechanism (a request sock with
no listener, so sk_to_full_sk() returns NULL)?  Would a short comment at the
tcp_ecn_create_request() call site also help keep the two paths from
silently disagreeing later?

> diff --git a/include/net/tcp.h b/include/net/tcp.h
> --- a/include/net/tcp.h
> +++ b/include/net/tcp.h

[ ... ]

> @@ -3035,6 +3035,12 @@ struct bpf_tcp_ops {
>  	 */
>  	int (*rwnd_init)(struct sock *sk, struct request_sock *req);
>
> +	/* Should return the ECN variant to negotiate in this handshake:
> +	 * one of net.ipv4.tcp_ecn values. bpf_get_retval() has the sysctl.
> +	 * @req as in timeout_init().
> +	 */
> +	int (*ecn_init)(struct sock *sk, struct request_sock *req);
> +

Kuniyuki Iwashima raised design concerns on v9 that do not look fully
resolved.

He asked why ip-rule (or VRF) with a per-route attribute cannot be used,
noting that a route attribute would also work with syncookies:

> Why can't ip-rule (or VRF) be used with a per-route attribute ?  Also, a
> route attribute would work with syncookie. ... one concern would be that we
> end up adding more single-purpose stateless callbacks during 3WHS, which
> could be more expensive than stateful solution.

The v10 respin only adjusted the commit message and applied his nits.  Was
there a reply on the callback cost question, or from Amery Hung whom he
asked for input?  Is ecn_init() still preferred over a stateful approach
such as rwnd_init() plus a kfunc, given that syncookies still bypass the
callback?


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/46008849646
--===============1281668951458116797==--
Technical Details
Message-ID: <3f89ad0cf49f89f8d10f230ecb61bd69bebef63465e260b3e4faf4e2eb65799d@mail.kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372760-linux-kernel-netdev=dewy.ru
References: <20261127133051.2540069-1-irlanki.s@samsung.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372760-linux-kernel-netdev=dewy.ru
From: bot+bpf-ci@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH bpf-next v10 1/2] bpf: tcp: add ecn_init callback to bpf_tcp_ops for per-connection ECN
Date: Fri, 27 Nov 2026 14:04:03 +0000 (UTC)
Organization: Usenet Network
Message-ID: <3f89ad0cf49f89f8d10f230ecb61bd69bebef63465e260b3e4faf4e2eb65799d@mail.kernel.org>
References: <20261127133051.2540069-1-irlanki.s@samsung.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============1281668951458116797=="
Injection-Info: usenet.network;
	logging-data="745923"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:E1VSf7nrrcs/x276xAmL4YRt5z8= sha256:qyyrjVmHYUijNODQcfaCO5PIkVubg2xS0eygtOqYCFg=
	sha1:mIYupIS6Kf44Mes0oWdXn1csUn4= sha256:56V0E4AF4Iuoga+ZYC8aMgunpogL9Su8aiHa0knX+dM=
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 AB718125F5E; Fri, 27 Nov 2026 17:04:32 +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 dAsWSbUKYp3E;
	Fri, 27 Nov 2026 17:04:25 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-372760-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 B2D09125F5D; Fri, 27 Nov 2026 17:04:12 +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 4F6723FC41; Fri, 27 Nov 2026 14:04:08 +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=1795788247;
	b=ldWIlBiY5UsbDWI+YmC7j11P8o/IreMoCJQyIHmL6UgSHw72qugBWUnBg28tUxSCnW72
	 OEtTQxmyz2lSg+fBAD3CX8oK4swnGs9aIFW4dVxY8daEVvLpToBik5nYinf1u2RqV4JDp
	 K5Y0sp/T9TkQFFMzo3vF1WqSNI48Gebsrg215W6kfhtaz4pA+GY1XmqoPS/dubEJSi1x2
	 bVxbTangSwCvNfTPSqTPz9xnOrEL7hZG9Bxtb4SWRza0QgChX8q/N//ZBQ2Lop+GmVr/Z
	 gP9s5F6US9YCVUOZTPmuBhAufKdfRCirg68RE18JBzxygERRELqvpehuYYCe6TLgp1Q==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795788247;
	h=X-Original-To:Received:Received:DKIM-Signature:Content-Type:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Message-Id:
	 In-Reply-To:References:Subject:From:To:Cc:Date;
	bh=/oInJo8vXdWdzusi1A6UniTrK0nXFaYuOLA3sRJZHVo=;
	b=eaqi/4Yj7QRgx3rJh98z0G6J9TdEmTJqT2oNSO23R1Ud9FD6yGtKRgMMMQPpl9fYQWFE
	 ltqgHFk5gMBy5fBBijATzZxADlDs9fc9P5+bjDCiFP9RMpcS/YagcmVr3nfvHEP1XABcD
	 zuH7GX+lE5L0y9n1LZxcugU2WE1vmVgQbAKOPfw3kyflLUCB4NH415SPqQ2Dl3DayznML
	 ecV0K50ecq0do5agYiLfwDvh1DK/tlDpwDsVIjXx12Cec14pmNYR3bKcdKnpn/9PZ28/b
	 MVKS+fEYWVIA4iBCO+aB0Q1W46p6g1weF2wEbGLrl+w4daaU8W8k3ZNd9Zz/1PdctpA==
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=gmvrnUMV;
	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 BE874606A323;
	Fri, 27 Nov 2026 14:04:07 +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=gmvrnUMV
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=1795788246;
	b=BrwaE1qmSSTAnJujOZwpdqVfAp1asSYMk14eAOqO+aNm5yd+pxMOi38wYKF+EzZpx2KB
	 rY31G0QVQugISWBKCqdzjzHAFW362I+wYUWOzZKZV+9wrKJd70UrOmKDCeBsnJLYo0zMx
	 /+WNTzdYGm/OT7d6BHCmZ7Yj0/dDW2wQq7gjuL/Rmg4gK0S+sCj1/IiziI8cY3c9FEWc3
	 pUGSHiPePH5DX3Z+B0kR1qvKr5wMM/+Q2CFY0T54wEAInxs2Vquegqh2vw/f89i80QBtv
	 3gJRy2xW0cAXYrsHH2gVFcRLGNGH8rvD46Q10K0niD0HOlYtQ56iQO8hUVr+yTIqKBA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795788246;
	h=Received:DKIM-Signature:Content-Type:MIME-Version:Message-Id:
	 In-Reply-To:References:Subject:From:To:Cc:Date;
	bh=/oInJo8vXdWdzusi1A6UniTrK0nXFaYuOLA3sRJZHVo=;
	b=HHRZ/b3wuCzEYvwWVpmQmMY0g/SbwFwwwDk/3O95k4E8xnNw/i35wZzhqN3xUhqIFpyi
	 2AaY+hn/Dn0lzCryLeUwT8wWtmceVlyP2LJUiiwwcmFKYEhpV2hE3B7QGe5UXqxvTWyxW
	 ovhsUmqumUzO0dpJFT34c42z9zQaf2g/fgDL+kNqSTB2AsBqg8MvJMF5oBWlxB3xSIlI1
	 Xi12H5LMwBMoJKpwMdKVromkU+Z4aQNpuPC1YpEGA8gc9qCvfa0MdZ8bx6hELiFBUAmr+
	 eGo11ENqyboWTCmTXK14cvDWsJ7cNmEyxvEm3bwzjCzfasH9+6C7Ue+IrL8urN4Hnag==
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=gmvrnUMV;
	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 DE3D6606A31C;
	Fri, 27 Nov 2026 14:04:06 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 640FA1F00925;
	Fri, 27 Nov 2026 14:04:03 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795788246;
	bh=/oInJo8vXdWdzusi1A6UniTrK0nXFaYuOLA3sRJZHVo=;
	h=In-Reply-To:References:Subject:From:To:Cc:Date;
	b=gmvrnUMVwfdN0snrK0lo2swGupjTqd8Atp2w+NKm7Ak134BtC9w3Qp4x0w2Tu3y2K
	 dRwC+sHsEmm98mEBlL4qvA7ytTSjXqJdahTOSjadAiVMEXV8KfAseTaHe7TLWdWIEg
	 Z6JNSKYOPSTE6hrxtKLEDtoLueuO15aH8FGdlrLaxtKvgiEc1NX5fvRxtrItVHlcmP
	 jvB/zNU6bJGXnW2k+vZ55TnUSghagm0coC7MXYZZrf/km4UPXExZr/HAKoRk9YXlvt
	 yH9Xxhu6/6fRgq8JHGNuIR1r1q58tvU+AWuStPT/U+EoDstmJrplfeWOvUlLz+kD3O
	 wsfFnfbQJIJXg==
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
X-In-Reply-To: <20261127133051.2540069-1-irlanki.s@samsung.com>
X-Cc: alexei.starovoitov@gmail.com,ameryhung@gmail.com,andrii@kernel.org,ast@kernel.org,bpf@vger.kernel.org,corbet@lwn.net,cpgs@samsung.com,daeil2.hwang@samsung.com,daniel@iogearbox.net,davem@davemloft.net,edumazet@google.com,g.pokhra@samsung.com,irlanki.s@samsung.com,kuba@kernel.org,linux-kernel@vger.kernel.org,lorenzo@google.com,madhan.raj@samsung.com,maze@google.com,motomuman@google.com,ncardwell@google.com,netdev@vger.kernel.org,pabeni@redhat.com,r.kumawat@samsung.com,raj.kumars@samsung.com,ramyashree.s@samsung.com,sharmasagarika@google.com,sporeba@google.com,srihari.k@samsung.com,ts413.lee@samsung.com,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev