Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: lucien.xin@gmail.com
Cc: netdev@vger.kernel.org, quic@lists.linux.dev,
	davem@davemloft.net, kuba@kernel.org, edumazet@google.com,
	pabeni@redhat.com, horms@kernel.org, metze@samba.org,
	mbuhl@openbsd.org, tfanelli@redhat.com, hepengtao@xiaomi.com,
	dreibh@simula.no, linux-cifs@vger.kernel.org, pc@manguebit.org,
	linkinjeon@kernel.org, tom@talpey.com,
	kernel-tls-handshake@lists.linux.dev, chuck.lever@oracle.com,
	jlayton@kernel.org, steved@redhat.com, hare@suse.de,
	aahringo@redhat.com, dhowells@redhat.com, matttbe@kernel.org,
	mail@johnericson.me, xiyou.wangcong@gmail.com,
	alibuda@linux.alibaba.com, jbaron@akamai.com,
	illiliti@protonmail.com, sd@queasysnail.net,
	marcelo.leitner@gmail.com, daniel@haxx.se,
	andrew.gospodarek@broadcom.com, mef@scarletmail.rutgers.edu,
	paul@jakma.org, kuniyu@google.com
Subject: Re: [PATCH net-next v16 09/15] quic: add congestion control
Date: Wed, 07 Oct 2026 01:05:16 +0000	[thread overview]
Message-ID: <179133511607.434549.17774997950314089010@kernel.org> (raw)
In-Reply-To: <04d71cfc6acd9df9eb52e4f998c35eee568c4319.1791227050.git.lucien.xin@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] quic_cong_on_packet_lost() (net/quic/cong.c) lets a packet
  that was sent before the first RTT sample start the persistent-…
- [Medium] The New Reno handlers in net/quic/cong.c decide whether to
  react to loss or ECN using only cong->state.

--

quic: add congestion control

This patch adds struct quic_cong for RTT measurement and congestion
control, and a quic_cong_ops interface for congestion control
algorithms. It implements the RFC 9002 state machine (slow start,
congestion avoidance, recovery) with New Reno as the only algorithm. It
also adds persistent congestion detection and pacing.

> diff --git a/net/quic/cong.c b/net/quic/cong.c
> new file mode 100644
> index 0000000000000..4779ffe90a3f2
> --- /dev/null
> +++ b/net/quic/cong.c
> @@ -0,0 +1,319 @@

[ ... ]

