2 * Copyright (c) 2018-2019 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #include <vcl/vcl_private.h>
17 #include <vlibmemory/api.h>
19 #include <vnet/format_fns.h>
20 #include <vnet/session/session.api_enum.h>
21 #include <vnet/session/session.api_types.h>
23 #define REPLY_MSG_ID_BASE msg_id_base
25 static u16 msg_id_base;
28 format_api_error (u8 * s, va_list * args)
30 i32 error = va_arg (*args, u32);
33 p = hash_get (vcm->error_string_by_error_number, -error);
36 s = format (s, "%s (%d)", p[0], error);
38 s = format (s, "%d", error);
43 vl_api_session_enable_disable_reply_t_handler
44 (vl_api_session_enable_disable_reply_t * mp)
46 vcl_worker_t *wrk = vcl_worker_get (0);
50 clib_warning ("VCL<%d>: session_enable_disable failed: %U", getpid (),
51 format_api_error, ntohl (mp->retval));
54 wrk->bapi_app_state = STATE_APP_ENABLED;
58 vl_api_app_attach_reply_t_handler (vl_api_app_attach_reply_t * mp)
60 vcl_worker_t *wrk = vcl_worker_get (0);
64 char *segment_name = 0;
68 VERR ("attach failed: %U", format_api_error, ntohl (mp->retval));
72 vcl_set_worker_index (0);
74 segment_handle = clib_net_to_host_u64 (mp->segment_handle);
75 if (segment_handle == VCL_INVALID_SEGMENT_HANDLE)
77 VERR ("invalid segment handle");
83 vec_validate (fds, mp->n_fds);
84 if (vl_socket_client_recv_fd_msg2 (&wrk->bapi_sock_ctx, fds, mp->n_fds,
88 if (mp->fd_flags & SESSION_FD_F_VPP_MQ_SEGMENT)
89 if (vcl_segment_attach (vcl_vpp_worker_segment_handle (0),
90 "vpp-mq-seg", SSVM_SEGMENT_MEMFD,
94 if (mp->fd_flags & SESSION_FD_F_MEMFD_SEGMENT)
96 segment_name = vl_api_from_api_to_new_c_string (&mp->segment_name);
98 vcl_segment_attach (segment_handle, segment_name,
99 SSVM_SEGMENT_MEMFD, fds[n_fds++]);
100 vec_free (segment_name);
105 vcl_segment_attach_mq (segment_handle, mp->app_mq, 0,
106 &wrk->app_event_queue);
108 if (mp->fd_flags & SESSION_FD_F_MQ_EVENTFD)
110 svm_msg_q_set_eventfd (wrk->app_event_queue, fds[n_fds]);
111 vcl_mq_epoll_add_evfd (wrk, wrk->app_event_queue);
115 vcl_segment_discover_mqs (vcl_vpp_worker_segment_handle (0), fds + n_fds,
117 vcl_segment_attach_mq (vcl_vpp_worker_segment_handle (0),
118 mp->vpp_ctrl_mq, mp->vpp_ctrl_mq_thread,
120 vcm->ctrl_mq = wrk->ctrl_mq;
126 segment_name = vl_api_from_api_to_new_c_string (&mp->segment_name);
128 vcl_segment_attach (segment_handle, segment_name, SSVM_SEGMENT_SHM,
130 vec_free (segment_name);
135 vcm->app_index = clib_net_to_host_u32 (mp->app_index);
136 wrk->bapi_app_state = STATE_APP_ATTACHED;
140 wrk->bapi_app_state = STATE_APP_FAILED;
141 for (i = clib_max (n_fds - 1, 0); i < vec_len (fds); i++)
147 vl_api_app_worker_add_del_reply_t_handler (vl_api_app_worker_add_del_reply_t *
150 int n_fds = 0, *fds = 0, i, rv;
154 char *segment_name = 0;
159 wrk_index = mp->context;
160 wrk = vcl_worker_get_if_valid (wrk_index);
166 clib_warning ("VCL<%d>: add/del worker failed: %U", getpid (),
167 format_api_error, ntohl (mp->retval));
171 vcl_set_worker_index (wrk_index);
172 wrk->vpp_wrk_index = clib_net_to_host_u32 (mp->wrk_index);
173 wrk->ctrl_mq = vcm->ctrl_mq;
175 segment_handle = clib_net_to_host_u64 (mp->segment_handle);
176 if (segment_handle == VCL_INVALID_SEGMENT_HANDLE)
178 clib_warning ("invalid segment handle");
184 vec_validate (fds, mp->n_fds);
185 if (vl_socket_client_recv_fd_msg2 (&wrk->bapi_sock_ctx, fds, mp->n_fds,
189 if (mp->fd_flags & SESSION_FD_F_VPP_MQ_SEGMENT)
190 if (vcl_segment_attach (vcl_vpp_worker_segment_handle (wrk_index),
191 "vpp-worker-seg", SSVM_SEGMENT_MEMFD,
195 if (mp->fd_flags & SESSION_FD_F_MEMFD_SEGMENT)
197 segment_name = vl_api_from_api_to_new_c_string (&mp->segment_name);
199 vcl_segment_attach (segment_handle, segment_name,
200 SSVM_SEGMENT_MEMFD, fds[n_fds++]);
201 vec_free (segment_name);
206 vcl_segment_attach_mq (segment_handle, mp->app_event_queue_address, 0,
207 &wrk->app_event_queue);
209 if (mp->fd_flags & SESSION_FD_F_MQ_EVENTFD)
211 svm_msg_q_set_eventfd (wrk->app_event_queue, fds[n_fds]);
212 vcl_mq_epoll_add_evfd (wrk, wrk->app_event_queue);
220 segment_name = vl_api_from_api_to_new_c_string (&mp->segment_name);
222 vcl_segment_attach (segment_handle, segment_name, SSVM_SEGMENT_SHM,
224 vec_free (segment_name);
228 wrk->bapi_app_state = STATE_APP_READY;
229 VDBG (0, "worker %u vpp-worker %u added", wrk_index, wrk->vpp_wrk_index);
233 wrk->bapi_app_state = STATE_APP_FAILED;
234 for (i = clib_max (n_fds - 1, 0); i < vec_len (fds); i++)
240 vl_api_app_add_cert_key_pair_reply_t_handler (
241 vl_api_app_add_cert_key_pair_reply_t *mp)
243 vcl_worker_t *wrk = vcl_worker_get_current ();
247 VDBG (0, "Adding cert and key failed: %U", format_api_error,
251 wrk->bapi_return = clib_net_to_host_u32 (mp->index);
252 wrk->bapi_app_state = STATE_APP_READY;
256 vl_api_app_del_cert_key_pair_reply_t_handler (
257 vl_api_app_del_cert_key_pair_reply_t *mp)
261 VDBG (0, "Deleting cert and key failed: %U", format_api_error,
267 #define foreach_sock_msg \
268 _ (SESSION_ENABLE_DISABLE_REPLY, session_enable_disable_reply) \
269 _ (APP_ATTACH_REPLY, app_attach_reply) \
270 _ (APP_ADD_CERT_KEY_PAIR_REPLY, app_add_cert_key_pair_reply) \
271 _ (APP_DEL_CERT_KEY_PAIR_REPLY, app_del_cert_key_pair_reply) \
272 _ (APP_WORKER_ADD_DEL_REPLY, app_worker_add_del_reply)
274 #define vl_endianfun /* define message structures */
275 #include <vnet/session/session.api.h>
278 #define vl_calcsizefun
279 #include <vnet/session/session.api.h>
280 #undef vl_calcsizefun
282 /* instantiate all the print functions we know about */
284 #include <vnet/session/session.api.h>
287 #define vl_api_version(n, v) static u32 api_version = v;
288 #include <vnet/session/session.api.h>
289 #undef vl_api_version
292 vcl_bapi_hookup (void)
294 u8 *msg_base_lookup_name = format (0, "session_%08x%c", api_version, 0);
297 vl_client_get_first_plugin_msg_id ((char *) msg_base_lookup_name);
299 vec_free (msg_base_lookup_name);
301 if (REPLY_MSG_ID_BASE == (u16) ~0)
305 vl_msg_api_config (&(vl_msg_api_msg_config_t){ \
306 .id = REPLY_MSG_ID_BASE + VL_API_##N, \
308 .handler = vl_api_##n##_t_handler, \
309 .endian = vl_api_##n##_t_endian, \
310 .format_fn = vl_api_##n##_t_format, \
311 .size = sizeof (vl_api_##n##_t), \
313 .tojson = vl_api_##n##_t_tojson, \
314 .fromjson = vl_api_##n##_t_fromjson, \
315 .calc_size = vl_api_##n##_t_calc_size, \
322 * VPP-API message functions
325 vcl_bapi_send_session_enable_disable (u8 is_enable)
327 vcl_worker_t *wrk = vcl_worker_get_current ();
328 vl_api_session_enable_disable_t *bmp;
329 bmp = vl_msg_api_alloc (sizeof (*bmp));
330 memset (bmp, 0, sizeof (*bmp));
332 bmp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_SESSION_ENABLE_DISABLE);
333 bmp->client_index = wrk->api_client_handle;
334 bmp->context = htonl (0xfeedface);
335 bmp->is_enable = is_enable;
336 vl_msg_api_send_shmem (wrk->vl_input_queue, (u8 *) & bmp);
340 vcl_bapi_send_attach (void)
342 vcl_worker_t *wrk = vcl_worker_get_current ();
343 u8 tls_engine = CRYPTO_ENGINE_OPENSSL;
344 vl_api_app_attach_t *bmp;
345 u8 nsid_len = vec_len (vcm->cfg.namespace_id);
346 u8 app_is_proxy = (vcm->cfg.app_proxy_transport_tcp ||
347 vcm->cfg.app_proxy_transport_udp);
349 tls_engine = vcm->cfg.tls_engine ? vcm->cfg.tls_engine : tls_engine;
351 bmp = vl_msg_api_alloc (sizeof (*bmp));
352 memset (bmp, 0, sizeof (*bmp));
354 bmp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_APP_ATTACH);
355 bmp->client_index = wrk->api_client_handle;
356 bmp->context = htonl (0xfeedface);
357 bmp->options[APP_OPTIONS_FLAGS] =
358 APP_OPTIONS_FLAGS_ACCEPT_REDIRECT | APP_OPTIONS_FLAGS_ADD_SEGMENT |
359 (vcm->cfg.app_scope_local ? APP_OPTIONS_FLAGS_USE_LOCAL_SCOPE : 0) |
360 (vcm->cfg.app_scope_global ? APP_OPTIONS_FLAGS_USE_GLOBAL_SCOPE : 0) |
361 (app_is_proxy ? APP_OPTIONS_FLAGS_IS_PROXY : 0) |
362 (vcm->cfg.use_mq_eventfd ? APP_OPTIONS_FLAGS_EVT_MQ_USE_EVENTFD : 0) |
363 (vcm->cfg.huge_page ? APP_OPTIONS_FLAGS_USE_HUGE_PAGE : 0) |
364 (vcm->cfg.app_original_dst ? APP_OPTIONS_FLAGS_GET_ORIGINAL_DST : 0);
365 bmp->options[APP_OPTIONS_PROXY_TRANSPORT] =
366 (u64) ((vcm->cfg.app_proxy_transport_tcp ? 1 << TRANSPORT_PROTO_TCP : 0) |
367 (vcm->cfg.app_proxy_transport_udp ? 1 << TRANSPORT_PROTO_UDP : 0));
368 bmp->options[APP_OPTIONS_SEGMENT_SIZE] = vcm->cfg.segment_size;
369 bmp->options[APP_OPTIONS_ADD_SEGMENT_SIZE] = vcm->cfg.add_segment_size;
370 bmp->options[APP_OPTIONS_RX_FIFO_SIZE] = vcm->cfg.rx_fifo_size;
371 bmp->options[APP_OPTIONS_TX_FIFO_SIZE] = vcm->cfg.tx_fifo_size;
372 bmp->options[APP_OPTIONS_PREALLOC_FIFO_PAIRS] =
373 vcm->cfg.preallocated_fifo_pairs;
374 bmp->options[APP_OPTIONS_EVT_QUEUE_SIZE] = vcm->cfg.event_queue_size;
375 bmp->options[APP_OPTIONS_TLS_ENGINE] = tls_engine;
378 vl_api_vec_to_api_string (vcm->cfg.namespace_id, &bmp->namespace_id);
379 bmp->options[APP_OPTIONS_NAMESPACE_SECRET] = vcm->cfg.namespace_secret;
381 vl_msg_api_send_shmem (wrk->vl_input_queue, (u8 *) & bmp);
385 vcl_bapi_send_detach (void)
387 vcl_worker_t *wrk = vcl_worker_get_current ();
388 vl_api_application_detach_t *bmp;
389 bmp = vl_msg_api_alloc (sizeof (*bmp));
390 memset (bmp, 0, sizeof (*bmp));
392 bmp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_APPLICATION_DETACH);
393 bmp->client_index = wrk->api_client_handle;
394 bmp->context = htonl (0xfeedface);
395 vl_msg_api_send_shmem (wrk->vl_input_queue, (u8 *) & bmp);
399 vcl_bapi_send_app_worker_add_del (u8 is_add)
401 vcl_worker_t *wrk = vcl_worker_get_current ();
402 vl_api_app_worker_add_del_t *mp;
404 mp = vl_msg_api_alloc (sizeof (*mp));
405 memset (mp, 0, sizeof (*mp));
407 mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_APP_WORKER_ADD_DEL);
408 mp->client_index = wrk->api_client_handle;
409 mp->app_index = clib_host_to_net_u32 (vcm->app_index);
410 mp->context = wrk->wrk_index;
413 mp->wrk_index = clib_host_to_net_u32 (wrk->vpp_wrk_index);
415 vl_msg_api_send_shmem (wrk->vl_input_queue, (u8 *) & mp);
419 vcl_bapi_send_child_worker_del (vcl_worker_t * child_wrk)
421 vcl_worker_t *wrk = vcl_worker_get_current ();
422 vl_api_app_worker_add_del_t *mp;
424 mp = vl_msg_api_alloc (sizeof (*mp));
425 memset (mp, 0, sizeof (*mp));
427 mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_APP_WORKER_ADD_DEL);
428 mp->client_index = wrk->api_client_handle;
429 mp->app_index = clib_host_to_net_u32 (vcm->app_index);
430 mp->context = wrk->wrk_index;
432 mp->wrk_index = clib_host_to_net_u32 (child_wrk->vpp_wrk_index);
434 vl_msg_api_send_shmem (wrk->vl_input_queue, (u8 *) & mp);
438 vcl_bapi_send_app_add_cert_key_pair (vppcom_cert_key_pair_t *ckpair)
440 vcl_worker_t *wrk = vcl_worker_get_current ();
441 u32 cert_len = ckpair->cert_len;
442 u32 key_len = ckpair->key_len;
443 vl_api_app_add_cert_key_pair_t *bmp;
445 bmp = vl_msg_api_alloc (sizeof (*bmp) + cert_len + key_len);
446 clib_memset (bmp, 0, sizeof (*bmp) + cert_len + key_len);
448 bmp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_APP_ADD_CERT_KEY_PAIR);
449 bmp->client_index = wrk->api_client_handle;
450 bmp->context = wrk->wrk_index;
451 bmp->cert_len = clib_host_to_net_u16 (cert_len);
452 bmp->certkey_len = clib_host_to_net_u16 (key_len + cert_len);
453 clib_memcpy_fast (bmp->certkey, ckpair->cert, cert_len);
454 clib_memcpy_fast (bmp->certkey + cert_len, ckpair->key, key_len);
456 vl_msg_api_send_shmem (wrk->vl_input_queue, (u8 *) &bmp);
460 vcl_bapi_send_app_del_cert_key_pair (u32 ckpair_index)
462 vcl_worker_t *wrk = vcl_worker_get_current ();
463 vl_api_app_del_cert_key_pair_t *bmp;
464 bmp = vl_msg_api_alloc (sizeof (*bmp));
465 clib_memset (bmp, 0, sizeof (*bmp));
467 bmp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_APP_DEL_CERT_KEY_PAIR);
468 bmp->client_index = wrk->api_client_handle;
469 bmp->context = wrk->wrk_index;
470 bmp->index = clib_host_to_net_u32 (ckpair_index);
471 vl_msg_api_send_shmem (wrk->vl_input_queue, (u8 *) &bmp);
475 vcl_bapi_max_nsid_len (void)
477 vl_api_app_attach_t *mp;
478 return (sizeof (mp->namespace_id) - 1);
482 vcl_bapi_init_error_string_table (void)
484 vcm->error_string_by_error_number = hash_create (0, sizeof (uword));
486 #define _(n, v, s) hash_set (vcm->error_string_by_error_number, -v, s);
487 foreach_vnet_api_error;
490 hash_set (vcm->error_string_by_error_number, 99, "Misc");
494 vcl_bapi_cleanup (void)
496 socket_client_main_t *scm = &socket_client_main;
497 api_main_t *am = vlibapi_get_main ();
499 am->my_client_index = ~0;
500 am->my_registration = 0;
501 am->vl_input_queue = 0;
502 am->msg_index_by_name_and_crc = 0;
505 vl_client_api_unmap ();
509 vcl_bapi_connect_to_vpp (void)
511 vcl_worker_t *wrk = vcl_worker_get_current ();
512 vppcom_cfg_t *vcl_cfg = &vcm->cfg;
517 wrk_name = format (0, "%v-wrk-%u%c", vcm->app_name, wrk->wrk_index, 0);
519 /* Make sure api is cleaned up in case this is a connect from a
523 vlibapi_set_main (&wrk->bapi_api_ctx);
524 vlibapi_set_memory_client_main (&wrk->bapi_mem_ctx);
526 if (!vcl_cfg->vpp_bapi_socket_name)
532 if (vl_socket_client_connect2 (&wrk->bapi_sock_ctx,
533 (char *) vcl_cfg->vpp_bapi_socket_name,
535 0 /* default rx/tx buffer */ ))
537 VERR ("app (%s) socket connect failed!", wrk_name);
538 rv = VPPCOM_ECONNREFUSED;
542 if (vl_socket_client_init_shm2 (&wrk->bapi_sock_ctx, 0,
543 1 /* want_pthread */ ))
545 VERR ("app (%s) init shm failed!", wrk_name);
546 rv = VPPCOM_ECONNREFUSED;
551 am = vlibapi_get_main ();
552 wrk->vl_input_queue = am->shmem_hdr->vl_input_queue;
553 wrk->api_client_handle = (u32) am->my_client_index;
555 VDBG (0, "app (%s) is connected to VPP!", wrk_name);
556 vcl_evt (VCL_EVT_INIT, vcm);
564 vcl_bapi_disconnect_from_vpp (void)
566 vcl_worker_t *wrk = vcl_worker_get_current ();
567 vppcom_cfg_t *vcl_cfg = &vcm->cfg;
569 if (vcl_cfg->vpp_bapi_socket_name)
570 vl_socket_client_disconnect2 (&wrk->bapi_sock_ctx);
572 vl_client_disconnect_from_vlib ();
576 vcl_bapi_app_state_str (vcl_bapi_app_state_t state)
582 case STATE_APP_START:
583 st = "STATE_APP_START";
586 case STATE_APP_CONN_VPP:
587 st = "STATE_APP_CONN_VPP";
590 case STATE_APP_ENABLED:
591 st = "STATE_APP_ENABLED";
594 case STATE_APP_ATTACHED:
595 st = "STATE_APP_ATTACHED";
599 st = "UNKNOWN_APP_STATE";
607 vcl_bapi_wait_for_wrk_state_change (vcl_bapi_app_state_t app_state)
609 vcl_worker_t *wrk = vcl_worker_get_current ();
610 f64 timeout = clib_time_now (&wrk->clib_time) + vcm->cfg.app_timeout;
612 while (clib_time_now (&wrk->clib_time) < timeout)
614 if (wrk->bapi_app_state == app_state)
616 if (wrk->bapi_app_state == STATE_APP_FAILED)
617 return VPPCOM_ECONNABORTED;
619 VDBG (0, "timeout waiting for state %s, current state %d",
620 vcl_bapi_app_state_str (app_state), wrk->bapi_app_state);
621 vcl_evt (VCL_EVT_SESSION_TIMEOUT, vcm, bapi_app_state);
623 return VPPCOM_ETIMEDOUT;
627 vcl_bapi_session_enable (void)
629 vcl_worker_t *wrk = vcl_worker_get_current ();
632 if (wrk->bapi_app_state != STATE_APP_ENABLED)
634 vcl_bapi_send_session_enable_disable (1 /* is_enabled == TRUE */ );
635 rv = vcl_bapi_wait_for_wrk_state_change (STATE_APP_ENABLED);
636 if (PREDICT_FALSE (rv))
638 VDBG (0, "application session enable timed out! returning %d (%s)",
639 rv, vppcom_retval_str (rv));
649 vcl_worker_t *wrk = vcl_worker_get_current ();
652 wrk->bapi_app_state = STATE_APP_START;
653 vcl_bapi_init_error_string_table ();
654 rv = vcl_bapi_connect_to_vpp ();
657 VERR ("couldn't connect to VPP!");
660 VDBG (0, "sending session enable");
661 rv = vcl_bapi_session_enable ();
664 VERR ("vppcom_app_session_enable() failed!");
672 vcl_bapi_attach (void)
676 /* API hookup and connect to VPP */
677 if ((rv = vcl_bapi_init ()))
680 vcl_bapi_send_attach ();
681 rv = vcl_bapi_wait_for_wrk_state_change (STATE_APP_ATTACHED);
682 if (PREDICT_FALSE (rv))
684 VDBG (0, "application attach timed out! returning %d (%s)", rv,
685 vppcom_retval_str (rv));
693 vcl_bapi_app_worker_add (void)
695 vcl_worker_t *wrk = vcl_worker_get_current ();
697 if (vcl_bapi_connect_to_vpp ())
700 wrk->bapi_app_state = STATE_APP_ADDING_WORKER;
701 vcl_bapi_send_app_worker_add_del (1 /* is_add */ );
702 if (vcl_bapi_wait_for_wrk_state_change (STATE_APP_READY))
708 vcl_bapi_app_worker_del (vcl_worker_t * wrk)
710 /* Notify vpp that the worker is going away */
711 if (wrk->wrk_index == vcl_get_worker_index ())
712 vcl_bapi_send_app_worker_add_del (0 /* is_add */ );
714 vcl_bapi_send_child_worker_del (wrk);
716 /* Disconnect the binary api */
717 if (vec_len (vcm->workers) == 1)
718 vcl_bapi_disconnect_from_vpp ();
720 vl_client_send_disconnect (1 /* vpp should cleanup */ );
724 vcl_bapi_recv_fds (vcl_worker_t * wrk, int *fds, int n_fds)
728 if ((err = vl_socket_client_recv_fd_msg2 (&wrk->bapi_sock_ctx, fds, n_fds,
731 clib_error_report (err);
739 vcl_bapi_add_cert_key_pair (vppcom_cert_key_pair_t *ckpair)
741 vcl_worker_t *wrk = vcl_worker_get_current ();
743 if (ckpair->key_len == 0 || ckpair->key_len == ~0)
744 return VPPCOM_EINVAL;
746 vcl_bapi_send_app_add_cert_key_pair (ckpair);
747 wrk->bapi_app_state = STATE_APP_ADDING_TLS_DATA;
748 vcl_bapi_wait_for_wrk_state_change (STATE_APP_READY);
749 if (wrk->bapi_app_state == STATE_APP_READY)
750 return wrk->bapi_return;
751 return VPPCOM_EFAULT;
755 vcl_bapi_del_cert_key_pair (u32 ckpair_index)
757 /* Don't wait for reply */
758 vcl_bapi_send_app_del_cert_key_pair (ckpair_index);
763 vcl_bapi_worker_set (void)
765 vcl_worker_t *wrk = vcl_worker_get_current ();
768 /* Find the first worker with the same pid */
769 for (i = 0; i < vec_len (vcm->workers); i++)
771 if (i == wrk->wrk_index)
773 if (vcm->workers[i].current_pid == wrk->current_pid)
775 wrk->vl_input_queue = vcm->workers[i].vl_input_queue;
776 wrk->api_client_handle = vcm->workers[i].api_client_handle;
784 * fd.io coding-style-patch-verification: ON
787 * eval: (c-set-style "gnu")