aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/node.h
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2019-07-23 10:22:31 -0400
committerDave Barach <dave@barachs.net>2019-10-25 18:00:05 -0400
commitb5bc2e0e1cc70eb301c864212d3a3099b08bac49 (patch)
treeced89d1e7d5f0076c3f38a6606f1e96303d7c55c /src/vlib/node.h
parente6329ada4401f4a7e418a48fe829bbc211e28b6f (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> (cherry picked from commit 687c9021fda009caa2b7eb17bea2eaa51d275bde)
Diffstat (limited to 'src/vlib/node.h')
-rw-r--r--src/vlib/node.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/vlib/node.h b/src/vlib/node.h
index bdc3c6b59ad..c2638d03692 100644
--- a/src/vlib/node.h
+++ b/src/vlib/node.h
@@ -761,8 +761,27 @@ typedef struct
/* Node registrations added by constructors */
vlib_node_registration_t *node_registrations;
+
+ /* Node index from error code */
+ u32 *node_by_error;
} vlib_node_main_t;
+typedef u16 vlib_error_t;
+
+always_inline u32
+vlib_error_get_node (vlib_node_main_t * nm, vlib_error_t e)
+{
+ return nm->node_by_error[e];
+}
+
+always_inline u32
+vlib_error_get_code (vlib_node_main_t * nm, vlib_error_t e)
+{
+ u32 node_index = nm->node_by_error[e];
+ vlib_node_t *n = nm->nodes[node_index];
+ u32 error_code = e - n->error_heap_index;
+ return error_code;
+}
#define FRAME_QUEUE_MAX_NELTS 32
typedef struct