aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/tcp/tcp.h
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-08-16 10:33:49 -0700
committerDamjan Marion <dmarion@me.com>2019-08-19 09:22:18 +0000
commitd206724e78d99aee5d91d43fb0832d51d70eb57a (patch)
treed4a61d3764f84f9e26998bb6c3869bf44875969a /src/vnet/tcp/tcp.h
parent14bea1bb6505c0134dd5d2a18bcc436ce72cd149 (diff)
tcp: allow cc algos to set pacing rate
Type: feature Change-Id: Ie7f0f5d2a476d401ede567e422abb953b2bb4a78 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/tcp/tcp.h')
-rw-r--r--src/vnet/tcp/tcp.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/vnet/tcp/tcp.h b/src/vnet/tcp/tcp.h
index 753a1ca6996..81ce1d52bde 100644
--- a/src/vnet/tcp/tcp.h
+++ b/src/vnet/tcp/tcp.h
@@ -417,6 +417,7 @@ struct _tcp_cc_algorithm
void (*recovered) (tcp_connection_t * tc);
void (*undo_recovery) (tcp_connection_t * tc);
void (*event) (tcp_connection_t *tc, tcp_cc_event_t evt);
+ u64 (*get_pacing_rate) (tcp_connection_t *tc);
};
/* *INDENT-ON* */
@@ -1053,6 +1054,18 @@ tcp_cc_event (tcp_connection_t * tc, tcp_cc_event_t evt)
tc->cc_algo->event (tc, evt);
}
+static inline u64
+tcp_cc_get_pacing_rate (tcp_connection_t * tc)
+{
+ if (tc->cc_algo->get_pacing_rate)
+ return tc->cc_algo->get_pacing_rate (tc);
+
+ f64 srtt = clib_min ((f64) tc->srtt * TCP_TICK, tc->mrtt_us);
+ /* TODO should constrain to interface's max throughput but
+ * we don't have link speeds for sw ifs ..*/
+ return (tc->cwnd / srtt);
+}
+
always_inline void
tcp_timer_set (tcp_connection_t * tc, u8 timer_id, u32 interval)
{