From nobody Mon Aug 14 10:30:29 2023 X-Original-To: dev-commits-src-all@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 4RPVz96762z4qHpG; Mon, 14 Aug 2023 10:30:29 +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 4RPVz95bxNz4S3K; Mon, 14 Aug 2023 10:30:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692009029; 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=UmBzim2SZh5yNW87yP+f+KJaQlpw2bqO6ekbpB2WYds=; b=rH1IPSbCQF7Bf4VqGOsAzTY88vSL36t0u29b18KlhMdFYUolNObhq1WDLIYjAK5JJfGdci xc7CD92Yw2aQobsmL7E4Q061jaZl93rAiSFLj2mXuK168H+z5orVS2K4aPuVQkHeTPDxEA qbUVnm2Hq/IGFn6xszG/yjitKbqIaluxeJMjaVYGT6aO9YXMreKXHAhOpatCebJryRNE4S CHwp8cjjaSHbPeKjmmKNzeKLu7FORG7DGcC9DGsANcp/gC3NVqwW1t/ffnyCFfTi3sh1Aw TC9ZSqcRlsNSdgSrHXH7wLzz+hr6SPmipgaCS6T8wZyAyf+F0GDKI5aY/zAvLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692009029; 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=UmBzim2SZh5yNW87yP+f+KJaQlpw2bqO6ekbpB2WYds=; b=OeOafukr59f6WhpuWhXr4LhVU//pRMpF8wQCihCf9PTJ5+oQIpLALIh7/cpr5dfcBp8KO1 kIwf45VVH//MFMLr/pYpAtpd5o5NZvzpi68KUetXkV1pNjlvWLQ/DDxUJupxdtJLvXmuQy eaYF2VORB5RTGh8AsPN/veLjhHVO9wu7/u1x3ob0DILvetgAwv+AGSZ2TjykQ9LOHYdjEE DsILtyJwSNDDF82W6B4bkKwxneKy3d13nIrju0SQWhshlwPAcpFR8m2OtaIsE4F/4hr5U7 z2hCKAUyl0QkMfjapxioJuSo+7T1ipoEjL1prgJs1ys6TfutEjgRFLoV0Lsu+A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1692009029; a=rsa-sha256; cv=none; b=Jmx5mXEm7KZ+jjmLqYLtGmYWKVjIFNxQ1nB2hSDCPUJonZPWOQGZQ/q5F/1Naiyt9AWOtE k3mKN5lJYUzBRGlyWZPbLZRO3+ScdyGkFi7sMOeLYkAHdaMt7GlTKrMwt4igXlJOXb5iFx dpYN0NSyBo+z5jGbZWKlrZ0TziYNRGTYLJqU++2P/qDSpnglWYuOKs+N/TNJufvNDHTm+k iWuWHcqAyqRhKnkoCnnXa11uOs4ANjwEzYGupCDz02UGijp/cWBdwQkyIAYjVXJtg3gyaE F0LIVQMSdng0LxqOtrODBFzfm+FtDxpy6C5iKvQsKQNezU1UQDdzRk16DRWC4g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4RPVz94Ltyz9XL; Mon, 14 Aug 2023 10:30:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 37EAUTBH020477; Mon, 14 Aug 2023 10:30:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37EAUTk8020474; Mon, 14 Aug 2023 10:30:29 GMT (envelope-from git) Date: Mon, 14 Aug 2023 10:30:29 GMT Message-Id: <202308141030.37EAUTk8020474@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 749a7fb588c4 - main - sctp: cleanup List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: 749a7fb588c4a872a4f1ce3ee92be86bab1b1f17 Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=749a7fb588c4a872a4f1ce3ee92be86bab1b1f17 commit 749a7fb588c4a872a4f1ce3ee92be86bab1b1f17 Author: Michael Tuexen AuthorDate: 2023-08-14 10:27:39 +0000 Commit: Michael Tuexen CommitDate: 2023-08-14 10:27:39 +0000 sctp: cleanup Do not put a variable in the stcb for passing it to a function. Just use a parameter of the function. No functional change intended. MFC after: 1 week --- sys/netinet/sctp_indata.c | 9 ++------- sys/netinet/sctp_pcb.c | 11 +++-------- sys/netinet/sctputil.c | 27 ++++++++++----------------- 3 files changed, 15 insertions(+), 32 deletions(-) diff --git a/sys/netinet/sctp_indata.c b/sys/netinet/sctp_indata.c index b8bfaf164904..ba2504d0fea8 100644 --- a/sys/netinet/sctp_indata.c +++ b/sys/netinet/sctp_indata.c @@ -5491,9 +5491,8 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, struct sctp_association *asoc; uint32_t new_cum_tsn, gap; unsigned int i, fwd_sz, m_size; - uint32_t str_seq; struct sctp_stream_in *strm; - struct sctp_queued_to_read *control, *ncontrol, *sv; + struct sctp_queued_to_read *control, *ncontrol; asoc = &stcb->asoc; if ((fwd_sz = ntohs(fwd->ch.chunk_length)) < sizeof(struct sctp_forward_tsn_chunk)) { @@ -5674,9 +5673,7 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, TAILQ_FOREACH(control, &stcb->sctp_ep->read_queue, next) { if ((control->sinfo_stream == sid) && (SCTP_MID_EQ(asoc->idata_supported, control->mid, mid))) { - str_seq = (sid << 16) | (0x0000ffff & mid); control->pdapi_aborted = 1; - sv = stcb->asoc.control_pdapi; control->end_added = 1; if (control->on_strm_q == SCTP_ON_ORDERED) { TAILQ_REMOVE(&strm->inqueue, control, next_instrm); @@ -5699,13 +5696,11 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, #endif } control->on_strm_q = 0; - stcb->asoc.control_pdapi = control; sctp_ulp_notify(SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION, stcb, SCTP_PARTIAL_DELIVERY_ABORTED, - (void *)&str_seq, + (void *)control, SCTP_SO_NOT_LOCKED); - stcb->asoc.control_pdapi = sv; break; } else if ((control->sinfo_stream == sid) && SCTP_MID_GT(asoc->idata_supported, control->mid, mid)) { diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index aad5879afe63..0f1d2291a819 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -4777,20 +4777,15 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre * added right after this * msg. */ - uint32_t strseq; - - stcb->asoc.control_pdapi = sq; - strseq = (sq->sinfo_stream << 16) | (sq->mid & 0x0000ffff); sctp_ulp_notify(SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION, stcb, SCTP_PARTIAL_DELIVERY_ABORTED, - (void *)&strseq, + (void *)sq, SCTP_SO_LOCKED); - stcb->asoc.control_pdapi = NULL; } + /* Add an end to wake them */ + sq->end_added = 1; } - /* Add an end to wake them */ - sq->end_added = 1; } } SCTP_INP_READ_UNLOCK(inp); diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index f85cf99a43fe..3a952a452289 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -3642,7 +3642,8 @@ sctp_notify_adaptation_layer(struct sctp_tcb *stcb) static void sctp_notify_partial_delivery_indication(struct sctp_tcb *stcb, uint32_t error, - uint32_t val, int so_locked) + struct sctp_queued_to_read *aborted_control, + int so_locked) { struct mbuf *m_notify; struct sctp_pdapi_event *pdapi; @@ -3655,6 +3656,7 @@ sctp_notify_partial_delivery_indication(struct sctp_tcb *stcb, uint32_t error, return; } + KASSERT(aborted_control != NULL, ("aborted_control is NULL")); SCTP_INP_READ_LOCK_ASSERT(stcb->sctp_ep); m_notify = sctp_get_mbuf_for_msg(sizeof(struct sctp_pdapi_event), 0, M_NOWAIT, 1, MT_DATA); @@ -3668,8 +3670,8 @@ sctp_notify_partial_delivery_indication(struct sctp_tcb *stcb, uint32_t error, pdapi->pdapi_flags = 0; pdapi->pdapi_length = sizeof(struct sctp_pdapi_event); pdapi->pdapi_indication = error; - pdapi->pdapi_stream = (val >> 16); - pdapi->pdapi_seq = (val & 0x0000ffff); + pdapi->pdapi_stream = aborted_control->sinfo_stream; + pdapi->pdapi_seq = (uint16_t)aborted_control->mid; pdapi->pdapi_assoc_id = sctp_get_associd(stcb); SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_pdapi_event); @@ -3695,12 +3697,7 @@ sctp_notify_partial_delivery_indication(struct sctp_tcb *stcb, uint32_t error, sctp_sblog(sb, control->do_not_ref_stcb ? NULL : stcb, SCTP_LOG_SBRESULT, 0); } control->end_added = 1; - if (stcb->asoc.control_pdapi) - TAILQ_INSERT_AFTER(&stcb->sctp_ep->read_queue, stcb->asoc.control_pdapi, control, next); - else { - /* we really should not see this case */ - TAILQ_INSERT_TAIL(&stcb->sctp_ep->read_queue, control, next); - } + TAILQ_INSERT_AFTER(&stcb->sctp_ep->read_queue, aborted_control, control, next); if (stcb->sctp_ep && stcb->sctp_socket) { /* This should always be the case */ sctp_sorwakeup(stcb->sctp_ep, stcb->sctp_socket); @@ -4136,14 +4133,10 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb, (struct sctp_tmit_chunk *)data, so_locked); break; case SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION: - { - uint32_t val; - - val = *((uint32_t *)data); - - sctp_notify_partial_delivery_indication(stcb, error, val, so_locked); - break; - } + sctp_notify_partial_delivery_indication(stcb, error, + (struct sctp_queued_to_read *)data, + so_locked); + break; case SCTP_NOTIFY_ASSOC_LOC_ABORTED: if ((SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) || (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED)) {