summaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-06-14 14:55:50 -0700
committerDave Barach <openvpp@barachs.net>2018-06-19 22:08:34 +0000
commit8b20bf5ef72a85ed70d7457f33c096f1eef51d0a (patch)
tree7e485897c8ef6d5d21c45c58e74600250dca92b7 /src/vnet/session
parent0c8a3bc95dd79cc856c4210a2234d15153149be0 (diff)
tcp: optimize tcp output
Change-Id: Idf17a0633a1618b12c22b1119e40c2e9d3192df9 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session')
-rw-r--r--src/vnet/session/session_debug.h31
-rw-r--r--src/vnet/session/session_node.c10
2 files changed, 34 insertions, 7 deletions
diff --git a/src/vnet/session/session_debug.h b/src/vnet/session/session_debug.h
index f63509d1ffb..559f0bd6ed1 100644
--- a/src/vnet/session/session_debug.h
+++ b/src/vnet/session/session_debug.h
@@ -23,6 +23,8 @@
_(DEQ, "dequeue") \
_(DEQ_NODE, "dequeue") \
_(POLL_GAP_TRACK, "poll gap track") \
+ _(POLL_DISPATCH_TIME, "dispatch time")\
+ _(DISPATCH_END, "dispatch end") \
typedef enum _session_evt_dbg
{
@@ -31,7 +33,7 @@ typedef enum _session_evt_dbg
#undef _
} session_evt_dbg_e;
-#define SESSION_DEBUG (0 && TRANSPORT_DEBUG)
+#define SESSION_DEBUG 0 * (TRANSPORT_DEBUG > 0)
#define SESSION_DEQ_NODE_EVTS (0)
#define SESSION_EVT_POLL_DBG (0)
@@ -55,6 +57,7 @@ typedef enum _session_evt_dbg
} * ed; \
ed = ELOG_DATA (&vlib_global_main.elog_main, _e)
+#if SESSION_DEQ_NODE_EVTS && SESSION_DEBUG > 1
#define SESSION_EVT_DEQ_HANDLER(_s, _body) \
{ \
ELOG_TYPE_DECLARE (_e) = \
@@ -77,7 +80,6 @@ typedef enum _session_evt_dbg
do { _body; } while (0); \
}
-#if SESSION_DEQ_NODE_EVTS && SESSION_DEBUG > 1
#define SESSION_EVT_DEQ_NODE_HANDLER(_node_evt) \
{ \
ELOG_TYPE_DECLARE (_e) = \
@@ -94,6 +96,8 @@ typedef enum _session_evt_dbg
ed->data[0] = _node_evt; \
}
#else
+#define SESSION_EVT_DEQ_HANDLER(_s, _body)
+#define SESSION_EVT_ENQ_HANDLER(_s, _body)
#define SESSION_EVT_DEQ_NODE_HANDLER(_node_evt)
#endif /* SESSION_DEQ_NODE_EVTS */
@@ -117,11 +121,34 @@ typedef enum _session_evt_dbg
_smm->last_event_poll_by_thread[_ti] = now; \
}
+#define SESSION_EVT_POLL_DISPATCH_TIME_HANDLER(_smm, _ti) \
+{ \
+ f64 diff = vlib_time_now (vlib_get_main ()) - \
+ _smm->last_event_poll_by_thread[_ti]; \
+ if (diff > 5e-2) \
+ { \
+ ELOG_TYPE_DECLARE (_e) = \
+ { \
+ .format = "dispatch time: %d us", \
+ .format_args = "i4", \
+ }; \
+ DEC_SESSION_ED(_e, 1); \
+ ed->data[0] = diff *1000000.0; \
+ } \
+}
+
#else
#define SESSION_EVT_POLL_GAP(_smm, _my_thread_index)
#define SESSION_EVT_POLL_GAP_TRACK_HANDLER(_smm, _my_thread_index)
+#define SESSION_EVT_POLL_DISPATCH_TIME_HANDLER(_smm, _ti)
#endif /* SESSION_EVT_POLL_DBG */
+#define SESSION_EVT_DISPATCH_END_HANDLER(_smm, _ti) \
+{ \
+ SESSION_EVT_DEQ_NODE_HANDLER(1); \
+ SESSION_EVT_POLL_DISPATCH_TIME_HANDLER(_smm, _ti); \
+}
+
#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)
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 2eea30be439..1902adc29d5 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -249,11 +249,11 @@ session_tx_fill_buffer (vlib_main_t * vm, session_tx_context_t * ctx,
session_tx_fifo_chain_tail (vm, ctx, b, n_bufs, peek_data);
/* *INDENT-OFF* */
- SESSION_EVT_DBG(SESSION_EVT_DEQ, s, ({
- ed->data[0] = e->event_type;
- ed->data[1] = max_dequeue;
+ SESSION_EVT_DBG(SESSION_EVT_DEQ, ctx->s, ({
+ ed->data[0] = FIFO_EVENT_APP_TX;
+ ed->data[1] = ctx->max_dequeue;
ed->data[2] = len_to_deq;
- ed->data[3] = left_to_snd;
+ ed->data[3] = ctx->left_to_snd;
}));
/* *INDENT-ON* */
}
@@ -841,7 +841,7 @@ skip_dequeue:
vlib_node_increment_counter (vm, session_queue_node.index,
SESSION_QUEUE_ERROR_TX, n_tx_packets);
- SESSION_EVT_DBG (SESSION_EVT_DEQ_NODE, 1);
+ SESSION_EVT_DBG (SESSION_EVT_DISPATCH_END, smm, thread_index);
return n_tx_packets;
}