summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-04-20 10:51:49 -0700
committerFlorin Coras <fcoras@cisco.com>2018-04-30 23:50:41 -0700
commitc1a448b3ad16f4ae78527220420fe5c1e41a4ab9 (patch)
treebcccc20a32a8dfdd27c8eb32e20681ec30785c86
parentf4addbd03a21c6aa2a25d693cfd66988605fff36 (diff)
tcp/session: debug improvements/fixes
Change-Id: I906e58b4f9827a79a6ab673f8fa2e03036c69820 Signed-off-by: Florin Coras <fcoras@cisco.com>
-rw-r--r--src/vnet/session-apps/echo_server.c5
-rw-r--r--src/vnet/session/session.c2
-rw-r--r--src/vnet/session/session.h2
-rw-r--r--src/vnet/session/session_debug.h22
-rwxr-xr-xsrc/vnet/tcp/tcp_debug.h19
-rw-r--r--src/vnet/tcp/tcp_input.c5
6 files changed, 25 insertions, 30 deletions
diff --git a/src/vnet/session-apps/echo_server.c b/src/vnet/session-apps/echo_server.c
index 85e6c299919..f34a4909a34 100644
--- a/src/vnet/session-apps/echo_server.c
+++ b/src/vnet/session-apps/echo_server.c
@@ -63,7 +63,6 @@ echo_server_session_accept_callback (stream_session_t * s)
session_manager_get_vpp_event_queue (s->thread_index);
s->session_state = SESSION_STATE_READY;
esm->byte_index = 0;
- vec_validate (esm->rx_retries[s->thread_index], s->session_index);
esm->rx_retries[s->thread_index][s->session_index] = 0;
return 0;
}
@@ -391,7 +390,9 @@ echo_server_create (vlib_main_t * vm, u8 * appns_id, u64 appns_flags,
vec_validate (echo_server_main.vpp_queue, num_threads - 1);
vec_validate (esm->rx_buf, num_threads - 1);
vec_validate (esm->rx_retries, num_threads - 1);
-
+ for (i = 0; i < vec_len (esm->rx_retries); i++)
+ vec_validate (esm->rx_retries[i],
+ pool_elts (session_manager_main.sessions[i]));
esm->rcv_buffer_size = clib_max (esm->rcv_buffer_size, esm->fifo_size);
for (i = 0; i < num_threads; i++)
vec_validate (esm->rx_buf[i], esm->rcv_buffer_size);
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index dfc967b12dc..568065ebc0d 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -1293,7 +1293,7 @@ session_manager_main_enable (vlib_main_t * vm)
clib_rwlock_init (&smm->peekers_rw_locks[i]);
}
-#if SESSION_DBG
+#if SESSION_DEBUG
vec_validate (smm->last_event_poll_by_thread, num_threads - 1);
#endif
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h
index 9d534aec19b..b54f46189f3 100644
--- a/src/vnet/session/session.h
+++ b/src/vnet/session/session.h
@@ -194,7 +194,7 @@ struct _session_manager_main
/** Preallocate session config parameter */
u32 preallocated_sessions;
-#if SESSION_DBG
+#if SESSION_DEBUG
/**
* last event poll time by thread
* Debug only. Will cause false cache-line sharing as-is
diff --git a/src/vnet/session/session_debug.h b/src/vnet/session/session_debug.h
index 12c667c08d8..f63509d1ffb 100644
--- a/src/vnet/session/session_debug.h
+++ b/src/vnet/session/session_debug.h
@@ -44,10 +44,7 @@ typedef enum _session_evt_dbg
{ \
u32 data[_size]; \
} * ed; \
- transport_proto_vft_t *vft = \
- transport_protocol_get_vft (_s->session_type); \
- transport_connection_t *_tc = \
- vft->get_connection (_s->connection_index, _s->thread_index); \
+ transport_connection_t *_tc = session_get_transport (_s); \
ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, \
_e, _tc->elog_track)
@@ -101,24 +98,23 @@ typedef enum _session_evt_dbg
#endif /* SESSION_DEQ_NODE_EVTS */
#if SESSION_EVT_POLL_DBG && SESSION_DEBUG > 1
-#define SESSION_EVT_POLL_GAP(_smm, _my_thread_index) \
+#define SESSION_EVT_POLL_GAP(_smm, _ti) \
{ \
ELOG_TYPE_DECLARE (_e) = \
{ \
- .format = "nixon-gap: %d MS", \
+ .format = "nixon-gap: %d us", \
.format_args = "i4", \
}; \
DEC_SESSION_ED(_e, 1); \
ed->data[0] = (u32) ((now - \
- _smm->last_event_poll_by_thread[my_thread_index])*1000.0); \
+ _smm->last_event_poll_by_thread[_ti])*1000000.0); \
}
-#define SESSION_EVT_POLL_GAP_TRACK_HANDLER(_smm, _my_thread_index) \
+#define SESSION_EVT_POLL_GAP_TRACK_HANDLER(_smm, _ti) \
{ \
- if (PREDICT_TRUE( \
- smm->last_event_poll_by_thread[my_thread_index] != 0.0)) \
- if (now > smm->last_event_poll_by_thread[_my_thread_index] + 500e-6)\
- SESSION_EVT_POLL_GAP(smm, my_thread_index); \
- _smm->last_event_poll_by_thread[my_thread_index] = now; \
+ if (PREDICT_TRUE (smm->last_event_poll_by_thread[_ti] != 0.0)) \
+ if (now > smm->last_event_poll_by_thread[_ti] + 500e-6) \
+ SESSION_EVT_POLL_GAP(smm, _ti); \
+ _smm->last_event_poll_by_thread[_ti] = now; \
}
#else
diff --git a/src/vnet/tcp/tcp_debug.h b/src/vnet/tcp/tcp_debug.h
index d35691173c1..2e67c84cc33 100755
--- a/src/vnet/tcp/tcp_debug.h
+++ b/src/vnet/tcp/tcp_debug.h
@@ -21,7 +21,7 @@
#define TCP_DEBUG (1)
#define TCP_DEBUG_SM (0)
#define TCP_DEBUG_CC (0)
-#define TCP_DEBUG_CC_STAT (1)
+#define TCP_DEBUG_CC_STAT (0)
#define TCP_DEBUG_BUFFER_ALLOCATION (0)
#define foreach_tcp_dbg_evt \
@@ -767,6 +767,9 @@ if (_tc->c_cc_stat_tstamp + STATS_INTERVAL < tcp_time_now()) \
_tc->c_cc_stat_tstamp = tcp_time_now(); \
} \
}
+#else
+#define TCP_EVT_CC_STAT_HANDLER(_tc, ...)
+#endif
/*
* Buffer allocation
@@ -776,22 +779,22 @@ if (_tc->c_cc_stat_tstamp + STATS_INTERVAL < tcp_time_now()) \
#define TCP_DBG_BUFFER_ALLOC_MAYBE_FAIL(thread_index) \
{ \
static u32 *buffer_fail_counters; \
- if (PREDICT_FALSE (buffer_fail_counters == 0)) \
+ if (PREDICT_FALSE (buffer_fail_counters == 0)) \
{ \
u32 num_threads; \
- vlib_thread_main_t *vtm = vlib_get_thread_main (); \
+ vlib_thread_main_t *vtm = vlib_get_thread_main (); \
num_threads = 1 /* main thread */ + vtm->n_threads; \
vec_validate (buffer_fail_counters, num_threads - 1); \
} \
if (PREDICT_FALSE (tcp_main.buffer_fail_fraction != 0.0)) \
{ \
- if (PREDICT_TRUE (buffer_fail_counters[thread_index] > 0)) \
+ if (PREDICT_TRUE (buffer_fail_counters[thread_index] > 0)) \
{ \
- if ((1.0 / (f32) (buffer_fail_counters[thread_index])) \
+ if ((1.0 / (f32) (buffer_fail_counters[thread_index])) \
< tcp_main.buffer_fail_fraction) \
{ \
buffer_fail_counters[thread_index] = 0.0000001; \
- return -1; \
+ return -1; \
} \
} \
buffer_fail_counters[thread_index] ++; \
@@ -801,10 +804,6 @@ if (_tc->c_cc_stat_tstamp + STATS_INTERVAL < tcp_time_now()) \
#define TCP_DBG_BUFFER_ALLOC_MAYBE_FAIL(thread_index)
#endif
-#else
-#define TCP_EVT_CC_STAT_HANDLER(_tc, ...)
-#endif
-
#endif /* SRC_VNET_TCP_TCP_DEBUG_H_ */
/*
* fd.io coding-style-patch-verification: ON
diff --git a/src/vnet/tcp/tcp_input.c b/src/vnet/tcp/tcp_input.c
index a1cdc76c626..497b709bec0 100644
--- a/src/vnet/tcp/tcp_input.c
+++ b/src/vnet/tcp/tcp_input.c
@@ -2780,9 +2780,8 @@ tcp46_listen_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
/* 3. check for a SYN (did that already) */
/* Make sure connection wasn't just created */
- child0 =
- tcp_lookup_connection (lc0->c_fib_index, b0, my_thread_index,
- is_ip4);
+ child0 = tcp_lookup_connection (lc0->c_fib_index, b0,
+ my_thread_index, is_ip4);
if (PREDICT_FALSE (child0->state != TCP_STATE_LISTEN))
{
error0 = TCP_ERROR_CREATE_EXISTS;