From 309bef25f109ff9ef03e178ac6fe233f4d778d73 Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Fri, 22 Jan 2016 16:09:52 -0500 Subject: Enable shared-VM namespace support Required prep work for gracefully supporting "... dpdk { proc-type secondary }" - multiple processes sharing a physical host, VM, container, etc. Change-Id: Ic3eb72f4093e26d7c86dde3b8799264f1d0c218b Signed-off-by: Dave Barach --- vpp/api/api.c | 20 ++++++++++++++++++++ vpp/api/gmon.c | 5 ++++- 2 files changed, 24 insertions(+), 1 deletion(-) (limited to 'vpp/api') diff --git a/vpp/api/api.c b/vpp/api/api.c index 9f3da214..55de9946 100644 --- a/vpp/api/api.c +++ b/vpp/api/api.c @@ -4979,6 +4979,26 @@ vpe_api_init (vlib_main_t *vm) VLIB_INIT_FUNCTION(vpe_api_init); +static clib_error_t * +chroot_config (vlib_main_t * vm, unformat_input_t * input) +{ + u8 * chroot_path; + + while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) + { + if (unformat (input, "prefix %s", &chroot_path)) + { + vec_add1 (chroot_path, 0); + vl_set_memory_root_path ((char *)chroot_path); + } + else + return clib_error_return (0, "unknown input `%U'", + format_unformat_error, input); + } + return 0; +} +VLIB_EARLY_CONFIG_FUNCTION (chroot_config, "chroot"); + void * get_unformat_vnet_sw_interface (void) { return (void *) &unformat_vnet_sw_interface; diff --git a/vpp/api/gmon.c b/vpp/api/gmon.c index 75bf3443..e256e83b 100644 --- a/vpp/api/gmon.c +++ b/vpp/api/gmon.c @@ -35,6 +35,8 @@ #include #include #include +#include +#include #include #include @@ -104,11 +106,12 @@ static clib_error_t * gmon_init (vlib_main_t *vm) { gmon_main_t *gm = &gmon_main; + api_main_t * am = &api_main; pid_t *swp = 0; f64 *v = 0; gm->vlib_main = vm; - gm->svmdb_client = svmdb_map(); + gm->svmdb_client = svmdb_map_chroot(am->root_path); /* Find or create, set to zero */ vec_add1 (v, 0.0); -- cgit 1.2.3-korg