From 0c4931cb351929a1ccdb6b29431def3705f101d7 Mon Sep 17 00:00:00 2001 From: Filip Tehlar Date: Wed, 6 Oct 2021 09:47:41 +0000 Subject: tcp: fix severity info Type: fix Signed-off-by: Filip Tehlar Signed-off-by: Florin Coras Change-Id: Ibe39bc045c3b154209a83b59ef95a37c61b32c0c --- src/vlib/error.c | 6 ++-- src/vnet/tcp/tcp.h | 2 +- src/vnet/tcp/tcp_error.def | 74 +++++++++++++++++++++--------------------- src/vnet/tcp/tcp_input.c | 28 ++++++++-------- src/vnet/tcp/tcp_output.c | 12 +++---- src/vnet/tcp/tcp_syn_filter4.c | 16 ++++----- 6 files changed, 69 insertions(+), 69 deletions(-) diff --git a/src/vlib/error.c b/src/vlib/error.c index 97cb0b52192..9a9ca4a535d 100644 --- a/src/vlib/error.c +++ b/src/vlib/error.c @@ -306,11 +306,11 @@ show_errors (vlib_main_t * vm, if (verbose) vlib_cli_output (vm, "%10lu%=35v%=35s%=10s%=6d", c, n->name, - em->counters_heap[i].name, + em->counters_heap[i].desc, sev2str (em->counters_heap[i].severity), i); else vlib_cli_output (vm, "%10lu%=35v%=35s%=10s", c, n->name, - em->counters_heap[i].name, + em->counters_heap[i].desc, sev2str (em->counters_heap[i].severity)); } } @@ -330,7 +330,7 @@ show_errors (vlib_main_t * vm, { if (verbose) vlib_cli_output (vm, "%10lu%=40v%=20s%=10d", sums[i], n->name, - em->counters_heap[i].name, i); + em->counters_heap[i].desc, i); } } } diff --git a/src/vnet/tcp/tcp.h b/src/vnet/tcp/tcp.h index ca650b7fa29..3ddd324873b 100644 --- a/src/vnet/tcp/tcp.h +++ b/src/vnet/tcp/tcp.h @@ -34,7 +34,7 @@ extern timer_expiration_handler tcp_timer_retransmit_syn_handler; typedef enum _tcp_error { -#define tcp_error(n,s) TCP_ERROR_##n, +#define tcp_error(f, n, s, d) TCP_ERROR_##f, #include #undef tcp_error TCP_N_ERROR, diff --git a/src/vnet/tcp/tcp_error.def b/src/vnet/tcp/tcp_error.def index d51e7ebf756..a6f0ce4b35f 100644 --- a/src/vnet/tcp/tcp_error.def +++ b/src/vnet/tcp/tcp_error.def @@ -12,40 +12,40 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -tcp_error (NONE, "no error") -tcp_error (WRONG_THREAD, "Wrong worker thread") -tcp_error (FILTERED, "Packets filtered") -tcp_error (LENGTH, "inconsistent ip/tcp lengths") -tcp_error (NO_LISTENER, "no listener for dst port") -tcp_error (LOOKUP_DROPS, "lookup drops") -tcp_error (DISPATCH, "Dispatch error") -tcp_error (ENQUEUED, "Packets pushed into rx fifo") -tcp_error (ENQUEUED_OOO, "OOO packets pushed into rx fifo") -tcp_error (FIFO_FULL, "Packets dropped for lack of rx fifo space") -tcp_error (PARTIALLY_ENQUEUED, "Packets partially pushed into rx fifo") -tcp_error (SEGMENT_OLD, "Old segment") -tcp_error (SEGMENT_INVALID, "Invalid segments") -tcp_error (SYNS_RCVD, "SYNs received") -tcp_error (SPURIOUS_SYN, "Spurious SYNs received") -tcp_error (SYN_ACKS_RCVD, "SYN-ACKs received") -tcp_error (SPURIOUS_SYN_ACK, "Spurious SYN-ACKs received") -tcp_error (MSG_QUEUE_FULL, "Events not sent for lack of msg queue space") -tcp_error (CREATE_SESSION_FAIL, "Sessions couldn't be allocated") -tcp_error (ACK_OK, "Pure ACKs received") -tcp_error (ACK_INVALID, "Invalid ACK") -tcp_error (ACK_DUP, "Duplicate ACK") -tcp_error (ACK_OLD, "Old ACK") -tcp_error (ACK_FUTURE, "Future ACK") -tcp_error (PKTS_SENT, "Packets sent") -tcp_error (RST_SENT, "Resets sent") -tcp_error (RST_RCVD, "Resets received") -tcp_error (INVALID_CONNECTION, "Invalid connection") -tcp_error (CONNECTION_CLOSED, "Connection closed") -tcp_error (CREATE_EXISTS, "Connection already exists") -tcp_error (PUNT, "Packets punted") -tcp_error (OPTIONS, "Could not parse options") -tcp_error (PAWS, "PAWS check failed") -tcp_error (RCV_WND, "Segment not in receive window") -tcp_error (FIN_RCVD, "FINs received") -tcp_error (LINK_LOCAL_RW, "No rewrite for link local connection") -tcp_error (ZERO_RWND, "Zero receive window") \ No newline at end of file +tcp_error (NONE, none, INFO, "no error") +tcp_error (WRONG_THREAD, wrong_thread, ERROR, "Wrong worker thread") +tcp_error (FILTERED, filtered, INFO, "Packets filtered") +tcp_error (LENGTH, length, ERROR, "inconsistent ip/tcp lengths") +tcp_error (NO_LISTENER, no_listener, ERROR, "no listener for dst port") +tcp_error (LOOKUP_DROPS, lookup_drops, ERROR, "lookup drops") +tcp_error (DISPATCH, dispatch, ERROR, "Dispatch error") +tcp_error (ENQUEUED, enqueued, INFO, "Packets pushed into rx fifo") +tcp_error (ENQUEUED_OOO, enqueued_ooo, WARN, "OOO packets pushed into rx fifo") +tcp_error (FIFO_FULL, fifo_full, ERROR, "Packets dropped for lack of rx fifo space") +tcp_error (PARTIALLY_ENQUEUED, partially_enqueued, WARN, "Packets partially pushed into rx fifo") +tcp_error (SEGMENT_OLD, segment_old, WARN, "Old segment") +tcp_error (SEGMENT_INVALID, segment_invalid, ERROR, "Invalid segments") +tcp_error (SYNS_RCVD, syns_rcvd, INFO, "SYNs received") +tcp_error (SPURIOUS_SYN, spurious_syn, WARN, "Spurious SYNs received") +tcp_error (SYN_ACKS_RCVD, syn_acks_rcvd, INFO, "SYN-ACKs received") +tcp_error (SPURIOUS_SYN_ACK, spurious_syn_ack, WARN, "Spurious SYN-ACKs received") +tcp_error (MSG_QUEUE_FULL, msg_queue_full, ERROR, "Events not sent for lack of msg queue space") +tcp_error (CREATE_SESSION_FAIL, create_session_fail, ERROR, "Sessions couldn't be allocated") +tcp_error (ACK_OK, ack_ok, INFO, "Pure ACKs received") +tcp_error (ACK_INVALID, ack_invalid, ERROR, "Invalid ACK") +tcp_error (ACK_DUP, ack_dup, WARN, "Duplicate ACK") +tcp_error (ACK_OLD, ack_old, WARN, "Old ACK") +tcp_error (ACK_FUTURE, ack_future, WARN, "Future ACK") +tcp_error (PKTS_SENT, pkts_sent, INFO, "Packets sent") +tcp_error (RST_SENT, rst_sent, INFO, "Resets sent") +tcp_error (RST_RCVD, rst_rcvd, INFO, "Resets received") +tcp_error (INVALID_CONNECTION, invalid_connection, ERROR, "Invalid connection") +tcp_error (CONNECTION_CLOSED, connection_closed, WARN, "Connection closed") +tcp_error (CREATE_EXISTS, create_exists, ERROR, "Connection already exists") +tcp_error (PUNT, punt, INFO, "Packets punted") +tcp_error (OPTIONS, options, ERROR, "Could not parse options") +tcp_error (PAWS, paws, ERROR, "PAWS check failed") +tcp_error (RCV_WND, rcv_wnd, WARN, "Segment not in receive window") +tcp_error (FIN_RCVD, fin_rcvd, INFO, "FINs received") +tcp_error (LINK_LOCAL_RW, link_local_rw, ERROR, "No rewrite for link local connection") +tcp_error (ZERO_RWND, zero_rwnd, WARN, "Zero receive window") diff --git a/src/vnet/tcp/tcp_input.c b/src/vnet/tcp/tcp_input.c index 3d3272c8765..6546a1422c1 100644 --- a/src/vnet/tcp/tcp_input.c +++ b/src/vnet/tcp/tcp_input.c @@ -21,8 +21,8 @@ #include #include -static char *tcp_error_strings[] = { -#define tcp_error(n,s) s, +static vlib_error_desc_t tcp_input_error_counters[] = { +#define tcp_error(f, n, s, d) { #n, d, VL_COUNTER_SEVERITY_##s }, #include #undef tcp_error }; @@ -1575,7 +1575,7 @@ VLIB_REGISTER_NODE (tcp4_established_node) = /* Takes a vector of packets. */ .vector_size = sizeof (u32), .n_errors = TCP_N_ERROR, - .error_strings = tcp_error_strings, + .error_counters = tcp_input_error_counters, .n_next_nodes = TCP_ESTABLISHED_N_NEXT, .next_nodes = { @@ -1594,7 +1594,7 @@ VLIB_REGISTER_NODE (tcp6_established_node) = /* Takes a vector of packets. */ .vector_size = sizeof (u32), .n_errors = TCP_N_ERROR, - .error_strings = tcp_error_strings, + .error_counters = tcp_input_error_counters, .n_next_nodes = TCP_ESTABLISHED_N_NEXT, .next_nodes = { @@ -2069,7 +2069,7 @@ VLIB_REGISTER_NODE (tcp4_syn_sent_node) = /* Takes a vector of packets. */ .vector_size = sizeof (u32), .n_errors = TCP_N_ERROR, - .error_strings = tcp_error_strings, + .error_counters = tcp_input_error_counters, .n_next_nodes = TCP_SYN_SENT_N_NEXT, .next_nodes = { @@ -2088,7 +2088,7 @@ VLIB_REGISTER_NODE (tcp6_syn_sent_node) = /* Takes a vector of packets. */ .vector_size = sizeof (u32), .n_errors = TCP_N_ERROR, - .error_strings = tcp_error_strings, + .error_counters = tcp_input_error_counters, .n_next_nodes = TCP_SYN_SENT_N_NEXT, .next_nodes = { @@ -2534,7 +2534,7 @@ VLIB_REGISTER_NODE (tcp4_rcv_process_node) = /* Takes a vector of packets. */ .vector_size = sizeof (u32), .n_errors = TCP_N_ERROR, - .error_strings = tcp_error_strings, + .error_counters = tcp_input_error_counters, .n_next_nodes = TCP_RCV_PROCESS_N_NEXT, .next_nodes = { @@ -2553,7 +2553,7 @@ VLIB_REGISTER_NODE (tcp6_rcv_process_node) = /* Takes a vector of packets. */ .vector_size = sizeof (u32), .n_errors = TCP_N_ERROR, - .error_strings = tcp_error_strings, + .error_counters = tcp_input_error_counters, .n_next_nodes = TCP_RCV_PROCESS_N_NEXT, .next_nodes = { @@ -2724,7 +2724,7 @@ VLIB_REGISTER_NODE (tcp4_listen_node) = /* Takes a vector of packets. */ .vector_size = sizeof (u32), .n_errors = TCP_N_ERROR, - .error_strings = tcp_error_strings, + .error_counters = tcp_input_error_counters, .n_next_nodes = TCP_LISTEN_N_NEXT, .next_nodes = { @@ -2743,7 +2743,7 @@ VLIB_REGISTER_NODE (tcp6_listen_node) = /* Takes a vector of packets. */ .vector_size = sizeof (u32), .n_errors = TCP_N_ERROR, - .error_strings = tcp_error_strings, + .error_counters = tcp_input_error_counters, .n_next_nodes = TCP_LISTEN_N_NEXT, .next_nodes = { @@ -2998,7 +2998,7 @@ VLIB_REGISTER_NODE (tcp4_input_nolookup_node) = /* Takes a vector of packets. */ .vector_size = sizeof (u32), .n_errors = TCP_N_ERROR, - .error_strings = tcp_error_strings, + .error_counters = tcp_input_error_counters, .n_next_nodes = TCP_INPUT_N_NEXT, .next_nodes = { @@ -3018,7 +3018,7 @@ VLIB_REGISTER_NODE (tcp6_input_nolookup_node) = /* Takes a vector of packets. */ .vector_size = sizeof (u32), .n_errors = TCP_N_ERROR, - .error_strings = tcp_error_strings, + .error_counters = tcp_input_error_counters, .n_next_nodes = TCP_INPUT_N_NEXT, .next_nodes = { @@ -3052,7 +3052,7 @@ VLIB_REGISTER_NODE (tcp4_input_node) = /* Takes a vector of packets. */ .vector_size = sizeof (u32), .n_errors = TCP_N_ERROR, - .error_strings = tcp_error_strings, + .error_counters = tcp_input_error_counters, .n_next_nodes = TCP_INPUT_N_NEXT, .next_nodes = { @@ -3072,7 +3072,7 @@ VLIB_REGISTER_NODE (tcp6_input_node) = /* Takes a vector of packets. */ .vector_size = sizeof (u32), .n_errors = TCP_N_ERROR, - .error_strings = tcp_error_strings, + .error_counters = tcp_input_error_counters, .n_next_nodes = TCP_INPUT_N_NEXT, .next_nodes = { diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c index 7a46798e746..5b445fa5165 100644 --- a/src/vnet/tcp/tcp_output.c +++ b/src/vnet/tcp/tcp_output.c @@ -40,8 +40,8 @@ typedef enum _tcp_output_next _ (IP_REWRITE, "ip6-rewrite") \ _ (IP_ARP, "ip6-discover-neighbor") -static char *tcp_error_strings[] = { -#define tcp_error(n,s) s, +static vlib_error_desc_t tcp_output_error_counters[] = { +#define tcp_error(f, n, s, d) { #n, d, VL_COUNTER_SEVERITY_##s }, #include #undef tcp_error }; @@ -2288,7 +2288,7 @@ VLIB_REGISTER_NODE (tcp4_output_node) = .vector_size = sizeof (u32), .n_errors = TCP_N_ERROR, .protocol_hint = VLIB_NODE_PROTO_HINT_TCP, - .error_strings = tcp_error_strings, + .error_counters = tcp_output_error_counters, .n_next_nodes = TCP_OUTPUT_N_NEXT, .next_nodes = { #define _(s,n) [TCP_OUTPUT_NEXT_##s] = n, @@ -2308,7 +2308,7 @@ VLIB_REGISTER_NODE (tcp6_output_node) = .vector_size = sizeof (u32), .n_errors = TCP_N_ERROR, .protocol_hint = VLIB_NODE_PROTO_HINT_TCP, - .error_strings = tcp_error_strings, + .error_counters = tcp_output_error_counters, .n_next_nodes = TCP_OUTPUT_N_NEXT, .next_nodes = { #define _(s,n) [TCP_OUTPUT_NEXT_##s] = n, @@ -2412,7 +2412,7 @@ VLIB_REGISTER_NODE (tcp4_reset_node) = { .name = "tcp4-reset", .vector_size = sizeof (u32), .n_errors = TCP_N_ERROR, - .error_strings = tcp_error_strings, + .error_counters = tcp_output_error_counters, .n_next_nodes = TCP_RESET_N_NEXT, .next_nodes = { #define _(s,n) [TCP_RESET_NEXT_##s] = n, @@ -2428,7 +2428,7 @@ VLIB_REGISTER_NODE (tcp6_reset_node) = { .name = "tcp6-reset", .vector_size = sizeof (u32), .n_errors = TCP_N_ERROR, - .error_strings = tcp_error_strings, + .error_counters = tcp_output_error_counters, .n_next_nodes = TCP_RESET_N_NEXT, .next_nodes = { #define _(s,n) [TCP_RESET_NEXT_##s] = n, diff --git a/src/vnet/tcp/tcp_syn_filter4.c b/src/vnet/tcp/tcp_syn_filter4.c index ef7a3280c03..1b003e04e51 100644 --- a/src/vnet/tcp/tcp_syn_filter4.c +++ b/src/vnet/tcp/tcp_syn_filter4.c @@ -54,20 +54,20 @@ format_syn_filter4_trace (u8 * s, va_list * args) extern vlib_node_registration_t syn_filter4_node; -#define foreach_syn_filter_error \ -_(THROTTLED, "TCP SYN packet throttle drops") \ -_(OK, "TCP SYN packets passed") +#define foreach_syn_filter_error \ + _ (THROTTLED, throttled, ERROR, "TCP SYN packet throttle drops") \ + _ (OK, ok, INFO, "TCP SYN packets passed") typedef enum { -#define _(sym,str) SYN_FILTER_ERROR_##sym, +#define _(f, n, s, d) SYN_FILTER_ERROR_##f, foreach_syn_filter_error #undef _ SYN_FILTER_N_ERROR, } syn_filter_error_t; -static char *syn_filter4_error_strings[] = { -#define _(sym,string) string, +static vlib_error_desc_t tcp_syn_error_counters[] = { +#define _(f, n, s, d) { #n, d, VL_COUNTER_SEVERITY_##s }, foreach_syn_filter_error #undef _ }; @@ -408,8 +408,8 @@ VLIB_REGISTER_NODE (syn_filter4_node) = .type = VLIB_NODE_TYPE_INTERNAL, .runtime_data_bytes = sizeof (syn_filter4_runtime_t), - .n_errors = ARRAY_LEN(syn_filter4_error_strings), - .error_strings = syn_filter4_error_strings, + .n_errors = SYN_FILTER_N_ERROR, + .error_counters = tcp_syn_error_counters, .n_next_nodes = SYN_FILTER_N_NEXT, -- cgit 1.2.3-korg