summaryrefslogtreecommitdiffstats
path: root/src/vnet/udp/udp_encap_node.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2018-03-20 01:47:35 -0700
committerChris Luke <chris_luke@comcast.com>2018-03-21 20:24:34 +0000
commit43b1f44571fd6989d6442723433cad28a5ab244f (patch)
tree1fe6d14f23e3263161879c36b929e405d4db5180 /src/vnet/udp/udp_encap_node.c
parent0cae3f737fcbfbef364fb8237faee08842f3fb68 (diff)
UDP Encap counters
Change-Id: Ib5639981dca0b11b2d62acf2c0963cc95c380f70 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/udp/udp_encap_node.c')
-rw-r--r--src/vnet/udp/udp_encap_node.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/vnet/udp/udp_encap_node.c b/src/vnet/udp/udp_encap_node.c
index 09a76b530f6..2d37d8b58dd 100644
--- a/src/vnet/udp/udp_encap_node.c
+++ b/src/vnet/udp/udp_encap_node.c
@@ -27,6 +27,8 @@ typedef struct udp6_encap_trace_t_
ip6_header_t ip;
} udp6_encap_trace_t;
+extern vlib_combined_counter_main_t udp_encap_counters;
+
static u8 *
format_udp4_encap_trace (u8 * s, va_list * args)
{
@@ -62,8 +64,10 @@ udp_encap_inline (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * frame, int is_encap_v6)
{
+ vlib_combined_counter_main_t *cm = &udp_encap_counters;
u32 *from = vlib_frame_vector_args (frame);
u32 n_left_from, n_left_to_next, *to_next, next_index;
+ u32 thread_index = vlib_get_thread_index ();
n_left_from = frame->n_vectors;
next_index = node->cached_next_index;
@@ -104,6 +108,13 @@ udp_encap_inline (vlib_main_t * vm,
uei0 = vnet_buffer (b0)->ip.adj_index[VLIB_TX];
uei1 = vnet_buffer (b1)->ip.adj_index[VLIB_TX];
+ vlib_increment_combined_counter (cm, thread_index, uei0, 1,
+ vlib_buffer_length_in_chain (vm,
+ b0));
+ vlib_increment_combined_counter (cm, thread_index, uei1, 1,
+ vlib_buffer_length_in_chain (vm,
+ b1));
+
/* Rewrite packet header and updates lengths. */
ue0 = udp_encap_get (uei0);
ue1 = udp_encap_get (uei1);
@@ -185,6 +196,10 @@ udp_encap_inline (vlib_main_t * vm,
/* Rewrite packet header and updates lengths. */
ue0 = udp_encap_get (uei0);
+ vlib_increment_combined_counter (cm, thread_index, uei0, 1,
+ vlib_buffer_length_in_chain (vm,
+ b0));
+
/* Paint */
if (is_encap_v6)
{