summaryrefslogtreecommitdiffstats
path: root/src/vnet/tcp
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/tcp')
-rw-r--r--src/vnet/tcp/tcp.c13
-rw-r--r--src/vnet/tcp/tcp.h6
-rw-r--r--src/vnet/tcp/tcp_input.c12
-rw-r--r--src/vnet/tcp/tcp_output.c2
4 files changed, 22 insertions, 11 deletions
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c
index 1726355f0e3..ba427b76b1a 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -1153,7 +1153,7 @@ const static transport_proto_vft_t tcp_proto = {
/* *INDENT-ON* */
void
-tcp_update_pacer (tcp_connection_t * tc)
+tcp_connection_tx_pacer_update (tcp_connection_t * tc)
{
f64 srtt;
@@ -1165,6 +1165,17 @@ tcp_update_pacer (tcp_connection_t * tc)
((f64) tc->cwnd) / srtt);
}
+void
+tcp_connection_tx_pacer_reset (tcp_connection_t * tc, u32 window,
+ u32 start_bucket)
+{
+ tcp_worker_ctx_t *wrk = tcp_get_worker (tc->c_thread_index);
+ u32 byte_rate = window / ((f64) TCP_TICK * tc->srtt);
+ u64 last_time = wrk->vm->clib_time.last_cpu_time;
+ transport_connection_tx_pacer_reset (&tc->connection, byte_rate,
+ start_bucket, last_time);
+}
+
static void
tcp_timer_keep_handler (u32 conn_index)
{
diff --git a/src/vnet/tcp/tcp.h b/src/vnet/tcp/tcp.h
index 71af461aca3..bd5e4f71bdb 100644
--- a/src/vnet/tcp/tcp.h
+++ b/src/vnet/tcp/tcp.h
@@ -735,14 +735,16 @@ void tcp_connection_timers_init (tcp_connection_t * tc);
void tcp_connection_timers_reset (tcp_connection_t * tc);
void tcp_init_snd_vars (tcp_connection_t * tc);
void tcp_connection_init_vars (tcp_connection_t * tc);
-void tcp_update_pacer (tcp_connection_t * tc);
+void tcp_connection_tx_pacer_update (tcp_connection_t * tc);
+void tcp_connection_tx_pacer_reset (tcp_connection_t * tc, u32 window,
+ u32 start_bucket);
always_inline void
tcp_cc_rcv_ack (tcp_connection_t * tc)
{
tc->cc_algo->rcv_ack (tc);
tc->tsecr_last_ack = tc->rcv_opts.tsecr;
- tcp_update_pacer (tc);
+ tcp_connection_tx_pacer_update (tc);
}
always_inline void
diff --git a/src/vnet/tcp/tcp_input.c b/src/vnet/tcp/tcp_input.c
index af13c5f8215..fb2f1ddc9ef 100644
--- a/src/vnet/tcp/tcp_input.c
+++ b/src/vnet/tcp/tcp_input.c
@@ -1085,10 +1085,6 @@ tcp_cc_fastrecovery_exit (tcp_connection_t * tc)
tcp_fastrecovery_1_smss_off (tc);
tcp_fastrecovery_first_off (tc);
- /* Update pacer because our cwnd changed. Also makes sure
- * that we recompute the max burst size */
- tcp_update_pacer (tc);
-
TCP_EVT_DBG (TCP_EVT_CC_EVT, tc, 3);
}
@@ -1290,7 +1286,8 @@ tcp_cc_handle_event (tcp_connection_t * tc, u32 is_dack)
}
else if (tcp_should_fastrecover (tc))
{
- u32 byte_rate;
+ u32 pacer_wnd;
+
ASSERT (!tcp_in_fastrecovery (tc));
/* Heuristic to catch potential late dupacks
@@ -1319,8 +1316,9 @@ tcp_cc_handle_event (tcp_connection_t * tc, u32 is_dack)
tc->cwnd = tc->ssthresh + 3 * tc->snd_mss;
}
- byte_rate = (0.3 * tc->cwnd) / ((f64) TCP_TICK * tc->srtt);
- transport_connection_tx_pacer_init (&tc->connection, byte_rate, 0);
+ pacer_wnd = clib_max (0.1 * tc->cwnd, 2 * tc->snd_mss);
+ tcp_connection_tx_pacer_reset (tc, pacer_wnd,
+ 0 /* start bucket */ );
tcp_program_fastretransmit (tcp_get_worker (tc->c_thread_index),
tc);
return;
diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c
index c315c031c97..c135a311fb5 100644
--- a/src/vnet/tcp/tcp_output.c
+++ b/src/vnet/tcp/tcp_output.c
@@ -1406,7 +1406,7 @@ tcp_rxt_timeout_cc (tcp_connection_t * tc)
tc->snd_congestion = tc->snd_una_max;
tc->rtt_ts = 0;
tc->cwnd_acc_bytes = 0;
-
+ tcp_connection_tx_pacer_reset (tc, tc->cwnd, 2 * tc->snd_mss);
tcp_recovery_on (tc);
}