public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: lucien.xin@gmail.com
Cc: Simon Horman <horms@kernel.org>,
	jlayton@kernel.org, davem@davemloft.net, daniel@haxx.se,
	kuba@kernel.org, dhowells@redhat.com, chuck.lever@oracle.com,
	andrew.gospodarek@broadcom.com, matttbe@kernel.org,
	tfanelli@redhat.com, metze@samba.org, marcelo.leitner@gmail.com,
	edumazet@google.com, linkinjeon@kernel.org, hepengtao@xiaomi.com,
	illiliti@protonmail.com, quic@lists.linux.dev,
	mail@johnericson.me, jbaron@akamai.com,
	alibuda@linux.alibaba.com, tom@talpey.com, steved@redhat.com,
	sd@queasysnail.net, pc@manguebit.com, smfrench@gmail.com,
	pabeni@redhat.com, netdev@vger.kernel.org,
	linux-cifs@vger.kernel.org, xiyou.wangcong@gmail.com,
	dreibh@simula.no, kernel-tls-handshake@lists.linux.dev,
	mbuhl@openbsd.org, aahringo@redhat.com, hare@suse.de
Subject: Re: [net-next,v8,09/15] quic: add congestion control
Date: Wed, 28 Jan 2026 16:15:05 +0000	[thread overview]
Message-ID: <20260128161505.1454974-1-horms@kernel.org> (raw)
In-Reply-To: <9b38b4291e2b1b47ee17f7247c4c66f5bcdccffe.1769439073.git.lucien.xin@gmail.com>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.

For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
quic: add congestion control

This patch introduces quic_cong for RTT measurement and congestion
control. It implements a congestion control state machine with slow
start, congestion avoidance, and recovery phases using New Reno.

> diff --git a/net/quic/cong.c b/net/quic/cong.c
> new file mode 100644
> index 000000000000..1a8b7f8db977
> --- /dev/null
> +++ b/net/quic/cong.c

[ ... ]

