diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/svm/svm_fifo.c | 25 | ||||
-rwxr-xr-x | src/vnet/session/session_cli.c | 37 | ||||
-rw-r--r-- | src/vnet/session/transport.c | 57 | ||||
-rw-r--r-- | src/vnet/session/transport.h | 10 | ||||
-rw-r--r-- | src/vnet/session/transport_interface.h | 2 | ||||
-rw-r--r-- | src/vnet/tcp/tcp.c | 83 |
6 files changed, 143 insertions, 71 deletions
diff --git a/src/svm/svm_fifo.c b/src/svm/svm_fifo.c index 46ce32bbbd8..817cb8d2639 100644 --- a/src/svm/svm_fifo.c +++ b/src/svm/svm_fifo.c @@ -152,13 +152,15 @@ u8 * format_ooo_list (u8 * s, va_list * args) { svm_fifo_t *f = va_arg (*args, svm_fifo_t *); + u32 indent = va_arg (*args, u32); u32 ooo_segment_index = f->ooos_list_head; ooo_segment_t *seg; while (ooo_segment_index != OOO_SEGMENT_INVALID_INDEX) { seg = pool_elt_at_index (f->ooo_segments, ooo_segment_index); - s = format (s, " %U\n", format_ooo_segment, f, seg); + s = format (s, "%U%U\n", format_white_space, indent, format_ooo_segment, + f, seg); ooo_segment_index = seg->next; } @@ -170,27 +172,30 @@ format_svm_fifo (u8 * s, va_list * args) { svm_fifo_t *f = va_arg (*args, svm_fifo_t *); int verbose = va_arg (*args, int); + u32 indent; if (!s) return s; + indent = format_get_indent (s); s = format (s, "cursize %u nitems %u has_event %d\n", f->cursize, f->nitems, f->has_event); - s = format (s, " head %d tail %d segment manager %u\n", f->head, f->tail, - f->segment_manager); + s = format (s, "%Uhead %d tail %d segment manager %u\n", format_white_space, + indent, f->head, f->tail, f->segment_manager); if (verbose > 1) - s = format - (s, " vpp session %d thread %d app session %d thread %d\n", - f->master_session_index, f->master_thread_index, - f->client_session_index, f->client_thread_index); + s = format (s, "%Uvpp session %d thread %d app session %d thread %d\n", + format_white_space, indent, f->master_session_index, + f->master_thread_index, f->client_session_index, + f->client_thread_index); if (verbose) { - s = format (s, " ooo pool %d active elts newest %u\n", - pool_elts (f->ooo_segments), f->ooos_newest); + s = format (s, "%Uooo pool %d active elts newest %u\n", + format_white_space, indent, pool_elts (f->ooo_segments), + f->ooos_newest); if (svm_fifo_has_ooo_data (f)) - s = format (s, " %U", format_ooo_list, f, verbose); + s = format (s, " %U", format_ooo_list, f, indent, verbose); } return s; } diff --git a/src/vnet/session/session_cli.c b/src/vnet/session/session_cli.c index 57f3d3ad7f1..6ca090a8508 100755 --- a/src/vnet/session/session_cli.c +++ b/src/vnet/session/session_cli.c @@ -16,7 +16,7 @@ #include <vnet/session/session.h> u8 * -format_stream_session_fifos (u8 * s, va_list * args) +format_session_fifos (u8 * s, va_list * args) { stream_session_t *ss = va_arg (*args, stream_session_t *); int verbose = va_arg (*args, int); @@ -58,36 +58,34 @@ format_stream_session (u8 * s, va_list * args) { stream_session_t *ss = va_arg (*args, stream_session_t *); int verbose = va_arg (*args, int); - transport_proto_vft_t *tp_vft; + u32 tp = session_get_transport_proto (ss); u8 *str = 0; - tp_vft = transport_protocol_get_vft (session_get_transport_proto (ss)); if (verbose == 1 && ss->session_state >= SESSION_STATE_ACCEPTING) - str = format (0, "%-10u%-10u%-10lld", + str = format (0, "%-10u%-10u", svm_fifo_max_dequeue (ss->server_rx_fifo), - svm_fifo_max_enqueue (ss->server_tx_fifo), - session_get_index (ss)); + svm_fifo_max_dequeue (ss->server_tx_fifo)); if (ss->session_state >= SESSION_STATE_ACCEPTING) { - s = format (s, "%U", tp_vft->format_connection, ss->connection_index, - ss->thread_index, verbose); + s = format (s, "%U", format_transport_connection, tp, + ss->connection_index, ss->thread_index, verbose); if (verbose == 1) s = format (s, "%v", str); if (verbose > 1) - s = format (s, "%U", format_stream_session_fifos, ss, verbose); + s = format (s, "%U", format_session_fifos, ss, verbose); } else if (ss->session_state == SESSION_STATE_LISTENING) { - s = format (s, "%-40U%v", tp_vft->format_listener, ss->connection_index, - str); + s = format (s, "%-40U%v", format_transport_listen_connection, + tp, ss->connection_index, str); if (verbose > 1) - s = format (s, "\n%U", format_stream_session_fifos, ss, verbose); + s = format (s, "\n%U", format_session_fifos, ss, verbose); } else if (ss->session_state == SESSION_STATE_CONNECTING) { - s = format (s, "%-40U%v", tp_vft->format_half_open, - ss->connection_index, str); + s = format (s, "%-40U%v", format_transport_half_open_connection, + tp, ss->connection_index, str); } else { @@ -244,15 +242,15 @@ show_session_command_fn (vlib_main_t * vm, unformat_input_t * input, if (do_listeners) { sst = session_type_from_proto_and_ip (transport_proto, 1); - vlib_cli_output (vm, "%-40s%-24s%-10s", "Listener", "App", "S-idx"); + vlib_cli_output (vm, "%-40s%-24s", "Listener", "App"); /* *INDENT-OFF* */ pool_foreach (s, smm->sessions[0], ({ if (s->session_state != SESSION_STATE_LISTENING || s->session_type != sst) continue; app_name = application_name_from_index (s->app_wrk_index); - vlib_cli_output (vm, "%U%-25v%-10u", format_stream_session, s, 1, - app_name, s->session_index); + vlib_cli_output (vm, "%U%-25v%", format_stream_session, s, 1, + app_name); vec_free (app_name); })); /* *INDENT-ON* */ @@ -275,9 +273,8 @@ show_session_command_fn (vlib_main_t * vm, unformat_input_t * input, { if (once_per_pool && verbose == 1) { - str = format (str, "%-50s%-15s%-10s%-10s%-10s", - "Connection", "State", "Rx-f", "Tx-f", - "S-idx"); + str = format (str, "%-50s%-15s%-10s%-10s", + "Connection", "State", "Rx-f", "Tx-f"); vlib_cli_output (vm, "%v", str); vec_reset_length (str); once_per_pool = 0; diff --git a/src/vnet/session/transport.c b/src/vnet/session/transport.c index c333c4161d4..8cbad0d397f 100644 --- a/src/vnet/session/transport.c +++ b/src/vnet/session/transport.c @@ -93,6 +93,63 @@ format_transport_proto_short (u8 * s, va_list * args) return s; } +u8 * +format_transport_connection (u8 * s, va_list * args) +{ + u32 transport_proto = va_arg (*args, u32); + u32 conn_index = va_arg (*args, u32); + u32 thread_index = va_arg (*args, u32); + u32 verbose = va_arg (*args, u32); + transport_proto_vft_t *tp_vft; + transport_connection_t *tc; + u32 indent; + + tp_vft = transport_protocol_get_vft (transport_proto); + if (!tp_vft) + return s; + + s = format (s, "%U", tp_vft->format_connection, conn_index, thread_index, + verbose); + tc = tp_vft->get_connection (conn_index, thread_index); + if (tc && transport_connection_is_tx_paced (tc) && verbose > 1) + { + indent = format_get_indent (s) + 1; + s = format (s, "%Upacer: %U\n", format_white_space, indent, + format_transport_pacer, &tc->pacer); + } + return s; +} + +u8 * +format_transport_listen_connection (u8 * s, va_list * args) +{ + u32 transport_proto = va_arg (*args, u32); + u32 listen_index = va_arg (*args, u32); + transport_proto_vft_t *tp_vft; + + tp_vft = transport_protocol_get_vft (transport_proto); + if (!tp_vft) + return s; + + s = format (s, "%U", tp_vft->format_listener, listen_index); + return s; +} + +u8 * +format_transport_half_open_connection (u8 * s, va_list * args) +{ + u32 transport_proto = va_arg (*args, u32); + u32 listen_index = va_arg (*args, u32); + transport_proto_vft_t *tp_vft; + + tp_vft = transport_protocol_get_vft (transport_proto); + if (!tp_vft) + return s; + + s = format (s, "%U", tp_vft->format_half_open, listen_index); + return s; +} + uword unformat_transport_proto (unformat_input_t * input, va_list * args) { diff --git a/src/vnet/session/transport.h b/src/vnet/session/transport.h index 07366692c3e..a4f26a45a6a 100644 --- a/src/vnet/session/transport.h +++ b/src/vnet/session/transport.h @@ -20,9 +20,6 @@ #include <vnet/ip/ip.h> #include <vnet/tcp/tcp_debug.h> -/* - * Protocol independent transport properties associated to a session - */ typedef struct _transport_stats { u64 tx_bytes; @@ -36,6 +33,9 @@ typedef struct _spacer u64 last_update; } spacer_t; +/* + * Protocol independent transport properties associated to a session + */ typedef struct _transport_connection { /** Connection ID */ @@ -116,6 +116,10 @@ typedef enum _transport_proto u8 *format_transport_proto (u8 * s, va_list * args); u8 *format_transport_proto_short (u8 * s, va_list * args); +u8 *format_transport_connection (u8 * s, va_list * args); +u8 *format_transport_listen_connection (u8 * s, va_list * args); +u8 *format_transport_half_open_connection (u8 * s, va_list * args); + uword unformat_transport_proto (unformat_input_t * input, va_list * args); #define foreach_transport_connection_fields \ diff --git a/src/vnet/session/transport_interface.h b/src/vnet/session/transport_interface.h index ec9bd43e30f..a96c5e12d7a 100644 --- a/src/vnet/session/transport_interface.h +++ b/src/vnet/session/transport_interface.h @@ -89,7 +89,7 @@ extern transport_proto_vft_t *tp_vfts; #define transport_proto_foreach(VAR, BODY) \ do { \ for (VAR = 0; VAR < vec_len (tp_vfts); VAR++) \ - if (tp_vfts[VAR].push_header != 0) \ + if (tp_vfts[VAR].push_header != 0) \ do { BODY; } while (0); \ } while (0) diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c index 626b49997ac..122e1208ce5 100644 --- a/src/vnet/tcp/tcp.c +++ b/src/vnet/tcp/tcp.c @@ -737,7 +737,6 @@ format_tcp_timers (u8 * s, va_list * args) if (tc->timers[i] != TCP_TIMER_HANDLE_INVALID) last = i; - s = format (s, "["); for (i = 0; i < last; i++) { if (tc->timers[i] != TCP_TIMER_HANDLE_INVALID) @@ -745,9 +744,7 @@ format_tcp_timers (u8 * s, va_list * args) } if (last >= 0) - s = format (s, "%s]", tcp_conn_timers[i]); - else - s = format (s, "]"); + s = format (s, "%s", tcp_conn_timers[i]); return s; } @@ -772,11 +769,30 @@ tcp_rcv_wnd_available (tcp_connection_t * tc) } static u8 * +format_tcp_congestion (u8 * s, va_list * args) +{ + tcp_connection_t *tc = va_arg (*args, tcp_connection_t *); + u32 indent = format_get_indent (s); + + s = format (s, "%U ", format_tcp_congestion_status, tc); + s = format (s, "cwnd %u ssthresh %u rtx_bytes %u bytes_acked %u\n", + tc->cwnd, tc->ssthresh, tc->snd_rxt_bytes, tc->bytes_acked); + s = format (s, "%Ucc space %u prev_ssthresh %u snd_congestion %u" + " dupack %u\n", format_white_space, indent, + tcp_available_cc_snd_space (tc), tc->prev_ssthresh, + tc->snd_congestion - tc->iss, tc->rcv_dupacks); + s = format (s, "%Utsecr %u tsecr_last_ack %u limited_transmit %u\n", + format_white_space, indent, tc->rcv_opts.tsecr, + tc->tsecr_last_ack, tc->limited_transmit - tc->iss); + return s; +} + +static u8 * format_tcp_vars (u8 * s, va_list * args) { tcp_connection_t *tc = va_arg (*args, tcp_connection_t *); - s = format (s, " flags: %U timers: %U\n", format_tcp_connection_flags, tc, - format_tcp_timers, tc); + s = format (s, " index: %u flags: %U timers: %U\n", tc->c_c_index, + format_tcp_connection_flags, tc, format_tcp_timers, tc); s = format (s, " snd_una %u snd_nxt %u snd_una_max %u", tc->snd_una - tc->iss, tc->snd_nxt - tc->iss, tc->snd_una_max - tc->iss); @@ -786,30 +802,20 @@ format_tcp_vars (u8 * s, va_list * args) tc->snd_wnd, tc->rcv_wnd, tc->rcv_wscale); s = format (s, "snd_wl1 %u snd_wl2 %u\n", tc->snd_wl1 - tc->irs, tc->snd_wl2 - tc->iss); - s = format (s, " flight size %u out space %u cc space %u rcv_wnd_av %u\n", + s = format (s, " flight size %u out space %u rcv_wnd_av %u\n", tcp_flight_size (tc), tcp_available_output_snd_space (tc), - tcp_available_cc_snd_space (tc), tcp_rcv_wnd_available (tc)); - s = format (s, " cong %U ", format_tcp_congestion_status, tc); - s = format (s, "cwnd %u ssthresh %u rtx_bytes %u bytes_acked %u\n", - tc->cwnd, tc->ssthresh, tc->snd_rxt_bytes, tc->bytes_acked); - s = format (s, " prev_ssthresh %u snd_congestion %u dupack %u", - tc->prev_ssthresh, tc->snd_congestion - tc->iss, - tc->rcv_dupacks); - s = format (s, " limited_transmit %u\n", tc->limited_transmit - tc->iss); - s = format (s, " tsecr %u tsecr_last_ack %u\n", tc->rcv_opts.tsecr, - tc->tsecr_last_ack); - s = format (s, " rto %u rto_boff %u srtt %u rttvar %u rtt_ts %2.5f ", - tc->rto, tc->rto_boff, tc->srtt, tc->rttvar, tc->rtt_ts); - s = format (s, "rtt_seq %u\n", tc->rtt_seq); + tcp_rcv_wnd_available (tc)); s = format (s, " tsval_recent %u tsval_recent_age %u\n", tc->tsval_recent, tcp_time_now () - tc->tsval_recent_age); + s = format (s, " rto %u rto_boff %u srtt %u rttvar %u rtt_ts %2.5f ", + tc->rto, tc->rto_boff, tc->srtt, tc->rttvar, tc->rtt_ts); + s = format (s, "rtt_seq %u\n", tc->rtt_seq - tc->iss); + s = format (s, " cong: %U", format_tcp_congestion, tc); + if (tc->state >= TCP_STATE_ESTABLISHED) { - s = format (s, " scoreboard: %U\n", format_tcp_scoreboard, &tc->sack_sb, + s = format (s, " sboard: %U\n", format_tcp_scoreboard, &tc->sack_sb, tc); - if (transport_connection_is_tx_paced (&tc->connection)) - s = format (s, " pacer: %U\n", format_transport_pacer, - &tc->connection.pacer); } if (vec_len (tc->snd_sacks)) s = format (s, " sacks tx: %U\n", format_tcp_sacks, tc); @@ -825,15 +831,15 @@ format_tcp_connection_id (u8 * s, va_list * args) return s; if (tc->c_is_ip4) { - s = format (s, "[#%d][%s] %U:%d->%U:%d", tc->c_thread_index, "T", - format_ip4_address, &tc->c_lcl_ip4, + s = format (s, "[%d:%d][%s] %U:%d->%U:%d", tc->c_thread_index, + tc->c_s_index, "T", format_ip4_address, &tc->c_lcl_ip4, clib_net_to_host_u16 (tc->c_lcl_port), format_ip4_address, &tc->c_rmt_ip4, clib_net_to_host_u16 (tc->c_rmt_port)); } else { - s = format (s, "[#%d][%s] %U:%d->%U:%d", tc->c_thread_index, "T", - format_ip6_address, &tc->c_lcl_ip6, + s = format (s, "[%d:%d][%s] %U:%d->%U:%d", tc->c_thread_index, + tc->c_s_index, "T", format_ip6_address, &tc->c_lcl_ip6, clib_net_to_host_u16 (tc->c_lcl_port), format_ip6_address, &tc->c_rmt_ip6, clib_net_to_host_u16 (tc->c_rmt_port)); } @@ -958,23 +964,26 @@ format_tcp_scoreboard (u8 * s, va_list * args) sack_scoreboard_t *sb = va_arg (*args, sack_scoreboard_t *); tcp_connection_t *tc = va_arg (*args, tcp_connection_t *); sack_scoreboard_hole_t *hole; + u32 indent = format_get_indent (s); + s = format (s, "sacked_bytes %u last_sacked_bytes %u lost_bytes %u\n", sb->sacked_bytes, sb->last_sacked_bytes, sb->lost_bytes); - s = format (s, " last_bytes_delivered %u high_sacked %u snd_una_adv %u\n", - sb->last_bytes_delivered, sb->high_sacked - tc->iss, - sb->snd_una_adv); - s = format (s, " cur_rxt_hole %u high_rxt %u rescue_rxt %u", - sb->cur_rxt_hole, sb->high_rxt - tc->iss, - sb->rescue_rxt - tc->iss); + s = format (s, "%Ulast_bytes_delivered %u high_sacked %u snd_una_adv %u\n", + format_white_space, indent, sb->last_bytes_delivered, + sb->high_sacked - tc->iss, sb->snd_una_adv); + s = format (s, "%Ucur_rxt_hole %u high_rxt %u rescue_rxt %u", + format_white_space, indent, sb->cur_rxt_hole, + sb->high_rxt - tc->iss, sb->rescue_rxt - tc->iss); hole = scoreboard_first_hole (sb); if (hole) - s = format (s, "\n head %u tail %u %u holes:\n", sb->head, sb->tail, - pool_elts (sb->holes)); + s = format (s, "\n%Uhead %u tail %u %u holes:\n", format_white_space, + indent, sb->head, sb->tail, pool_elts (sb->holes)); while (hole) { - s = format (s, "%U", format_tcp_sack_hole, hole, tc); + s = format (s, "%U%U", format_white_space, indent, format_tcp_sack_hole, + hole, tc); hole = scoreboard_next_hole (sb, hole); } |