tcp: add cc algo start tx event 13/20513/4
authorFlorin Coras <fcoras@cisco.com>
Fri, 5 Jul 2019 00:05:59 +0000 (17:05 -0700)
committerDamjan Marion <dmarion@me.com>
Fri, 5 Jul 2019 11:58:34 +0000 (11:58 +0000)
Type: feature

Notify cc algos that new data is sent on a connection that was
apparently idle.

Change-Id: I892e5e9bb5b88d791265ffbbefce6f9694d01970
Signed-off-by: Florin Coras <fcoras@cisco.com>
src/vnet/tcp/tcp.h
src/vnet/tcp/tcp_output.c

index f2626af..c83e7dc 100644 (file)
@@ -288,6 +288,11 @@ typedef enum _tcp_cc_ack_t
   TCP_CC_PARTIALACK
 } tcp_cc_ack_t;
 
+typedef enum tcp_cc_event_
+{
+  TCP_CC_EVT_START_TX,
+} tcp_cc_event_t;
+
 typedef struct _tcp_connection
 {
   CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
@@ -388,6 +393,7 @@ struct _tcp_cc_algorithm
   void (*loss) (tcp_connection_t * tc);
   void (*recovered) (tcp_connection_t * tc);
   void (*undo_recovery) (tcp_connection_t * tc);
+  void (*event) (tcp_connection_t *tc, tcp_cc_event_t evt);
 };
 /* *INDENT-ON* */
 
@@ -979,6 +985,13 @@ tcp_cc_undo_recovery (tcp_connection_t * tc)
     tc->cc_algo->undo_recovery (tc);
 }
 
+static inline void
+tcp_cc_event (tcp_connection_t * tc, tcp_cc_event_t evt)
+{
+  if (tc->cc_algo->event)
+    tc->cc_algo->event (tc, evt);
+}
+
 always_inline void
 tcp_timer_set (tcp_connection_t * tc, u8 timer_id, u32 interval)
 {
index 8537b1f..17873ac 100644 (file)
@@ -425,6 +425,9 @@ tcp_update_burst_snd_vars (tcp_connection_t * tc)
 
   if (tc->flags & TCP_CONN_RATE_SAMPLE)
     tc->flags |= TCP_CONN_TRACK_BURST;
+
+  if (tc->snd_una == tc->snd_nxt)
+    tcp_cc_event (tc, TCP_CC_EVT_START_TX);
 }
 
 void