Re: [PATCH net-next v7 06/16] quic: add stream management

Paolo Abeni <[email protected]> Tue, 20 Jan 2026 13:31:51 +0100
Newsgroups dev.linux.lists.quic,dev.linux.lists.kernel-tls-handshake,org.kernel.vger.linux-cifs,org.kernel.vger.netdev
Message-ID <[email protected]>
On 1/15/26 4:11 PM, Xin Long wrote:
> +struct quic_stream {
> +	struct hlist_node node;
> +	s64 id;				/* Stream ID as defined in RFC 9000 Section 2.1 */
> +	struct {
> +		/* Sending-side stream level flow control */
> +		u64 last_max_bytes;	/* Maximum send offset advertised by peer at last update */
> +		u64 max_bytes;		/* Current maximum offset we are allowed to send to */
> +		u64 bytes;		/* Bytes already sent to peer */
> +
> +		u32 errcode;		/* Application error code to send in RESET_STREAM */
> +		u32 frags;		/* Number of sent STREAM frames not yet acknowledged */
> +		u8 state;		/* Send stream state, per rfc9000#section-3.1 */
> +
> +		u8 data_blocked:1;	/* True if flow control blocks sending more data */
> +		u8 done:1;		/* True if application indicated end of stream (FIN sent) */

Minor nit: AFAICS with the current struct layout the bitfield above does
not save any space, compared to plain u8 and will lead to worse code.

> +	} send;
> +	struct {
> +		/* Receiving-side stream level flow control */
> +		u64 max_bytes;		/* Maximum offset peer is allowed to send to */
> +		u64 window;		/* Remaining receive window before advertise a new limit */
> +		u64 bytes;		/* Bytes consumed by application from the stream */
> +
> +		u64 highest;		/* Highest received offset */
> +		u64 offset;		/* Offset up to which data is in buffer or consumed */
> +		u64 finalsz;		/* Final size of the stream if FIN received */
> +
> +		u32 frags;		/* Number of received STREAM frames pending reassembly */
> +		u8 state;		/* Receive stream state, per rfc9000#section-3.2 */
> +
> +		u8 stop_sent:1;		/* True if STOP_SENDING has been sent */
> +		u8 done:1;		/* True if FIN received and final size validated */

... same here...

> +	} recv;
> +};
> +
> +struct quic_stream_limits {
> +	/* Stream limit parameters defined in rfc9000#section-18.2 */
> +	u64 max_stream_data_bidi_remote;	/* initial_max_stream_data_bidi_remote */
> +	u64 max_stream_data_bidi_local;		/* initial_max_stream_data_bidi_local */
> +	u64 max_stream_data_uni;		/* initial_max_stream_data_uni */
> +	u64 max_streams_bidi;			/* initial_max_streams_bidi */
> +	u64 max_streams_uni;			/* initial_max_streams_uni */
> +
> +	s64 next_bidi_stream_id;	/* Next bidi stream ID to open or accept */
> +	s64 next_uni_stream_id;		/* Next uni stream ID to open or accept */
> +	s64 max_bidi_stream_id;		/* Highest allowed bidi stream ID */
> +	s64 max_uni_stream_id;		/* Highest allowed uni stream ID */
> +	s64 active_stream_id;		/* Most recently opened stream ID */
> +
> +	u8 bidi_blocked:1;	/* STREAMS_BLOCKED_BIDI sent, awaiting ACK */
> +	u8 uni_blocked:1;	/* STREAMS_BLOCKED_UNI sent, awaiting ACK */
> +	u8 bidi_pending:1;	/* MAX_STREAMS_BIDI needs to be sent */
> +	u8 uni_pending:1;	/* MAX_STREAMS_UNI needs to be sent */

... and here.

Other than that LGTM. With the bitfield replaced with plain u8 feel free
to add my

Acked-by: Paolo Abeni <[email protected]>