quic: add stream management
Subsystems (5)
[email protected]
AI reviewThank 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 comment above quic_stream_max_streams_update() (net/quic/stream.c:313-319) says it "Recalculates the max_uni and…
--
quic: add stream management
This patch adds struct quic_stream_table and struct quic_stream to manage QUIC streams per socket. It adds quic_stream_get() and quic_stream_put() to acquire and release send and receive streams. It also adds quic_stream_id_exceeds() and quic_stream_max_streams_update() to track stream limits.
Quoted 6 lines
net/quic/stream.c new file +0
-0@@ -0,0 +1,427 @@
[ ... ]
Quoted 11 lines
net/quic/stream.c new file +11
-0+/* Updates the maximum allowed incoming stream IDs if any streams were recently +* closed. Recalculates the max_uni and max_bidi stream ID limits based on the +* number of open streams and whether any were marked for deletion. +* +* Returns true if either max_uni or max_bidi was updated, indicating that a +* MAX_STREAMS_UNI or MAX_STREAMS_BIDI frame should be sent to the peer. +*/ +bool quic_stream_max_streams_update (struct quic_stream_table *streams, +s64 *max_uni,s64 *max_bidi) +{ +s64 max, rem;
net/quic/stream.c
Quoted 10 lines
net/quic/stream.c new file +10
-0+ + *max_uni =0 ; + *max_bidi =0 ; +if (streams->recv.uni_pending) { + rem = streams->recv.max_streams_uni - streams->recv.streams_uni; + max = streams->recv.next_uni_stream_id -QUIC_STREAM_ID_STEP + + (rem <<QUIC_STREAM_TYPE_BITS ); + + streams->recv.max_uni_stream_id = max; + *max_uni =quic_stream_id_to_streams (max);
[Severity: Low]
This isn't a bug, but does the comment above quic_stream_max_streams_update() describe max_uni and max_bidi correctly?
The comment says the function "Recalculates the max_uni and max_bidi stream ID limits". max_uni and max_bidi are the names of the output parameters, but those parameters receive stream counts:
*max_uni = quic_stream_id_to_streams(max);
...
*max_bidi = quic_stream_id_to_streams(max);Here quic_stream_id_to_streams() returns (stream_id >> 2) + 1. The stream ID limits are only stored in streams->recv.max_uni_stream_id and streams->recv.max_bidi_stream_id.
The code itself is correct, because MAX_STREAMS frames carry a count. Nothing in the series calls this function yet. A future caller that follows the comment and encodes *max_uni and *max_bidi as stream IDs would advertise the wrong MAX_STREAMS value.
Could the comment say that the output parameters are stream counts?
Quoted 2 lines
net/quic/stream.c new file +2
-0+ streams->recv.uni_pending =0 ; + }
[ ... ]
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1792164438.git.lucien.xin%40gmail.com