VCL: add vpp api q length to config file.

Change-Id: Ibe3e6cea0ea2fc700ef0a284c8ea5fe5d5476514
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
This commit is contained in:
Dave Wallace
2017-11-29 22:46:32 -05:00
committed by Florin Coras
parent e9d9170b55
commit c8f1ee6783
2 changed files with 25 additions and 2 deletions

View File

@ -1,6 +1,9 @@
# Test VPPCOM config file
vcl {
heapsize 1G
heapsize 1
vpp-api-q-length 32
vpp-api-q-length 65536
api-prefix daw # this is a comment
uid 1020 this is also a comment.
gid 1020

View File

@ -132,6 +132,7 @@ typedef struct
typedef struct vppcom_cfg_t_
{
u64 heapsize;
u32 vpp_api_q_length;
u64 segment_baseva;
u32 segment_size;
u32 add_segment_size;
@ -361,7 +362,8 @@ vppcom_connect_to_vpp (char *app_name)
if (VPPCOM_DEBUG > 0)
printf ("\nConnecting to VPP api...");
if (vl_client_connect_to_vlib ("/vpe-api", app_name, 32) < 0)
if (vl_client_connect_to_vlib ("/vpe-api", app_name,
vcm->cfg.vpp_api_q_length) < 0)
{
clib_warning ("[%d] connect to vpp (%s) failed!", getpid (), app_name);
return VPPCOM_ECONNREFUSED;
@ -1449,6 +1451,7 @@ vppcom_cfg_init (vppcom_cfg_t * vcl_cfg)
ASSERT (vcl_cfg);
vcl_cfg->heapsize = (256ULL << 20);
vcl_cfg->vpp_api_q_length = 1024;
vcl_cfg->segment_baseva = 0x200000000ULL;
vcl_cfg->segment_size = (256 << 20);
vcl_cfg->add_segment_size = (128 << 20);
@ -1611,7 +1614,7 @@ vppcom_cfg_read (char *conf_fname)
u8 vc_cfg_input = 0;
u8 *chroot_path;
struct stat s;
u32 uid, gid;
u32 uid, gid, q_len;
fd = open (conf_fname, O_RDONLY);
if (fd < 0)
@ -1670,6 +1673,23 @@ vppcom_cfg_read (char *conf_fname)
getpid (), chroot_path);
chroot_path = 0; /* Don't vec_free() it! */
}
else if (unformat (line_input, "vpp-api-q-length %d", &q_len))
{
if (q_len < vcl_cfg->vpp_api_q_length)
{
clib_warning ("[%d] ERROR: configured vpp-api-q-length "
"(%u) is too small! Using default: %u ",
getpid (), q_len, vcl_cfg->vpp_api_q_length);
}
else
{
vcl_cfg->vpp_api_q_length = q_len;
if (VPPCOM_DEBUG > 0)
clib_warning ("[%d] configured vpp-api-q-length %u",
getpid (), vcl_cfg->vpp_api_q_length);
}
}
else if (unformat (line_input, "uid %d", &uid))
{
vl_set_memory_uid (uid);