git: b279e84a47dd - main - sctp: improve consistency
- Reply: Kristof Provost : "Re: git: b279e84a47dd - main - sctp: improve consistency"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 28 Jul 2023 22:03:12 UTC
The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=b279e84a47ddb59e55b5a3cec31c51cd41bf0dc3 commit b279e84a47ddb59e55b5a3cec31c51cd41bf0dc3 Author: Michael Tuexen <tuexen@FreeBSD.org> AuthorDate: 2023-07-28 12:36:11 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> CommitDate: 2023-07-28 12:36:11 +0000 sctp: improve consistency This is simplifying a patch to address PR 260116. PR: 260116 MFC after: 1 week --- sys/netinet/sctputil.c | 8 ++------ sys/netinet/sctputil.h | 6 +----- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 00a8953336de..ef8d763efabf 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -5044,11 +5044,7 @@ sctp_free_bufspace(struct sctp_tcb *stcb, struct sctp_association *asoc, 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) { - atomic_subtract_int(&((stcb)->sctp_socket->so_snd.sb_cc), tp1->book_size); - } else { - stcb->sctp_socket->so_snd.sb_cc = 0; - } + SCTP_SAVE_ATOMIC_DECREMENT(&stcb->sctp_socket->so_snd.sb_cc, tp1->book_size); } } @@ -6125,7 +6121,7 @@ get_more_data: if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SB_LOGGING_ENABLE) { sctp_sblog(&so->so_rcv, control->do_not_ref_stcb ? NULL : stcb, SCTP_LOG_SBFREE, (int)cp_len); } - atomic_subtract_int(&so->so_rcv.sb_cc, (int)cp_len); + SCTP_SAVE_ATOMIC_DECREMENT(&so->so_rcv.sb_cc, (int)cp_len); if ((control->do_not_ref_stcb == 0) && stcb) { atomic_subtract_int(&stcb->asoc.sb_cc, (int)cp_len); diff --git a/sys/netinet/sctputil.h b/sys/netinet/sctputil.h index 1105ea14e1ad..60b5661c309c 100644 --- a/sys/netinet/sctputil.h +++ b/sys/netinet/sctputil.h @@ -253,11 +253,7 @@ do { \ } \ 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 >= sp->length) { \ - atomic_subtract_int(&stcb->sctp_socket->so_snd.sb_cc,sp->length); \ - } else { \ - stcb->sctp_socket->so_snd.sb_cc = 0; \ - } \ + SCTP_SAVE_ATOMIC_DECREMENT(&stcb->sctp_socket->so_snd.sb_cc, sp->length); \ } \ } \ } while (0)