From nobody Tue Feb 22 22:57:43 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0861F19E993D; Tue, 22 Feb 2022 22:57:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4K3F1g6mzYz3m3T; Tue, 22 Feb 2022 22:57:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645570664; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sqy0V2K0jJWyi2chE4o13cTaJik4F0vWeJ6Yz6D5MFc=; b=rR2TeG1gucNCk1ekm+Yz3XaIe48Bl2YUtpmt0zbawff/mth38H3RsxVjUS+Dob0tCheTmy tu6a0pASW6TjkhievjGQ28WMIfeL2Jg3xpIyLYHuMV/sqttm08WOdRUks/Ig8DqDVcDiqA TyfHE3augvgQXcW0uvE/3BhPpxWFX2N/8wfFasvscitfjPTJqMNosCdBFtaAbizuKixi3J Dc0K7vK6SpltrYU9Xts9F+bu/WNNDigmz4fIBIN9wWUfZUP1z86ZJjhNgi2qrgIFuc25kA C7rUhhpCT7hmgIel+2NszVUDcrUHBV/nc+8c3JSXm5ScG3vCzXYlJulD0oqrnw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C83AF49FF; Tue, 22 Feb 2022 22:57:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 21MMvhZw070231; Tue, 22 Feb 2022 22:57:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21MMvhPW070230; Tue, 22 Feb 2022 22:57:43 GMT (envelope-from git) Date: Tue, 22 Feb 2022 22:57:43 GMT Message-Id: <202202222257.21MMvhPW070230@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: ba0ac9095a26 - stable/13 - sctp: cleanup and adding KASSERT()s, no functional change List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ba0ac9095a26f01526e4dcd7ebe86bed90a712de Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645570664; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sqy0V2K0jJWyi2chE4o13cTaJik4F0vWeJ6Yz6D5MFc=; b=KahV7I8hzqkOU68Y2Ql58AozHXDUgxONHZnlYfgZKadQoaOWouKclLgrvmwJ0T1yNu+1rM bVNnDZZz5f0WXRwYKEsCUZEWc4J2Nz7dpzpH3XV9uV3wMER2XgqCMPrWuTFfJWbngwkvut BtVLsvGF8cjHJ5qVJ3qNdjVIrvGtMIA5hGkeNg1T4kxhDFGHWx9bl3ewg4l05pGFkoYME0 1SECBp8wWayKkFYLtI87X4PJX9Qc1f67CvgfdFlGJD8yRwKu+E0HRbfGMCvvZSSjME14zj l/YtoqlByKZ869Fm3UiAT+UPwkf6R7EB3CWmV91MIJqC4PuNx9jYSaQA5+L7NA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645570664; a=rsa-sha256; cv=none; b=rTrQBGB129NHPgVjwZxbNqrfNh2knjFvhO4vJGaud6NaKDiaU+8esKuCz0xtrBI7pzBcRN dWDzIMyNNGV/D9Ea6FWPyvv3FAFzZp4FnmnXK5t1jSYyZKzpAkbTx1Sb93pPm0sK7DUND1 ta7hyO9pW13TeyL9O+K8h4ZzQMSLBnKV/47ENhJxYT0hAp9MoEr43q4CrUsEnsUtH0dLa2 M7WXixRWlmnob4C8ZvQNtV6BBviVWxx7x1UzeacLwtcENM6ChA3M/acIpBxTxdhkx1BNcd n30Fkj7tKQSz5xPYAVYr0tbcm4VmSrNlkNd0YWs7WGfjM+G+XKXU/MKMkUChdQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=ba0ac9095a26f01526e4dcd7ebe86bed90a712de commit ba0ac9095a26f01526e4dcd7ebe86bed90a712de Author: Michael Tuexen AuthorDate: 2021-09-28 18:29:43 +0000 Commit: Michael Tuexen CommitDate: 2022-02-22 22:57:22 +0000 sctp: cleanup and adding KASSERT()s, no functional change (cherry picked from commit fa947a3687b98b387de55a33154fce7d6e3dffa3) --- sys/netinet/sctp_ss_functions.c | 55 ++++++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/sys/netinet/sctp_ss_functions.c b/sys/netinet/sctp_ss_functions.c index ff108eb0eb33..fe4b96cf00ab 100644 --- a/sys/netinet/sctp_ss_functions.c +++ b/sys/netinet/sctp_ss_functions.c @@ -63,9 +63,9 @@ sctp_ss_default_init(struct sctp_tcb *stcb, struct sctp_association *asoc) * an existing association has been changed. We need to add all * stream queues to the wheel. */ - for (i = 0; i < stcb->asoc.streamoutcnt; i++) { - stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, &stcb->asoc, - &stcb->asoc.strmout[i], + for (i = 0; i < asoc->streamoutcnt; i++) { + stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, asoc, + &asoc->strmout[i], NULL); } return; @@ -81,6 +81,7 @@ sctp_ss_default_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_out *strq; strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); + KASSERT(strq->ss_params.scheduled, ("strq %p not scheduled", (void *)strq)); TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.ss.rr.next_spoke); strq->ss_params.scheduled = false; } @@ -162,6 +163,9 @@ sctp_ss_default_select(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets *net, struct sctp_stream_out *strq, *strqt; if (asoc->ss_data.locked_on_sending) { + KASSERT(asoc->ss_data.locked_on_sending->ss_params.scheduled, + ("strq %p not scheduled", + (void *)asoc->ss_data.locked_on_sending)); return (asoc->ss_data.locked_on_sending); } strqt = asoc->ss_data.last_out_stream; @@ -170,11 +174,15 @@ default_again: if (strqt == NULL) { strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); } else { + KASSERT(strqt->ss_params.scheduled, + ("strq %p not scheduled", (void *)strqt)); strq = TAILQ_NEXT(strqt, ss_params.ss.rr.next_spoke); if (strq == NULL) { strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); } } + KASSERT(strq == NULL || strq->ss_params.scheduled, + ("strq %p not scheduled", (void *)strq)); /* * If CMT is off, we must validate that the stream in question has @@ -210,16 +218,18 @@ sctp_ss_default_scheduled(struct sctp_tcb *stcb, { struct sctp_stream_queue_pending *sp; + KASSERT(strq != NULL, ("strq is NULL")); + KASSERT(strq->ss_params.scheduled, ("strq %p is not scheduled", (void *)strq)); asoc->ss_data.last_out_stream = strq; - if (stcb->asoc.idata_supported == 0) { + if (asoc->idata_supported == 0) { sp = TAILQ_FIRST(&strq->outqueue); if ((sp != NULL) && (sp->some_taken == 1)) { - stcb->asoc.ss_data.locked_on_sending = strq; + asoc->ss_data.locked_on_sending = strq; } else { - stcb->asoc.ss_data.locked_on_sending = NULL; + asoc->ss_data.locked_on_sending = NULL; } } else { - stcb->asoc.ss_data.locked_on_sending = NULL; + asoc->ss_data.locked_on_sending = NULL; } return; } @@ -324,11 +334,15 @@ rrp_again: if (strqt == NULL) { strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); } else { + KASSERT(strqt->ss_params.scheduled, + ("strq %p not scheduled", (void *)strqt)); strq = TAILQ_NEXT(strqt, ss_params.ss.rr.next_spoke); if (strq == NULL) { strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); } } + KASSERT(strq == NULL || strq->ss_params.scheduled, + ("strq %p not scheduled", (void *)strq)); /* * If CMT is off, we must validate that the stream in question has @@ -370,6 +384,7 @@ sctp_ss_prio_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_out *strq; strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); + KASSERT(strq->ss_params.scheduled, ("strq %p not scheduled", (void *)strq)); if (clear_values) { strq->ss_params.ss.prio.priority = 0; } @@ -464,6 +479,9 @@ sctp_ss_prio_select(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets *net, struct sctp_stream_out *strq, *strqt, *strqn; if (asoc->ss_data.locked_on_sending) { + KASSERT(asoc->ss_data.locked_on_sending->ss_params.scheduled, + ("strq %p not scheduled", + (void *)asoc->ss_data.locked_on_sending)); return (asoc->ss_data.locked_on_sending); } strqt = asoc->ss_data.last_out_stream; @@ -472,6 +490,8 @@ prio_again: if (strqt == NULL) { strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); } else { + KASSERT(strqt->ss_params.scheduled, + ("strq %p not scheduled", (void *)strqt)); strqn = TAILQ_NEXT(strqt, ss_params.ss.prio.next_spoke); if (strqn != NULL && strqn->ss_params.ss.prio.priority == strqt->ss_params.ss.prio.priority) { @@ -480,6 +500,8 @@ prio_again: strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); } } + KASSERT(strq == NULL || strq->ss_params.scheduled, + ("strq %p not scheduled", (void *)strq)); /* * If CMT is off, we must validate that the stream in question has @@ -544,6 +566,7 @@ sctp_ss_fb_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_out *strq; strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); + KASSERT(strq->ss_params.scheduled, ("strq %p not scheduled", (void *)strq)); if (clear_values) { strq->ss_params.ss.fb.rounds = -1; } @@ -625,6 +648,9 @@ sctp_ss_fb_select(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets *net, struct sctp_stream_out *strq = NULL, *strqt; if (asoc->ss_data.locked_on_sending) { + KASSERT(asoc->ss_data.locked_on_sending->ss_params.scheduled, + ("strq %p not scheduled", + (void *)asoc->ss_data.locked_on_sending)); return (asoc->ss_data.locked_on_sending); } if (asoc->ss_data.last_out_stream == NULL || @@ -664,15 +690,15 @@ sctp_ss_fb_scheduled(struct sctp_tcb *stcb, struct sctp_nets *net SCTP_UNUSED, struct sctp_stream_out *strqt; int subtract; - if (stcb->asoc.idata_supported == 0) { + if (asoc->idata_supported == 0) { sp = TAILQ_FIRST(&strq->outqueue); if ((sp != NULL) && (sp->some_taken == 1)) { - stcb->asoc.ss_data.locked_on_sending = strq; + asoc->ss_data.locked_on_sending = strq; } else { - stcb->asoc.ss_data.locked_on_sending = NULL; + asoc->ss_data.locked_on_sending = NULL; } } else { - stcb->asoc.ss_data.locked_on_sending = NULL; + asoc->ss_data.locked_on_sending = NULL; } subtract = strq->ss_params.ss.fb.rounds; TAILQ_FOREACH(strqt, &asoc->ss_data.out.wheel, ss_params.ss.fb.next_spoke) { @@ -715,8 +741,8 @@ sctp_ss_fcfs_init(struct sctp_tcb *stcb, struct sctp_association *asoc) */ while (add_more) { add_more = 0; - for (i = 0; i < stcb->asoc.streamoutcnt; i++) { - sp = TAILQ_FIRST(&stcb->asoc.strmout[i].outqueue); + for (i = 0; i < asoc->streamoutcnt; i++) { + sp = TAILQ_FIRST(&asoc->strmout[i].outqueue); x = 0; /* Find n. message in current stream queue */ while (sp != NULL && x < n) { @@ -724,7 +750,7 @@ sctp_ss_fcfs_init(struct sctp_tcb *stcb, struct sctp_association *asoc) x++; } if (sp != NULL) { - sctp_ss_fcfs_add(stcb, &stcb->asoc, &stcb->asoc.strmout[i], sp); + sctp_ss_fcfs_add(stcb, asoc, &asoc->strmout[i], sp); add_more = 1; } } @@ -743,6 +769,7 @@ sctp_ss_fcfs_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, while (!TAILQ_EMPTY(&asoc->ss_data.out.list)) { sp = TAILQ_FIRST(&asoc->ss_data.out.list); + KASSERT(sp->scheduled, ("sp %p not scheduled", (void *)sp)); TAILQ_REMOVE(&asoc->ss_data.out.list, sp, ss_next); sp->scheduled = false; }