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>
diff --git a/src/vlib/drop.c b/src/vlib/drop.c
index 2b245b5..034a23f 100644
--- a/src/vlib/drop.c
+++ b/src/vlib/drop.c
@@ -27,8 +27,8 @@
 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 @@
   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 @@
   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;