Netdev List
 help / color / mirror / Atom feed
From: Jun Yang <juny24602@gmail.com>
To: lucien.xin@gmail.com, marcelo.leitner@gmail.com
Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, horms@kernel.org, linux-sctp@vger.kernel.org,
	netdev@vger.kernel.org, junvyyang@tencent.com,
	corvus@tencent.com, stable@kernel.org,
	Jun Yang <juny24602@gmail.com>
Subject: [PATCH net v2] sctp: preserve stream scheduler across outq teardown
Date: Tue, 17 Nov 2026 19:04:49 +0800	[thread overview]
Message-ID: <20261117110459.44083-1-juny24602@gmail.com> (raw)

From: Jun Yang <junvyyang@tencent.com>

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")
Cc: stable@kernel.org
Reported-by: TencentOS Corvus AI <corvus@tencent.com>
Link: https://lore.kernel.org/r/20261104105507.62743-1-juny24602@gmail.com
Signed-off-by: Jun Yang <junvyyang@tencent.com>
---
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/20261104105507.62743-1-juny24602@gmail.com/

 net/sctp/outqueue.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index e92fb9da4647..3dafa6e6cab3 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -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


             reply	other threads:[~2026-11-17 11:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 11:04 Jun Yang [this message]
2026-11-17 11:07 ` [PATCH net v2] sctp: preserve stream scheduler across outq teardown netdev-bot+sinfo

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=20261117110459.44083-1-juny24602@gmail.com \
    --to=juny24602@gmail.com \
    --cc=corvus@tencent.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=junvyyang@tencent.com \
    --cc=kuba@kernel.org \
    --cc=linux-sctp@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=marcelo.leitner@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@kernel.org \
    /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