Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_input.c
Show First 20 Lines • Show All 1,915 Lines • ▼ Show 20 Lines | #endif | ||||
if (so->so_rcv.sb_state & SBS_CANTRCVMORE) { | if (so->so_rcv.sb_state & SBS_CANTRCVMORE) { | ||||
m_freem(m); | m_freem(m); | ||||
} else { | } else { | ||||
/* | /* | ||||
* Set new socket buffer size. | * Set new socket buffer size. | ||||
* Give up when limit is reached. | * Give up when limit is reached. | ||||
*/ | */ | ||||
if (newsize) | if (newsize) | ||||
if (!sbreserve_locked(&so->so_rcv, | if (!sbreserve_locked(so, SO_RCV, | ||||
newsize, so, NULL)) | newsize, NULL)) | ||||
so->so_rcv.sb_flags &= ~SB_AUTOSIZE; | so->so_rcv.sb_flags &= ~SB_AUTOSIZE; | ||||
m_adj(m, drop_hdrlen); /* delayed header drop */ | m_adj(m, drop_hdrlen); /* delayed header drop */ | ||||
sbappendstream_locked(&so->so_rcv, m, 0); | sbappendstream_locked(&so->so_rcv, m, 0); | ||||
} | } | ||||
/* NB: sorwakeup_locked() does an implicit unlock. */ | /* NB: sorwakeup_locked() does an implicit unlock. */ | ||||
sorwakeup_locked(so); | sorwakeup_locked(so); | ||||
if (DELAY_ACK(tp, tlen)) { | if (DELAY_ACK(tp, tlen)) { | ||||
tp->t_flags |= TF_DELACK; | tp->t_flags |= TF_DELACK; | ||||
▲ Show 20 Lines • Show All 1,909 Lines • ▼ Show 20 Lines | else | ||||
bufsize = so->so_snd.sb_hiwat; | bufsize = so->so_snd.sb_hiwat; | ||||
if (bufsize < mss) | if (bufsize < mss) | ||||
mss = bufsize; | mss = bufsize; | ||||
else { | else { | ||||
bufsize = roundup(bufsize, mss); | bufsize = roundup(bufsize, mss); | ||||
if (bufsize > sb_max) | if (bufsize > sb_max) | ||||
bufsize = sb_max; | bufsize = sb_max; | ||||
if (bufsize > so->so_snd.sb_hiwat) | if (bufsize > so->so_snd.sb_hiwat) | ||||
(void)sbreserve_locked(&so->so_snd, bufsize, so, NULL); | (void)sbreserve_locked(so, SO_SND, bufsize, NULL); | ||||
} | } | ||||
SOCKBUF_UNLOCK(&so->so_snd); | SOCKBUF_UNLOCK(&so->so_snd); | ||||
/* | /* | ||||
* Sanity check: make sure that maxseg will be large | * Sanity check: make sure that maxseg will be large | ||||
* enough to allow some data on segments even if the | * enough to allow some data on segments even if the | ||||
* all the option space is used (40bytes). Otherwise | * all the option space is used (40bytes). Otherwise | ||||
* funny things may happen in tcp_output. | * funny things may happen in tcp_output. | ||||
* | * | ||||
* XXXGL: shouldn't we reserve space for IP/IPv6 options? | * XXXGL: shouldn't we reserve space for IP/IPv6 options? | ||||
*/ | */ | ||||
tp->t_maxseg = max(mss, 64); | tp->t_maxseg = max(mss, 64); | ||||
SOCKBUF_LOCK(&so->so_rcv); | SOCKBUF_LOCK(&so->so_rcv); | ||||
if ((so->so_rcv.sb_hiwat == V_tcp_recvspace) && metrics.rmx_recvpipe) | if ((so->so_rcv.sb_hiwat == V_tcp_recvspace) && metrics.rmx_recvpipe) | ||||
bufsize = metrics.rmx_recvpipe; | bufsize = metrics.rmx_recvpipe; | ||||
else | else | ||||
bufsize = so->so_rcv.sb_hiwat; | bufsize = so->so_rcv.sb_hiwat; | ||||
if (bufsize > mss) { | if (bufsize > mss) { | ||||
bufsize = roundup(bufsize, mss); | bufsize = roundup(bufsize, mss); | ||||
if (bufsize > sb_max) | if (bufsize > sb_max) | ||||
bufsize = sb_max; | bufsize = sb_max; | ||||
if (bufsize > so->so_rcv.sb_hiwat) | if (bufsize > so->so_rcv.sb_hiwat) | ||||
(void)sbreserve_locked(&so->so_rcv, bufsize, so, NULL); | (void)sbreserve_locked(so, SO_RCV, bufsize, NULL); | ||||
} | } | ||||
SOCKBUF_UNLOCK(&so->so_rcv); | SOCKBUF_UNLOCK(&so->so_rcv); | ||||
/* Check the interface for TSO capabilities. */ | /* Check the interface for TSO capabilities. */ | ||||
if (cap.ifcap & CSUM_TSO) { | if (cap.ifcap & CSUM_TSO) { | ||||
tp->t_flags |= TF_TSO; | tp->t_flags |= TF_TSO; | ||||
tp->t_tsomax = cap.tsomax; | tp->t_tsomax = cap.tsomax; | ||||
tp->t_tsomaxsegcount = cap.tsomaxsegcount; | tp->t_tsomaxsegcount = cap.tsomaxsegcount; | ||||
▲ Show 20 Lines • Show All 191 Lines • Show Last 20 Lines |