Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 1 | /* |
Florin Coras | 5e06257 | 2019-03-14 19:07:51 -0700 | [diff] [blame] | 2 | * Copyright (c) 2018-2019 Cisco and/or its affiliates. |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | * you may not use this |
| 5 | * You may obtain a copy of the License at: |
| 6 | * |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | * |
| 9 | * Unless required by applicable law or agreed to in writing, software |
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | * See the License for the specific language governing permissions and |
| 13 | * limitations under the License. |
| 14 | */ |
| 15 | |
| 16 | #include <vcl/vcl_private.h> |
| 17 | |
| 18 | /* NOTE: _vppcom_main is only used until the heap is allocated. |
| 19 | * Do not access it directly -- use vcm which will point to |
| 20 | * the heap allocated copy after init. |
| 21 | */ |
Florin Coras | ce815de | 2020-04-16 18:47:27 +0000 | [diff] [blame] | 22 | vppcom_main_t _vppcom_main = { |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 23 | .debug = VPPCOM_DEBUG_INIT, |
Florin Coras | 134a996 | 2018-08-28 11:32:04 -0700 | [diff] [blame] | 24 | .is_init = 0, |
Florin Coras | c1f5a43 | 2018-11-20 11:31:26 -0800 | [diff] [blame] | 25 | .app_index = ~0, |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 26 | }; |
| 27 | |
| 28 | vppcom_main_t *vcm = &_vppcom_main; |
| 29 | |
| 30 | void |
| 31 | vppcom_cfg_init (vppcom_cfg_t * vcl_cfg) |
| 32 | { |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 33 | ASSERT (vcl_cfg); |
| 34 | |
| 35 | vcl_cfg->heapsize = (256ULL << 20); |
Florin Coras | 134a996 | 2018-08-28 11:32:04 -0700 | [diff] [blame] | 36 | vcl_cfg->max_workers = 16; |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 37 | vcl_cfg->segment_size = (256 << 20); |
| 38 | vcl_cfg->add_segment_size = (128 << 20); |
| 39 | vcl_cfg->preallocated_fifo_pairs = 8; |
| 40 | vcl_cfg->rx_fifo_size = (1 << 20); |
| 41 | vcl_cfg->tx_fifo_size = (1 << 20); |
| 42 | vcl_cfg->event_queue_size = 2048; |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 43 | vcl_cfg->app_timeout = 10 * 60.0; |
| 44 | vcl_cfg->session_timeout = 10 * 60.0; |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 45 | vcl_cfg->event_log_path = "/dev/shm"; |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 46 | } |
| 47 | |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 48 | #define VCFG_DBG(_lvl, _fmt, _args...) \ |
| 49 | { \ |
Florin Coras | 54693d2 | 2018-07-17 10:46:29 -0700 | [diff] [blame] | 50 | if (vcm->debug > _lvl) \ |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 51 | fprintf (stderr, _fmt "\n", ##_args); \ |
| 52 | } |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 53 | void |
| 54 | vppcom_cfg_heapsize (char *conf_fname) |
| 55 | { |
| 56 | vppcom_cfg_t *vcl_cfg = &vcm->cfg; |
| 57 | FILE *fp; |
| 58 | char inbuf[4096]; |
| 59 | int argc = 1; |
| 60 | char **argv = NULL; |
| 61 | char *arg = NULL; |
| 62 | char *p; |
| 63 | int i; |
| 64 | u8 *sizep; |
| 65 | u32 size; |
| 66 | void *vcl_mem; |
| 67 | void *heap; |
| 68 | |
| 69 | fp = fopen (conf_fname, "r"); |
| 70 | if (fp == NULL) |
| 71 | { |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 72 | VCFG_DBG (0, "VCL<%d>: using default heapsize %lu (0x%lx)", |
David Johnson | d9818dd | 2018-12-14 14:53:41 -0500 | [diff] [blame] | 73 | getpid (), (unsigned long) vcl_cfg->heapsize, |
| 74 | (unsigned long) vcl_cfg->heapsize); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 75 | goto defaulted; |
| 76 | } |
| 77 | |
| 78 | argv = calloc (1, sizeof (char *)); |
| 79 | if (argv == NULL) |
| 80 | { |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 81 | VCFG_DBG (0, "VCL<%d>: calloc failed, using default heapsize %lu" |
David Johnson | d9818dd | 2018-12-14 14:53:41 -0500 | [diff] [blame] | 82 | " (0x%lx)", getpid (), (unsigned long) vcl_cfg->heapsize, |
| 83 | (unsigned long) vcl_cfg->heapsize); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 84 | goto defaulted; |
| 85 | } |
| 86 | |
| 87 | while (1) |
| 88 | { |
| 89 | if (fgets (inbuf, 4096, fp) == 0) |
| 90 | break; |
| 91 | p = strtok (inbuf, " \t\n"); |
| 92 | while (p != NULL) |
| 93 | { |
| 94 | if (*p == '#') |
| 95 | break; |
| 96 | argc++; |
| 97 | char **tmp = realloc (argv, argc * sizeof (char *)); |
| 98 | if (tmp == NULL) |
| 99 | { |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 100 | VCFG_DBG (0, "VCL<%d>: realloc failed, using default " |
| 101 | "heapsize %lu (0x%lx)", getpid (), |
David Johnson | d9818dd | 2018-12-14 14:53:41 -0500 | [diff] [blame] | 102 | (unsigned long) vcl_cfg->heapsize, |
| 103 | (unsigned long) vcl_cfg->heapsize); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 104 | goto defaulted; |
| 105 | } |
| 106 | argv = tmp; |
| 107 | arg = strndup (p, 1024); |
| 108 | if (arg == NULL) |
| 109 | { |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 110 | VCFG_DBG (0, "VCL<%d>: strndup failed, using default " |
David Johnson | d9818dd | 2018-12-14 14:53:41 -0500 | [diff] [blame] | 111 | "heapsize %lu (0x%lx)", getpid (), |
| 112 | (unsigned long) vcl_cfg->heapsize, |
| 113 | (unsigned long) vcl_cfg->heapsize); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 114 | goto defaulted; |
| 115 | } |
| 116 | argv[argc - 1] = arg; |
| 117 | p = strtok (NULL, " \t\n"); |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | fclose (fp); |
| 122 | fp = NULL; |
| 123 | |
| 124 | char **tmp = realloc (argv, (argc + 1) * sizeof (char *)); |
| 125 | if (tmp == NULL) |
| 126 | { |
David Johnson | d9818dd | 2018-12-14 14:53:41 -0500 | [diff] [blame] | 127 | VCFG_DBG (0, "VCL<%d>: realloc failed, using default heapsize %lu " |
| 128 | "(0x%lx)", getpid (), (unsigned long) vcl_cfg->heapsize, |
| 129 | (unsigned long) vcl_cfg->heapsize); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 130 | goto defaulted; |
| 131 | } |
| 132 | argv = tmp; |
| 133 | argv[argc] = NULL; |
| 134 | |
| 135 | /* |
| 136 | * Look for and parse the "heapsize" config parameter. |
| 137 | * Manual since none of the clib infra has been bootstrapped yet. |
| 138 | * |
| 139 | * Format: heapsize <nn>[mM][gG] |
| 140 | */ |
| 141 | |
| 142 | for (i = 1; i < (argc - 1); i++) |
| 143 | { |
| 144 | if (!strncmp (argv[i], "heapsize", 8)) |
| 145 | { |
| 146 | sizep = (u8 *) argv[i + 1]; |
| 147 | size = 0; |
| 148 | while (*sizep >= '0' && *sizep <= '9') |
| 149 | { |
| 150 | size *= 10; |
| 151 | size += *sizep++ - '0'; |
| 152 | } |
| 153 | if (size == 0) |
| 154 | { |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 155 | VCFG_DBG (0, "VCL<%d>: parse error '%s %s', using default " |
David Johnson | d9818dd | 2018-12-14 14:53:41 -0500 | [diff] [blame] | 156 | "heapsize %lu (0x%lx)", getpid (), argv[i], |
| 157 | argv[i + 1], (unsigned long) vcl_cfg->heapsize, |
| 158 | (unsigned long) vcl_cfg->heapsize); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 159 | goto defaulted; |
| 160 | } |
| 161 | |
| 162 | if (*sizep == 'g' || *sizep == 'G') |
| 163 | vcl_cfg->heapsize = size << 30; |
| 164 | else if (*sizep == 'm' || *sizep == 'M') |
| 165 | vcl_cfg->heapsize = size << 20; |
| 166 | else |
| 167 | { |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 168 | VCFG_DBG (0, "VCL<%d>: parse error '%s %s', using default " |
David Johnson | d9818dd | 2018-12-14 14:53:41 -0500 | [diff] [blame] | 169 | "heapsize %lu (0x%lx)", getpid (), argv[i], |
| 170 | argv[i + 1], (unsigned long) vcl_cfg->heapsize, |
| 171 | (unsigned long) vcl_cfg->heapsize); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 172 | goto defaulted; |
| 173 | } |
| 174 | } |
Florin Coras | 053a0e4 | 2018-11-13 15:52:38 -0800 | [diff] [blame] | 175 | free (argv[i]); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 176 | } |
| 177 | |
| 178 | defaulted: |
| 179 | if (fp != NULL) |
| 180 | fclose (fp); |
| 181 | if (argv != NULL) |
| 182 | free (argv); |
| 183 | |
| 184 | vcl_mem = mmap (0, vcl_cfg->heapsize, PROT_READ | PROT_WRITE, |
| 185 | MAP_SHARED | MAP_ANONYMOUS, -1, 0); |
| 186 | if (vcl_mem == MAP_FAILED) |
| 187 | { |
David Johnson | d9818dd | 2018-12-14 14:53:41 -0500 | [diff] [blame] | 188 | VCFG_DBG (0, "VCL<%d>: ERROR: mmap(0, %lu == 0x%lx, " |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 189 | "PROT_READ | PROT_WRITE,MAP_SHARED | MAP_ANONYMOUS, " |
David Johnson | d9818dd | 2018-12-14 14:53:41 -0500 | [diff] [blame] | 190 | "-1, 0) failed!", getpid (), |
| 191 | (unsigned long) vcl_cfg->heapsize, |
| 192 | (unsigned long) vcl_cfg->heapsize); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 193 | ASSERT (vcl_mem != MAP_FAILED); |
| 194 | return; |
| 195 | } |
Dave Barach | 6a5adc3 | 2018-07-04 10:56:23 -0400 | [diff] [blame] | 196 | heap = clib_mem_init_thread_safe (vcl_mem, vcl_cfg->heapsize); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 197 | if (!heap) |
| 198 | { |
Florin Coras | 54693d2 | 2018-07-17 10:46:29 -0700 | [diff] [blame] | 199 | fprintf (stderr, "VCL<%d>: ERROR: clib_mem_init() failed!", getpid ()); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 200 | ASSERT (heap); |
| 201 | return; |
| 202 | } |
| 203 | vcl_mem = clib_mem_alloc (sizeof (_vppcom_main)); |
| 204 | if (!vcl_mem) |
| 205 | { |
| 206 | clib_warning ("VCL<%d>: ERROR: clib_mem_alloc() failed!", getpid ()); |
| 207 | ASSERT (vcl_mem); |
| 208 | return; |
| 209 | } |
| 210 | |
| 211 | clib_memcpy (vcl_mem, &_vppcom_main, sizeof (_vppcom_main)); |
| 212 | vcm = vcl_mem; |
| 213 | |
David Johnson | d9818dd | 2018-12-14 14:53:41 -0500 | [diff] [blame] | 214 | VCFG_DBG (0, "VCL<%d>: allocated VCL heap = %p, size %lu (0x%lx)", |
| 215 | getpid (), heap, (unsigned long) vcl_cfg->heapsize, |
| 216 | (unsigned long) vcl_cfg->heapsize); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 217 | } |
| 218 | |
| 219 | void |
| 220 | vppcom_cfg_read_file (char *conf_fname) |
| 221 | { |
| 222 | vppcom_cfg_t *vcl_cfg = &vcm->cfg; |
| 223 | int fd; |
| 224 | unformat_input_t _input, *input = &_input; |
| 225 | unformat_input_t _line_input, *line_input = &_line_input; |
Florin Coras | d4c7092 | 2019-11-28 14:21:21 -0800 | [diff] [blame] | 226 | u8 vc_cfg_input = 0; |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 227 | struct stat s; |
Florin Coras | ca78b56 | 2020-11-09 19:59:16 -0800 | [diff] [blame] | 228 | u32 uid, gid; |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 229 | |
| 230 | fd = open (conf_fname, O_RDONLY); |
| 231 | if (fd < 0) |
| 232 | { |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 233 | VCFG_DBG (0, "VCL<%d>: using default configuration.", getpid ()); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 234 | goto file_done; |
| 235 | } |
| 236 | |
| 237 | if (fstat (fd, &s) < 0) |
| 238 | { |
Florin Coras | 053a0e4 | 2018-11-13 15:52:38 -0800 | [diff] [blame] | 239 | VCFG_DBG (0, "VCL<%d>: failed to stat `%s' using default configuration", |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 240 | getpid (), conf_fname); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 241 | goto file_done; |
| 242 | } |
| 243 | |
| 244 | if (!(S_ISREG (s.st_mode) || S_ISLNK (s.st_mode))) |
| 245 | { |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 246 | VCFG_DBG (0, "VCL<%d>: not a regular file `%s', using default " |
| 247 | "configuration", getpid (), conf_fname); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 248 | goto file_done; |
| 249 | } |
| 250 | |
| 251 | unformat_init_clib_file (input, fd); |
| 252 | |
| 253 | while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) |
| 254 | { |
Florin Coras | ac306bd | 2021-10-22 10:56:54 -0700 | [diff] [blame] | 255 | /* skip empty newlines as they confuse unformat_line_input */ |
| 256 | unformat_skip_white_space (input); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 257 | (void) unformat_user (input, unformat_line_input, line_input); |
| 258 | unformat_skip_white_space (line_input); |
| 259 | |
| 260 | if (unformat (line_input, "vcl {")) |
| 261 | { |
| 262 | vc_cfg_input = 1; |
Florin Coras | 053a0e4 | 2018-11-13 15:52:38 -0800 | [diff] [blame] | 263 | unformat_free (line_input); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 264 | continue; |
| 265 | } |
| 266 | |
| 267 | if (vc_cfg_input) |
| 268 | { |
Florin Coras | 053a0e4 | 2018-11-13 15:52:38 -0800 | [diff] [blame] | 269 | if (unformat (line_input, "heapsize %U", unformat_memory_size, |
| 270 | &vcl_cfg->heapsize)) |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 271 | { |
Florin Coras | 134a996 | 2018-08-28 11:32:04 -0700 | [diff] [blame] | 272 | VCFG_DBG (0, "VCL<%d>: configured heapsize %lu", getpid (), |
David Johnson | d9818dd | 2018-12-14 14:53:41 -0500 | [diff] [blame] | 273 | (unsigned long) vcl_cfg->heapsize); |
Florin Coras | 134a996 | 2018-08-28 11:32:04 -0700 | [diff] [blame] | 274 | } |
Florin Coras | 053a0e4 | 2018-11-13 15:52:38 -0800 | [diff] [blame] | 275 | else |
| 276 | if (unformat |
| 277 | (line_input, "max-workers %u", &vcl_cfg->max_workers)) |
Florin Coras | 134a996 | 2018-08-28 11:32:04 -0700 | [diff] [blame] | 278 | { |
| 279 | VCFG_DBG (0, "VCL<%d>: configured max-workers %u", getpid (), |
| 280 | vcl_cfg->max_workers); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 281 | } |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 282 | else if (unformat (line_input, "api-socket-name %s", |
Florin Coras | b88de90 | 2020-09-08 16:47:57 -0700 | [diff] [blame] | 283 | &vcl_cfg->vpp_bapi_socket_name)) |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 284 | { |
Florin Coras | b88de90 | 2020-09-08 16:47:57 -0700 | [diff] [blame] | 285 | vec_terminate_c_string (vcl_cfg->vpp_bapi_socket_name); |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 286 | VCFG_DBG (0, "VCL<%d>: configured api-socket-name (%s)", |
Florin Coras | b88de90 | 2020-09-08 16:47:57 -0700 | [diff] [blame] | 287 | getpid (), vcl_cfg->vpp_bapi_socket_name); |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 288 | } |
Florin Coras | 935ce75 | 2020-09-08 22:43:47 -0700 | [diff] [blame] | 289 | else if (unformat (line_input, "app-socket-api %s", |
| 290 | &vcl_cfg->vpp_app_socket_api)) |
| 291 | { |
| 292 | vec_terminate_c_string (vcl_cfg->vpp_app_socket_api); |
| 293 | VCFG_DBG (0, "VCL<%d>: configured app-socket-api (%s)", |
| 294 | getpid (), vcl_cfg->vpp_app_socket_api); |
| 295 | } |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 296 | else if (unformat (line_input, "uid %d", &uid)) |
| 297 | { |
| 298 | vl_set_memory_uid (uid); |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 299 | VCFG_DBG (0, "VCL<%d>: configured uid %d", getpid (), uid); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 300 | } |
| 301 | else if (unformat (line_input, "gid %d", &gid)) |
| 302 | { |
| 303 | vl_set_memory_gid (gid); |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 304 | VCFG_DBG (0, "VCL<%d>: configured gid %d", getpid (), gid); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 305 | } |
Florin Coras | d18528f | 2020-03-27 18:41:54 +0000 | [diff] [blame] | 306 | else if (unformat (line_input, "segment-size 0x%lx", |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 307 | &vcl_cfg->segment_size)) |
| 308 | { |
Florin Coras | d18528f | 2020-03-27 18:41:54 +0000 | [diff] [blame] | 309 | VCFG_DBG (0, "VCL<%d>: configured segment_size 0x%lx (%lu)", |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 310 | getpid (), vcl_cfg->segment_size, |
| 311 | vcl_cfg->segment_size); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 312 | } |
Florin Coras | d18528f | 2020-03-27 18:41:54 +0000 | [diff] [blame] | 313 | else if (unformat (line_input, "segment-size %lu", |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 314 | &vcl_cfg->segment_size)) |
| 315 | { |
Florin Coras | d18528f | 2020-03-27 18:41:54 +0000 | [diff] [blame] | 316 | VCFG_DBG (0, "VCL<%d>: configured segment_size %lu (0x%lx)", |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 317 | getpid (), vcl_cfg->segment_size, |
| 318 | vcl_cfg->segment_size); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 319 | } |
Florin Coras | d18528f | 2020-03-27 18:41:54 +0000 | [diff] [blame] | 320 | else if (unformat (line_input, "add-segment-size 0x%lx", |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 321 | &vcl_cfg->add_segment_size)) |
| 322 | { |
Florin Coras | d18528f | 2020-03-27 18:41:54 +0000 | [diff] [blame] | 323 | VCFG_DBG (0, "VCL<%d>: configured add_segment_size 0x%lx (%lu)", |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 324 | getpid (), vcl_cfg->add_segment_size, |
| 325 | vcl_cfg->add_segment_size); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 326 | } |
Florin Coras | d18528f | 2020-03-27 18:41:54 +0000 | [diff] [blame] | 327 | else if (unformat (line_input, "add-segment-size %lu", |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 328 | &vcl_cfg->add_segment_size)) |
| 329 | { |
Florin Coras | d18528f | 2020-03-27 18:41:54 +0000 | [diff] [blame] | 330 | VCFG_DBG (0, "VCL<%d>: configured add_segment_size %lu (0x%lx)", |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 331 | getpid (), vcl_cfg->add_segment_size, |
| 332 | vcl_cfg->add_segment_size); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 333 | } |
Florin Coras | 1a3d237 | 2019-07-28 10:25:40 -0700 | [diff] [blame] | 334 | else if (unformat (line_input, "preallocated-fifo-pairs %u", |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 335 | &vcl_cfg->preallocated_fifo_pairs)) |
| 336 | { |
Florin Coras | 1a3d237 | 2019-07-28 10:25:40 -0700 | [diff] [blame] | 337 | VCFG_DBG (0, "VCL<%d>: configured preallocated_fifo_pairs %u " |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 338 | "(0x%x)", getpid (), vcl_cfg->preallocated_fifo_pairs, |
| 339 | vcl_cfg->preallocated_fifo_pairs); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 340 | } |
Florin Coras | 1a3d237 | 2019-07-28 10:25:40 -0700 | [diff] [blame] | 341 | else if (unformat (line_input, "rx-fifo-size 0x%x", |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 342 | &vcl_cfg->rx_fifo_size)) |
| 343 | { |
Florin Coras | 1a3d237 | 2019-07-28 10:25:40 -0700 | [diff] [blame] | 344 | VCFG_DBG (0, "VCL<%d>: configured rx_fifo_size 0x%x (%u)", |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 345 | getpid (), vcl_cfg->rx_fifo_size, |
| 346 | vcl_cfg->rx_fifo_size); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 347 | } |
Florin Coras | 1a3d237 | 2019-07-28 10:25:40 -0700 | [diff] [blame] | 348 | else if (unformat (line_input, "rx-fifo-size %u", |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 349 | &vcl_cfg->rx_fifo_size)) |
| 350 | { |
Florin Coras | 1a3d237 | 2019-07-28 10:25:40 -0700 | [diff] [blame] | 351 | VCFG_DBG (0, "VCL<%d>: configured rx_fifo_size %u (0x%x)", |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 352 | getpid (), vcl_cfg->rx_fifo_size, |
| 353 | vcl_cfg->rx_fifo_size); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 354 | } |
Florin Coras | 1a3d237 | 2019-07-28 10:25:40 -0700 | [diff] [blame] | 355 | else if (unformat (line_input, "tx-fifo-size 0x%x", |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 356 | &vcl_cfg->tx_fifo_size)) |
| 357 | { |
Florin Coras | 1a3d237 | 2019-07-28 10:25:40 -0700 | [diff] [blame] | 358 | VCFG_DBG (0, "VCL<%d>: configured tx_fifo_size 0x%x (%u)", |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 359 | getpid (), vcl_cfg->tx_fifo_size, |
| 360 | vcl_cfg->tx_fifo_size); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 361 | } |
Florin Coras | 1a3d237 | 2019-07-28 10:25:40 -0700 | [diff] [blame] | 362 | else if (unformat (line_input, "tx-fifo-size %u", |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 363 | &vcl_cfg->tx_fifo_size)) |
| 364 | { |
Florin Coras | 1a3d237 | 2019-07-28 10:25:40 -0700 | [diff] [blame] | 365 | VCFG_DBG (0, "VCL<%d>: configured tx_fifo_size %u (0x%x)", |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 366 | getpid (), vcl_cfg->tx_fifo_size, |
| 367 | vcl_cfg->tx_fifo_size); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 368 | } |
Florin Coras | 1a3d237 | 2019-07-28 10:25:40 -0700 | [diff] [blame] | 369 | else if (unformat (line_input, "event-queue-size 0x%x", |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 370 | &vcl_cfg->event_queue_size)) |
| 371 | { |
Florin Coras | 1a3d237 | 2019-07-28 10:25:40 -0700 | [diff] [blame] | 372 | VCFG_DBG (0, "VCL<%d>: configured event_queue_size 0x%x (%u)", |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 373 | getpid (), vcl_cfg->event_queue_size, |
| 374 | vcl_cfg->event_queue_size); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 375 | } |
Florin Coras | 1a3d237 | 2019-07-28 10:25:40 -0700 | [diff] [blame] | 376 | else if (unformat (line_input, "event-queue-size %u", |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 377 | &vcl_cfg->event_queue_size)) |
| 378 | { |
Florin Coras | 1a3d237 | 2019-07-28 10:25:40 -0700 | [diff] [blame] | 379 | VCFG_DBG (0, "VCL<%d>: configured event_queue_size %u (0x%x)", |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 380 | getpid (), vcl_cfg->event_queue_size, |
| 381 | vcl_cfg->event_queue_size); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 382 | } |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 383 | else if (unformat (line_input, "app-timeout %f", |
| 384 | &vcl_cfg->app_timeout)) |
| 385 | { |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 386 | VCFG_DBG (0, "VCL<%d>: configured app_timeout %f", |
| 387 | getpid (), vcl_cfg->app_timeout); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 388 | } |
| 389 | else if (unformat (line_input, "session-timeout %f", |
| 390 | &vcl_cfg->session_timeout)) |
| 391 | { |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 392 | VCFG_DBG (0, "VCL<%d>: configured session_timeout %f", |
| 393 | getpid (), vcl_cfg->session_timeout); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 394 | } |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 395 | else if (unformat (line_input, "app-proxy-transport-tcp")) |
| 396 | { |
| 397 | vcl_cfg->app_proxy_transport_tcp = 1; |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 398 | VCFG_DBG (0, "VCL<%d>: configured app_proxy_transport_tcp (%d)", |
| 399 | getpid (), vcl_cfg->app_proxy_transport_tcp); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 400 | } |
| 401 | else if (unformat (line_input, "app-proxy-transport-udp")) |
| 402 | { |
| 403 | vcl_cfg->app_proxy_transport_udp = 1; |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 404 | VCFG_DBG (0, "VCL<%d>: configured app_proxy_transport_udp (%d)", |
| 405 | getpid (), vcl_cfg->app_proxy_transport_udp); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 406 | } |
| 407 | else if (unformat (line_input, "app-scope-local")) |
| 408 | { |
| 409 | vcl_cfg->app_scope_local = 1; |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 410 | VCFG_DBG (0, "VCL<%d>: configured app_scope_local (%d)", |
| 411 | getpid (), vcl_cfg->app_scope_local); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 412 | } |
| 413 | else if (unformat (line_input, "app-scope-global")) |
| 414 | { |
| 415 | vcl_cfg->app_scope_global = 1; |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 416 | VCFG_DBG (0, "VCL<%d>: configured app_scope_global (%d)", |
| 417 | getpid (), vcl_cfg->app_scope_global); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 418 | } |
Junfeng Wang | c795b88 | 2022-08-12 16:24:46 +0800 | [diff] [blame] | 419 | else if (unformat (line_input, "huge_page")) |
| 420 | { |
| 421 | vcl_cfg->huge_page = 1; |
| 422 | VCFG_DBG (0, "VCL<%d>: configured huge_page (%d)", getpid (), |
| 423 | vcl_cfg->huge_page); |
| 424 | } |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 425 | else if (unformat (line_input, "namespace-secret %lu", |
| 426 | &vcl_cfg->namespace_secret)) |
| 427 | { |
Florin Coras | 1a3d237 | 2019-07-28 10:25:40 -0700 | [diff] [blame] | 428 | VCFG_DBG (0, "VCL<%d>: configured namespace_secret %llu " |
| 429 | "(0x%llx)", getpid (), |
David Johnson | d9818dd | 2018-12-14 14:53:41 -0500 | [diff] [blame] | 430 | (unsigned long long) vcl_cfg->namespace_secret, |
| 431 | (unsigned long long) vcl_cfg->namespace_secret); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 432 | } |
| 433 | else if (unformat (line_input, "namespace-id %v", |
| 434 | &vcl_cfg->namespace_id)) |
| 435 | { |
Florin Coras | b88de90 | 2020-09-08 16:47:57 -0700 | [diff] [blame] | 436 | u32 max_nsid_vec_len = vcl_bapi_max_nsid_len (); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 437 | u32 nsid_vec_len = vec_len (vcl_cfg->namespace_id); |
| 438 | if (nsid_vec_len > max_nsid_vec_len) |
| 439 | { |
Damjan Marion | 8bea589 | 2022-04-04 22:40:45 +0200 | [diff] [blame] | 440 | vec_set_len (vcl_cfg->namespace_id, max_nsid_vec_len); |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 441 | VCFG_DBG (0, "VCL<%d>: configured namespace_id is too long," |
| 442 | " truncated to %d characters!", |
| 443 | getpid (), max_nsid_vec_len); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 444 | } |
| 445 | |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 446 | VCFG_DBG (0, "VCL<%d>: configured namespace_id %s", |
| 447 | getpid (), (char *) vcl_cfg->namespace_id); |
| 448 | } |
| 449 | else if (unformat (line_input, "use-mq-eventfd")) |
| 450 | { |
| 451 | vcl_cfg->use_mq_eventfd = 1; |
| 452 | VCFG_DBG (0, "VCL<%d>: configured with mq with eventfd", |
| 453 | getpid ()); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 454 | } |
Florin Coras | d747c3c | 2019-10-20 19:55:56 -0700 | [diff] [blame] | 455 | else if (unformat (line_input, "tls-engine %u", |
| 456 | &vcl_cfg->tls_engine)) |
| 457 | { |
| 458 | VCFG_DBG (0, "VCL<%d>: configured tls-engine %u (0x%x)", |
| 459 | getpid (), vcl_cfg->tls_engine, vcl_cfg->tls_engine); |
| 460 | } |
Florin Coras | ff40d8f | 2020-08-11 22:05:28 -0700 | [diff] [blame] | 461 | else if (unformat (line_input, "multi-thread-workers")) |
hanlin | a3a4896 | 2020-07-13 11:09:15 +0800 | [diff] [blame] | 462 | { |
Florin Coras | ff40d8f | 2020-08-11 22:05:28 -0700 | [diff] [blame] | 463 | vcl_cfg->mt_wrk_supported = 1; |
| 464 | VCFG_DBG (0, "VCL<%d>: configured with multithread workers", |
| 465 | getpid ()); |
hanlin | a3a4896 | 2020-07-13 11:09:15 +0800 | [diff] [blame] | 466 | } |
qinyang | af9b715 | 2023-06-27 01:11:53 -0700 | [diff] [blame] | 467 | else if (unformat (line_input, "app_original_dst")) |
| 468 | { |
| 469 | vcl_cfg->app_original_dst = 1; |
| 470 | VCFG_DBG (0, "VCL<%d>: support original destination", getpid ()); |
| 471 | } |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 472 | else if (unformat (line_input, "}")) |
| 473 | { |
| 474 | vc_cfg_input = 0; |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 475 | VCFG_DBG (0, "VCL<%d>: completed parsing vppcom config!", |
| 476 | getpid ()); |
Florin Coras | 053a0e4 | 2018-11-13 15:52:38 -0800 | [diff] [blame] | 477 | unformat_free (line_input); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 478 | goto input_done; |
| 479 | } |
| 480 | else |
| 481 | { |
| 482 | if (line_input->buffer[line_input->index] != '#') |
| 483 | { |
| 484 | clib_warning ("VCL<%d>: Unknown vppcom config option: '%s'", |
| 485 | getpid (), (char *) |
| 486 | &line_input->buffer[line_input->index]); |
| 487 | } |
| 488 | } |
Florin Coras | 053a0e4 | 2018-11-13 15:52:38 -0800 | [diff] [blame] | 489 | unformat_free (line_input); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 490 | } |
| 491 | } |
| 492 | |
| 493 | input_done: |
| 494 | unformat_free (input); |
| 495 | |
| 496 | file_done: |
| 497 | if (fd >= 0) |
| 498 | close (fd); |
| 499 | } |
| 500 | |
| 501 | void |
| 502 | vppcom_cfg (vppcom_cfg_t * vcl_cfg) |
| 503 | { |
| 504 | char *conf_fname, *env_var_str; |
| 505 | |
| 506 | vppcom_cfg_init (vcl_cfg); |
| 507 | env_var_str = getenv (VPPCOM_ENV_DEBUG); |
| 508 | if (env_var_str) |
| 509 | { |
| 510 | u32 tmp; |
| 511 | if (sscanf (env_var_str, "%u", &tmp) != 1) |
Florin Coras | 9686eac | 2018-08-01 17:24:08 -0700 | [diff] [blame] | 512 | { |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 513 | VCFG_DBG (0, "VCL<%d>: WARNING: Invalid debug level specified " |
| 514 | "in the environment variable " VPPCOM_ENV_DEBUG |
| 515 | " (%s)!\n", getpid (), env_var_str); |
Florin Coras | 9686eac | 2018-08-01 17:24:08 -0700 | [diff] [blame] | 516 | } |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 517 | else |
| 518 | { |
| 519 | vcm->debug = tmp; |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 520 | VCFG_DBG (0, "VCL<%d>: configured VCL debug level (%u) from " |
| 521 | VPPCOM_ENV_DEBUG "!", getpid (), vcm->debug); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 522 | } |
| 523 | } |
| 524 | conf_fname = getenv (VPPCOM_ENV_CONF); |
| 525 | if (!conf_fname) |
| 526 | conf_fname = VPPCOM_CONF_DEFAULT; |
| 527 | vppcom_cfg_heapsize (conf_fname); |
| 528 | vppcom_cfg_read_file (conf_fname); |
| 529 | |
Florin Coras | d4c7092 | 2019-11-28 14:21:21 -0800 | [diff] [blame] | 530 | /* Regrab cfg after heap initialization */ |
| 531 | vcl_cfg = &vcm->cfg; |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 532 | env_var_str = getenv (VPPCOM_ENV_APP_NAMESPACE_ID); |
| 533 | if (env_var_str) |
| 534 | { |
| 535 | u32 ns_id_vec_len = strlen (env_var_str); |
| 536 | |
| 537 | vec_reset_length (vcm->cfg.namespace_id); |
| 538 | vec_validate (vcm->cfg.namespace_id, ns_id_vec_len - 1); |
| 539 | clib_memcpy (vcm->cfg.namespace_id, env_var_str, ns_id_vec_len); |
| 540 | |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 541 | VCFG_DBG (0, "VCL<%d>: configured namespace_id (%s) from " |
BenoƮt Ganne | fe67afd | 2019-07-12 11:53:07 +0200 | [diff] [blame] | 542 | VPPCOM_ENV_APP_NAMESPACE_ID "!", getpid (), env_var_str); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 543 | } |
| 544 | env_var_str = getenv (VPPCOM_ENV_APP_NAMESPACE_SECRET); |
| 545 | if (env_var_str) |
| 546 | { |
| 547 | u64 tmp; |
David Johnson | d9818dd | 2018-12-14 14:53:41 -0500 | [diff] [blame] | 548 | if (sscanf (env_var_str, "%llu", (unsigned long long *) &tmp) != 1) |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 549 | { |
| 550 | VCFG_DBG (0, "VCL<%d>: WARNING: Invalid namespace secret specified" |
| 551 | " in the environment variable " |
| 552 | VPPCOM_ENV_APP_NAMESPACE_SECRET " (%s)!\n", getpid (), |
| 553 | env_var_str); |
| 554 | } |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 555 | else |
| 556 | { |
| 557 | vcm->cfg.namespace_secret = tmp; |
David Johnson | d9818dd | 2018-12-14 14:53:41 -0500 | [diff] [blame] | 558 | VCFG_DBG (0, "VCL<%d>: configured namespace secret (%llu) from " |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 559 | VPPCOM_ENV_APP_NAMESPACE_SECRET "!", getpid (), |
David Johnson | d9818dd | 2018-12-14 14:53:41 -0500 | [diff] [blame] | 560 | (unsigned long long) vcm->cfg.namespace_secret); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 561 | } |
| 562 | } |
| 563 | if (getenv (VPPCOM_ENV_APP_PROXY_TRANSPORT_TCP)) |
| 564 | { |
| 565 | vcm->cfg.app_proxy_transport_tcp = 1; |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 566 | VCFG_DBG (0, "VCL<%d>: configured app_proxy_transport_tcp (%u) from " |
| 567 | VPPCOM_ENV_APP_PROXY_TRANSPORT_TCP "!", getpid (), |
| 568 | vcm->cfg.app_proxy_transport_tcp); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 569 | } |
| 570 | if (getenv (VPPCOM_ENV_APP_PROXY_TRANSPORT_UDP)) |
| 571 | { |
| 572 | vcm->cfg.app_proxy_transport_udp = 1; |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 573 | VCFG_DBG (0, "VCL<%d>: configured app_proxy_transport_udp (%u) from " |
| 574 | VPPCOM_ENV_APP_PROXY_TRANSPORT_UDP "!", getpid (), |
| 575 | vcm->cfg.app_proxy_transport_udp); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 576 | } |
| 577 | if (getenv (VPPCOM_ENV_APP_SCOPE_LOCAL)) |
| 578 | { |
| 579 | vcm->cfg.app_scope_local = 1; |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 580 | VCFG_DBG (0, "VCL<%d>: configured app_scope_local (%u) from " |
| 581 | VPPCOM_ENV_APP_SCOPE_LOCAL "!", getpid (), |
| 582 | vcm->cfg.app_scope_local); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 583 | } |
| 584 | if (getenv (VPPCOM_ENV_APP_SCOPE_GLOBAL)) |
| 585 | { |
| 586 | vcm->cfg.app_scope_global = 1; |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 587 | VCFG_DBG (0, "VCL<%d>: configured app_scope_global (%u) from " |
| 588 | VPPCOM_ENV_APP_SCOPE_GLOBAL "!", getpid (), |
| 589 | vcm->cfg.app_scope_global); |
| 590 | } |
| 591 | env_var_str = getenv (VPPCOM_ENV_VPP_API_SOCKET); |
| 592 | if (env_var_str) |
| 593 | { |
Florin Coras | b88de90 | 2020-09-08 16:47:57 -0700 | [diff] [blame] | 594 | vcm->cfg.vpp_bapi_socket_name = format (0, "%s%c", env_var_str, 0); |
Florin Coras | 9936831 | 2018-08-02 10:45:44 -0700 | [diff] [blame] | 595 | VCFG_DBG (0, "VCL<%d>: configured api-socket-name (%s)", getpid (), |
Florin Coras | b88de90 | 2020-09-08 16:47:57 -0700 | [diff] [blame] | 596 | vcl_cfg->vpp_bapi_socket_name); |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 597 | } |
Florin Coras | 165f3ae | 2020-11-08 18:04:33 -0800 | [diff] [blame] | 598 | env_var_str = getenv (VPPCOM_ENV_VPP_SAPI_SOCKET); |
| 599 | if (env_var_str) |
| 600 | { |
| 601 | vcm->cfg.vpp_app_socket_api = format (0, "%s%c", env_var_str, 0); |
| 602 | VCFG_DBG (0, "VCL<%d>: configured app-socket-api (%s)", getpid (), |
| 603 | vcl_cfg->vpp_app_socket_api); |
| 604 | } |
Filip Tehlar | 794599b | 2022-02-09 08:35:26 +0000 | [diff] [blame] | 605 | env_var_str = getenv (VPPCOM_ENV_APP_USE_MQ_EVENTFD); |
| 606 | if (env_var_str) |
| 607 | { |
| 608 | vcm->cfg.use_mq_eventfd = 1; |
| 609 | VCFG_DBG (0, "VCL<%d>: configured " VPPCOM_ENV_APP_USE_MQ_EVENTFD, |
| 610 | getpid ()); |
| 611 | } |
Florin Coras | 697faea | 2018-06-27 17:10:49 -0700 | [diff] [blame] | 612 | } |
| 613 | |
| 614 | /* |
| 615 | * fd.io coding-style-patch-verification: ON |
| 616 | * |
| 617 | * Local Variables: |
| 618 | * eval: (c-set-style "gnu") |
| 619 | * End: |
| 620 | */ |