BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Irlanki Sandeep" <irlanki.s@samsung.com>, bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v8] bpf: tcp: add ecn_init callback to bpf_tcp_ops for per-connection ECN
Date: Mon, 16 Nov 2026 13:58:58 +0000	[thread overview]
Message-ID: <sashiko-outbox-217122@kernel.org> (raw)
In-Reply-To: <20261116134652.322156-1-irlanki.s@samsung.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] selftests/bpf: multi-line comment style in bpf_tcp_ops_ecn.c
--

commit 826a67ec5267cf10887c1bb0ea3883a7cff12093
Author: Irlanki Sandeep <irlanki.s@samsung.com>

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

This commit adds an ecn_init callback to struct bpf_tcp_ops so cgroup
BPF programs can override net.ipv4.tcp_ecn per connection during TCP
handshakes, along with documentation and BPF selftests.

> diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ops_ecn.c b/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ops_ecn.c
> new file mode 100644
> index 0000000000000..077148a6127c1
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ops_ecn.c

[ ... ]

> +/* net.ipv4.tcp_ecn / ecn_init() values (enum tcp_ecn_mode): 0 == no ECN,
> + * 1 == accept + request RFC3168 ECN, 3 == accept + request AccECN.
> + */
> +static const struct ecn_case ecn_cases[] = {
> +	{
> +		/* The sysctl disables ECN; BPF negotiates RFC3168 ECN. */
> +		.name = "bpf_enables_classic",
> +		.sysctl_ecn = 0,
> +		.retval_active = 1,
> +		.retval_passive = 1,
> +		.mode_client = TCP_ECN_MODE_RFC3168,
> +		.mode_server = TCP_ECN_MODE_RFC3168,
> +	},
> +	{
> +		/* The sysctl disables ECN; BPF negotiates AccECN. */
> +		.name = "bpf_enables_accecn",
> +		.sysctl_ecn = 0,
> +		.retval_active = 3,
> +		.retval_passive = 3,
> +		.mode_client = TCP_ECN_MODE_ACCECN,
> +		.mode_server = TCP_ECN_MODE_ACCECN,
> +	},
> +	{
> +		/* The client requests AccECN but the server only accepts
> +		 * RFC3168 ECN (< 3): negotiation degrades to RFC3168.
> +		 */
> +		.name = "passive_clamps_accecn",
> +		.sysctl_ecn = 0,
> +		.retval_active = 3,
> +		.retval_passive = 1,
> +		.mode_client = TCP_ECN_MODE_RFC3168,
> +		.mode_server = TCP_ECN_MODE_RFC3168,
> +	},
> +	{
> +		/* The server refuses ECN although the sysctl allows it. */
> +		.name = "passive_refuses_ecn",
> +		.sysctl_ecn = 1,
> +		.retval_active = 3,
> +		.retval_passive = 0,
> +		.mode_client = TCP_ECN_MODE_DISABLED,
> +		.mode_server = TCP_ECN_MODE_DISABLED,
> +	},
> +	{
> +		/* The client does not request ECN although the sysctl
> +		 * allows it, so there is nothing for the server to accept.
> +		 */
> +		.name = "active_disables_ecn",
> +		.sysctl_ecn = 1,
> +		.retval_active = 0,
> +		.retval_passive = 3,
> +		.mode_client = TCP_ECN_MODE_DISABLED,
> +		.mode_server = TCP_ECN_MODE_DISABLED,
> +	},
> +	{
> +		/* Return values above TCP_ECN_IN_ACCECN_OUT_NOECN fall back
> +		 * to the sysctl on both sides.
> +		 */
> +		.name = "fallback_above_range",
> +		.sysctl_ecn = 1,
> +		.retval_active = 6,
> +		.retval_passive = 6,
> +		.mode_client = TCP_ECN_MODE_RFC3168,
> +		.mode_server = TCP_ECN_MODE_RFC3168,
> +	},
> +	{
> +		/* Negative return values fall back to the sysctl too. */
> +		.name = "fallback_negative",
> +		.sysctl_ecn = 1,
> +		.retval_active = -1,
> +		.retval_passive = -1,
> +		.mode_client = TCP_ECN_MODE_RFC3168,
> +		.mode_server = TCP_ECN_MODE_RFC3168,
> +	},
> +};
> +
> +/* Connect over loopback and accept() the child socket, so that
> + * passive_established is guaranteed to have run: the listener is woken
> + * up only after tcp_rcv_state_process() moved the child to established.
> + */
> +static void do_ecn_connect(int family)

[Severity: Low]
This isn't a bug, but BPF code uses the multi-line comment style where
the opening /* sits on its own line with the comment text starting on
the next line. Could the multi-line comments in ecn_cases[] and above
do_ecn_connect() be formatted that way?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261116134652.322156-1-irlanki.s@samsung.com?part=1

      reply	other threads:[~2026-11-16 13:58 UTC|newest]

Thread overview: 4+ 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
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 13:58       ` sashiko-bot [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=sashiko-outbox-217122@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=irlanki.s@samsung.com \
    --cc=sashiko-reviews@lists.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