aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2017-03-30 02:54:28 -0700
committerDave Barach <openvpp@barachs.net>2017-04-02 14:02:30 +0000
commit3e350af5d3e9744a4529a28dd293b2d4601442f7 (patch)
treee4b489ddd509fc96382d49592cfc5bafc412a216 /src/vnet/session
parent799e26d5bdf6b74ab615644e0cd291de6e352989 (diff)
TCP cc/window management fixes and debugging
- added persist timer - update rcv_las whenever sending an ack - moved fifo size to its own cache line - improved session and builtin client debugging Change-Id: Ia649cf942cf0c061a713e8b67f0eb6974a6cd55b Signed-off-by: Florin Coras <fcoras@cisco.com> Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vnet/session')
-rw-r--r--src/vnet/session/node.c24
-rw-r--r--src/vnet/session/session.c6
-rw-r--r--src/vnet/session/session.h12
-rw-r--r--src/vnet/session/session_debug.h32
4 files changed, 61 insertions, 13 deletions
diff --git a/src/vnet/session/node.c b/src/vnet/session/node.c
index 8681105c284..b86e87d9bac 100644
--- a/src/vnet/session/node.c
+++ b/src/vnet/session/node.c
@@ -119,15 +119,20 @@ session_tx_fifo_read_and_snd_i (vlib_main_t * vm, vlib_node_runtime_t * node,
/* Nothing to read return */
if (max_dequeue0 == 0)
- {
- return 0;
- }
+ return 0;
/* Ensure we're not writing more than transport window allows */
- max_len_to_snd0 = clib_min (max_dequeue0, snd_space0);
-
- /* TODO check if transport is willing to send len_to_snd0
- * bytes (Nagle) */
+ if (max_dequeue0 < snd_space0)
+ {
+ /* Constrained by tx queue. Try to send only fully formed segments */
+ max_len_to_snd0 = (max_dequeue0 > snd_mss0) ?
+ max_dequeue0 - max_dequeue0 % snd_mss0 : max_dequeue0;
+ /* TODO Nagle ? */
+ }
+ else
+ {
+ max_len_to_snd0 = snd_space0;
+ }
n_frame_bytes = snd_mss0 * VLIB_FRAME_SIZE;
n_frames_per_evt = ceil ((double) max_len_to_snd0 / n_frame_bytes);
@@ -308,11 +313,14 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
int n_tx_packets = 0;
u32 my_thread_index = vm->cpu_index;
int i, rv;
+ f64 now = vlib_time_now (vm);
+
+ SESSION_EVT_DBG (SESSION_EVT_POLL_GAP_TRACK, smm, my_thread_index);
/*
* Update TCP time
*/
- tcp_update_time (vlib_time_now (vm), my_thread_index);
+ tcp_update_time (now, my_thread_index);
/*
* Get vpp queue events
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index f10918aa3c4..8e2b2616f58 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -556,7 +556,7 @@ session_manager_allocate_session_fifos (session_manager_main_t * smm,
u8 * added_a_segment)
{
svm_fifo_segment_private_t *fifo_segment;
- u32 fifo_size, default_fifo_size = 128 << 10; /* TODO config */
+ u32 fifo_size, default_fifo_size = 1 << 16; /* TODO config */
int i;
*added_a_segment = 0;
@@ -1293,6 +1293,10 @@ session_manager_main_enable (vlib_main_t * vm)
vec_validate (smm->current_enqueue_epoch, num_threads - 1);
vec_validate (smm->vpp_event_queues, num_threads - 1);
+#if SESSION_DBG
+ vec_validate (smm->last_event_poll_by_thread, num_threads - 1);
+#endif
+
/* $$$$ preallocate hack config parameter */
for (i = 0; i < 200000; i++)
{
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h
index a39bc06ffca..6878b4d25c8 100644
--- a/src/vnet/session/session.h
+++ b/src/vnet/session/session.h
@@ -20,6 +20,7 @@
#include <vlibmemory/api.h>
#include <vppinfra/sparse_vec.h>
#include <svm/svm_fifo_segment.h>
+#include <vnet/session/session_debug.h>
#define HALF_OPEN_LOOKUP_INVALID_VALUE ((u64)~0)
#define INVALID_INDEX ((u32)~0)
@@ -36,7 +37,7 @@ typedef enum
FIFO_EVENT_BUILTIN_RX
} fifo_event_type_t;
-#define foreach_session_input_error \
+#define foreach_session_input_error \
_(NO_SESSION, "No session drops") \
_(NO_LISTENER, "No listener for dst port drops") \
_(ENQUEUED, "Packets pushed into rx fifo") \
@@ -218,6 +219,15 @@ struct _session_manager_main
/* Convenience */
vlib_main_t *vlib_main;
vnet_main_t *vnet_main;
+
+#if SESSION_DBG
+ /**
+ * last event poll time by thread
+ * Debug only. Will cause false cache-line sharing as-is
+ */
+ f64 *last_event_poll_by_thread;
+#endif
+
};
extern session_manager_main_t session_manager_main;
diff --git a/src/vnet/session/session_debug.h b/src/vnet/session/session_debug.h
index 80a97cd5f09..eb11f1a00b9 100644
--- a/src/vnet/session/session_debug.h
+++ b/src/vnet/session/session_debug.h
@@ -16,13 +16,13 @@
#define SRC_VNET_SESSION_SESSION_DEBUG_H_
#include <vnet/session/transport.h>
-#include <vnet/session/session.h>
#include <vlib/vlib.h>
#define foreach_session_dbg_evt \
_(ENQ, "enqueue") \
_(DEQ, "dequeue") \
- _(DEQ_NODE, "dequeue")
+ _(DEQ_NODE, "dequeue") \
+ _(POLL_GAP_TRACK, "poll gap track") \
typedef enum _session_evt_dbg
{
@@ -33,6 +33,7 @@ typedef enum _session_evt_dbg
#define SESSION_DBG (0)
#define SESSION_DEQ_NODE_EVTS (0)
+#define SESSION_EVT_POLL_DBG (1)
#if TRANSPORT_DEBUG && SESSION_DBG
@@ -97,9 +98,34 @@ typedef enum _session_evt_dbg
#define SESSION_EVT_DEQ_NODE_HANDLER(_node_evt)
#endif
+#if SESSION_DBG && SESSION_EVT_POLL_DBG
+#define SESSION_EVT_POLL_GAP(_smm, _my_thread_index) \
+{ \
+ ELOG_TYPE_DECLARE (_e) = \
+ { \
+ .format = "nixon-gap: %d MS", \
+ .format_args = "i4", \
+ }; \
+ DEC_SESSION_ED(_e, 1); \
+ ed->data[0] = (u32) ((now - \
+ _smm->last_event_poll_by_thread[my_thread_index])*1000.0); \
+}
+#define SESSION_EVT_POLL_GAP_TRACK_HANDLER(_smm, _my_thread_index) \
+{ \
+ 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; \
+}
+
+#else
+#define SESSION_EVT_POLL_GAP(_smm, _my_thread_index)
+#define SESSION_EVT_POLL_GAP_TRACK_HANDLER(_smm, _my_thread_index)
+#endif
+
#define CONCAT_HELPER(_a, _b) _a##_b
#define CC(_a, _b) CONCAT_HELPER(_a, _b)
-
#define SESSION_EVT_DBG(_evt, _args...) CC(_evt, _HANDLER)(_args)
#else