diff options
author | Florin Coras <fcoras@cisco.com> | 2022-01-03 10:34:52 -0800 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2022-01-06 20:14:49 +0000 |
commit | 273968cf2d0343b2f4e3217f25c0752f20cf03c5 (patch) | |
tree | e5adf6d886e137a505997d988d66670ba4ca38b9 /src/vnet/tcp/tcp.c | |
parent | 632ea7089f404186cc7209bdfb2644b24593a2df (diff) |
tcp: cast timer ticks to u32
tc->rto * TCP_TO_TIMER_TICK can return garbage if not cast to u32 and
that confuses clib_max
Type: fix
Signed-off-by: Florin Coras <fcoras@cisco.com>
signed-off-by: Vipul Agrawal <Vipul.Agrawal@enea.com>
Change-Id: Ief4d29b9625e2ef2e75e0c7e3d731ab147465f6d
Diffstat (limited to 'src/vnet/tcp/tcp.c')
-rw-r--r-- | src/vnet/tcp/tcp.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c index af985d2de86..3d3cc886024 100644 --- a/src/vnet/tcp/tcp.c +++ b/src/vnet/tcp/tcp.c @@ -1438,7 +1438,8 @@ tcp_expired_timers_dispatch (u32 * expired_timers) clib_fifo_add (wrk->pending_timers, expired_timers, n_expired); - max_loops = clib_max (1, 0.5 * TCP_TIMER_TICK * wrk->vm->loops_per_second); + max_loops = + clib_max ((u32) 0.5 * TCP_TIMER_TICK * wrk->vm->loops_per_second, 1); max_per_loop = clib_max ((n_left + n_expired) / max_loops, 10); max_per_loop = clib_min (max_per_loop, VLIB_FRAME_SIZE); wrk->max_timers_per_loop = clib_max (n_left ? wrk->max_timers_per_loop : 0, |