In the current implement, tcp would start or up an one tick
retransmit timer for that connection if vlib_buffer_alloc()
return 0. Now the tick is 0.1ms, this means that if VPP is
in a buffer shortage state, there would be a large number of
burst timer expirations.
This commit limits the minimum interval of the retransmission
timer to 100ms.
Type: fix
Signed-off-by: liuyacan <liuyacan@corp.netease.com>
Change-Id: Ia11d693fe46119c5dc16b24ca93c30c31109057a
tcp_cfg.lastack_time = 300000; /* 30s */
tcp_cfg.finwait2_time = 300000; /* 30s */
tcp_cfg.closing_time = 300000; /* 30s */
tcp_cfg.lastack_time = 300000; /* 30s */
tcp_cfg.finwait2_time = 300000; /* 30s */
tcp_cfg.closing_time = 300000; /* 30s */
+ tcp_cfg.alloc_err_timeout = 1000; /* 100ms */
/* This value is seconds */
tcp_cfg.cleanup_time = 0.1; /* 100ms */
/* This value is seconds */
tcp_cfg.cleanup_time = 0.1; /* 100ms */
/** Timer ticks to wait in closing for fin ack */
u32 closing_time;
/** Timer ticks to wait in closing for fin ack */
u32 closing_time;
+ /** Timer ticks to wait for free buffer */
+ u32 alloc_err_timeout;
+
/** Time to wait (sec) before cleaning up the connection */
f32 cleanup_time;
/** Time to wait (sec) before cleaning up the connection */
f32 cleanup_time;
tcp_cfg.lastack_time = tmp_time / TCP_TIMER_TICK;
else if (unformat (input, "closing-time %u", &tmp_time))
tcp_cfg.closing_time = tmp_time / TCP_TIMER_TICK;
tcp_cfg.lastack_time = tmp_time / TCP_TIMER_TICK;
else if (unformat (input, "closing-time %u", &tmp_time))
tcp_cfg.closing_time = tmp_time / TCP_TIMER_TICK;
+ else if (unformat (input, "alloc-err-timeout %u", &tmp_time))
+ tcp_cfg.alloc_err_timeout = tmp_time / TCP_TIMER_TICK;
else if (unformat (input, "cleanup-time %u", &tmp_time))
tcp_cfg.cleanup_time = tmp_time / 1000.0;
else
else if (unformat (input, "cleanup-time %u", &tmp_time))
tcp_cfg.cleanup_time = tmp_time / 1000.0;
else
if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1)))
{
if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1)))
{
- tcp_timer_update (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT_SYN, 1);
+ tcp_timer_update (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT_SYN,
+ tcp_cfg.alloc_err_timeout);
tcp_worker_stats_inc (wrk, no_buffer, 1);
return;
}
tcp_worker_stats_inc (wrk, no_buffer, 1);
return;
}
if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1)))
{
if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1)))
{
- tcp_timer_update (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT, 1);
+ tcp_timer_update (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT,
+ tcp_cfg.alloc_err_timeout);
tcp_worker_stats_inc (wrk, no_buffer, 1);
return;
}
tcp_worker_stats_inc (wrk, no_buffer, 1);
return;
}
if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1)))
{
/* Out of buffers so program fin retransmit ASAP */
if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1)))
{
/* Out of buffers so program fin retransmit ASAP */
- tcp_timer_update (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT, 1);
+ tcp_timer_update (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT,
+ tcp_cfg.alloc_err_timeout);
if (fin_snt)
tc->snd_nxt += 1;
else
if (fin_snt)
tc->snd_nxt += 1;
else
n_bytes = tcp_prepare_retransmit_segment (wrk, tc, 0, n_bytes, &b);
if (!n_bytes)
{
n_bytes = tcp_prepare_retransmit_segment (wrk, tc, 0, n_bytes, &b);
if (!n_bytes)
{
- tcp_timer_update (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT, 1);
+ tcp_timer_update (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT,
+ tcp_cfg.alloc_err_timeout);
if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1)))
{
if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1)))
{
- tcp_timer_update (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT, 1);
+ tcp_timer_update (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT,
+ tcp_cfg.alloc_err_timeout);
tcp_worker_stats_inc (wrk, no_buffer, 1);
return;
}
tcp_worker_stats_inc (wrk, no_buffer, 1);
return;
}
if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1)))
{
if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1)))
{
- tcp_timer_update (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT_SYN, 1);
+ tcp_timer_update (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT_SYN,
+ tcp_cfg.alloc_err_timeout);
tcp_worker_stats_inc (wrk, no_buffer, 1);
return;
}
tcp_worker_stats_inc (wrk, no_buffer, 1);
return;
}