From: "Irlanki Sandeep" <irlanki.s@samsung.com>
To: "'Kuniyuki Iwashima'" <kuniyu@google.com>, <ameryhung@gmail.com>
Cc: <netdev@vger.kernel.org>, <bpf@vger.kernel.org>,
<kuba@kernel.org>, <cpgs@samsung.com>, <edumazet@google.com>,
<davem@davemloft.net>, <pabeni@redhat.com>,
<ncardwell@google.com>, <ast@kernel.org>,
<alexei.starovoitov@gmail.com>, <ameryhung@gmail.com>,
<daniel@iogearbox.net>, <andrii@kernel.org>, <corbet@lwn.net>,
<linux-kernel@vger.kernel.org>, <lorenzo@google.com>,
<maze@google.com>, <sporeba@google.com>, <motomuman@google.com>,
<madhan.raj@samsung.com>, <srihari.k@samsung.com>,
<g.pokhra@samsung.com>, <r.kumawat@samsung.com>,
<raj.kumars@samsung.com>, <ts413.lee@samsung.com>,
<ramyashree.s@samsung.com>, <daeil2.hwang@samsung.com>,
<sharmasagarika@google.com>, <irlanki.s@samsung.com>
Subject: RE: [PATCH bpf-next v9] bpf: tcp: add ecn_init callback to bpf_tcp_ops for per-connection ECN
Date: Fri, 27 Nov 2026 20:17:42 +0530 [thread overview]
Message-ID: <000001dd7e7e$448c3000$cda49000$@samsung.com> (raw)
In-Reply-To: <av8pip2n63ZBofcE@google.com>
Hi Kuniyuki,
Thanks for the review. v10 is posted as 0/2, 1/2 and 2/2.
> Why can't ip-rule (or VRF) be used with a per-route attribute ?
Routes and rules select traffic by destination, interface, mark, uid
range, protocol and port, not by cgroup or application. A uid or mark
rule can separate apps, but the existing per-route ECN bit
(RTAX_FEATURE_ECN) only force-enables classic ECN, so selecting AccECN
would need a new route feature. VRF separates traffic by routing table
and interface, not by application on the same route.
> Also, a route attribute would work with syncookie.
Correct. Syncookie connections do not run the callback, so with this
series they use the sysctl; the route bit still applies via
cookie_ecn_ok(). ip-sysctl.rst documents this. An automated review of
v10 pointed out that the commit message is wrong about syncookies. It
says no request_sock is created, but a request_sock is allocated; it just
has no listener, so sk_to_full_sk() returns NULL and the program is
skipped. v11 will fix the commit message and add a comment at the call
site. I consider the fallback acceptable, since syncookies only come into
play under load. If you think the per-connection policy should also cover
the syncookie path, I'm happy to discuss options.
> This is simple, but one concern would be that we end up adding more
> single-purpose stateless callbacks during 3WHS, which could be more
> expensive than stateful solution.
>
> For stateful use case w/ per-socket field, rwnd_init() + kfunc would
> suffice (and we have such a use case).
The cost concern is valid. The callback runs at most once per side per
handshake, and since v10 on the passive side only for SYNs that request
ECN.
For the stateful alternative, rwnd_init() + kfunc works on the active
side, because rwnd_init() runs in tcp_connect_init() before
tcp_ecn_send_syn(). On the passive side it does not, because
tcp_ecn_create_request() decides the ECN bits before rwnd_init() runs,
so a field set there would not affect that SYN-ACK. If your per-socket
use case is active-side only, rwnd_init() + kfunc is viable for it, and
we can discuss it as a follow-up.
> nit: reverse xmas tree order
> Please avoid calling it if not needed,
> !tcp_accecn_syn_requested && !th_ecn
>
> also nit: reverse xmas tree
Done in v10. The declarations in tcp_ecn_send_syn() and
tcp_ecn_create_request() are reordered. tcp_ecn_create_request() now
returns before calling tcp_ecn_init_bpf() unless the SYN requests AccECN
or carries ECE+CWR.
> Please split selftest into a separate patch.
Done in v10. The selftests are in their own patch (2/2).
Thanks,
Sandeep
prev parent reply other threads:[~2026-11-27 14:47 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 ` [PATCH bpf-next v10 1/2] bpf: tcp: add ecn_init callback to bpf_tcp_ops for per-connection ECN bot+bpf-ci
2026-11-27 14:47 ` Irlanki Sandeep [this message]
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='000001dd7e7e$448c3000$cda49000$@samsung.com' \
--to=irlanki.s@samsung.com \
--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=edumazet@google.com \
--cc=g.pokhra@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=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 \
/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®