Skip to contentSkip to conversation

sctp: preserve stream scheduler across outq teardown

PATCH Applied Jun Yang 4 participants 4 messages Nov 17 – Nov 24

Subsystems (3)
lore
Share & tools
lore

Jun Yang

author
#0 lore raw

PATCH v2 1/1 sctp: preserve stream scheduler across outq teardown

From: Jun Yang <[email protected]>

sctp_outq_init() clears the installed scheduler when it reinitializes an outqueue after teardown. The streams still have scheduler-specific state that the old scheduler needs to release if the scheduler changes.

Initialize the queue counters and flags individually so that sctp_sched_set_sched() can use the installed scheduler. A new association is zero-allocated and starts with the socket's default scheduler as before.

When the socket default matches the installed scheduler, streams retain their PRIO priorities and WFQ weights. FC and WFQ also retain fc_length, including bytes charged for purged chunks. Those chunks were queued on the stream and the accounting converges as new data flows.

Fixes 5bbbbe32a431 ("sctp: introduce stream scheduler foundations")

---
v2:
- Initialize the five queue counters and flags individually, as Xin Long suggested.
- Document the per-stream settings and fc_length accounting retained when the scheduler stays the same.
v1: https://lore.kernel.org/netdev/[email protected]/

 net/sctp/outqueue.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
net/sctp/outqueue.c +5 -2
index e92fb9da4647..3dafa6e6cab3 100644
@@ -190,9 +190,12 @@ static inline int sctp_cacc_skip(struct sctp_transport *primary,
  */
 void sctp_outq_init(struct sctp_association *asoc, struct sctp_outq *q)
 {
-	memset(q, 0, sizeof(struct sctp_outq));
-
 	q->asoc = asoc;
+	q->out_qlen = 0;
+	q->error = 0;
+	q->outstanding_bytes = 0;
+	q->fast_rtx = 0;
+	q->cork = 0;
 	INIT_LIST_HEAD(&q->out_chunk_list);
 	INIT_LIST_HEAD(&q->control_chunk_list);
 	INIT_LIST_HEAD(&q->retransmit);

base-commit: a2239d5dbbda3a61b6323df8836f605921a29f7f

#1 lore raw
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

Hi!

This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

- Whether the issue was actually triggered, or is only theoretical (e.g. found by LLM and not proven at runtime). If it was triggered please include the symptoms, like the stack trace or kernel messages.

Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account.

*IMPORTANT*: If you do repost (for other reasons) - please include the relevant info in the cover letter or commit messages.

Signature · 2 lines
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
maintainer Acked-by on v2 1/1
#2 lore raw
In reply to Jun Yang
Quoted 53 lines · Jun Yang

From: Jun Yang <[email protected]>

sctp_outq_init() clears the installed scheduler when it reinitializes an outqueue after teardown. The streams still have scheduler-specific state that the old scheduler needs to release if the scheduler changes.

Initialize the queue counters and flags individually so that sctp_sched_set_sched() can use the installed scheduler. A new association is zero-allocated and starts with the socket's default scheduler as before.

When the socket default matches the installed scheduler, streams retain their PRIO priorities and WFQ weights. FC and WFQ also retain fc_length, including bytes charged for purged chunks. Those chunks were queued on the stream and the accounting converges as new data flows.

Fixes 5bbbbe32a431 ("sctp: introduce stream scheduler foundations")

---
v2:
- Initialize the five queue counters and flags individually, as Xin Long suggested.
- Document the per-stream settings and fc_length accounting retained when the scheduler stays the same.
v1: https://lore.kernel.org/netdev/[email protected]/

 net/sctp/outqueue.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
net/sctp/outqueue.c +5 -2
index e92fb9da4647..3dafa6e6cab3 100644
@@ -190,9 +190,12 @@ static inline int sctp_cacc_skip(struct sctp_transport *primary,
  */
 void sctp_outq_init(struct sctp_association *asoc, struct sctp_outq *q)
 {
-       memset(q, 0, sizeof(struct sctp_outq));
-
        q->asoc = asoc;
+       q->out_qlen = 0;
+       q->error = 0;
+       q->outstanding_bytes = 0;
+       q->fast_rtx = 0;
+       q->cork = 0;
        INIT_LIST_HEAD(&q->out_chunk_list);
        INIT_LIST_HEAD(&q->control_chunk_list);
        INIT_LIST_HEAD(&q->retransmit);
Quoted 2 lines

base-commit: a2239d5dbbda3a61b6323df8836f605921a29f7f

#3 lore raw
In reply to Jun Yang
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 6 lines · On Tue, 17 Nov 2026 19:04:49 +0800 you wrote:

From: Jun Yang <[email protected]>

sctp_outq_init() clears the installed scheduler when it reinitializes an outqueue after teardown. The streams still have scheduler-specific state that the old scheduler needs to release if the scheduler changes.

Quoted 6 lines

Initialize the queue counters and flags individually so that sctp_sched_set_sched() can use the installed scheduler. A new association is zero-allocated and starts with the socket's default scheduler as before.

[...]

Here is the summary with links:
- [net,v2] sctp: preserve stream scheduler across outq teardown

    https://git.kernel.org/netdev/net/c/d1be830de8cb

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html