summaryrefslogtreecommitdiffstats
path: root/src/vlib
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlib')
-rw-r--r--src/vlib/CMakeLists.txt1
-rw-r--r--src/vlib/counter.c4
-rw-r--r--src/vlib/counter.h13
-rw-r--r--src/vlib/counter_types.h32
-rw-r--r--src/vlib/error.c8
5 files changed, 42 insertions, 16 deletions
diff --git a/src/vlib/CMakeLists.txt b/src/vlib/CMakeLists.txt
index c3dfba924a5..b187f980401 100644
--- a/src/vlib/CMakeLists.txt
+++ b/src/vlib/CMakeLists.txt
@@ -66,6 +66,7 @@ add_vpp_library(vlib
cli_funcs.h
cli.h
counter.h
+ counter_types.h
defs.h
error_funcs.h
error.h
diff --git a/src/vlib/counter.c b/src/vlib/counter.c
index 6afa73e0a7d..5c3350fceec 100644
--- a/src/vlib/counter.c
+++ b/src/vlib/counter.c
@@ -99,7 +99,7 @@ vlib_validate_simple_counter (vlib_simple_counter_main_t * cm, u32 index)
vec_validate_aligned (cm->counters[i], index, CLIB_CACHE_LINE_BYTES);
vlib_stats_pop_heap (cm, oldheap,
- 3 /* STAT_DIR_TYPE_COUNTER_VECTOR_SIMPLE */ );
+ 2 /* STAT_DIR_TYPE_COUNTER_VECTOR_SIMPLE */ );
}
void
@@ -114,7 +114,7 @@ vlib_validate_combined_counter (vlib_combined_counter_main_t * cm, u32 index)
vec_validate_aligned (cm->counters[i], index, CLIB_CACHE_LINE_BYTES);
vlib_stats_pop_heap (cm, oldheap,
- 4 /*STAT_DIR_TYPE_COUNTER_VECTOR_COMBINED */ );
+ 3 /*STAT_DIR_TYPE_COUNTER_VECTOR_COMBINED */ );
}
u32
diff --git a/src/vlib/counter.h b/src/vlib/counter.h
index fe5279a5e28..3aacc9b375f 100644
--- a/src/vlib/counter.h
+++ b/src/vlib/counter.h
@@ -40,6 +40,8 @@
#ifndef included_vlib_counter_h
#define included_vlib_counter_h
+#include <vlib/counter_types.h>
+
/** \file
Optimized thread-safe counters.
@@ -50,9 +52,6 @@
The idea is to drastically eliminate atomic operations.
*/
-/** 64bit counters */
-typedef u64 counter_t;
-
/** A collection of simple counters */
typedef struct
@@ -135,14 +134,6 @@ vlib_zero_simple_counter (vlib_simple_counter_main_t * cm, u32 index)
}
}
-/** Combined counter to hold both packets and byte differences.
- */
-typedef struct
-{
- counter_t packets; /**< packet counter */
- counter_t bytes; /**< byte counter */
-} vlib_counter_t;
-
/** Add two combined counters, results in the first counter
@param [in,out] a - (vlib_counter_t *) dst counter
@param b - (vlib_counter_t *) src counter
diff --git a/src/vlib/counter_types.h b/src/vlib/counter_types.h
new file mode 100644
index 00000000000..d6ce27f6fd6
--- /dev/null
+++ b/src/vlib/counter_types.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 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.
+ */
+
+#ifndef included_vlib_counter_types_h
+#define included_vlib_counter_types_h
+
+#include <stdint.h>
+
+/** 64bit counters */
+typedef uint64_t counter_t;
+
+/** Combined counter to hold both packets and byte differences.
+ */
+typedef struct
+{
+ counter_t packets; /**< packet counter */
+ counter_t bytes; /**< byte counter */
+} vlib_counter_t;
+
+#endif
diff --git a/src/vlib/error.c b/src/vlib/error.c
index aa53324fa8f..9fc1e708b63 100644
--- a/src/vlib/error.c
+++ b/src/vlib/error.c
@@ -140,9 +140,10 @@ VLIB_REGISTER_NODE (misc_drop_buffers_node,static) = {
};
/* *INDENT-ON* */
-void vlib_stats_register_error_index (u8 *, u64) __attribute__ ((weak));
+void vlib_stats_register_error_index (u8 *, u64 *, u64)
+ __attribute__ ((weak));
void
-vlib_stats_register_error_index (u8 * notused, u64 notused2)
+vlib_stats_register_error_index (u8 * notused, u64 * notused2, u64 notused3)
{
};
@@ -210,7 +211,8 @@ vlib_register_errors (vlib_main_t * vm,
{
error_name = format (0, "/err/%v/%s%c", n->name, error_strings[i], 0);
/* Note: error_name consumed by the following call */
- vlib_stats_register_error_index (error_name, n->error_heap_index + i);
+ vlib_stats_register_error_index (error_name, em->counters,
+ n->error_heap_index + i);
}
}