aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/tcp/tcp_types.h
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-07-31 12:32:40 -0700
committerFlorin Coras <florin.coras@gmail.com>2020-08-03 15:36:32 +0000
commiteedc74b804a955de39e013f14c97f2abb4770157 (patch)
tree6c9e640858a6f4b548c67ae8d2f97e9d69fdab47 /src/vnet/tcp/tcp_types.h
parentf3ae9e32664ccc3ce0980fcafee9453a3c0cef9b (diff)
tcp: improve timestamp rtt accuracy
- switch to using vlib_time as reference for timestamps - use us precision ticks for tcp but keep using ms precision for timestamps. As a result, srtt, rttvar and rto are now measured in us instead of ms. MRTT samples from timestamps are converted from ms to us (not accurate under ms) while high precision samples are used with us precision, i.e., they're no longer converted to ms precision samples. Type: improvement Change-Id: Ibda559575d9b4fdc85b0985264f7c865ff367e34 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/tcp/tcp_types.h')
-rw-r--r--src/vnet/tcp/tcp_types.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/vnet/tcp/tcp_types.h b/src/vnet/tcp/tcp_types.h
index 3cf4e9e33ef..d7bcac5e3bc 100644
--- a/src/vnet/tcp/tcp_types.h
+++ b/src/vnet/tcp/tcp_types.h
@@ -22,10 +22,14 @@
#include <vnet/session/transport.h>
#include <vppinfra/tw_timer_16t_2w_512sl.h>
-#define TCP_TICK 0.001 /**< TCP tick period (s) */
-#define THZ (u32) (1/TCP_TICK) /**< TCP tick frequency */
-#define TCP_TSTAMP_RESOLUTION TCP_TICK /**< Time stamp resolution */
-#define TCP_PAWS_IDLE 24 * 24 * 60 * 60 * THZ /**< 24 days */
+#define TCP_TICK 0.000001 /**< TCP tick period (s) */
+#define THZ (u32) (1/TCP_TICK) /**< TCP tick frequency */
+
+#define TCP_TSTP_TICK 0.001 /**< Timestamp tick (s) */
+#define TCP_TSTP_HZ (u32) (1/TCP_TSTP_TICK) /**< Timestamp freq */
+#define TCP_PAWS_IDLE (24 * 86400 * TCP_TSTP_HZ)/**< 24 days */
+#define TCP_TSTP_TO_HZ (u32) (TCP_TSTP_TICK * THZ)
+
#define TCP_FIB_RECHECK_PERIOD 1 * THZ /**< Recheck every 1s */
#define TCP_MAX_OPTION_SPACE 40
#define TCP_CC_DATA_SZ 24
@@ -355,7 +359,7 @@ typedef struct _tcp_connection
/* RTT and RTO */
u32 rto; /**< Retransmission timeout */
u32 rto_boff; /**< Index for RTO backoff */
- u32 srtt; /**< Smoothed RTT */
+ u32 srtt; /**< Smoothed RTT measured in @ref TCP_TICK */
u32 rttvar; /**< Smoothed mean RTT difference. Approximates variance */
u32 rtt_seq; /**< Sequence number for tracked ACK */
f64 rtt_ts; /**< Timestamp for tracked ACK */