From nobody Wed Feb 01 22:57:53 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 4P6cl610G7z3cGny; Wed, 1 Feb 2023 22:57:54 +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 4P6cl60W4xz3DP8; Wed, 1 Feb 2023 22:57:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675292274; 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=MAo3wd0LwR+Co6rtidYCzZPcQXqmjqrua3Hg9vBdoKg=; b=mr1BAydCGIVRHHPbdOel4oUde153PkOLatY2qlacm00rmebrnd+s7mOj0GokkE8lQ0deTb DXCNfllA3R55+pZHHBKytEy2r43RUm0CfIMHRi63uiA3iOiSm7u+eD5vkm5oPlTckam+Ul UQfuspA6PCvoRw50Ae/W6jJ9Xv+os47i1Q5r0Vvc4eUmqaFdGh/TnS3LisZBXqETe3CFgd XuoiqrCWaLPgqq7LcQhihAvKLOF3yVpPv7+MMifzTTdbVFQu9EhZS7orgLSQFdd6S1bv2h YrgpHoLQA0CQ2q70eftfWktF1OnaRqMoiVRs3Tl9EJ/hJN2uyTN1sQGjZlBLlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675292274; 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=MAo3wd0LwR+Co6rtidYCzZPcQXqmjqrua3Hg9vBdoKg=; b=s03iLbKiPoWuO7kHUCUqpQpm05leUiCMvLqn/L9u9srgt4yi94FQCnXNiFCsRf2AXEkxuj b2Kpz93jgOY7MlHjsZ/ZnHOo5ukAQqNP5Bso/t9cNupjsVeMjOz/wu/0eS7ZK9tNFW8+2O p+gjw/bLVpVyeA8j1CzLJRB7G9TV8bXqSKuxXBGEDfpHprlBWz91OVf2bfDEEtScr/813B bwk0X29vOE+RBI/febWydkeZPSBWI7Ix4JJKl5XBSLHTcDhyxMLWtN9u5nYKA04cQxiq8A VFHbx0v46cma83itjr+cp8gvtqeketz42b1a6QBWDYHwxZBm3Tixr8A9H+LkaQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675292274; a=rsa-sha256; cv=none; b=S4hiv/oH7KIsMjIUJI3y4ju2VegKj0eJkhd83MaETHA8mv+S3SJ/O3rSZzuN5Wiu6+Ma2C irxafqURArMIaRy7fcNgcC+VvebsAuNVpsBTE5K+vMqbdZR30cThs8VTHx0ZCde8TmKsT8 u2dJlXGG4NqFlnBN5EkFMCqmHtWwz0ds95woupUWVfJHYKxnHsJMwtMOtJqoyqLqM+mJfG Xu+k2KWbvverQG1Z1NQW1XXXUSEL9OBSvMN9HW4VioRmyfKx3BxqdzKNUaagtu0LpmB88C APbW3szF6ghYyPDFKzzuuLdhVlWO0PD87Tl4ONztxiYDiII442ztB6rWmq6KiQ== 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 4P6cl56NfhzXF5; Wed, 1 Feb 2023 22:57:53 +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 311Mvrcw017696; Wed, 1 Feb 2023 22:57:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 311Mvrg6017695; Wed, 1 Feb 2023 22:57:53 GMT (envelope-from git) Date: Wed, 1 Feb 2023 22:57:53 GMT Message-Id: <202302012257.311Mvrg6017695@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: 0a0782655a3c - stable/13 - sctp: more sb_cc related cleanups 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 0a0782655a3ca190f552e4e7a558cee305b985e0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=0a0782655a3ca190f552e4e7a558cee305b985e0 commit 0a0782655a3ca190f552e4e7a558cee305b985e0 Author: Michael Tuexen AuthorDate: 2022-05-23 14:09:23 +0000 Commit: Michael Tuexen CommitDate: 2023-02-01 22:57:27 +0000 sctp: more sb_cc related cleanups No functional change intended. It allows a simpler patch for PR 260116. (cherry picked from commit 5cebd8305afecad82f5d9628d8f7981d33559037) --- sys/netinet/sctp_var.h | 2 +- sys/netinet/sctputil.c | 15 +++++++-------- sys/netinet/sctputil.h | 24 ------------------------ 3 files changed, 8 insertions(+), 33 deletions(-) diff --git a/sys/netinet/sctp_var.h b/sys/netinet/sctp_var.h index a18dbb5e66e2..d1dec9e39d08 100644 --- a/sys/netinet/sctp_var.h +++ b/sys/netinet/sctp_var.h @@ -85,7 +85,7 @@ extern struct pr_usrreqs sctp_usrreqs; #define sctp_sbspace(asoc, sb) ((long) ((sctp_maxspace(sb) > (asoc)->sb_cc) ? (sctp_maxspace(sb) - (asoc)->sb_cc) : 0)) -#define sctp_sbspace_failedmsgs(sb) ((long) ((sctp_maxspace(sb) > (sb)->sb_cc) ? (sctp_maxspace(sb) - (sb)->sb_cc) : 0)) +#define sctp_sbspace_failedmsgs(sb) ((long) ((sctp_maxspace(sb) > SCTP_SBAVAIL(sb)) ? (sctp_maxspace(sb) - SCTP_SBAVAIL(sb)) : 0)) #define sctp_sbspace_sub(a,b) (((a) > (b)) ? ((a) - (b)) : 0) diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 7746740ea6c1..905bd2be129b 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -5003,7 +5003,6 @@ sctp_generate_no_user_data_cause(uint32_t tsn) return (m); } -#ifdef SCTP_MBCNT_LOGGING void sctp_free_bufspace(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_tmit_chunk *tp1, int chk_cnt) @@ -5011,7 +5010,8 @@ sctp_free_bufspace(struct sctp_tcb *stcb, struct sctp_association *asoc, if (tp1->data == NULL) { return; } - asoc->chunks_on_out_queue -= chk_cnt; + atomic_subtract_int(&asoc->chunks_on_out_queue, chk_cnt); +#ifdef SCTP_MBCNT_LOGGING if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBCNT_LOGGING_ENABLE) { sctp_log_mbcnt(SCTP_LOG_MBCNT_DECREASE, asoc->total_output_queue_size, @@ -5019,24 +5019,23 @@ sctp_free_bufspace(struct sctp_tcb *stcb, struct sctp_association *asoc, 0, tp1->mbcnt); } +#endif if (asoc->total_output_queue_size >= tp1->book_size) { - atomic_add_int(&asoc->total_output_queue_size, -tp1->book_size); + atomic_subtract_int(&asoc->total_output_queue_size, tp1->book_size); } else { asoc->total_output_queue_size = 0; } - - if (stcb->sctp_socket && (((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) || + if ((stcb->sctp_socket != NULL) && + (((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) || ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE)))) { if (stcb->sctp_socket->so_snd.sb_cc >= tp1->book_size) { - stcb->sctp_socket->so_snd.sb_cc -= tp1->book_size; + atomic_subtract_int(&((stcb)->sctp_socket->so_snd.sb_cc), tp1->book_size); } else { stcb->sctp_socket->so_snd.sb_cc = 0; } } } -#endif - int sctp_release_pr_sctp_chunk(struct sctp_tcb *stcb, struct sctp_tmit_chunk *tp1, uint8_t sent, int so_locked) diff --git a/sys/netinet/sctputil.h b/sys/netinet/sctputil.h index 8253fde829e1..1105ea14e1ad 100644 --- a/sys/netinet/sctputil.h +++ b/sys/netinet/sctputil.h @@ -239,34 +239,10 @@ sctp_bindx_delete_address(struct sctp_inpcb *inp, struct sockaddr *sa, int sctp_local_addr_count(struct sctp_tcb *stcb); -#ifdef SCTP_MBCNT_LOGGING void sctp_free_bufspace(struct sctp_tcb *, struct sctp_association *, struct sctp_tmit_chunk *, int); -#else -#define sctp_free_bufspace(stcb, asoc, tp1, chk_cnt) \ -do { \ - if (tp1->data != NULL) { \ - atomic_subtract_int(&((asoc)->chunks_on_out_queue), chk_cnt); \ - if ((asoc)->total_output_queue_size >= tp1->book_size) { \ - atomic_subtract_int(&((asoc)->total_output_queue_size), tp1->book_size); \ - } else { \ - (asoc)->total_output_queue_size = 0; \ - } \ - if (stcb->sctp_socket && ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || \ - (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL))) { \ - if (stcb->sctp_socket->so_snd.sb_cc >= tp1->book_size) { \ - atomic_subtract_int(&((stcb)->sctp_socket->so_snd.sb_cc), tp1->book_size); \ - } else { \ - stcb->sctp_socket->so_snd.sb_cc = 0; \ - } \ - } \ - } \ -} while (0) - -#endif - #define sctp_free_spbufspace(stcb, asoc, sp) \ do { \ if (sp->data != NULL) { \