BPF List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: chia-yu.chang@nokia-bell-labs.com
Cc: emil@etsalapatis.com, martin.lau@kernel.org, ast@kernel.org,
	kafai.wan@linux.dev, bpf@vger.kernel.org, willemb@google.com,
	horms@kernel.org, linux-kernel@vger.kernel.org, kuba@kernel.org,
	netdev@vger.kernel.org, pabeni@redhat.com, davem@davemloft.net,
	edumazet@kernel.org, kuniyu@google.com, ij@kernel.org,
	ncardwell@google.com, koen0607@gmail.com, g.white@cablelabs.com,
	ingemar.s.johansson@ericsson.com, mirja.kuehlewind@ericsson.com,
	cheshire@apple.com, rs.ietf@gmx.at, Jason_Livingood@comcast.com,
	vidhi_goel@apple.com, Mike_Rudolph@comcast.com,
	Jeff_Howe@comcast.com, srichard@netapp.com
Subject: Re: [PATCH net-next v5 1/4] tcp: export CE count in rate_sample
Date: Tue, 01 Dec 2026 13:10:19 +0000	[thread overview]
Message-ID: <179613061918.3146.18307347617095764135@kernel.org> (raw)
In-Reply-To: <20261130125658.20292-2-chia-yu.chang@nokia-bell-labs.com>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The new comment on struct rate_sample::acked_sacked_ce
  (include/net/tcp.h:1372-1378) calls the field the "Number of packets…

--

tcp: export CE count in rate_sample

This commit adds an acked_sacked_ce field to struct rate_sample. The field
holds the number of newly ACKed/SACKed CE-marked packets, for use by
upcoming congestion control modules such as TCP Prague. In RFC3168 mode it
is set to the delivered count when FLAG_ECE is present. In AccECN mode it
holds the delta derived from the ACE field or the AccECN options.

> diff --git a/include/net/tcp.h b/include/net/tcp.h
> index 68a60268d19da..12129ae8b06b5 100644
> --- a/include/net/tcp.h
> +++ b/include/net/tcp.h
> @@ -1369,6 +1369,13 @@ struct rate_sample {
>  	long rtt_us;		/* RTT of last (S)ACKed packet (or -1) */
>  	int  losses;		/* number of packets marked lost upon ACK */
>  	u32  acked_sacked;	/* number of packets newly (S)ACKed upon ACK */
> +	/*
> +	 * Number of packets newly (S)ACked associated with congestion
> +	 * signalling upon ACK.
> +	 * For AccECN, this is the number of newly CE-marked packets.
> +	 * For RFC3168, this equals acked_sacked when the ECE flag is present.
> +	 */
> +	u32  acked_sacked_ce;

[Severity: Low]
Does this comment hold for the AccECN case? It describes the field as a
subset of the newly (S)ACKed packets, which implies acked_sacked_ce never
exceeds acked_sacked. The AccECN path doesn't seem to guarantee that.

__tcp_accecn_process() keeps going on timestamp progress alone, so
delivered_pkts can be 0:

net/ipv4/tcp_input.c:__tcp_accecn_process() {
    ...
	if (!(flag & (FLAG_FORWARD_PROGRESS | FLAG_TS_PROGRESS)))
		return 0;
    ...
	corrected_ace = tcp_accecn_ace(th) - TCP_ACCECN_CEP_INIT_OFFSET;
	delta = (corrected_ace - tp->delivered_ce) & TCP_ACCECN_CEP_ACE_MASK;
	if (delivered_pkts <= TCP_ACCECN_CEP_ACE_MASK)
		return delta;
    ...
}

Take an ACK on the slowpath that doesn't ack the SYN. Here delta can be
1..7, taken from the peer's ACE field, even when delivered_pkts is 0 or
smaller than delta. tcp_accecn_process() then stores it without any clamp:

	rs->acked_sacked_ce = delta;

Later, tcp_rate_gen() sets rs->acked_sacked = delivered without checking
it against acked_sacked_ce.

The ACE bits are set by the peer. A peer can therefore make
acked_sacked_ce larger than acked_sacked, including when acked_sacked is 0.
This can happen maliciously, or simply because the peer counts CE-marked
pure ACKs or retransmits, which RFC 9768 allows.

The value is also visible right away to BPF struct_ops cong_control
programs. A consumer that trusts this comment and computes acked_sacked_ce
/ acked_sacked could get a ratio above 1, or a non-zero numerator over a
zero denominator.

Nothing in the tree reads acked_sacked_ce yet, and the stored value has the
same meaning as the old ecn_count. So this is mostly a mismatch between the
comment and the code.

Could the comment say that under AccECN this is the ACE/option-derived CE
count, which is not bounded by acked_sacked? Or should the value be clamped
to the delivered count?

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130125658.20292-1-chia-yu.chang%40nokia-bell-labs.com

  reply	other threads:[~2026-12-01 13:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 12:56 [PATCH net-next v5 0/4] TCP Prague preparation series chia-yu.chang
2026-11-30 12:56 ` [PATCH net-next v5 1/4] tcp: export CE count in rate_sample chia-yu.chang
2026-12-01 13:10   ` netdev-bot+sashiko [this message]
2026-11-30 12:56 ` [PATCH net-next v5 2/4] tcp: rename ECN transmit helper function chia-yu.chang
2026-11-30 12:56 ` [PATCH net-next v5 3/4] tcp: add TCP_ECN_SEND_ECT_1 flag for congestion control chia-yu.chang
2026-12-01 12:57   ` sashiko-bot
2026-12-01 13:10   ` netdev-bot+sashiko
2026-11-30 12:56 ` [PATCH net-next v5 4/4] tcp: add MSS ceiling callback " chia-yu.chang
2026-12-01 12:57   ` sashiko-bot
2026-12-01 13:10   ` netdev-bot+sashiko

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=179613061918.3146.18307347617095764135@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=Jason_Livingood@comcast.com \
    --cc=Jeff_Howe@comcast.com \
    --cc=Mike_Rudolph@comcast.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=cheshire@apple.com \
    --cc=chia-yu.chang@nokia-bell-labs.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=emil@etsalapatis.com \
    --cc=g.white@cablelabs.com \
    --cc=horms@kernel.org \
    --cc=ij@kernel.org \
    --cc=ingemar.s.johansson@ericsson.com \
    --cc=kafai.wan@linux.dev \
    --cc=koen0607@gmail.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@kernel.org \
    --cc=mirja.kuehlewind@ericsson.com \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rs.ietf@gmx.at \
    --cc=srichard@netapp.com \
    --cc=vidhi_goel@apple.com \
    --cc=willemb@google.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