aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/tcp
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-04-18 16:40:55 -0700
committerFlorin Coras <fcoras@cisco.com>2018-04-20 05:33:43 -0700
commit62166004a9f0861e9ea50101b2194881ef1a35aa (patch)
treecf7a52e59565489d4922bb8fd39f3ab40003b124 /src/vnet/tcp
parent00cd22d627325a4a2869bedac68d0c1dd4d8ade7 (diff)
tcp: make newreno byte instead of acks dependent
Should be more resilient to ack losses Change-Id: Icec3b93c1d290dec437fcc4e6fe5171906c9ba8a Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/tcp')
-rw-r--r--src/vnet/tcp/tcp.h1
-rwxr-xr-xsrc/vnet/tcp/tcp_debug.h19
-rw-r--r--src/vnet/tcp/tcp_input.c1
-rw-r--r--src/vnet/tcp/tcp_newreno.c10
4 files changed, 28 insertions, 3 deletions
diff --git a/src/vnet/tcp/tcp.h b/src/vnet/tcp/tcp.h
index 9606a0e1d15..8a6f74ab13a 100644
--- a/src/vnet/tcp/tcp.h
+++ b/src/vnet/tcp/tcp.h
@@ -283,6 +283,7 @@ typedef struct _tcp_connection
/* Congestion control */
u32 cwnd; /**< Congestion window */
+ u32 cwnd_acc_bytes; /**< Bytes accumulated for cwnd increment */
u32 ssthresh; /**< Slow-start threshold */
u32 prev_ssthresh; /**< ssthresh before congestion */
u32 prev_cwnd; /**< ssthresh before congestion */
diff --git a/src/vnet/tcp/tcp_debug.h b/src/vnet/tcp/tcp_debug.h
index e37b3cd9a9b..d35691173c1 100755
--- a/src/vnet/tcp/tcp_debug.h
+++ b/src/vnet/tcp/tcp_debug.h
@@ -721,7 +721,7 @@ if (_tc->c_cc_stat_tstamp + STATS_INTERVAL < tcp_time_now()) \
{ \
ELOG_TYPE_DECLARE (_e) = \
{ \
- .format = "rto_stat: rto %u srtt %u rttvar %u ", \
+ .format = "rcv_stat: rto %u srtt %u rttvar %u ", \
.format_args = "i4i4i4", \
}; \
DECLARE_ETD(_tc, _e, 3); \
@@ -730,6 +730,23 @@ if (_tc->c_cc_stat_tstamp + STATS_INTERVAL < tcp_time_now()) \
ed->data[2] = _tc->rttvar; \
} \
}
+#define TCP_EVT_CC_SND_STAT_HANDLER(_tc, ...) \
+{ \
+if (_tc->c_cc_stat_tstamp + STATS_INTERVAL < tcp_time_now()) \
+{ \
+ ELOG_TYPE_DECLARE (_e) = \
+ { \
+ .format = "snd_stat: dack %u sacked %u lost %u out %u rxt %u", \
+ .format_args = "i4i4i4i4i4", \
+ }; \
+ DECLARE_ETD(_tc, _e, 5); \
+ ed->data[0] = _tc->rcv_dupacks; \
+ ed->data[1] = _tc->sack_sb.sacked_bytes; \
+ ed->data[2] = _tc->sack_sb.lost_bytes; \
+ ed->data[3] = tcp_bytes_out (_tc); \
+ ed->data[3] = _tc->snd_rxt_bytes; \
+} \
+}
#define TCP_EVT_CC_STAT_HANDLER(_tc, ...) \
{ \
diff --git a/src/vnet/tcp/tcp_input.c b/src/vnet/tcp/tcp_input.c
index 5a1e84f3569..a1cdc76c626 100644
--- a/src/vnet/tcp/tcp_input.c
+++ b/src/vnet/tcp/tcp_input.c
@@ -941,6 +941,7 @@ tcp_cc_init_congestion (tcp_connection_t * tc)
{
tcp_fastrecovery_on (tc);
tc->snd_congestion = tc->snd_una_max;
+ tc->cwnd_acc_bytes = 0;
tc->cc_algo->congestion (tc);
TCP_EVT_DBG (TCP_EVT_CC_EVT, tc, 4);
}
diff --git a/src/vnet/tcp/tcp_newreno.c b/src/vnet/tcp/tcp_newreno.c
index 103fea4c194..7ae7f484b56 100644
--- a/src/vnet/tcp/tcp_newreno.c
+++ b/src/vnet/tcp/tcp_newreno.c
@@ -36,8 +36,14 @@ newreno_rcv_ack (tcp_connection_t * tc)
}
else
{
- /* Round up to 1 if needed */
- tc->cwnd += clib_max ((tc->snd_mss * tc->snd_mss) / tc->cwnd, 1);
+ /* tc->cwnd += clib_max ((tc->snd_mss * tc->snd_mss) / tc->cwnd, 1); */
+ tc->cwnd_acc_bytes += tc->bytes_acked;
+ if (tc->cwnd_acc_bytes >= tc->cwnd)
+ {
+ u32 inc = tc->cwnd_acc_bytes / tc->cwnd;
+ tc->cwnd += inc * tc->snd_mss;
+ tc->cwnd_acc_bytes -= inc * tc->cwnd;
+ }
}
}