Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 1 | /* |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 2 | * vlib_api.c VLIB API implementation |
| 3 | * |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 4 | * Copyright (c) 2021 Cisco and/or its affiliates. |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at: |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 16 | */ |
| 17 | |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 18 | #include <vlibapi/api.h> |
| 19 | #include <vlibmemory/api.h> |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 20 | #include <vnet/api_errno.h> |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 21 | |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 22 | #include <vlibmemory/vlib.api_enum.h> |
| 23 | #include <vlibmemory/vlib.api_types.h> |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 24 | |
Ole Troan | 3459ece | 2021-09-27 17:11:34 +0200 | [diff] [blame] | 25 | static u16 msg_id_base; |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 26 | #define REPLY_MSG_ID_BASE msg_id_base |
| 27 | #include <vlibapi/api_helper_macros.h> |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 28 | |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 29 | static void |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 30 | shmem_cli_output (uword arg, u8 *buffer, uword buffer_bytes) |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 31 | { |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 32 | u8 **shmem_vecp = (u8 **) arg; |
| 33 | u8 *shmem_vec; |
| 34 | void *oldheap; |
| 35 | u32 offset; |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 36 | |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 37 | shmem_vec = *shmem_vecp; |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 38 | |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 39 | offset = vec_len (shmem_vec); |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 40 | |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 41 | oldheap = vl_msg_push_heap (); |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 42 | |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 43 | vec_validate (shmem_vec, offset + buffer_bytes - 1); |
| 44 | |
| 45 | clib_memcpy (shmem_vec + offset, buffer, buffer_bytes); |
| 46 | |
| 47 | vl_msg_pop_heap (oldheap); |
| 48 | |
| 49 | *shmem_vecp = shmem_vec; |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 50 | } |
| 51 | |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 52 | static void |
| 53 | vl_api_cli_t_handler (vl_api_cli_t *mp) |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 54 | { |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 55 | vl_api_cli_reply_t *rp; |
Florin Coras | 6c4dae2 | 2018-01-09 06:39:23 -0800 | [diff] [blame] | 56 | vl_api_registration_t *reg; |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 57 | vlib_main_t *vm = vlib_get_main (); |
| 58 | unformat_input_t input; |
| 59 | u8 *shmem_vec = 0; |
| 60 | void *oldheap; |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 61 | |
Florin Coras | 6c4dae2 | 2018-01-09 06:39:23 -0800 | [diff] [blame] | 62 | reg = vl_api_client_index_to_registration (mp->client_index); |
| 63 | if (!reg) |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 64 | return; |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 65 | ; |
| 66 | |
| 67 | rp = vl_msg_api_alloc (sizeof (*rp)); |
| 68 | rp->_vl_msg_id = ntohs (VL_API_CLI_REPLY + REPLY_MSG_ID_BASE); |
| 69 | rp->context = mp->context; |
| 70 | |
| 71 | unformat_init_vector (&input, (u8 *) (uword) mp->cmd_in_shmem); |
| 72 | |
| 73 | vlib_cli_input (vm, &input, shmem_cli_output, (uword) &shmem_vec); |
| 74 | |
| 75 | oldheap = vl_msg_push_heap (); |
| 76 | vec_add1 (shmem_vec, 0); |
| 77 | vl_msg_pop_heap (oldheap); |
| 78 | |
| 79 | rp->reply_in_shmem = (uword) shmem_vec; |
| 80 | |
| 81 | vl_api_send_msg (reg, (u8 *) rp); |
| 82 | } |
| 83 | |
| 84 | static void |
| 85 | inband_cli_output (uword arg, u8 *buffer, uword buffer_bytes) |
| 86 | { |
| 87 | u8 **mem_vecp = (u8 **) arg; |
| 88 | u8 *mem_vec = *mem_vecp; |
| 89 | u32 offset = vec_len (mem_vec); |
| 90 | |
| 91 | vec_validate (mem_vec, offset + buffer_bytes - 1); |
| 92 | clib_memcpy (mem_vec + offset, buffer, buffer_bytes); |
| 93 | *mem_vecp = mem_vec; |
| 94 | } |
| 95 | |
| 96 | static void |
| 97 | vl_api_cli_inband_t_handler (vl_api_cli_inband_t *mp) |
| 98 | { |
| 99 | vl_api_cli_inband_reply_t *rmp; |
| 100 | int rv = 0; |
| 101 | vlib_main_t *vm = vlib_get_main (); |
| 102 | unformat_input_t input; |
| 103 | u8 *out_vec = 0; |
| 104 | u8 *cmd_vec = 0; |
| 105 | |
| 106 | if (vl_msg_api_get_msg_length (mp) < |
| 107 | vl_api_string_len (&mp->cmd) + sizeof (*mp)) |
| 108 | { |
| 109 | rv = -1; |
| 110 | goto error; |
| 111 | } |
| 112 | |
| 113 | cmd_vec = vl_api_from_api_to_new_vec (mp, &mp->cmd); |
| 114 | |
| 115 | unformat_init_string (&input, (char *) cmd_vec, |
| 116 | vl_api_string_len (&mp->cmd)); |
| 117 | rv = vlib_cli_input (vm, &input, inband_cli_output, (uword) &out_vec); |
| 118 | unformat_free (&input); |
| 119 | |
| 120 | error: |
| 121 | REPLY_MACRO3 (VL_API_CLI_INBAND_REPLY, vec_len (out_vec), |
| 122 | ({ vl_api_vec_to_api_string (out_vec, &rmp->reply); })); |
| 123 | vec_free (out_vec); |
| 124 | vec_free (cmd_vec); |
| 125 | } |
| 126 | |
| 127 | static void |
| 128 | vl_api_get_node_index_t_handler (vl_api_get_node_index_t *mp) |
| 129 | { |
| 130 | vlib_main_t *vm = vlib_get_main (); |
| 131 | vl_api_get_node_index_reply_t *rmp; |
| 132 | vlib_node_t *n; |
| 133 | int rv = 0; |
| 134 | u32 node_index = ~0; |
| 135 | |
| 136 | n = vlib_get_node_by_name (vm, mp->node_name); |
| 137 | |
| 138 | if (n == 0) |
| 139 | rv = VNET_API_ERROR_NO_SUCH_NODE; |
| 140 | else |
| 141 | node_index = n->index; |
| 142 | |
| 143 | REPLY_MACRO2 (VL_API_GET_NODE_INDEX_REPLY, |
| 144 | ({ rmp->node_index = htonl (node_index); })); |
| 145 | } |
| 146 | |
| 147 | static void |
| 148 | vl_api_add_node_next_t_handler (vl_api_add_node_next_t *mp) |
| 149 | { |
| 150 | vlib_main_t *vm = vlib_get_main (); |
| 151 | vl_api_add_node_next_reply_t *rmp; |
| 152 | vlib_node_t *n, *next; |
| 153 | int rv = 0; |
| 154 | u32 next_index = ~0; |
| 155 | |
| 156 | n = vlib_get_node_by_name (vm, mp->node_name); |
| 157 | |
| 158 | if (n == 0) |
| 159 | { |
| 160 | rv = VNET_API_ERROR_NO_SUCH_NODE; |
| 161 | goto out; |
| 162 | } |
| 163 | |
| 164 | next = vlib_get_node_by_name (vm, mp->next_name); |
| 165 | |
| 166 | if (next == 0) |
| 167 | rv = VNET_API_ERROR_NO_SUCH_NODE2; |
| 168 | else |
| 169 | next_index = vlib_node_add_next (vm, n->index, next->index); |
| 170 | |
| 171 | out: |
| 172 | REPLY_MACRO2 (VL_API_ADD_NODE_NEXT_REPLY, |
| 173 | ({ rmp->next_index = htonl (next_index); })); |
| 174 | } |
| 175 | |
| 176 | static void |
| 177 | get_thread_data (vl_api_thread_data_t *td, int index) |
| 178 | { |
| 179 | vlib_worker_thread_t *w = vlib_worker_threads + index; |
| 180 | td->id = htonl (index); |
| 181 | if (w->name) |
| 182 | strncpy ((char *) td->name, (char *) w->name, ARRAY_LEN (td->name) - 1); |
| 183 | if (w->registration) |
| 184 | strncpy ((char *) td->type, (char *) w->registration->name, |
| 185 | ARRAY_LEN (td->type) - 1); |
| 186 | td->pid = htonl (w->lwp); |
| 187 | td->cpu_id = htonl (w->cpu_id); |
| 188 | td->core = htonl (w->core_id); |
| 189 | td->cpu_socket = htonl (w->numa_id); |
| 190 | } |
| 191 | |
| 192 | static void |
| 193 | vl_api_show_threads_t_handler (vl_api_show_threads_t *mp) |
| 194 | { |
| 195 | int count = 0; |
| 196 | |
| 197 | #if !defined(__powerpc64__) |
| 198 | vl_api_registration_t *reg; |
| 199 | vl_api_show_threads_reply_t *rmp; |
| 200 | vl_api_thread_data_t *td; |
| 201 | int i, msg_size = 0; |
| 202 | count = vec_len (vlib_worker_threads); |
| 203 | if (!count) |
| 204 | return; |
| 205 | |
| 206 | msg_size = sizeof (*rmp) + sizeof (rmp->thread_data[0]) * count; |
| 207 | reg = vl_api_client_index_to_registration (mp->client_index); |
| 208 | if (!reg) |
| 209 | return; |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 210 | |
| 211 | rmp = vl_msg_api_alloc (msg_size); |
Dave Barach | b7b9299 | 2018-10-17 10:38:51 -0400 | [diff] [blame] | 212 | clib_memset (rmp, 0, msg_size); |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 213 | rmp->_vl_msg_id = htons (VL_API_SHOW_THREADS_REPLY + REPLY_MSG_ID_BASE); |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 214 | rmp->context = mp->context; |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 215 | rmp->count = htonl (count); |
| 216 | td = rmp->thread_data; |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 217 | |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 218 | for (i = 0; i < count; i++) |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 219 | { |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 220 | get_thread_data (&td[i], i); |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 221 | } |
| 222 | |
Florin Coras | 6c4dae2 | 2018-01-09 06:39:23 -0800 | [diff] [blame] | 223 | vl_api_send_msg (reg, (u8 *) rmp); |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 224 | #else |
| 225 | |
| 226 | /* unimplemented support */ |
| 227 | rv = -9; |
| 228 | clib_warning ("power pc does not support show threads api"); |
| 229 | REPLY_MACRO2 (VL_API_SHOW_THREADS_REPLY, ({ rmp->count = htonl (count); })); |
| 230 | #endif |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 231 | } |
| 232 | |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 233 | static void |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 234 | vl_api_get_node_graph_t_handler (vl_api_get_node_graph_t *mp) |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 235 | { |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 236 | int rv = 0; |
| 237 | u8 *vector = 0; |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 238 | vlib_main_t *vm = vlib_get_main (); |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 239 | void *oldheap; |
| 240 | vl_api_get_node_graph_reply_t *rmp; |
| 241 | static vlib_node_t ***node_dups; |
| 242 | static vlib_main_t **stat_vms; |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 243 | |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 244 | oldheap = vl_msg_push_heap (); |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 245 | |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 246 | /* |
| 247 | * Keep the number of memcpy ops to a minimum (e.g. 1). |
| 248 | */ |
| 249 | vec_validate (vector, 16384); |
| 250 | vec_reset_length (vector); |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 251 | |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 252 | vlib_node_get_nodes (vm, 0 /* main threads */, 0 /* include stats */, |
| 253 | 1 /* barrier sync */, &node_dups, &stat_vms); |
| 254 | vector = vlib_node_serialize (vm, node_dups, vector, 1 /* include nexts */, |
| 255 | 1 /* include stats */); |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 256 | |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 257 | vl_msg_pop_heap (oldheap); |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 258 | |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 259 | REPLY_MACRO2 (VL_API_GET_NODE_GRAPH_REPLY, |
| 260 | ({ rmp->reply_in_shmem = (uword) vector; })); |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 261 | } |
| 262 | |
| 263 | static void |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 264 | vl_api_get_next_index_t_handler (vl_api_get_next_index_t *mp) |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 265 | { |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 266 | vlib_main_t *vm = vlib_get_main (); |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 267 | vl_api_get_next_index_reply_t *rmp; |
| 268 | vlib_node_t *node, *next_node; |
| 269 | int rv = 0; |
| 270 | u32 next_node_index = ~0, next_index = ~0; |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 271 | uword *p; |
| 272 | |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 273 | node = vlib_get_node_by_name (vm, mp->node_name); |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 274 | |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 275 | if (node == 0) |
| 276 | { |
| 277 | rv = VNET_API_ERROR_NO_SUCH_NODE; |
| 278 | goto out; |
| 279 | } |
| 280 | |
| 281 | next_node = vlib_get_node_by_name (vm, mp->next_name); |
| 282 | |
| 283 | if (next_node == 0) |
| 284 | { |
| 285 | rv = VNET_API_ERROR_NO_SUCH_NODE2; |
| 286 | goto out; |
| 287 | } |
| 288 | else |
| 289 | next_node_index = next_node->index; |
| 290 | |
| 291 | p = hash_get (node->next_slot_by_node, next_node_index); |
| 292 | |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 293 | if (p == 0) |
| 294 | { |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 295 | rv = VNET_API_ERROR_NO_SUCH_ENTRY; |
| 296 | goto out; |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 297 | } |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 298 | else |
| 299 | next_index = p[0]; |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 300 | |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 301 | out: |
| 302 | REPLY_MACRO2 (VL_API_GET_NEXT_INDEX_REPLY, |
| 303 | ({ rmp->next_index = htonl (next_index); })); |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 304 | } |
| 305 | |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 306 | static void |
| 307 | vl_api_get_f64_endian_value_t_handler (vl_api_get_f64_endian_value_t *mp) |
| 308 | { |
| 309 | int rv = 0; |
| 310 | f64 one = 1.0; |
| 311 | vl_api_get_f64_endian_value_reply_t *rmp; |
| 312 | if (1.0 != clib_net_to_host_f64 (mp->f64_one)) |
| 313 | rv = VNET_API_ERROR_API_ENDIAN_FAILED; |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 314 | |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 315 | REPLY_MACRO2 (VL_API_GET_F64_ENDIAN_VALUE_REPLY, |
| 316 | ({ rmp->f64_one_result = clib_host_to_net_f64 (one); })); |
| 317 | } |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 318 | |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 319 | static void |
| 320 | vl_api_get_f64_increment_by_one_t_handler ( |
| 321 | vl_api_get_f64_increment_by_one_t *mp) |
| 322 | { |
| 323 | int rv = 0; |
| 324 | vl_api_get_f64_increment_by_one_reply_t *rmp; |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 325 | |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 326 | REPLY_MACRO2 (VL_API_GET_F64_INCREMENT_BY_ONE_REPLY, ({ |
| 327 | rmp->f64_value = clib_host_to_net_f64 ( |
| 328 | clib_net_to_host_f64 (mp->f64_value) + 1.0); |
| 329 | })); |
| 330 | } |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 331 | |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 332 | #include <vlibmemory/vlib.api.c> |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 333 | static clib_error_t * |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 334 | vlib_apis_hookup (vlib_main_t *vm) |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 335 | { |
Dave Barach | 39d6911 | 2019-11-27 11:42:13 -0500 | [diff] [blame] | 336 | api_main_t *am = vlibapi_get_main (); |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 337 | |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 338 | /* |
| 339 | * Set up the (msg_name, crc, message-id) table |
| 340 | */ |
| 341 | msg_id_base = setup_message_id_table (); |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 342 | |
Vladislav Grishenko | e7c57c4 | 2023-03-19 02:57:01 +0500 | [diff] [blame] | 343 | /* Mark messages as mp safe */ |
| 344 | vl_api_set_msg_thread_safe (am, msg_id_base + VL_API_GET_NODE_GRAPH, 1); |
| 345 | vl_api_set_msg_thread_safe (am, msg_id_base + VL_API_SHOW_THREADS, 1); |
| 346 | |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 347 | return 0; |
| 348 | } |
| 349 | |
Florin Coras | 248210c | 2021-09-14 18:54:45 -0700 | [diff] [blame] | 350 | VLIB_API_INIT_FUNCTION (vlib_apis_hookup); |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 351 | |
| 352 | /* |
| 353 | * fd.io coding-style-patch-verification: ON |
| 354 | * |
| 355 | * Local Variables: |
| 356 | * eval: (c-set-style "gnu") |
| 357 | * End: |
| 358 | */ |