aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMathiasRaoul <mathias.raoul@gmail.com>2019-09-26 09:13:39 +0000
committerDave Wallace <dwallacelf@gmail.com>2019-10-01 23:42:34 +0000
commitff1f6faaa90cd446545a8d0c0b0baa85d69efa35 (patch)
treed7491c50e367bcc0ed1cfad863176dc7bda77091 /src
parentd4aeb84c3f066b755b723163da292eab95bd1ef9 (diff)
quic: Add Tx, Rx and packet drop counters
Type: feature Change-Id: I25aeeed49fc569315296a73c5595c2e2e302434f Signed-off-by: MathiasRaoul <mathias.raoul@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/quic/quic.c34
-rw-r--r--src/plugins/quic/quic.h10
-rw-r--r--src/plugins/quic/quic_error.def22
3 files changed, 66 insertions, 0 deletions
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c
index 38f41ba8291..3d0da256fb6 100644
--- a/src/plugins/quic/quic.c
+++ b/src/plugins/quic/quic.c
@@ -30,6 +30,11 @@
#include <quicly/defaults.h>
+static char *quic_error_strings[] = {
+#define quic_error(n,s) s,
+#include "quic_error.def"
+#undef quic_error
+};
static quic_main_t quic_main;
static void quic_update_timer (quic_ctx_t * ctx);
@@ -225,6 +230,13 @@ quic_connection_delete (quic_ctx_t * ctx)
quic_ctx_free (ctx);
}
+void
+quic_increment_counter (u8 evt, u8 val)
+{
+ vlib_main_t *vm = vlib_get_main ();
+ vlib_node_increment_counter (vm, quic_input_node.index, evt, val);
+}
+
/**
* Called when quicly return an error
* This function interacts tightly with quic_proto_on_close
@@ -326,6 +338,9 @@ quic_send_datagram (session_t * udp_session, quicly_datagram_t * packet)
QUIC_DBG (1, "Not enough space to enqueue payload");
return QUIC_ERROR_FULL_FIFO;
}
+
+ quic_increment_counter (QUIC_ERROR_TX_PACKETS, 1);
+
return 0;
}
@@ -1959,6 +1974,7 @@ quic_process_one_rx_packet (u64 udp_session_handle,
return 1;
}
+ quic_increment_counter (QUIC_ERROR_RX_PACKETS, 1);
rv = 0;
quic_build_sockaddr (sa, &salen, &ph.rmt_ip, ph.rmt_port, ph.is_ip4);
quicly_ctx = quic_get_quicly_ctx_from_udp (udp_session_handle);
@@ -2315,6 +2331,24 @@ VLIB_PLUGIN_REGISTER () =
.description = "Quic transport protocol",
.default_disabled = 1,
};
+
+static uword
+quic_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
+{
+ return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_REGISTER_NODE (quic_input_node) =
+{
+ .function = quic_node_fn,
+ .name = "quic-input",
+ .vector_size = sizeof (u32),
+ .type = VLIB_NODE_TYPE_INTERNAL,
+ .n_errors = ARRAY_LEN (quic_error_strings),
+ .error_strings = quic_error_strings,
+};
/* *INDENT-ON* */
/*
diff --git a/src/plugins/quic/quic.h b/src/plugins/quic/quic.h
index 5b821d77bae..777820ee2c2 100644
--- a/src/plugins/quic/quic.h
+++ b/src/plugins/quic/quic.h
@@ -65,6 +65,16 @@
#define QUIC_DBG(_lvl, _fmt, _args...)
#endif
+extern vlib_node_registration_t quic_input_node;
+
+typedef enum
+{
+#define quic_error(n,s) QUIC_ERROR_##n,
+#include <plugins/quic/quic_error.def>
+#undef quic_error
+ QUIC_N_ERROR,
+} quic_error_t;
+
typedef enum quic_ctx_conn_state_
{
QUIC_CONN_STATE_OPENED,
diff --git a/src/plugins/quic/quic_error.def b/src/plugins/quic/quic_error.def
new file mode 100644
index 00000000000..ecfcd677b46
--- /dev/null
+++ b/src/plugins/quic/quic_error.def
@@ -0,0 +1,22 @@
+/*
+ * quic_error.def: quic errors
+ *
+ * Copyright (c) 2013-2019 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.
+ */
+
+quic_error (NONE, "no error")
+quic_error (TX_PACKETS, "quic TX packets")
+quic_error (RX_PACKETS, "quic RX packets")
+quic_error (PACKET_DROP, "quic packet drops")
+