2 * Copyright (c) 2016 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with 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.
19 #include <vppinfra/clib.h>
20 #include <vppinfra/format.h>
21 #include <vppinfra/error.h>
22 #include <vppinfra/time.h>
23 #include <vppinfra/macros.h>
24 #include <vnet/vnet.h>
25 #include <vlib/vlib.h>
26 #include <vlib/unix/unix.h>
27 #include <vlibapi/api.h>
28 #include <vlibmemory/api.h>
29 #include <vpp/api/vpe_msg_enum.h>
30 #include <svm/svm_fifo_segment.h>
33 #include "../vnet/session/application_interface.h"
35 #define vl_typedefs /* define message structures */
36 #include <vpp/api/vpe_all_api_h.h>
39 /* declare message handlers for each api */
41 #define vl_endianfun /* define message structures */
42 #include <vpp/api/vpe_all_api_h.h>
45 /* instantiate all the print functions we know about */
46 #define vl_print(handle, ...)
48 #include <vpp/api/vpe_all_api_h.h>
51 /* Satisfy external references when not linking with -lvlib */
52 vlib_main_t vlib_global_main;
53 vlib_main_t **vlib_mains;
64 svm_fifo_t *server_rx_fifo;
65 svm_fifo_t *server_tx_fifo;
71 unix_shared_memory_queue_t *vl_input_queue;
73 /* API client handle */
76 /* The URI we're playing with */
82 /* Hash table for disconnect processing */
83 uword *session_index_by_vpp_handles;
86 svm_fifo_segment_private_t *seg;
88 /* intermediate rx buffer */
97 unix_shared_memory_queue_t *our_event_queue;
99 /* $$$ single thread only for the moment */
100 unix_shared_memory_queue_t *vpp_event_queue;
102 /* $$$$ hack: cut-through session index */
103 volatile u32 cut_through_session_index;
105 /* unique segment name counter */
106 u32 unique_segment_index;
111 pthread_t cut_through_thread_handle;
113 /* For deadman timers */
114 clib_time_t clib_time;
116 /* State of the connection, shared between msg RX thread and main thread */
117 volatile connection_state_t state;
119 volatile int time_to_stop;
120 volatile int time_to_print_stats;
122 u32 configured_segment_size;
124 /* VNET_API_ERROR_FOO -> "Foo" hash table */
125 uword *error_string_by_error_number;
128 svm_fifo_segment_main_t *segment_main;
130 } uri_udp_test_main_t;
135 #define NITER 4000000
138 uri_udp_test_main_t uri_udp_test_main;
141 stop_signal (int signum)
143 uri_udp_test_main_t *um = &uri_udp_test_main;
145 um->time_to_stop = 1;
149 stats_signal (int signum)
151 uri_udp_test_main_t *um = &uri_udp_test_main;
153 um->time_to_print_stats = 1;
156 static clib_error_t *
157 setup_signal_handlers (void)
159 signal (SIGINT, stats_signal);
160 signal (SIGQUIT, stop_signal);
161 signal (SIGTERM, stop_signal);
167 format_api_error (u8 * s, va_list * args)
169 uri_udp_test_main_t *utm = va_arg (*args, uri_udp_test_main_t *);
170 i32 error = va_arg (*args, u32);
173 p = hash_get (utm->error_string_by_error_number, -error);
176 s = format (s, "%s", p[0]);
178 s = format (s, "%d", error);
183 wait_for_state_change (uri_udp_test_main_t * utm, connection_state_t state)
186 #define TIMEOUT 600.0
188 #define TIMEOUT 600.0
191 f64 timeout = clib_time_now (&utm->clib_time) + TIMEOUT;
193 while (clib_time_now (&utm->clib_time) < timeout)
195 if (utm->state == state)
201 u64 server_bytes_received, server_bytes_sent;
204 cut_through_thread_fn (void *arg)
209 u8 *my_copy_buffer = 0;
210 uri_udp_test_main_t *utm = &uri_udp_test_main;
215 while (utm->cut_through_session_index == ~0)
218 s = pool_elt_at_index (utm->sessions, utm->cut_through_session_index);
220 rx_fifo = s->server_rx_fifo;
221 tx_fifo = s->server_tx_fifo;
223 vec_validate (my_copy_buffer, 64 * 1024 - 1);
227 /* We read from the tx fifo and write to the rx fifo */
230 actual_transfer = svm_fifo_dequeue_nowait (tx_fifo, 0,
231 vec_len (my_copy_buffer),
234 while (actual_transfer <= 0);
236 server_bytes_received += actual_transfer;
239 while (actual_transfer > 0)
241 rv = svm_fifo_enqueue_nowait (rx_fifo, 0, actual_transfer,
242 my_copy_buffer + buffer_offset);
245 actual_transfer -= rv;
247 server_bytes_sent += rv;
251 if (PREDICT_FALSE (utm->time_to_stop))
259 uri_udp_slave_test (uri_udp_test_main_t * utm)
261 vl_api_connect_uri_t *cmp;
264 u64 bytes_received = 0, bytes_sent = 0;
267 int mypid = getpid ();
268 f64 before, after, delta, bytes_per_second;
270 svm_fifo_t *rx_fifo, *tx_fifo;
271 int buffer_offset, bytes_to_send = 0;
273 vec_validate (test_data, 64 * 1024 - 1);
274 for (i = 0; i < vec_len (test_data); i++)
275 test_data[i] = i & 0xff;
277 cmp = vl_msg_api_alloc (sizeof (*cmp));
278 memset (cmp, 0, sizeof (*cmp));
280 cmp->_vl_msg_id = ntohs (VL_API_CONNECT_URI);
281 cmp->client_index = utm->my_client_index;
282 cmp->context = ntohl (0xfeedface);
283 memcpy (cmp->uri, utm->connect_uri, vec_len (utm->connect_uri));
284 vl_msg_api_send_shmem (utm->vl_input_queue, (u8 *) & cmp);
286 if (wait_for_state_change (utm, STATE_READY))
288 clib_warning ("timeout waiting for STATE_READY");
292 session = pool_elt_at_index (utm->sessions, utm->cut_through_session_index);
293 rx_fifo = session->server_rx_fifo;
294 tx_fifo = session->server_tx_fifo;
296 before = clib_time_now (&utm->clib_time);
298 vec_validate (utm->rx_buf, vec_len (test_data) - 1);
300 for (i = 0; i < NITER; i++)
302 bytes_to_send = vec_len (test_data);
304 while (bytes_to_send > 0)
306 rv = svm_fifo_enqueue_nowait (tx_fifo, mypid,
308 test_data + buffer_offset);
318 bytes_to_read = svm_fifo_max_dequeue (rx_fifo);
320 bytes_to_read = vec_len (utm->rx_buf) > bytes_to_read ?
321 bytes_to_read : vec_len (utm->rx_buf);
324 while (bytes_to_read > 0)
326 rv = svm_fifo_dequeue_nowait (rx_fifo, mypid,
328 utm->rx_buf + buffer_offset);
333 bytes_received += rv;
337 while (bytes_received < bytes_sent)
339 rv = svm_fifo_dequeue_nowait (rx_fifo, mypid,
340 vec_len (utm->rx_buf), utm->rx_buf);
345 for (j = 0; j < rv; j++)
347 if (utm->rx_buf[j] != ((bytes_received + j) & 0xff))
349 clib_warning ("error at byte %lld, 0x%x not 0x%x",
352 ((bytes_received + j) & 0xff));
356 bytes_received += (u64) rv;
360 after = clib_time_now (&utm->clib_time);
361 delta = after - before;
362 bytes_per_second = 0.0;
365 bytes_per_second = (f64) bytes_received / delta;
368 "Done: %lld recv bytes in %.2f seconds, %.2f bytes/sec...\n\n",
369 bytes_received, delta, bytes_per_second);
371 "Done: %lld sent bytes in %.2f seconds, %.2f bytes/sec...\n\n",
372 bytes_sent, delta, bytes_per_second);
374 "client -> server -> client round trip: %.2f Gbit/sec \n\n",
375 (bytes_per_second * 8.0) / 1e9);
379 vl_api_bind_uri_reply_t_handler (vl_api_bind_uri_reply_t * mp)
381 uri_udp_test_main_t *utm = &uri_udp_test_main;
382 svm_fifo_segment_create_args_t _a, *a = &_a;
385 if (mp->segment_name_length == 0)
387 clib_warning ("segment_name_length zero");
391 a->segment_name = (char *) mp->segment_name;
392 a->segment_size = mp->segment_size;
394 ASSERT (mp->server_event_queue_address);
396 /* Attach to the segment vpp created */
397 rv = svm_fifo_segment_attach (a);
400 clib_warning ("svm_fifo_segment_attach ('%s') failed",
405 utm->our_event_queue = (unix_shared_memory_queue_t *)
406 mp->server_event_queue_address;
408 utm->state = STATE_READY;
412 vl_api_map_another_segment_t_handler (vl_api_map_another_segment_t * mp)
414 svm_fifo_segment_create_args_t _a, *a = &_a;
417 a->segment_name = (char *) mp->segment_name;
418 a->segment_size = mp->segment_size;
419 /* Attach to the segment vpp created */
420 rv = svm_fifo_segment_attach (a);
423 clib_warning ("svm_fifo_segment_attach ('%s') failed",
427 clib_warning ("Mapped new segment '%s' size %d", mp->segment_name,
432 vl_api_connect_uri_t_handler (vl_api_connect_uri_t * mp)
435 uri_udp_test_main_t *utm = &uri_udp_test_main;
436 svm_fifo_segment_main_t *sm = &svm_fifo_segment_main;
437 svm_fifo_segment_create_args_t _a, *a = &_a;
438 svm_fifo_segment_private_t *seg;
439 unix_shared_memory_queue_t *client_q;
440 vl_api_connect_uri_reply_t *rmp;
444 /* Create the segment */
445 a->segment_name = (char *) format (0, "%d:segment%d%c", utm->my_pid,
446 utm->unique_segment_index++, 0);
447 a->segment_size = utm->configured_segment_size;
449 rv = svm_fifo_segment_create (a);
452 clib_warning ("sm_fifo_segment_create ('%s') failed", a->segment_name);
453 rv = VNET_API_ERROR_URI_FIFO_CREATE_FAILED;
457 vec_add2 (utm->seg, seg, 1);
459 segment_index = vec_len (sm->segments) - 1;
461 memcpy (seg, sm->segments + segment_index, sizeof (utm->seg[0]));
463 pool_get (utm->sessions, session);
466 * By construction the master's idea of the rx fifo ends up in
467 * fsh->fifos[0], and the master's idea of the tx fifo ends up in
470 session->server_rx_fifo = svm_fifo_segment_alloc_fifo (utm->seg,
472 ASSERT (session->server_rx_fifo);
474 session->server_tx_fifo = svm_fifo_segment_alloc_fifo (utm->seg,
476 ASSERT (session->server_tx_fifo);
478 session->server_rx_fifo->server_session_index = session - utm->sessions;
479 session->server_tx_fifo->server_session_index = session - utm->sessions;
480 utm->cut_through_session_index = session - utm->sessions;
482 rv = pthread_create (&utm->cut_through_thread_handle,
483 NULL /*attr */ , cut_through_thread_fn, 0);
486 clib_warning ("pthread_create returned %d", rv);
487 rv = VNET_API_ERROR_SYSCALL_ERROR_1;
491 rmp = vl_msg_api_alloc (sizeof (*rmp));
492 memset (rmp, 0, sizeof (*rmp));
494 rmp->_vl_msg_id = ntohs (VL_API_CONNECT_URI_REPLY);
495 rmp->context = mp->context;
496 rmp->retval = ntohl (rv);
497 rmp->segment_name_length = vec_len (a->segment_name);
498 memcpy (rmp->segment_name, a->segment_name, vec_len (a->segment_name));
500 vec_free (a->segment_name);
502 client_q = (unix_shared_memory_queue_t *) mp->client_queue_address;
503 vl_msg_api_send_shmem (client_q, (u8 *) & rmp);
507 vl_api_unbind_uri_reply_t_handler (vl_api_unbind_uri_reply_t * mp)
509 uri_udp_test_main_t *utm = &uri_udp_test_main;
512 clib_warning ("returned %d", ntohl (mp->retval));
514 utm->state = STATE_START;
518 vl_api_accept_session_t_handler (vl_api_accept_session_t * mp)
520 uri_udp_test_main_t *utm = &uri_udp_test_main;
521 vl_api_accept_session_reply_t *rmp;
522 svm_fifo_t *rx_fifo, *tx_fifo;
524 static f64 start_time;
527 if (start_time == 0.0)
528 start_time = clib_time_now (&utm->clib_time);
530 utm->vpp_event_queue = (unix_shared_memory_queue_t *)
531 mp->vpp_event_queue_address;
533 pool_get (utm->sessions, session);
535 rx_fifo = (svm_fifo_t *) mp->server_rx_fifo;
536 rx_fifo->client_session_index = session - utm->sessions;
537 tx_fifo = (svm_fifo_t *) mp->server_tx_fifo;
538 tx_fifo->client_session_index = session - utm->sessions;
540 session->server_rx_fifo = rx_fifo;
541 session->server_tx_fifo = tx_fifo;
543 key = (((u64) mp->session_thread_index) << 32) | (u64) mp->session_index;
545 hash_set (utm->session_index_by_vpp_handles, key, session - utm->sessions);
547 utm->state = STATE_READY;
549 if (pool_elts (utm->sessions) && (pool_elts (utm->sessions) % 20000) == 0)
551 f64 now = clib_time_now (&utm->clib_time);
552 fformat (stdout, "%d active sessions in %.2f seconds, %.2f/sec...\n",
553 pool_elts (utm->sessions), now - start_time,
554 (f64) pool_elts (utm->sessions) / (now - start_time));
557 rmp = vl_msg_api_alloc (sizeof (*rmp));
558 memset (rmp, 0, sizeof (*rmp));
559 rmp->_vl_msg_id = ntohs (VL_API_ACCEPT_SESSION_REPLY);
560 rmp->session_type = mp->session_type;
561 rmp->session_index = mp->session_index;
562 rmp->session_thread_index = mp->session_thread_index;
563 vl_msg_api_send_shmem (utm->vl_input_queue, (u8 *) & rmp);
567 vl_api_disconnect_session_t_handler (vl_api_disconnect_session_t * mp)
569 uri_udp_test_main_t *utm = &uri_udp_test_main;
571 vl_api_disconnect_session_reply_t *rmp;
576 key = (((u64) mp->session_thread_index) << 32) | (u64) mp->session_index;
578 p = hash_get (utm->session_index_by_vpp_handles, key);
582 session = pool_elt_at_index (utm->sessions, p[0]);
583 hash_unset (utm->session_index_by_vpp_handles, key);
584 pool_put (utm->sessions, session);
588 clib_warning ("couldn't find session key %llx", key);
592 rmp = vl_msg_api_alloc (sizeof (*rmp));
593 memset (rmp, 0, sizeof (*rmp));
594 rmp->_vl_msg_id = ntohs (VL_API_DISCONNECT_SESSION_REPLY);
596 rmp->session_index = mp->session_index;
597 rmp->session_thread_index = mp->session_thread_index;
598 vl_msg_api_send_shmem (utm->vl_input_queue, (u8 *) & rmp);
602 vl_api_connect_uri_reply_t_handler (vl_api_connect_uri_reply_t * mp)
604 svm_fifo_segment_main_t *sm = &svm_fifo_segment_main;
605 uri_udp_test_main_t *utm = &uri_udp_test_main;
606 svm_fifo_segment_create_args_t _a, *a = &_a;
607 ssvm_shared_header_t *sh;
608 svm_fifo_segment_private_t *seg;
609 svm_fifo_segment_header_t *fsh;
614 ASSERT (utm->i_am_master == 0);
616 if (mp->segment_name_length == 0)
618 clib_warning ("segment_name_length zero");
622 memset (a, 0, sizeof (*a));
624 a->segment_name = (char *) mp->segment_name;
628 rv = svm_fifo_segment_attach (a);
631 clib_warning ("sm_fifo_segment_create ('%v') failed", mp->segment_name);
635 segment_index = vec_len (sm->segments) - 1;
637 vec_add2 (utm->seg, seg, 1);
639 memcpy (seg, sm->segments + segment_index, sizeof (*seg));
641 fsh = (svm_fifo_segment_header_t *) sh->opaque[0];
643 while (vec_len (fsh->fifos) < 2)
646 pool_get (utm->sessions, session);
647 utm->cut_through_session_index = session - utm->sessions;
649 session->server_rx_fifo = (svm_fifo_t *) fsh->fifos[0];
650 ASSERT (session->server_rx_fifo);
651 session->server_tx_fifo = (svm_fifo_t *) fsh->fifos[1];
652 ASSERT (session->server_tx_fifo);
654 /* security: could unlink /dev/shm/<mp->segment_name> here, maybe */
656 utm->state = STATE_READY;
659 #define foreach_uri_msg \
660 _(BIND_URI_REPLY, bind_uri_reply) \
661 _(CONNECT_URI, connect_uri) \
662 _(CONNECT_URI_REPLY, connect_uri_reply) \
663 _(UNBIND_URI_REPLY, unbind_uri_reply) \
664 _(ACCEPT_SESSION, accept_session) \
665 _(DISCONNECT_SESSION, disconnect_session) \
666 _(MAP_ANOTHER_SEGMENT, map_another_segment)
669 uri_api_hookup (uri_udp_test_main_t * utm)
672 vl_msg_api_set_handlers(VL_API_##N, #n, \
673 vl_api_##n##_t_handler, \
675 vl_api_##n##_t_endian, \
676 vl_api_##n##_t_print, \
677 sizeof(vl_api_##n##_t), 1);
685 connect_to_vpp (char *name)
687 uri_udp_test_main_t *utm = &uri_udp_test_main;
688 api_main_t *am = &api_main;
690 if (vl_client_connect_to_vlib ("/vpe-api", name, 32) < 0)
693 utm->vl_input_queue = am->shmem_hdr->vl_input_queue;
694 utm->my_client_index = am->my_client_index;
700 vlib_cli_output (struct vlib_main_t *vm, char *fmt, ...)
702 clib_warning ("BUG");
706 init_error_string_table (uri_udp_test_main_t * utm)
708 utm->error_string_by_error_number = hash_create (0, sizeof (uword));
710 #define _(n,v,s) hash_set (utm->error_string_by_error_number, -v, s);
711 foreach_vnet_api_error;
714 hash_set (utm->error_string_by_error_number, 99, "Misc");
718 handle_fifo_event_server_rx (uri_udp_test_main_t * utm,
719 session_fifo_event_t * e)
721 svm_fifo_t *rx_fifo, *tx_fifo;
724 session_fifo_event_t evt;
725 unix_shared_memory_queue_t *q;
729 tx_fifo = utm->sessions[rx_fifo->client_session_index].server_tx_fifo;
733 nbytes = svm_fifo_dequeue_nowait (rx_fifo, 0,
734 vec_len (utm->rx_buf), utm->rx_buf);
739 rv = svm_fifo_enqueue_nowait (tx_fifo, 0, nbytes, utm->rx_buf);
743 /* Fabricate TX event, send to vpp */
745 evt.event_type = FIFO_EVENT_SERVER_TX;
746 /* $$$$ for event logging */
747 evt.enqueue_length = nbytes;
748 evt.event_id = e->event_id;
749 q = utm->vpp_event_queue;
750 unix_shared_memory_queue_add (q, (u8 *) & evt, 0 /* do wait for mutex */ );
754 handle_event_queue (uri_udp_test_main_t * utm)
756 session_fifo_event_t _e, *e = &_e;;
760 unix_shared_memory_queue_sub (utm->our_event_queue, (u8 *) e,
762 switch (e->event_type)
764 case FIFO_EVENT_SERVER_RX:
765 handle_fifo_event_server_rx (utm, e);
768 case FIFO_EVENT_SERVER_EXIT:
772 clib_warning ("unknown event type %d", e->event_type);
775 if (PREDICT_FALSE (utm->time_to_stop == 1))
777 if (PREDICT_FALSE (utm->time_to_print_stats == 1))
779 utm->time_to_print_stats = 0;
780 fformat (stdout, "%d connections\n", pool_elts (utm->sessions));
786 uri_udp_test (uri_udp_test_main_t * utm)
788 vl_api_bind_uri_t *bmp;
789 vl_api_unbind_uri_t *ump;
791 bmp = vl_msg_api_alloc (sizeof (*bmp));
792 memset (bmp, 0, sizeof (*bmp));
794 bmp->_vl_msg_id = ntohs (VL_API_BIND_URI);
795 bmp->client_index = utm->my_client_index;
796 bmp->context = ntohl (0xfeedface);
797 bmp->initial_segment_size = 256 << 20; /* size of initial segment */
798 bmp->options[SESSION_OPTIONS_FLAGS] =
799 SESSION_OPTIONS_FLAGS_USE_FIFO | SESSION_OPTIONS_FLAGS_ADD_SEGMENT;
800 bmp->options[SESSION_OPTIONS_RX_FIFO_SIZE] = 16 << 10;
801 bmp->options[SESSION_OPTIONS_TX_FIFO_SIZE] = 16 << 10;
802 bmp->options[SESSION_OPTIONS_ADD_SEGMENT_SIZE] = 128 << 20;
803 memcpy (bmp->uri, utm->uri, vec_len (utm->uri));
804 vl_msg_api_send_shmem (utm->vl_input_queue, (u8 *) & bmp);
806 if (wait_for_state_change (utm, STATE_READY))
808 clib_warning ("timeout waiting for STATE_READY");
812 handle_event_queue (utm);
814 ump = vl_msg_api_alloc (sizeof (*ump));
815 memset (ump, 0, sizeof (*ump));
817 ump->_vl_msg_id = ntohs (VL_API_UNBIND_URI);
818 ump->client_index = utm->my_client_index;
819 memcpy (ump->uri, utm->uri, vec_len (utm->uri));
820 vl_msg_api_send_shmem (utm->vl_input_queue, (u8 *) & ump);
822 if (wait_for_state_change (utm, STATE_START))
824 clib_warning ("timeout waiting for STATE_START");
828 fformat (stdout, "Test complete...\n");
832 main (int argc, char **argv)
834 uri_udp_test_main_t *utm = &uri_udp_test_main;
835 unformat_input_t _argv, *a = &_argv;
838 u8 *bind_name = (u8 *) "udp://0.0.0.0/1234";
845 clib_mem_init (0, 256 << 20);
847 heap = clib_mem_get_per_cpu_heap ();
848 h = mheap_header (heap);
850 /* make the main heap thread-safe */
851 h->flags |= MHEAP_FLAG_THREAD_SAFE;
853 vec_validate (utm->rx_buf, 8192);
855 utm->session_index_by_vpp_handles = hash_create (0, sizeof (uword));
857 utm->my_pid = getpid ();
858 utm->configured_segment_size = 1 << 20;
860 clib_time_init (&utm->clib_time);
861 init_error_string_table (utm);
862 svm_fifo_segment_init (0x200000000ULL, 20);
863 unformat_init_command_line (a, argv);
865 while (unformat_check_input (a) != UNFORMAT_END_OF_INPUT)
867 if (unformat (a, "chroot prefix %s", &chroot_prefix))
869 vl_set_memory_root_path ((char *) chroot_prefix);
871 else if (unformat (a, "uri %s", &bind_name))
873 else if (unformat (a, "segment-size %dM", &tmp))
874 utm->configured_segment_size = tmp << 20;
875 else if (unformat (a, "segment-size %dG", &tmp))
876 utm->configured_segment_size = tmp << 30;
877 else if (unformat (a, "master"))
879 else if (unformat (a, "slave"))
883 fformat (stderr, "%s: usage [master|slave]\n");
888 utm->cut_through_session_index = ~0;
889 utm->uri = format (0, "%s%c", bind_name, 0);
890 utm->i_am_master = i_am_master;
891 utm->segment_main = &svm_fifo_segment_main;
893 utm->connect_uri = format (0, "udp://10.0.0.1/1234%c", 0);
895 setup_signal_handlers ();
897 uri_api_hookup (utm);
899 if (connect_to_vpp (i_am_master ? "uri_udp_master" : "uri_udp_slave") < 0)
902 fformat (stderr, "Couldn't connect to vpe, exiting...\n");
906 if (i_am_master == 0)
908 uri_udp_slave_test (utm);
912 /* $$$$ hack preallocation */
913 for (i = 0; i < 200000; i++)
915 pool_get (utm->sessions, session);
916 memset (session, 0, sizeof (*session));
918 for (i = 0; i < 200000; i++)
919 pool_put_index (utm->sessions, i);
923 vl_client_disconnect_from_vlib ();
927 #undef vl_api_version
928 #define vl_api_version(n,v) static u32 vpe_api_version = v;
929 #include <vpp/api/vpe.api.h>
930 #undef vl_api_version
933 vl_client_add_api_signatures (vl_api_memclnt_create_t * mp)
936 * Send the main API signature in slot 0. This bit of code must
937 * match the checks in ../vpe/api/api.c: vl_msg_api_version_check().
939 mp->api_versions[0] = clib_host_to_net_u32 (vpe_api_version);
949 * fd.io coding-style-patch-verification: ON
952 * eval: (c-set-style "gnu")