diff options
author | Florin Coras <fcoras@cisco.com> | 2018-01-05 03:20:25 -0800 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2018-01-09 18:33:08 +0000 |
commit | e86a8edd3c14fb41ace2a12efd17bc7772bf623f (patch) | |
tree | 480219864cadd743fdb95c21379aeaf88a985e23 /src/vlibapi/node_serialize.c | |
parent | 4363ad6c96b5641fca1b16c5a6ec22e2364adcfd (diff) |
api: refactor vlibmemory
- separate client/server code for both memory and socket apis
- separate memory api code from generic vlib api code
- move unix_shared_memory_fifo to svm and rename to svm_fifo_t
- overall declutter
Change-Id: I90cdd98ff74d0787d58825b914b0f1eafcfa4dc2
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vlibapi/node_serialize.c')
-rw-r--r-- | src/vlibapi/node_serialize.c | 59 |
1 files changed, 4 insertions, 55 deletions
diff --git a/src/vlibapi/node_serialize.c b/src/vlibapi/node_serialize.c index 50e5c41c219..575de11b8cc 100644 --- a/src/vlibapi/node_serialize.c +++ b/src/vlibapi/node_serialize.c @@ -16,9 +16,6 @@ #include <vppinfra/serialize.h> -extern void vl_msg_api_barrier_sync (void); -extern void vl_msg_api_barrier_release (void); - /* serialized representation of state strings */ #define foreach_state_string_code \ @@ -50,72 +47,24 @@ static char *state_strings[] = { * to recycle a vector / avoid memory allocation, etc. * Switch heaps before/after to serialize into API client shared memory. */ - u8 * -vlib_node_serialize (vlib_node_main_t * nm, u8 * vector, - u32 max_threads, int include_nexts, int include_stats) +vlib_node_serialize (vlib_main_t * vm, vlib_node_t *** node_dups, u8 * vector, + int include_nexts, int include_stats) { serialize_main_t _sm, *sm = &_sm; - vlib_main_t *vm = vlib_get_main (); vlib_node_t *n; - static vlib_node_t ***node_dups; vlib_node_t **nodes; - static vlib_main_t **stat_vms; - vlib_main_t *stat_vm; u8 *namep; u32 name_bytes; uword i, j, k; u64 l, v, c, d; state_string_enum_t state_code; - u32 threads_to_serialize; - - vec_reset_length (node_dups); - - if (vec_len (stat_vms) == 0) - { - for (i = 0; i < vec_len (vlib_mains); i++) - { - stat_vm = vlib_mains[i]; - if (stat_vm) - vec_add1 (stat_vms, stat_vm); - } - } - - threads_to_serialize = clib_min (max_threads, vec_len (stat_vms)); - - /* - * Barrier sync across stats scraping. - * Otherwise, the counts will be grossly inaccurate. - */ - vl_msg_api_barrier_sync (); - - for (j = 0; j < threads_to_serialize; j++) - { - stat_vm = stat_vms[j]; - nm = &stat_vm->node_main; - - if (include_stats) - { - for (i = 0; i < vec_len (nm->nodes); i++) - { - n = nm->nodes[i]; - vlib_node_sync_stats (stat_vm, n); - } - } - - nodes = vec_dup (nm->nodes); - - vec_add1 (node_dups, nodes); - } - vl_msg_api_barrier_release (); serialize_open_vector (sm, vector); + serialize_likely_small_unsigned_integer (sm, vec_len (node_dups)); - serialize_likely_small_unsigned_integer (sm, vec_len (stat_vms)); - - for (j = 0; j < vec_len (stat_vms); j++) + for (j = 0; j < vec_len (node_dups); j++) { - stat_vm = stat_vms[j]; nodes = node_dups[j]; serialize_likely_small_unsigned_integer (sm, vec_len (nodes)); |