diff options
author | 2016-02-19 09:06:23 -0500 | |
---|---|---|
committer | 2016-02-19 09:06:46 -0500 | |
commit | b44e9bc90b634b07d5f93a731a95028adc73bcbc (patch) | |
tree | ba6477830970b8cb663ad2c393cdca778418fb13 /vpp | |
parent | c07bf5d5032e2b3ed4a651c8e6b8ff2131bc79c6 (diff) |
Serialize and upload the data plane node graph
Include node names and graph arcs. Prep work for uploading node
runtime data, so the latter can be reported in a comprehensible
manner.
Change-Id: I215b1f8cff244200c37c7e088f1f22229dc97eb6
Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'vpp')
-rw-r--r-- | vpp/api/api.c | 32 | ||||
-rw-r--r-- | vpp/api/vpe.api | 25 |
2 files changed, 56 insertions, 1 deletions
diff --git a/vpp/api/api.c b/vpp/api/api.c index 1390291b..e14eef63 100644 --- a/vpp/api/api.c +++ b/vpp/api/api.c @@ -310,7 +310,8 @@ _(MAP_DOMAIN_DUMP, map_domain_dump) \ _(MAP_RULE_DUMP, map_rule_dump) \ _(MAP_SUMMARY_STATS, map_summary_stats) \ _(COP_INTERFACE_ENABLE_DISABLE, cop_interface_enable_disable) \ -_(COP_WHITELIST_ENABLE_DISABLE, cop_whitelist_enable_disable) +_(COP_WHITELIST_ENABLE_DISABLE, cop_whitelist_enable_disable) \ +_(GET_NODE_GRAPH, get_node_graph) #define QUOTE_(x) #x #define QUOTE(x) QUOTE_(x) @@ -4905,6 +4906,35 @@ static void vl_api_cop_whitelist_enable_disable_t_handler REPLY_MACRO(VL_API_COP_WHITELIST_ENABLE_DISABLE_REPLY); } +static void vl_api_get_node_graph_t_handler +(vl_api_get_node_graph_t * mp) +{ + int rv = 0; + u8 * vector = 0; + api_main_t * am = &api_main; + vlib_main_t * vm = vlib_get_main(); + void * oldheap; + vl_api_get_node_graph_reply_t * rmp; + + pthread_mutex_lock (&am->vlib_rp->mutex); + oldheap = svm_push_data_heap (am->vlib_rp); + + /* + * Keep the number of memcpy ops to a minimum (e.g. 1). + * The current size of the serialized vector is + * slightly under 4K. + */ + vec_validate (vector, 4095); + vec_reset_length (vector); + + vector = vlib_node_serialize (&vm->node_main, vector); + + svm_pop_heap (oldheap); + pthread_mutex_unlock (&am->vlib_rp->mutex); + + REPLY_MACRO2(VL_API_GET_NODE_GRAPH_REPLY, + rmp->reply_in_shmem = (uword) vector); +} #define BOUNCE_HANDLER(nn) \ static void vl_api_##nn##_t_handler ( \ diff --git a/vpp/api/vpe.api b/vpp/api/vpe.api index bc3e107f..d76a5c8e 100644 --- a/vpp/api/vpe.api +++ b/vpp/api/vpe.api @@ -2809,3 +2809,28 @@ define cop_whitelist_enable_disable_reply { i32 retval; }; +/** \brief get_node_graph - get a copy of the vpp node graph + including the current set of graph arcs. + + @param client_index - opaque cookie to identify the sender + @param context - sender context, to match reply w/ request +*/ + +define get_node_graph { + u32 client_index; + u32 context; +}; + +/** \brief get_node_graph_reply + @param context - returned sender context, to match reply w/ request + @param retval - return code + @param reply_in_shmem - result from vlib_node_serialize, in shared + memory. Process with vlib_node_unserialize, remember to switch + heaps and free the result. +*/ + +define get_node_graph_reply { + u32 context; + i32 retval; + u64 reply_in_shmem; +}; |