From nobody Thu Nov 14 10:08:15 2024 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 4Xpwp73Z1fz5cR9w; Thu, 14 Nov 2024 10:08:15 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xpwp732p5z40gZ; Thu, 14 Nov 2024 10:08:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731578895; 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=zY0SnxzxYYor0uYGyroxNJjaDzG1IBO0SrmaozVS1T8=; b=f1s6p/nqlJziaO0lAlBRtts6tlJ42qt6Vay9FZQwsYCM+TCqEcLMb3ECZj0LI9T+meixCJ 6C4QBRscIT9O17QlHHPn1llGctDsRYyZDliE7P1CvsbaNiTXTbTBqHHDFsnAhgOG/bxSEh xkQH3xXBlmVqSco4/gGyRV/tXdXHqs66wnDsbNId4Loxa5yZIgtFSDURWfkWdMftFulZIV E81MHwAIlFrLofzthWbvIdt1vCRz1K8Q32P9Wkx/nejAgn35eCN5o2vmdRUUWhvk0qfU+r R42ZkEX92xLf5uN1Lj5L2m2vl16z1eSuXnuxmDFIJxANVWDQIKJSh9UiJKZnfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731578895; 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=zY0SnxzxYYor0uYGyroxNJjaDzG1IBO0SrmaozVS1T8=; b=yPaLwO9V7AFOBDcK1xpVVihrhBdLi/3zPdN9MfAmt517QXg+l47IdKcfjivk+c2hZcBCo7 mpFjxB8CrUDqGmt5RhxGlDXJ7lI42jbjWJdsJ7nOUVfMZf20IaJk76sDTu+dSCv0Pw3IG+ 4bepJNgGvG2DSUu45/DcDbyIf35DCS76HSNEY/2czTF052/LRk6T8wu/irHgHpISR4mjtU BOJfh4OW4d6LFeXfnoZZUkBuHysmif6XH8e/p6H73ywHCCRNbhQdmgpS9ySn4DWsB4yig1 JTdePhZQijZxMNUuMpIA3Y1MyhR4zdvDIrRnPp+W5t5cnJh2pYrWO34vktY3bw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1731578895; a=rsa-sha256; cv=none; b=WKlsYgk+s3EwED3o2O0RnMd7kCRfvqZaR27Fkv/apCu1HZGjmSu8jfy5laYTxae5S77q0n BRpvL77fywqWr2FR7TMDDzPvJ8Xosk5Rpy2d9Px0WZR/zaaMbrXObKFdQQw2k4Tkp9fJEX RYToraWPb1nchYxdvx29N1NY5HIO9Br6vljDloi8O6JFBMaj2fqW6ojgdd8TsSV7qk8ZTt 0sfKPMewYExNM3ddoSQfzKWkucrV5+rHWiZNiR/yWauU6aQZajh+QDptytJcL3GppsSr3Z ytNsW4FXq8OQvDakNgj8W4axVw4tR/nY2w+Swzmv665XH7K609FbWZEw1iNl0Q== 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 4Xpwp72f8tzZxD; Thu, 14 Nov 2024 10:08:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4AEA8F48071348; Thu, 14 Nov 2024 10:08:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AEA8Fd6071345; Thu, 14 Nov 2024 10:08:15 GMT (envelope-from git) Date: Thu, 14 Nov 2024 10:08:15 GMT Message-Id: <202411141008.4AEA8Fd6071345@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: dded4e9e524c - main - tcp: change SOCKBUF_* macros to SOCK_[RECV|SEND]BUF_* macros 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dded4e9e524ca1fcf4ad1c8822817ec010caf5e6 Auto-Submitted: auto-generated The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=dded4e9e524ca1fcf4ad1c8822817ec010caf5e6 commit dded4e9e524ca1fcf4ad1c8822817ec010caf5e6 Author: Richard Scheffenegger AuthorDate: 2024-11-13 23:41:44 +0000 Commit: Richard Scheffenegger CommitDate: 2024-11-14 01:08:12 +0000 tcp: change SOCKBUF_* macros to SOCK_[RECV|SEND]BUF_* macros Change the older LOCK related macros over to the dedicated send/recv buffer macros in the base tcp stack. No functional change intended. Reviewed By: tuexen, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D47567 --- sys/netinet/tcp_input.c | 28 ++++++++++++++-------------- sys/netinet/tcp_output.c | 22 +++++++++++----------- sys/netinet/tcp_reass.c | 4 ++-- sys/netinet/tcp_subr.c | 4 ++-- sys/netinet/tcp_usrreq.c | 10 +++++----- 5 files changed, 34 insertions(+), 34 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index e5f5e09e57d8..3dfdb13994a5 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1512,7 +1512,7 @@ tcp_handle_wakeup(struct tcpcb *tp) struct socket *so = tptosocket(tp); tp->t_flags &= ~TF_WAKESOR; - SOCKBUF_LOCK_ASSERT(&so->so_rcv); + SOCK_RECVBUF_LOCK_ASSERT(so); sorwakeup_locked(so); } } @@ -1939,7 +1939,7 @@ tcp_do_segment(struct tcpcb *tp, struct mbuf *m, struct tcphdr *th, newsize = tcp_autorcvbuf(m, th, so, tp, tlen); /* Add data to socket buffer. */ - SOCKBUF_LOCK(&so->so_rcv); + SOCK_RECVBUF_LOCK(so); if (so->so_rcv.sb_state & SBS_CANTRCVMORE) { m_freem(m); } else { @@ -2819,9 +2819,9 @@ enter_recovery: * is new data available to be sent * or we need to send an ACK. */ - SOCKBUF_LOCK(&so->so_snd); + SOCK_SENDBUF_LOCK(so); avail = sbavail(&so->so_snd); - SOCKBUF_UNLOCK(&so->so_snd); + SOCK_SENDBUF_UNLOCK(so); if (tp->t_flags & TF_ACKNOW || (avail >= SEQ_SUB(tp->snd_nxt, tp->snd_una))) { @@ -2998,7 +2998,7 @@ process_ACK: tcp_xmit_timer(tp, ticks - tp->t_rtttime); } - SOCKBUF_LOCK(&so->so_snd); + SOCK_SENDBUF_LOCK(so); /* * Clear t_acktime if remote side has ACKd all data in the * socket buffer and FIN (if applicable). @@ -3029,7 +3029,7 @@ process_ACK: * skip rest of ACK processing. */ if (acked == 0) { - SOCKBUF_UNLOCK(&so->so_snd); + SOCK_SENDBUF_UNLOCK(so); goto step6; } @@ -3165,11 +3165,11 @@ step6: * soreceive. It's hard to imagine someone * actually wanting to send this much urgent data. */ - SOCKBUF_LOCK(&so->so_rcv); + SOCK_RECVBUF_LOCK(so); if (th->th_urp + sbavail(&so->so_rcv) > sb_max) { th->th_urp = 0; /* XXX */ thflags &= ~TH_URG; /* XXX */ - SOCKBUF_UNLOCK(&so->so_rcv); /* XXX */ + SOCK_RECVBUF_UNLOCK(so); /* XXX */ goto dodata; /* XXX */ } /* @@ -3195,7 +3195,7 @@ step6: sohasoutofband(so); tp->t_oobflags &= ~(TCPOOB_HAVEDATA | TCPOOB_HADDATA); } - SOCKBUF_UNLOCK(&so->so_rcv); + SOCK_RECVBUF_UNLOCK(so); /* * Remove out of band data so doesn't get presented to user. * This can happen independent of advancing the URG pointer, @@ -3268,7 +3268,7 @@ dodata: /* XXX */ thflags = tcp_get_flags(th) & TH_FIN; TCPSTAT_INC(tcps_rcvpack); TCPSTAT_ADD(tcps_rcvbyte, tlen); - SOCKBUF_LOCK(&so->so_rcv); + SOCK_RECVBUF_LOCK(so); if (so->so_rcv.sb_state & SBS_CANTRCVMORE) m_freem(m); else @@ -3980,7 +3980,7 @@ tcp_mss(struct tcpcb *tp, int offer) * if the mss is larger than the socket buffer, decrease the mss. */ so = inp->inp_socket; - SOCKBUF_LOCK(&so->so_snd); + SOCK_SENDBUF_LOCK(so); if ((so->so_snd.sb_hiwat == V_tcp_sendspace) && metrics.rmx_sendpipe) bufsize = metrics.rmx_sendpipe; else @@ -3994,7 +3994,7 @@ tcp_mss(struct tcpcb *tp, int offer) if (bufsize > so->so_snd.sb_hiwat) (void)sbreserve_locked(so, SO_SND, bufsize, NULL); } - SOCKBUF_UNLOCK(&so->so_snd); + SOCK_SENDBUF_UNLOCK(so); /* * Sanity check: make sure that maxseg will be large * enough to allow some data on segments even if the @@ -4015,7 +4015,7 @@ tcp_mss(struct tcpcb *tp, int offer) tp->t_flags2 &= ~TF2_PROC_SACK_PROHIBIT; } - SOCKBUF_LOCK(&so->so_rcv); + SOCK_RECVBUF_LOCK(so); if ((so->so_rcv.sb_hiwat == V_tcp_recvspace) && metrics.rmx_recvpipe) bufsize = metrics.rmx_recvpipe; else @@ -4027,7 +4027,7 @@ tcp_mss(struct tcpcb *tp, int offer) if (bufsize > so->so_rcv.sb_hiwat) (void)sbreserve_locked(so, SO_RCV, bufsize, NULL); } - SOCKBUF_UNLOCK(&so->so_rcv); + SOCK_RECVBUF_UNLOCK(so); /* Check the interface for TSO capabilities. */ if (cap.ifcap & CSUM_TSO) { diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 860b785b631b..8f19885f6b9b 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -359,7 +359,7 @@ after_sack_rexmit: if (tp->t_flags & TF_NEEDSYN) flags |= TH_SYN; - SOCKBUF_LOCK(&so->so_snd); + SOCK_SENDBUF_LOCK(so); /* * If in persist timeout with window of 0, send 1 byte. * Otherwise, if window is small but nonzero @@ -752,11 +752,11 @@ dontupdate: * No reason to send a segment, just return. */ just_return: - SOCKBUF_UNLOCK(&so->so_snd); + SOCK_SENDBUF_UNLOCK(so); return (0); send: - SOCKBUF_LOCK_ASSERT(&so->so_snd); + SOCK_SENDBUF_LOCK_ASSERT(so); if (len > 0) { if (len >= tp->t_maxseg) tp->t_flags2 |= TF2_PLPMTU_MAXSEGSNT; @@ -886,7 +886,7 @@ send: if (tp->t_port) { if (V_tcp_udp_tunneling_port == 0) { /* The port was removed?? */ - SOCKBUF_UNLOCK(&so->so_snd); + SOCK_SENDBUF_UNLOCK(so); return (EHOSTUNREACH); } hdrlen += sizeof(struct udphdr); @@ -978,7 +978,7 @@ send: * byte of the payload can be put into the * TCP segment. */ - SOCKBUF_UNLOCK(&so->so_snd); + SOCK_SENDBUF_UNLOCK(so); error = EMSGSIZE; sack_rxmit = 0; goto out; @@ -1060,7 +1060,7 @@ send: m = m_gethdr(M_NOWAIT, MT_DATA); if (m == NULL) { - SOCKBUF_UNLOCK(&so->so_snd); + SOCK_SENDBUF_UNLOCK(so); error = ENOBUFS; sack_rxmit = 0; goto out; @@ -1103,7 +1103,7 @@ send: tso = 0; } if (m->m_next == NULL) { - SOCKBUF_UNLOCK(&so->so_snd); + SOCK_SENDBUF_UNLOCK(so); (void) m_free(m); error = ENOBUFS; sack_rxmit = 0; @@ -1120,9 +1120,9 @@ send: if (((uint32_t)off + (uint32_t)len == sbused(&so->so_snd)) && !(flags & TH_SYN)) flags |= TH_PUSH; - SOCKBUF_UNLOCK(&so->so_snd); + SOCK_SENDBUF_UNLOCK(so); } else { - SOCKBUF_UNLOCK(&so->so_snd); + SOCK_SENDBUF_UNLOCK(so); if (tp->t_flags & TF_ACKNOW) TCPSTAT_INC(tcps_sndacks); else if (flags & (TH_SYN|TH_FIN|TH_RST)) @@ -1147,7 +1147,7 @@ send: m->m_data += max_linkhdr; m->m_len = hdrlen; } - SOCKBUF_UNLOCK_ASSERT(&so->so_snd); + SOCK_SENDBUF_UNLOCK_ASSERT(so); m->m_pkthdr.rcvif = (struct ifnet *)0; #ifdef MAC mac_inpcb_create_mbuf(inp, m); @@ -1687,7 +1687,7 @@ timer: if (IN_RECOVERY(tp->t_flags)) tp->sackhint.prr_out -= len; } - SOCKBUF_UNLOCK_ASSERT(&so->so_snd); /* Check gotos. */ + SOCK_SENDBUF_UNLOCK_ASSERT(so); /* Check gotos. */ switch (error) { case EACCES: case EPERM: diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c index 5768d90a9337..5f73e83dc8a9 100644 --- a/sys/netinet/tcp_reass.c +++ b/sys/netinet/tcp_reass.c @@ -957,7 +957,7 @@ new_entry: flags = tcp_get_flags(th) & TH_FIN; TCPSTAT_INC(tcps_rcvoopack); TCPSTAT_ADD(tcps_rcvoobyte, *tlenp); - SOCKBUF_LOCK(&so->so_rcv); + SOCK_RECVBUF_LOCK(so); if (so->so_rcv.sb_state & SBS_CANTRCVMORE) { m_freem(m); } else { @@ -1058,7 +1058,7 @@ present: #endif return (0); } - SOCKBUF_LOCK(&so->so_rcv); + SOCK_RECVBUF_LOCK(so); do { tp->rcv_nxt += q->tqe_len; flags = q->tqe_flags & TH_FIN; diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 668d218b34a8..8bf011afe855 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -3346,7 +3346,7 @@ tcp_mtudisc(struct inpcb *inp, int mtuoffer) tcp_mss_update(tp, -1, mtuoffer, NULL, NULL); so = inp->inp_socket; - SOCKBUF_LOCK(&so->so_snd); + SOCK_SENDBUF_LOCK(so); /* If the mss is larger than the socket buffer, decrease the mss. */ if (so->so_snd.sb_hiwat < tp->t_maxseg) { tp->t_maxseg = so->so_snd.sb_hiwat; @@ -3361,7 +3361,7 @@ tcp_mtudisc(struct inpcb *inp, int mtuoffer) tp->t_flags2 &= ~TF2_PROC_SACK_PROHIBIT; } } - SOCKBUF_UNLOCK(&so->so_snd); + SOCK_SENDBUF_UNLOCK(so); TCPSTAT_INC(tcps_mturesent); tp->t_rtttime = 0; diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 8326c67cf085..9a6e80363f0c 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1125,9 +1125,9 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, /* * XXXRW: PRUS_EOF not implemented with PRUS_OOB? */ - SOCKBUF_LOCK(&so->so_snd); + SOCK_SENDBUF_LOCK(so); if (sbspace(&so->so_snd) < -512) { - SOCKBUF_UNLOCK(&so->so_snd); + SOCK_SENDBUF_UNLOCK(so); error = ENOBUFS; goto out; } @@ -1142,7 +1142,7 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, if (tp->t_acktime == 0) tp->t_acktime = ticks; sbappendstream_locked(&so->so_snd, m, flags); - SOCKBUF_UNLOCK(&so->so_snd); + SOCK_SENDBUF_UNLOCK(so); m = NULL; if (nam && tp->t_state < TCPS_SYN_SENT) { /* @@ -1237,9 +1237,9 @@ tcp_usr_ready(struct socket *so, struct mbuf *m, int count) } tp = intotcpcb(inp); - SOCKBUF_LOCK(&so->so_snd); + SOCK_SENDBUF_LOCK(so); error = sbready(&so->so_snd, m, count); - SOCKBUF_UNLOCK(&so->so_snd); + SOCK_SENDBUF_UNLOCK(so); if (error) { INP_WUNLOCK(inp); return (error);