tcp: enable lc if any other debug option enabled

Also fix debug build after snd_una_nxt removal.

Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ife52689cd30cdebf36057cf4d20d7f6207f1e29e
diff --git a/src/vnet/tcp/tcp_debug.c b/src/vnet/tcp/tcp_debug.c
index cf61d22..e3d7452 100644
--- a/src/vnet/tcp/tcp_debug.c
+++ b/src/vnet/tcp/tcp_debug.c
@@ -53,6 +53,29 @@
 		     tdm->grp_dbg_lvl[i]);
 }
 
+static void
+tcp_debug_check_lc (void)
+{
+  tcp_dbg_main_t *tdm = &tcp_dbg_main;
+  int i, have_enabled = 0;
+
+  if (tdm->grp_dbg_lvl[TCP_EVT_GRP_LC])
+    return;
+
+  for (i = 0; i < TCP_EVT_N_GRP; i++)
+    {
+      if (tdm->grp_dbg_lvl[i])
+	{
+	  have_enabled = 1;
+	  break;
+	}
+    }
+
+  /* Make sure LC is enabled for track initialization */
+  if (have_enabled)
+    tdm->grp_dbg_lvl[TCP_EVT_GRP_LC] = 1;
+}
+
 static clib_error_t *
 tcp_debug_fn (vlib_main_t * vm, unformat_input_t * input,
 	      vlib_cli_command_t * cmd)
@@ -103,6 +126,8 @@
 
   tdm->grp_dbg_lvl[group] = level;
 
+  tcp_debug_check_lc ();
+
 done:
 
   unformat_free (line_input);
diff --git a/src/vnet/tcp/tcp_debug.h b/src/vnet/tcp/tcp_debug.h
index f4e7c39..1202f7f 100644
--- a/src/vnet/tcp/tcp_debug.h
+++ b/src/vnet/tcp/tcp_debug.h
@@ -345,14 +345,13 @@
 {									\
   ELOG_TYPE_DECLARE (_e) =						\
   {									\
-    .format = "syn-tx: iss %u snd_una %u snd_una_max %u snd_nxt %u",	\
-    .format_args = "i4i4i4i4",						\
+    .format = "syn-tx: iss %u snd_una %u snd_nxt %u",			\
+    .format_args = "i4i4i4",						\
   };									\
-  TCP_DECLARE_ETD(_tc, _e, 4);						\
+  TCP_DECLARE_ETD(_tc, _e, 3);						\
   ed->data[0] = _tc->iss;						\
   ed->data[1] = _tc->snd_una - _tc->iss;				\
-  ed->data[2] = _tc->snd_una_max - _tc->iss;				\
-  ed->data[3] = _tc->snd_nxt - _tc->iss;				\
+  ed->data[2] = _tc->snd_nxt - _tc->iss;				\
   TCP_EVT_STATE_CHANGE_HANDLER(_tc);					\
 }
 
@@ -548,8 +547,8 @@
 {									\
   ELOG_TYPE_DECLARE (_e) =						\
   {									\
-    .format = "ack-err: %s ack %u snd_una %u snd_nxt %u una_max %u",	\
-    .format_args = "t4i4i4i4i4",					\
+    .format = "ack-err: %s ack %u snd_una %u snd_nxt %u",		\
+    .format_args = "t4i4i4i4",						\
     .n_enum_strings = 3,						\
     .enum_strings = {                                           	\
       "invalid",                                                 	\
@@ -557,12 +556,11 @@
       "future",								\
     }, 									\
   };									\
-  TCP_DECLARE_ETD(_tc, _e, 5);						\
+  TCP_DECLARE_ETD(_tc, _e, 4);						\
   ed->data[0] = _type;							\
   ed->data[1] = _ack - _tc->iss;					\
   ed->data[2] = _tc->snd_una - _tc->iss;				\
   ed->data[3] = _tc->snd_nxt - _tc->iss;				\
-  ed->data[4] = _tc->snd_una_max - _tc->iss;				\
 }
 
 #define TCP_EVT_RCV_WND_SHRUNK_HANDLER(_tc, _obs, _av, ...)		\
@@ -787,12 +785,12 @@
 {									\
   ELOG_TYPE_DECLARE (_e) =						\
   {									\
-    .format = "pack: snd_una %u snd_una_max %u",			\
+    .format = "pack: snd_una %u snd_nxt %u",				\
     .format_args = "i4i4",						\
   };									\
   TCP_DECLARE_ETD(_tc, _e, 2);						\
   ed->data[0] = _tc->snd_una - _tc->iss;				\
-  ed->data[1] = _tc->snd_una_max - _tc->iss;				\
+  ed->data[1] = _tc->snd_nxt - _tc->iss;				\
 }
 #define TCP_EVT_CC_SCOREBOARD_HANDLER(_tc, ...)				\
 {									\