aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session_debug.h
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2017-03-07 10:06:24 -0800
committerDave Barach <dave@barachs.net>2017-03-13 13:24:39 -0400
commite69f4954a9de40a47f0bc27cdab0ba44e6985dac (patch)
treeb9191f75a4a0eded948efc55ffd2f9dac0360182 /src/vnet/session/session_debug.h
parentdfde53ae553f9d4c54882fb55a832cb0614834ea (diff)
VPP-659 Improve tcp/session debugging and testing
- event-logging support for tcp and session layer - improvements to uri test code - builtin_server on port 1234 - use the CLOSEWAIT timer when we rx FIN in FIN_WAIT_2 state Change-Id: Ibc445f164b2086b20323bf89c77cffd3059f570f Signed-off-by: Florin Coras <fcoras@cisco.com> Signed-off-by: Dave Barach <dbarach@cisco.com> Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vnet/session/session_debug.h')
-rw-r--r--src/vnet/session/session_debug.h86
1 files changed, 86 insertions, 0 deletions
diff --git a/src/vnet/session/session_debug.h b/src/vnet/session/session_debug.h
new file mode 100644
index 00000000000..858f12e0287
--- /dev/null
+++ b/src/vnet/session/session_debug.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef SRC_VNET_SESSION_SESSION_DEBUG_H_
+#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")
+
+typedef enum _session_evt_dbg
+{
+#define _(sym, str) SESSION_EVT_##sym,
+ foreach_session_dbg_evt
+#undef _
+} session_evt_dbg_e;
+
+#if TRANSPORT_DEBUG
+
+#define DEC_SESSION_ETD(_s, _e, _size) \
+ struct \
+ { \
+ u32 data[_size]; \
+ } * ed; \
+ transport_proto_vft_t *vft = \
+ session_get_transport_vft (_s->session_type); \
+ transport_connection_t *_tc = \
+ vft->get_connection (_s->connection_index, _s->thread_index); \
+ ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, \
+ _e, _tc->elog_track)
+
+
+#define SESSION_EVT_DEQ_HANDLER(_s, _body) \
+{ \
+ ELOG_TYPE_DECLARE (_e) = \
+ { \
+ .format = "deq: id %d len %d rd %d wnd %d", \
+ .format_args = "i4i4i4i4", \
+ }; \
+ DEC_SESSION_ETD(_s, _e, 4); \
+ do { _body; } while (0); \
+}
+
+#define SESSION_EVT_ENQ_HANDLER(_s, _body) \
+{ \
+ ELOG_TYPE_DECLARE (_e) = \
+ { \
+ .format = "enq: id %d length %d", \
+ .format_args = "i4i4", \
+ }; \
+ DEC_SESSION_ETD(_s, _e, 2); \
+ do { _body; } while (0); \
+}
+
+#define CONCAT_HELPER(_a, _b) _a##_b
+#define CC(_a, _b) CONCAT_HELPER(_a, _b)
+
+#define SESSION_EVT_DBG(_s, _evt, _body) CC(_evt, _HANDLER)(_s, _body)
+
+#else
+#define SESSION_EVT_DBG(_s, _evt, _body)
+#endif
+
+#endif /* SRC_VNET_SESSION_SESSION_DEBUG_H_ */
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */