aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/drop.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2019-07-23 10:22:31 -0400
committerFlorin Coras <florin.coras@gmail.com>2019-07-23 17:02:04 +0000
commit687c9021fda009caa2b7eb17bea2eaa51d275bde (patch)
treef4b1ab097c40477a847d902430abdea5bf31acc3 /src/vlib/drop.c
parent3b7261978ee4ffdc1e92336e708ae05e2be25f71 (diff)
vlib: address vlib_error_t scaling issue
Encoding the vpp node index into the vlib_error_t as a 10-bit quantity limits us to 1K graph nodes. Unfortunately, a few nodes need 6 bit per-node error codes. Only a very few nodes have so many counters. It turns out that there are about 2K total error counters in the system, which is (approximately) the maximum error heap index. The current (index,code) encoding limits the number of interfaces to around 250, since each interface has two associated graph nodes and we have about 500 "normal, interior" graph node This patch adds an error-index to node-index map, so we can store error heap indices directly in the vlib_buffer_t. Type: refactor Change-Id: I28101cad3d8750819e27b8785fc0cf71ff54f79a Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vlib/drop.c')
-rw-r--r--src/vlib/drop.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/vlib/drop.c b/src/vlib/drop.c
index 2b245b561e3..034a23fb759 100644
--- a/src/vlib/drop.c
+++ b/src/vlib/drop.c
@@ -27,8 +27,8 @@ typedef enum
static u8 *
validate_error (vlib_main_t * vm, vlib_error_t * e, u32 index)
{
- uword node_index = vlib_error_get_node (e[0]);
- uword code = vlib_error_get_code (e[0]);
+ uword node_index = vlib_error_get_node (&vm->node_main, e[0]);
+ uword code = vlib_error_get_code (&vm->node_main, e[0]);
vlib_node_t *n;
if (node_index >= vec_len (vm->node_main.nodes))
@@ -69,10 +69,10 @@ counter_index (vlib_main_t * vm, vlib_error_t e)
vlib_node_t *n;
u32 ci, ni;
- ni = vlib_error_get_node (e);
+ ni = vlib_error_get_node (&vm->node_main, e);
n = vlib_get_node (vm, ni);
- ci = vlib_error_get_code (e);
+ ci = vlib_error_get_code (&vm->node_main, e);
ASSERT (ci < n->n_errors);
ci += n->error_heap_index;
@@ -90,8 +90,8 @@ format_error_trace (u8 * s, va_list * va)
vlib_error_main_t *em = &vm->error_main;
u32 i;
- error_node = vlib_get_node (vm, vlib_error_get_node (e[0]));
- i = counter_index (vm, e[0]);
+ error_node = vlib_get_node (vm, vlib_error_get_node (&vm->node_main, e[0]));
+ i = counter_index (vm, vlib_error_get_code (&vm->node_main, e[0]));
s = format (s, "%v: %s", error_node->name, em->error_strings_heap[i]);
return s;