aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_timer.c
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2016-01-07 00:14:42 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2016-01-07 00:14:42 +0000
commit0c39d38d215df8423974f87134838fafc0170552 (patch)
tree3e84c070bf3f77cacff7c73e3720b9e5294f53f2 /sys/netinet/tcp_timer.c
parentb46e917554ee224fb1035c66bf4f7bbfccb3a922 (diff)
downloadsrc-0c39d38d215df8423974f87134838fafc0170552.tar.gz
src-0c39d38d215df8423974f87134838fafc0170552.zip
Historically we have two fields in tcpcb to describe sender MSS: t_maxopd,
and t_maxseg. This dualism emerged with T/TCP, but was not properly cleaned up after T/TCP removal. After all permutations over the years the result is that t_maxopd stores a minimum of peer offered MSS and MTU reduced by minimum protocol header. And t_maxseg stores (t_maxopd - TCPOLEN_TSTAMP_APPA) if timestamps are in action, or is equal to t_maxopd otherwise. That's a very rough estimate of MSS reduced by options length. Throughout the code it was used in places, where preciseness was not important, like cwnd or ssthresh calculations. With this change: - t_maxopd goes away. - t_maxseg now stores MSS not adjusted by options. - new function tcp_maxseg() is provided, that calculates MSS reduced by options length. The functions gives a better estimate, since it takes into account SACK state as well. Reviewed by: jtl Differential Revision: https://reviews.freebsd.org/D3593
Notes
Notes: svn path=/head/; revision=293284
Diffstat (limited to 'sys/netinet/tcp_timer.c')
-rw-r--r--sys/netinet/tcp_timer.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c
index 9767eb709056..fb4ff11a4a72 100644
--- a/sys/netinet/tcp_timer.c
+++ b/sys/netinet/tcp_timer.c
@@ -660,7 +660,6 @@ tcp_timer_rexmt(void * xtp)
*/
if (V_tcp_pmtud_blackhole_detect && (((tp->t_state == TCPS_ESTABLISHED))
|| (tp->t_state == TCPS_FIN_WAIT_1))) {
- int optlen;
#ifdef INET6
int isipv6;
#endif
@@ -684,8 +683,7 @@ tcp_timer_rexmt(void * xtp)
tp->t_flags2 |= TF2_PLPMTU_BLACKHOLE;
/* Keep track of previous MSS. */
- optlen = tp->t_maxopd - tp->t_maxseg;
- tp->t_pmtud_saved_maxopd = tp->t_maxopd;
+ tp->t_pmtud_saved_maxseg = tp->t_maxseg;
/*
* Reduce the MSS to blackhole value or to the default
@@ -694,13 +692,13 @@ tcp_timer_rexmt(void * xtp)
#ifdef INET6
isipv6 = (tp->t_inpcb->inp_vflag & INP_IPV6) ? 1 : 0;
if (isipv6 &&
- tp->t_maxopd > V_tcp_v6pmtud_blackhole_mss) {
+ tp->t_maxseg > V_tcp_v6pmtud_blackhole_mss) {
/* Use the sysctl tuneable blackhole MSS. */
- tp->t_maxopd = V_tcp_v6pmtud_blackhole_mss;
+ tp->t_maxseg = V_tcp_v6pmtud_blackhole_mss;
V_tcp_pmtud_blackhole_activated++;
} else if (isipv6) {
/* Use the default MSS. */
- tp->t_maxopd = V_tcp_v6mssdflt;
+ tp->t_maxseg = V_tcp_v6mssdflt;
/*
* Disable Path MTU Discovery when we switch to
* minmss.
@@ -713,13 +711,13 @@ tcp_timer_rexmt(void * xtp)
else
#endif
#ifdef INET
- if (tp->t_maxopd > V_tcp_pmtud_blackhole_mss) {
+ if (tp->t_maxseg > V_tcp_pmtud_blackhole_mss) {
/* Use the sysctl tuneable blackhole MSS. */
- tp->t_maxopd = V_tcp_pmtud_blackhole_mss;
+ tp->t_maxseg = V_tcp_pmtud_blackhole_mss;
V_tcp_pmtud_blackhole_activated++;
} else {
/* Use the default MSS. */
- tp->t_maxopd = V_tcp_mssdflt;
+ tp->t_maxseg = V_tcp_mssdflt;
/*
* Disable Path MTU Discovery when we switch to
* minmss.
@@ -728,7 +726,6 @@ tcp_timer_rexmt(void * xtp)
V_tcp_pmtud_blackhole_activated_min_mss++;
}
#endif
- tp->t_maxseg = tp->t_maxopd - optlen;
/*
* Reset the slow-start flight size
* as it may depend on the new MSS.
@@ -748,9 +745,7 @@ tcp_timer_rexmt(void * xtp)
(tp->t_rxtshift > 6)) {
tp->t_flags2 |= TF2_PLPMTU_PMTUD;
tp->t_flags2 &= ~TF2_PLPMTU_BLACKHOLE;
- optlen = tp->t_maxopd - tp->t_maxseg;
- tp->t_maxopd = tp->t_pmtud_saved_maxopd;
- tp->t_maxseg = tp->t_maxopd - optlen;
+ tp->t_maxseg = tp->t_pmtud_saved_maxseg;
V_tcp_pmtud_blackhole_failed++;
/*
* Reset the slow-start flight size as it