> +/* NEW RENO APIs */
> +static void quic_reno_handle_packet_lost(struct quic_cong *cong)
> +{
> +	switch (cong->state) {
> +	case QUIC_CONG_SLOW_START:
> +		pr_debug("%s: slow_start -> recovery, cwnd: %u, ssth: %u\n",
> +			 __func__, cong->window, cong->ssthresh);
> +		break;
> +	case QUIC_CONG_RECOVERY_PERIOD:
> +		return;
> +	case QUIC_CONG_CONGESTION_AVOIDANCE:

[ ... ]

> +	cong->recovery_time = cong->time;
> +	cong->state = QUIC_CONG_RECOVERY_PERIOD;
> +	cong->ssthresh = max(cong->window >> 1U, cong->min_window);
> +	cong->window = cong->ssthresh;
> +}
> +
> +static void quic_reno_on_packet_lost(struct quic_cong *cong, u64 time,
> +				     u32 bytes, s64 number)
> +{
> +	quic_reno_handle_packet_lost(cong);
> +}

[Severity: Medium]
Can one congestion event halve the window twice here?
quic_reno_on_packet_lost() gets the lost packet's send time in time, but
never uses it. quic_reno_handle_packet_lost() skips the reduction only
when cong->state is QUIC_CONG_RECOVERY_PERIOD.

In quic_reno_on_packet_acked(), the state leaves recovery as soon as one
packet sent after recovery_time is acked:

	case QUIC_CONG_RECOVERY_PERIOD:
		if (cong->recovery_time >= time)
			break;
		cong->state = QUIC_CONG_CONGESTION_AVOIDANCE;
		...
		fallthrough;

Here is one sequence:

  - A loss at time T starts recovery.
  - P20 was sent just before T and is lost in the network.
  - An ACK of P21, sent after T, ends recovery.

Later, P20 is declared lost, either by packet threshold on a later ACK
or by the time-threshold loss timer. At that point the state is
QUIC_CONG_CONGESTION_AVOIDANCE. A new recovery period starts and both
ssthresh and window are halved again.

In RFC 9002 Appendix B.6, OnCongestionEvent(sent_time) returns early
when sent_time <= congestion_recovery_start_time. B.7 applies the same
rule to ECN-CE.

Should quic_reno_on_packet_lost() compare time against
cong->recovery_time instead of relying only on cong->state?
quic_reno_on_process_ecn() gets no send time at all, so this check can't
be done there either.

The ACK side has a similar gap. In B.5, acked packets sent before the
recovery start don't grow cwnd. In QUIC_CONG_CONGESTION_AVOIDANCE,
quic_reno_on_packet_acked() grows the window for every acked packet,
whatever its send time.

[ ... ]

> +/* COMMON APIs */
> +void quic_cong_on_packet_lost(struct quic_cong *cong, u64 time, u32 bytes,
> +			      s64 number)
> +{
> +	if (cong->pc_detected)
> +		return;
> +
> +	if (cong->pc_start_time && time > cong->pc_start_time &&
> +	    quic_cong_check_persistent_congestion(cong, time)) {
> +		cong->pc_detected = 1;
> +		cong->min_rtt_valid = 0;
> +		cong->window = cong->min_window;
> +		cong->state = QUIC_CONG_SLOW_START;
> +		return;
> +	}
> +
> +	if (!cong->pc_start_time && cong->is_rtt_set)
> +		cong->pc_start_time = time;

[Severity: Medium]
Can a packet sent before the first RTT sample start the persistent
congestion period here? time is the lost packet's send time. is_rtt_set
shows the state when the loss is detected, not when the packet was sent.

RFC 9002 section 7.6.2 says the persistent congestion period should not
start until there is at least one RTT sample. Appendix B.8 only looks at
lost packets with lost.time_sent > first_rtt_sample.

struct quic_cong has no field for the time of the first RTT sample.
quic_cong_rtt_update() sets cong->is_rtt_set = 1 but doesn't record
when.

Here is an example:

  - A client sends Initial PN0 at T0.
  - It sends a PTO probe PN1 at about T0 + 1s. The PTO from
    QUIC_RTT_INIT is about 999ms.
  - Both packets are lost.
  - A later probe, PN2, is acked and gives a first RTT sample of 50ms.

Loss detection on that ACK marks PN0 lost. is_rtt_set is now 1, so
PN0's send time becomes pc_start_time.

PN1 is then marked lost. The gap of about 1s is larger than
(50 + max(4 * 25, 1) + 25) * 3 = 525ms. So the persistent congestion
branch above runs, cwnd drops to 2 * mss, and min_rtt_valid is cleared,
right after the handshake.

Should quic_cong_rtt_update() record the time of the first RTT sample?
quic_cong_on_packet_lost() could then use only lost packets sent after
that time.

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1791227050.git.lucien.xin%40gmail.com

         reply	other threads:[~2026-10-07  1:05 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-05 19:03 [PATCH net-next v16 00/15] net: introduce QUIC infrastructure and core subcomponents Xin Long
2026-10-05 19:03 ` [PATCH net-next v16 01/15] net: define IPPROTO_QUIC and SOL_QUIC constants Xin Long
2026-10-05 19:03 ` [PATCH net-next v16 02/15] net: build socket infrastructure for QUIC protocol Xin Long
2026-10-05 19:03 ` [PATCH net-next v16 03/15] quic: provide common utilities and data structures Xin Long
2026-10-05 19:03 ` [PATCH net-next v16 04/15] quic: provide family ops for address and protocol Xin Long
2026-10-07  1:05   ` netdev-bot+sashiko
2026-10-07 18:41     ` Xin Long
2026-10-09  1:18     ` Xin Long
2026-10-05 19:04 ` [PATCH net-next v16 05/15] quic: provide quic.h header files for kernel and userspace Xin Long
2026-10-05 19:04 ` [PATCH net-next v16 06/15] quic: add stream management Xin Long
2026-10-07  1:05   ` netdev-bot+sashiko
2026-10-09  1:28     ` Xin Long
2026-10-05 19:04 ` [PATCH net-next v16 07/15] quic: add connection id management Xin Long
2026-10-05 19:04 ` [PATCH net-next v16 08/15] quic: add path management Xin Long
2026-10-07  1:05   ` netdev-bot+sashiko
2026-10-07 19:11     ` Xin Long
2026-10-09  1:37     ` Xin Long
2026-10-05 19:04 ` [PATCH net-next v16 09/15] quic: add congestion control Xin Long
2026-10-07  1:05   ` netdev-bot+sashiko [this message]
2026-10-09  1:42     ` Xin Long
2026-10-05 19:04 ` [PATCH net-next v16 10/15] quic: add packet number space Xin Long
2026-10-05 19:04 ` [PATCH net-next v16 11/15] quic: add crypto key derivation and installation Xin Long
2026-10-07  1:05   ` netdev-bot+sashiko
2026-10-09  1:44     ` Xin Long
2026-10-05 19:04 ` [PATCH net-next v16 12/15] quic: add crypto packet encryption and decryption Xin Long
2026-10-07  1:05   ` netdev-bot+sashiko
2026-10-09  1:48     ` Xin Long
2026-10-05 19:04 ` [PATCH net-next v16 13/15] quic: add timer management Xin Long
2026-10-05 19:04 ` [PATCH net-next v16 14/15] quic: add packet builder base Xin Long
2026-10-05 19:04 ` [PATCH net-next v16 15/15] quic: add packet parser base Xin Long
2026-10-07  1:05   ` netdev-bot+sashiko
2026-10-09  1:55     ` Xin Long
2026-10-07 19:19 ` [PATCH net-next v16 00/15] net: introduce QUIC infrastructure and core subcomponents Xin Long

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=179133511607.434549.17774997950314089010@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=aahringo@redhat.com \
    --cc=alibuda@linux.alibaba.com \
    --cc=andrew.gospodarek@broadcom.com \
    --cc=chuck.lever@oracle.com \
    --cc=daniel@haxx.se \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=dreibh@simula.no \
    --cc=edumazet@google.com \
    --cc=hare@suse.de \
    --cc=hepengtao@xiaomi.com \
    --cc=horms@kernel.org \
    --cc=illiliti@protonmail.com \
    --cc=jbaron@akamai.com \
    --cc=jlayton@kernel.org \
    --cc=kernel-tls-handshake@lists.linux.dev \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=mail@johnericson.me \
    --cc=marcelo.leitner@gmail.com \
    --cc=matttbe@kernel.org \
    --cc=mbuhl@openbsd.org \
    --cc=mef@scarletmail.rutgers.edu \
    --cc=metze@samba.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=paul@jakma.org \
    --cc=pc@manguebit.org \
    --cc=quic@lists.linux.dev \
    --cc=sd@queasysnail.net \
    --cc=steved@redhat.com \
    --cc=tfanelli@redhat.com \
    --cc=tom@talpey.com \
    --cc=xiyou.wangcong@gmail.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