From eff6b82e905f39aa740db38341626d8d615282fa Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Wed, 3 Jul 2019 19:51:02 -0700 Subject: tcp: add cc algo undo recovery notification Type:feature Change-Id: Iedefe87555f0a0033abed8569bc2995c8f523d7e Signed-off-by: Florin Coras --- src/vnet/tcp/tcp.h | 14 ++++++++++++++ src/vnet/tcp/tcp_input.c | 27 +++++++++------------------ 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/vnet/tcp/tcp.h b/src/vnet/tcp/tcp.h index 2bc6f22ba83..f2626af9da8 100644 --- a/src/vnet/tcp/tcp.h +++ b/src/vnet/tcp/tcp.h @@ -387,6 +387,7 @@ struct _tcp_cc_algorithm void (*congestion) (tcp_connection_t * tc); void (*loss) (tcp_connection_t * tc); void (*recovered) (tcp_connection_t * tc); + void (*undo_recovery) (tcp_connection_t * tc); }; /* *INDENT-ON* */ @@ -965,6 +966,19 @@ tcp_cc_loss (tcp_connection_t * tc) tc->cc_algo->loss (tc); } +static inline void +tcp_cc_recovered (tcp_connection_t * tc) +{ + tc->cc_algo->recovered (tc); +} + +static inline void +tcp_cc_undo_recovery (tcp_connection_t * tc) +{ + if (tc->cc_algo->undo_recovery) + tc->cc_algo->undo_recovery (tc); +} + always_inline void tcp_timer_set (tcp_connection_t * tc, u8 timer_id, u32 interval) { diff --git a/src/vnet/tcp/tcp_input.c b/src/vnet/tcp/tcp_input.c index 5a7ae5eb2ab..50860ab1c8d 100644 --- a/src/vnet/tcp/tcp_input.c +++ b/src/vnet/tcp/tcp_input.c @@ -1183,8 +1183,9 @@ tcp_cc_recovery_exit (tcp_connection_t * tc) TCP_EVT_DBG (TCP_EVT_CC_EVT, tc, 3); } -static inline void -tcp_cc_fastrecovery_clear_inline (tcp_connection_t * tc) +#ifndef CLIB_MARCH_VARIANT +void +tcp_cc_fastrecovery_clear (tcp_connection_t * tc) { tc->snd_rxt_bytes = 0; tc->rcv_dupacks = 0; @@ -1195,20 +1196,6 @@ tcp_cc_fastrecovery_clear_inline (tcp_connection_t * tc) TCP_EVT_DBG (TCP_EVT_CC_EVT, tc, 3); } - -static void -tcp_cc_fastrecovery_exit (tcp_connection_t * tc) -{ - tc->cc_algo->recovered (tc); - tcp_cc_fastrecovery_clear_inline (tc); -} - -#ifndef CLIB_MARCH_VARIANT -void -tcp_cc_fastrecovery_clear (tcp_connection_t * tc) -{ - tcp_cc_fastrecovery_clear_inline (tc); -} #endif /* CLIB_MARCH_VARIANT */ static void @@ -1224,8 +1211,9 @@ tcp_cc_congestion_undo (tcp_connection_t * tc) } else if (tcp_in_fastrecovery (tc)) { - tcp_cc_fastrecovery_exit (tc); + tcp_cc_fastrecovery_clear (tc); } + tcp_cc_undo_recovery (tc); ASSERT (tc->rto_boff == 0); TCP_EVT_DBG (TCP_EVT_CC_EVT, tc, 5); } @@ -1266,7 +1254,10 @@ tcp_cc_recover (tcp_connection_t * tc) if (tcp_in_recovery (tc)) tcp_cc_recovery_exit (tc); else if (tcp_in_fastrecovery (tc)) - tcp_cc_fastrecovery_exit (tc); + { + tcp_cc_recovered (tc); + tcp_cc_fastrecovery_clear (tc); + } ASSERT (tc->rto_boff == 0); ASSERT (!tcp_in_cong_recovery (tc)); -- cgit 1.2.3-korg