> +/* rfc9002#section-5: Estimating the Round-Trip Time */
> +void quic_cong_rtt_update(struct quic_cong *cong, u64 time, u32 ack_delay)
> +{
> +	u32 adjusted_rtt, rttvar_sample;

[ ... ]

> +	/* rfc9002#section-5.3:
> +	 *   adjusted_rtt = latest_rtt
> +	 *   if (latest_rtt >= min_rtt + ack_delay):
> +	 *     adjusted_rtt = latest_rtt - ack_delay
> +	 *   smoothed_rtt = 7/8 * smoothed_rtt + 1/8 * adjusted_rtt
> +	 *   rttvar_sample = abs(smoothed_rtt - adjusted_rtt)
> +	 *   rttvar = 3/4 * rttvar + 1/4 * rttvar_sample
> +	 */
> +	adjusted_rtt = cong->latest_rtt;
> +	if (cong->latest_rtt >= cong->min_rtt + ack_delay)
> +		adjusted_rtt = cong->latest_rtt - ack_delay;
> +
> +	cong->smoothed_rtt = (cong->smoothed_rtt * 7 + adjusted_rtt) / 8;
> +	if (cong->smoothed_rtt >= adjusted_rtt)
> +		rttvar_sample = cong->smoothed_rtt - adjusted_rtt;
> +	else
> +		rttvar_sample = adjusted_rtt - cong->smoothed_rtt;

The comment above references abs(smoothed_rtt - adjusted_rtt). Paolo Abeni
suggested using abs_diff() from linux/math.h for this calculation in v3
review, and it was acknowledged. Could abs_diff() be used here instead of
the manual if-else?

https://lore.kernel.org/netdev/a9427359-a798-4f3a-88ef-c10a0bf614ec@redhat.com/

[ ... ]

> diff --git a/net/quic/cong.h b/net/quic/cong.h
> new file mode 100644
> index 000000000000..e6cfb0fa1b6c
> --- /dev/null
> +++ b/net/quic/cong.h

[ ... ]

> +struct quic_cong {
> +	/* RTT tracking */
> +	u32 max_ack_delay;	/* max_ack_delay from rfc9000#section-18.2 */
> +	u32 smoothed_rtt;	/* Smoothed RTT */
> +	u32 latest_rtt;		/* Latest RTT sample */
> +	u32 min_rtt;		/* Lowest observed RTT */
> +	u32 rttvar;		/* RTT variation */
> +	u32 pto;		/* Probe timeout */
> +
> +	/* Timing & pacing */
> +	u64 recovery_time;	/* Recovery period start timestamp */
> +	u64 pacing_rate;	/* Packet sending speed Bytes/sec */
> +	u64 pacing_time;	/* Next scheduled send timestamp (ns) */
> +	u64 time;		/* Cachedached current timestamp */
                                   ^^^^^^^^^^

There appears to be a typo here - "Cachedached" should be "Cached".

  reply	other threads:[~2026-01-28 16:15 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-26 14:50 [PATCH net-next v8 00/15] net: introduce QUIC infrastructure and core subcomponents Xin Long
2026-01-26 14:50 ` [PATCH net-next v8 01/15] net: define IPPROTO_QUIC and SOL_QUIC constants Xin Long
2026-01-26 14:51 ` [PATCH net-next v8 02/15] net: build socket infrastructure for QUIC protocol Xin Long
2026-01-26 14:51 ` [PATCH net-next v8 03/15] quic: provide common utilities and data structures Xin Long
2026-01-29 16:26   ` Paolo Abeni
2026-01-29 19:40     ` Xin Long
2026-01-26 14:51 ` [PATCH net-next v8 04/15] quic: provide family ops for address and protocol Xin Long
2026-01-26 14:51 ` [PATCH net-next v8 05/15] quic: provide quic.h header files for kernel and userspace Xin Long
2026-01-26 14:51 ` [PATCH net-next v8 06/15] quic: add stream management Xin Long
2026-01-26 14:51 ` [PATCH net-next v8 07/15] quic: add connection id management Xin Long
2026-01-29 12:33   ` Paolo Abeni
2026-01-26 14:51 ` [PATCH net-next v8 08/15] quic: add path management Xin Long
2026-01-29 16:20   ` Paolo Abeni
2026-01-29 20:46     ` Xin Long
2026-01-26 14:51 ` [PATCH net-next v8 09/15] quic: add congestion control Xin Long
2026-01-28 16:15   ` Simon Horman [this message]
2026-01-29 19:44     ` [net-next,v8,09/15] " Xin Long
2026-02-02 14:40       ` Simon Horman
2026-01-26 14:51 ` [PATCH net-next v8 10/15] quic: add packet number space Xin Long
2026-01-26 14:51 ` [PATCH net-next v8 11/15] quic: add crypto key derivation and installation Xin Long
2026-01-26 14:51 ` [PATCH net-next v8 12/15] quic: add crypto packet encryption and decryption Xin Long
2026-01-26 14:51 ` [PATCH net-next v8 13/15] quic: add timer management Xin Long
2026-01-26 14:51 ` [PATCH net-next v8 14/15] quic: add packet builder base Xin Long
2026-01-29 16:40   ` Paolo Abeni
2026-01-29 19:39     ` Xin Long
2026-01-26 14:51 ` [PATCH net-next v8 15/15] quic: add packet parser base Xin Long
2026-01-29 16:53   ` Paolo Abeni
2026-01-29 19:37     ` 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=20260128161505.1454974-1-horms@kernel.org \
    --to=horms@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=illiliti@protonmail.com \
    --cc=jbaron@akamai.com \
    --cc=jlayton@kernel.org \
    --cc=kernel-tls-handshake@lists.linux.dev \
    --cc=kuba@kernel.org \
    --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=metze@samba.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pc@manguebit.com \
    --cc=quic@lists.linux.dev \
    --cc=sd@queasysnail.net \
    --cc=smfrench@gmail.com \
    --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