From a0abbff4849e8b8721b70769ae1f3ef27dd6733c Mon Sep 17 00:00:00 2001 From: Aloys Augustin Date: Fri, 12 Jul 2019 12:16:16 +0200 Subject: session: add thread index to all formatters Add a thread_index argument to half-open and listener session formatters because QUIC can have listeners and half-open sessions in any thread. Change-Id: I1de60e35ece4c68ba8cfdd6b63f211bc620d687b Signed-off-by: Aloys Augustin Type: feature --- src/plugins/quic/quic.c | 6 ++++-- src/plugins/sctp/sctp.c | 2 ++ src/vnet/session/application_local.c | 1 + src/vnet/session/session_cli.c | 4 ++-- src/vnet/tcp/tcp.c | 2 ++ src/vnet/tls/tls.c | 2 ++ src/vnet/udp/udp.c | 2 ++ 7 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c index f38a7ca30a6..a96cb8546f4 100644 --- a/src/plugins/quic/quic.c +++ b/src/plugins/quic/quic.c @@ -1677,7 +1677,8 @@ static u8 * format_quic_half_open (u8 * s, va_list * args) { u32 qc_index = va_arg (*args, u32); - quic_ctx_t *ctx = quic_ctx_get (qc_index, vlib_get_thread_index ()); + u32 thread_index = va_arg (*args, u32); + quic_ctx_t *ctx = quic_ctx_get (qc_index, thread_index); s = format (s, "[QUIC] half-open app %u", ctx->parent_app_id); return s; } @@ -1687,8 +1688,9 @@ static u8 * format_quic_listener (u8 * s, va_list * args) { u32 tci = va_arg (*args, u32); + u32 thread_index = va_arg (*args, u32); u32 verbose = va_arg (*args, u32); - quic_ctx_t *ctx = quic_ctx_get (tci, vlib_get_thread_index ()); + quic_ctx_t *ctx = quic_ctx_get (tci, thread_index); if (ctx) { ASSERT (quic_ctx_is_listener (ctx)); diff --git a/src/plugins/sctp/sctp.c b/src/plugins/sctp/sctp.c index 14958e55d60..452b6bf22cc 100644 --- a/src/plugins/sctp/sctp.c +++ b/src/plugins/sctp/sctp.c @@ -713,6 +713,7 @@ u8 * format_sctp_listener_session (u8 * s, va_list * args) { u32 tci = va_arg (*args, u32); + u32 __clib_unused thread_index = va_arg (*args, u32); sctp_connection_t *tc = sctp_listener_get (tci); return format (s, "%U", format_sctp_connection_id, tc); } @@ -931,6 +932,7 @@ u8 * format_sctp_half_open (u8 * s, va_list * args) { u32 tci = va_arg (*args, u32); + u32 __clib_unused thread_index = va_arg (*args, u32); sctp_connection_t *sctp_conn = sctp_half_open_connection_get (tci); return format (s, "%U", format_sctp_connection_id, sctp_conn); } diff --git a/src/vnet/session/application_local.c b/src/vnet/session/application_local.c index 4a93d3a2ae5..4a268c7d30b 100644 --- a/src/vnet/session/application_local.c +++ b/src/vnet/session/application_local.c @@ -492,6 +492,7 @@ static u8 * format_ct_listener (u8 * s, va_list * args) { u32 tc_index = va_arg (*args, u32); + u32 __clib_unused thread_index = va_arg (*args, u32); u32 __clib_unused verbose = va_arg (*args, u32); ct_connection_t *ct = ct_connection_get (tc_index); s = format (s, "%-50U", format_ct_connection_id, ct); diff --git a/src/vnet/session/session_cli.c b/src/vnet/session/session_cli.c index a302ddd72bc..d839532eea3 100755 --- a/src/vnet/session/session_cli.c +++ b/src/vnet/session/session_cli.c @@ -89,14 +89,14 @@ format_session (u8 * s, va_list * args) else if (ss->session_state == SESSION_STATE_LISTENING) { s = format (s, "%U%v", format_transport_listen_connection, - tp, ss->connection_index, verbose, str); + tp, ss->connection_index, ss->thread_index, verbose, str); if (verbose > 1) s = format (s, "\n%U", format_session_fifos, ss, verbose); } else if (ss->session_state == SESSION_STATE_CONNECTING) { s = format (s, "%-40U%v", format_transport_half_open_connection, - tp, ss->connection_index, str); + tp, ss->connection_index, ss->thread_index, str); } else { diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c index 57e62f8eade..79741907337 100644 --- a/src/vnet/tcp/tcp.c +++ b/src/vnet/tcp/tcp.c @@ -964,6 +964,7 @@ static u8 * format_tcp_listener_session (u8 * s, va_list * args) { u32 tci = va_arg (*args, u32); + u32 __clib_unused thread_index = va_arg (*args, u32); u32 verbose = va_arg (*args, u32); tcp_connection_t *tc = tcp_listener_get (tci); s = format (s, "%-50U", format_tcp_connection_id, tc); @@ -976,6 +977,7 @@ static u8 * format_tcp_half_open_session (u8 * s, va_list * args) { u32 tci = va_arg (*args, u32); + u32 __clib_unused thread_index = va_arg (*args, u32); tcp_connection_t *tc = tcp_half_open_connection_get (tci); return format (s, "%U", format_tcp_connection_id, tc); } diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c index 344fdf41254..8d38be4ef8e 100644 --- a/src/vnet/tls/tls.c +++ b/src/vnet/tls/tls.c @@ -707,6 +707,7 @@ u8 * format_tls_listener (u8 * s, va_list * args) { u32 tc_index = va_arg (*args, u32); + u32 __clib_unused thread_index = va_arg (*args, u32); u32 __clib_unused verbose = va_arg (*args, u32); tls_ctx_t *ctx = tls_listener_ctx_get (tc_index); session_t *tls_listener; @@ -726,6 +727,7 @@ u8 * format_tls_half_open (u8 * s, va_list * args) { u32 tc_index = va_arg (*args, u32); + u32 __clib_unused thread_index = va_arg (*args, u32); tls_ctx_t *ctx = tls_ctx_half_open_get (tc_index); s = format (s, "[TLS] half-open app %u", ctx->parent_app_wrk_index); tls_ctx_half_open_reader_unlock (); diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c index fafe8900242..1a4431b1b57 100644 --- a/src/vnet/udp/udp.c +++ b/src/vnet/udp/udp.c @@ -239,6 +239,7 @@ u8 * format_udp_half_open_session (u8 * s, va_list * args) { u32 __clib_unused tci = va_arg (*args, u32); + u32 __clib_unused thread_index = va_arg (*args, u32); clib_warning ("BUG"); return 0; } @@ -247,6 +248,7 @@ u8 * format_udp_listener_session (u8 * s, va_list * args) { u32 tci = va_arg (*args, u32); + u32 __clib_unused thread_index = va_arg (*args, u32); u32 __clib_unused verbose = va_arg (*args, u32); udp_connection_t *uc = udp_listener_get (tci); return format (s, "%U", format_udp_connection, uc); -- cgit 1.2.3-korg