diff options
author | Garrett Wollman <wollman@FreeBSD.org> | 1997-02-14 18:15:53 +0000 |
---|---|---|
committer | Garrett Wollman <wollman@FreeBSD.org> | 1997-02-14 18:15:53 +0000 |
commit | d0390e0570c8bab47d99720f0e5a074ed9937840 (patch) | |
tree | 41d6953fc4c7a2929081f52e766fbc604285351b /sys/netinet/tcp_subr.c | |
parent | 4a26224c8d4cd5e63f8c0b29b107fa7f9babc8b1 (diff) | |
download | src-d0390e0570c8bab47d99720f0e5a074ed9937840.tar.gz src-d0390e0570c8bab47d99720f0e5a074ed9937840.zip |
Fix the mechanism for choosing wehether to save the slow-start threshold
in the route. This allows us to remove the unconditional setting of the
pipesize in the route, which should mean that SO_SNDBUF and SO_RCVBUF
should actually work again. While we're at it:
- Convert udp_usrreq from `mondo switch statement from Hell' to new-style.
- Delete old TCP mondo switch statement from Hell, which had previously
been diked out.
Notes
Notes:
svn path=/head/; revision=22719
Diffstat (limited to 'sys/netinet/tcp_subr.c')
-rw-r--r-- | sys/netinet/tcp_subr.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index cfa21d7a9a23..2f71ca28c6a1 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -320,6 +320,7 @@ tcp_close(tp) struct socket *so = inp->inp_socket; register struct mbuf *m; register struct rtentry *rt; + int dosavessthresh; /* * If we got enough samples through the srtt filter, @@ -364,15 +365,31 @@ tcp_close(tp) tcpstat.tcps_cachedrttvar++; } /* + * The old comment here said: * update the pipelimit (ssthresh) if it has been updated * already or if a pipesize was specified & the threshhold * got below half the pipesize. I.e., wait for bad news * before we start updating, then update on both good * and bad news. + * + * But we want to save the ssthresh even if no pipesize is + * specified explicitly in the route, because such + * connections still have an implicit pipesize specified + * by the global tcp_sendspace. In the absence of a reliable + * way to calculate the pipesize, it will have to do. */ + i = tp->snd_ssthresh; +#if 1 + if (rt->rt_rmx.rmx_sendpipe != 0) + dosavessthresh = (i < rt->rt_rmx.rmx_sendpipe / 2); + else + dosavessthresh = (i < so->so_snd.sb_hiwat / 2); +#else + dosavessthresh = (i < rt->rt_rmx.rmx_sendpipe / 2); +#endif if (((rt->rt_rmx.rmx_locks & RTV_SSTHRESH) == 0 && - ((i = tp->snd_ssthresh) != 0) && rt->rt_rmx.rmx_ssthresh) || - i < (rt->rt_rmx.rmx_sendpipe / 2)) { + i != 0 && rt->rt_rmx.rmx_ssthresh != 0) + || dosavessthresh) { /* * convert the limit from user data bytes to * packets then to packet data bytes. |