tcp: cmake option VPP_TCP_DEBUG_ALWAYS=ON not taken by all files
[vpp.git] / src / vnet / tcp / tcp_debug.h
index 1202f7f..04e921c 100644 (file)
 #define SRC_VNET_TCP_TCP_DEBUG_H_
 
 #include <vlib/vlib.h>
+#include <vpp/vnet/config.h>
 
 /**
  * Build debugging infra unconditionally. Debug components controlled via
  * debug configuration. Comes with some overhead so it's not recommended for
  * production/performance scenarios. Takes priority over TCP_DEBUG_ENABLE.
  */
+#ifdef VPP_TCP_DEBUG_ALWAYS
+#define TCP_DEBUG_ALWAYS (1)
+#else
 #define TCP_DEBUG_ALWAYS (0)
+#endif
 /**
  * Build debugging infra only if enabled. Debug components controlled via
  * macros that follow.
@@ -867,11 +872,12 @@ if (TCP_DEBUG_CC > 1)                                                     \
  */
 #if TCP_DEBUG_CS || TCP_DEBUG_ALWAYS
 
-#define STATS_INTERVAL 1
+#define STATS_INTERVAL 0.001
 
-#define tcp_cc_time_to_print_stats(_tc)                                        \
-  _tc->c_cc_stat_tstamp + STATS_INTERVAL < tcp_time_now()              \
-  || tcp_in_fastrecovery (_tc)                                         \
+#define tcp_cc_time_to_print_stats(_tc)                                       \
+  _tc->c_cc_stat_tstamp + STATS_INTERVAL <                                    \
+      tcp_time_now_us (_tc->c_thread_index) ||                                \
+    tcp_in_fastrecovery (_tc)
 
 #define TCP_EVT_CC_RTO_STAT_PRINT(_tc)                                 \
 {                                                                      \
@@ -887,14 +893,14 @@ if (TCP_DEBUG_CC > 1)                                                     \
   ed->data[3] = _tc->rttvar;                                           \
 }
 
-#define TCP_EVT_CC_RTO_STAT_HANDLER(_tc, ...)                          \
-{                                                                      \
-if (tcp_cc_time_to_print_stats (_tc))                                  \
-{                                                                      \
-  TCP_EVT_CC_RTO_STAT_PRINT (_tc);                                     \
-  _tc->c_cc_stat_tstamp = tcp_time_now ();                             \
-}                                                                      \
-}
+#define TCP_EVT_CC_RTO_STAT_HANDLER(_tc, ...)                                 \
+  {                                                                           \
+    if (tcp_cc_time_to_print_stats (_tc))                                     \
+      {                                                                       \
+       TCP_EVT_CC_RTO_STAT_PRINT (_tc);                                      \
+       _tc->c_cc_stat_tstamp = tcp_time_now_us (_tc->c_thread_index);        \
+      }                                                                       \
+  }
 
 #define TCP_EVT_CC_SND_STAT_PRINT(_tc)                                 \
 {                                                                      \
@@ -911,14 +917,14 @@ if (tcp_cc_time_to_print_stats (_tc))                                     \
   ed->data[3] = _tc->snd_rxt_bytes;                                    \
 }
 
-#define TCP_EVT_CC_SND_STAT_HANDLER(_tc, ...)                          \
-{                                                                      \
-if (tcp_cc_time_to_print_stats (_tc))                                  \
-{                                                                      \
-    TCP_EVT_CC_SND_STAT_PRINT(_tc);                                    \
-    _tc->c_cc_stat_tstamp = tcp_time_now ();                           \
-}                                                                      \
-}
+#define TCP_EVT_CC_SND_STAT_HANDLER(_tc, ...)                                 \
+  {                                                                           \
+    if (tcp_cc_time_to_print_stats (_tc))                                     \
+      {                                                                       \
+       TCP_EVT_CC_SND_STAT_PRINT (_tc);                                      \
+       _tc->c_cc_stat_tstamp = tcp_time_now_us (_tc->c_thread_index);        \
+      }                                                                       \
+  }
 
 #define TCP_EVT_CC_STAT_PRINT(_tc)                                     \
 {                                                                      \
@@ -937,14 +943,14 @@ if (tcp_cc_time_to_print_stats (_tc))                                     \
   TCP_EVT_CC_SND_STAT_PRINT (_tc);                                     \
 }
 
-#define TCP_EVT_CC_STAT_HANDLER(_tc, ...)                              \
-{                                                                      \
-if (tcp_cc_time_to_print_stats (_tc))                                  \
-{                                                                      \
-  TCP_EVT_CC_STAT_PRINT (_tc);                                         \
-  _tc->c_cc_stat_tstamp = tcp_time_now();                              \
-}                                                                      \
-}
+#define TCP_EVT_CC_STAT_HANDLER(_tc, ...)                                     \
+  {                                                                           \
+    if (tcp_cc_time_to_print_stats (_tc))                                     \
+      {                                                                       \
+       TCP_EVT_CC_STAT_PRINT (_tc);                                          \
+       _tc->c_cc_stat_tstamp = tcp_time_now_us (_tc->c_thread_index);        \
+      }                                                                       \
+  }
 #else
 #define TCP_EVT_CC_STAT_HANDLER(_tc, ...)
 #define TCP_EVT_CC_STAT_PRINT(_tc)