Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F103045450
D47567.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
7 KB
Referenced Files
None
Subscribers
None
D47567.diff
View Options
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1512,7 +1512,7 @@
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 @@
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 @@
* 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 @@
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 @@
* skip rest of ACK processing.
*/
if (acked == 0) {
- SOCKBUF_UNLOCK(&so->so_snd);
+ SOCK_SENDBUF_UNLOCK(so);
goto step6;
}
@@ -3165,11 +3165,11 @@
* 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 @@
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 @@
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 @@
* 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 @@
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 @@
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 @@
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
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -359,7 +359,7 @@
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 @@
* 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 @@
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 @@
* 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 @@
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 @@
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 @@
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 @@
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 @@
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
--- a/sys/netinet/tcp_reass.c
+++ b/sys/netinet/tcp_reass.c
@@ -957,7 +957,7 @@
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 @@
#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
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -3346,7 +3346,7 @@
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 @@
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
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1125,9 +1125,9 @@
/*
* 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 @@
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 @@
}
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);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 21, 5:28 AM (21 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14755391
Default Alt Text
D47567.diff (7 KB)
Attached To
Mode
D47567: tcp: chance SOCKBUF_LOCK calls to SOCK_[RECV|SEND]BUF_LOCK
Attached
Detach File
Event Timeline
Log In to Comment