mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: bot+bpf-ci@kernel.org
To: irlanki.s@samsung.com,kuniyu@google.com
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
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)	[thread overview]
Message-ID: <3f89ad0cf49f89f8d10f230ecb61bd69bebef63465e260b3e4faf4e2eb65799d@mail.kernel.org> (raw)
In-Reply-To: <20261127133051.2540069-1-irlanki.s@samsung.com>

[-- Attachment #1: Type: text/plain, Size: 3285 bytes --]

> 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

  parent reply	other threads:[~2026-11-27 14:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20261016100913epcas5p13a41d34ac5d203bff1d220b3d19dee67@epcas5p1.samsung.com>
2026-10-16 10:10 ` [PATCH net-next v7] tcp: add BPF kfuncs to set per-socket ECN mode and AccECN option Irlanki Sandeep
2026-10-16 18:03   ` Alexei Starovoitov
     [not found]     ` <CGME20261116134521epcas5p1feade37999749181544983efe729600a@epcas5p1.samsung.com>
2026-11-16 13:46       ` [PATCH bpf-next v8] bpf: tcp: add ecn_init callback to bpf_tcp_ops for per-connection ECN Irlanki Sandeep
2026-11-16 14:28         ` bot+bpf-ci
     [not found]     ` <CGME20261116151200epcas5p4218c26338b3e9580a9e232be400aecc5@epcas5p4.samsung.com>
2026-11-16 15:13       ` [PATCH bpf-next v9] " Irlanki Sandeep
2026-11-19 19:32         ` Kuniyuki Iwashima
     [not found]           ` <CGME20261127132303epcas5p4c8e774f6bce688ebdc0a4b7a29644dde@epcas5p4.samsung.com>
2026-11-27 13:24             ` [PATCH bpf-next v10 0/2] bpf: tcp: add ecn_init callback to bpf_tcp_ops Irlanki Sandeep
     [not found]               ` <CGME20261127132948epcas5p424c1b991bbb4b77880d85cbabba12428@epcas5p4.samsung.com>
2026-11-27 13:30                 ` [PATCH bpf-next v10 1/2] bpf: tcp: add ecn_init callback to bpf_tcp_ops for per-connection ECN Irlanki Sandeep
     [not found]                   ` <CGME20261127132957epcas5p4248d663f22ade00f0c45e349365bb3e8@epcas5p4.samsung.com>
2026-11-27 13:30                     ` [PATCH bpf-next v10 2/2] selftests/bpf: add selftests for bpf_tcp_ops ecn_init Irlanki Sandeep
2026-11-27 14:04                   ` bot+bpf-ci [this message]
2026-11-27 14:47           ` [PATCH bpf-next v9] bpf: tcp: add ecn_init callback to bpf_tcp_ops for per-connection ECN Irlanki Sandeep

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=3f89ad0cf49f89f8d10f230ecb61bd69bebef63465e260b3e4faf4e2eb65799d@mail.kernel.org \
    --to=bot+bpf-ci@kernel.org \
    --cc=alexei.starovoitov@gmail.com \
    --cc=ameryhung@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=corbet@lwn.net \
    --cc=cpgs@samsung.com \
    --cc=daeil2.hwang@samsung.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=eddyz87@gmail.com \
    --cc=edumazet@google.com \
    --cc=g.pokhra@samsung.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=irlanki.s@samsung.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenzo@google.com \
    --cc=madhan.raj@samsung.com \
    --cc=martin.lau@kernel.org \
    --cc=mason@kernel.org \
    --cc=maze@google.com \
    --cc=motomuman@google.com \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=r.kumawat@samsung.com \
    --cc=raj.kumars@samsung.com \
    --cc=ramyashree.s@samsung.com \
    --cc=sharmasagarika@google.com \
    --cc=sporeba@google.com \
    --cc=srihari.k@samsung.com \
    --cc=ts413.lee@samsung.com \
    --cc=yonghong.song@linux.dev \
    /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

all inboxes | Powered by JetHome®