39 return format (s,
"STATE_START");
41 return format (s,
"STATE_ATTACHED");
43 return format (s,
"STATE_LISTEN");
45 return format (s,
"STATE_READY");
47 return format (s,
"STATE_DATA_DONE");
49 return format (s,
"STATE_DISCONNECTED");
51 return format (s,
"STATE_DETACHED");
53 return format (s,
"unknown state");
59 u8 *
a = va_arg (*args,
u8 *);
74 u8 *
a = va_arg (*args,
u8 *);
77 else if (
unformat (input,
"qconnected"))
79 else if (
unformat (input,
"qconnect"))
81 else if (
unformat (input,
"sconnected"))
83 else if (
unformat (input,
"sconnect"))
85 else if (
unformat (input,
"lastbyte"))
97 u32 timing_event = va_arg (*args,
u32);
99 return format (s,
"start");
101 return format (s,
"qconnect");
103 return format (s,
"qconnected");
105 return format (s,
"sconnect");
107 return format (s,
"sconnected");
109 return format (s,
"lastbyte");
111 return format (s,
"exit");
113 return format (s,
"unknown timing event");
130 for (
i = 0;
i < n_sessions;
i++)
134 session->session_index = session - em->
sessions;
213 ECHO_FAIL (
"unknown handle 0x%lx", handle);
235 bmp->_vl_msg_id = ntohs (VL_API_APPLICATION_ATTACH);
237 bmp->
context = ntohl (0xfeedface);
258 cert_mp->_vl_msg_id = ntohs (VL_API_APPLICATION_TLS_CERT_ADD);
260 cert_mp->
context = ntohl (0xfeedface);
267 key_mp->_vl_msg_id = ntohs (VL_API_APPLICATION_TLS_KEY_ADD);
269 key_mp->
context = ntohl (0xfeedface);
282 bmp->_vl_msg_id = ntohs (VL_API_APPLICATION_DETACH);
284 bmp->
context = ntohl (0xfeedface);
295 bmp->_vl_msg_id = ntohs (VL_API_BIND_URI);
297 bmp->
context = ntohl (0xfeedface);
310 ump->_vl_msg_id = ntohs (VL_API_UNBIND_URI);
323 cmp->_vl_msg_id = ntohs (VL_API_CONNECT_URI);
337 dmp->_vl_msg_id = ntohs (VL_API_DISCONNECT_SESSION);
356 uword *segment_present;
357 ECHO_LOG (1,
"Waiting for segment 0x%lx...", segment_handle);
363 if (segment_present != 0)
368 ECHO_LOG (1,
"timeout wait_for_segment_allocation (0x%lx)", segment_handle);
393 "Some sessions are still open");
406 ECHO_FAIL (
"app_send_io_evt_to_vpp errored %d", rv);
475 ECHO_LOG (0,
"Session 0x%x done in %.6fs RX[%.4f] TX[%.4f] Gbit/s\n",
486 ECHO_LOG (0,
"Expected event %s to happend, which did not", s);
503 fformat (stdout,
"\"time\": \"%.9f\",\n", deltat);
504 fformat (stdout,
"\"start_evt\": \"%s\",\n", start_evt);
505 fformat (stdout,
"\"end_evt\": \"%s\",\n", end_evt);
508 fformat (stdout,
"\"closing\": {\n");
509 fformat (stdout,
" \"reset\": { \"q\": %d, \"s\": %d },\n",
511 fformat (stdout,
" \"close\": { \"q\": %d, \"s\": %d },\n",
513 fformat (stdout,
" \"active\": { \"q\": %d, \"s\": %d },\n",
515 fformat (stdout,
" \"clean\": { \"q\": %d, \"s\": %d }\n",
533 fformat (stdout,
"Timing %s\n", s);
534 fformat (stdout,
"-------- TX --------\n");
535 fformat (stdout,
"%lld bytes (%lld mbytes, %lld gbytes) in %.6f seconds\n",
538 fformat (stdout,
"%.4f Gbit/second\n",
540 fformat (stdout,
"-------- RX --------\n");
541 fformat (stdout,
"%lld bytes (%lld mbytes, %lld gbytes) in %.6f seconds\n",
544 fformat (stdout,
"%.4f Gbit/second\n",
546 fformat (stdout,
"--------------------\n");
562 u32 *session_indexes = 0, *session_index;
567 if (s->session_state == QUIC_SESSION_STATE_CLOSED)
568 vec_add1 (session_indexes, s->session_index);}
610 ECHO_LOG (1,
"Cleanup sessions (still %uQ %uS)",
625 if (s->session_type == QUIC_SESSION_TYPE_QUIC)
627 ECHO_LOG (1,
"ACTIVE close 0x%lx", s->vpp_session_handle);
628 if (em->send_quic_disconnects == ECHO_CLOSE_F_ACTIVE)
630 echo_send_rpc (em, echo_disconnect_session, (void *) s, 0);
631 em->stats.active_count.q++;
633 else if (em->send_quic_disconnects == ECHO_CLOSE_F_NONE)
635 echo_cleanup_session (em, s);
636 em->stats.clean_count.q++;
650 for (i = 0; i < n_read; i++)
655 ECHO_LOG (0,
"Session 0x%lx byte %lld was 0x%x expected 0x%x",
660 ECHO_LOG (0,
"Too many errors, hiding next ones");
689 if (!bytes_this_chunk)
692 bytes_this_chunk, 0);
704 while (n_sent < len && !em->time_to_stop)
713 ECHO_LOG (1,
"[%lu/%lu] -> S(%x) -> [%lu/%lu]",
748 int n_read, n_sent = 0;
782 if (n_sent || n_read)
789 ECHO_LOG (1,
"Idle FIFOs TX:%dB RX:%dB",
809 u32 n_closed_sessions = 0;
815 for (i = 0; !em->
time_to_stop; i = (i + 1) % thread_n_sessions)
817 n_closed_sessions = i == 0 ? 0 : n_closed_sessions;
822 switch (s->session_state)
840 if (n_closed_sessions == thread_n_sessions)
854 clib_net_to_host_u32 (mp->
retval));
859 clib_net_to_host_u16 (mp->
lcl_port));
882 ECHO_FAIL (
"wait_for_segment_allocation errored");
887 rx_fifo->client_session_index = session->session_index;
889 tx_fifo->client_session_index = session->session_index;
891 session->rx_fifo = rx_fifo;
892 session->tx_fifo = tx_fifo;
918 if (em->
cb_vft.quic_accepted_cb)
919 em->
cb_vft.quic_accepted_cb (mp, session->session_index);
928 em->
cb_vft.server_stream_accepted_cb (mp, session->session_index);
930 em->
cb_vft.client_stream_accepted_cb (mp, session->session_index);
958 clib_net_to_host_u32 (mp->
retval));
965 ECHO_FAIL (
"wait_for_segment_allocation errored");
970 rx_fifo->client_session_index = session->session_index;
972 tx_fifo->client_session_index = session->session_index;
974 session->rx_fifo = rx_fifo;
975 session->tx_fifo = tx_fifo;
988 if (em->
cb_vft.quic_connected_cb)
989 em->
cb_vft.quic_connected_cb (mp, session->session_index);
1001 em->
cb_vft.server_stream_connected_cb (mp, session->session_index);
1003 em->
cb_vft.client_stream_connected_cb (mp, session->session_index);
1038 ECHO_LOG (0,
"Qsession 0x%llx connected to %U:%d",
1040 mp->
lcl.is_ip4, clib_net_to_host_u16 (mp->
lcl.port));
1059 ECHO_FAIL (
"Got a wrong connected on session %u [%lx]", session_index,
1092 ECHO_FAIL (
"Got a wrong accept on session %u [%lx]", session_index,
1101 ECHO_LOG (0,
"Accepted session from: %s:%d", ip_str,
1102 clib_net_to_host_u16 (mp->
rmt.port));
1121 .quic_connected_cb =
NULL,
1134 if (
unformat (input,
"serverstream"))
1136 else if (
unformat (input,
"default"))
1219 switch (e->event_type)
1239 ECHO_LOG (0,
"unhandled event %u", e->event_type);
1250 if (em->
state == state)
1285 ECHO_FAIL (
"Application failed to attach");
1334 ECHO_FAIL (
"Timeout waiting for state disconnected");
1359 clib_net_to_host_u32 (mp->
retval));
1378 ECHO_FAIL (
"vl_socket_client_recv_fd_msg failed");
1382 if (mp->
fd_flags & SESSION_FD_F_VPP_MQ_SEGMENT)
1385 ECHO_FAIL (
"svm_fifo_segment_attach failed");
1389 if (mp->
fd_flags & SESSION_FD_F_MEMFD_SEGMENT)
1393 ECHO_FAIL (
"svm_fifo_segment_attach ('%s') failed",
1397 if (mp->
fd_flags & SESSION_FD_F_MQ_EVENTFD)
1407 ECHO_FAIL (
"svm_fifo_segment_attach ('%s') failed",
1413 ECHO_LOG (1,
"Mapped segment 0x%lx", segment_handle);
1429 ECHO_FAIL (
"detach returned with err: %d", mp->retval);
1442 ECHO_LOG (1,
"Unmaped segment 0x%lx", segment_handle);
1455 if (mp->
fd_flags & SESSION_FD_F_MEMFD_SEGMENT)
1460 ECHO_FAIL (
"vl_socket_client_recv_fd_msg failed");
1466 ECHO_FAIL (
"svm_fifo_segment_attach ('%s')" 1467 "failed on SSVM_SEGMENT_MEMFD", seg_name);
1480 ECHO_FAIL (
"svm_fifo_segment_attach ('%s') failed", seg_name);
1485 ECHO_LOG (1,
"Mapped segment 0x%lx", segment_handle);
1501 clib_net_to_host_u32 (mp->retval));
1513 if (mp->retval != 0)
1515 ECHO_FAIL (
"returned %d", ntohl (mp->retval));
1532 ECHO_FAIL (
"vpp complained about disconnect: %d", ntohl (mp->
retval));
1536 ECHO_LOG (1,
"Got disonnected reply for session 0x%lx", mp->
handle);
1547 (vl_api_application_tls_cert_add_reply_t * mp)
1555 (vl_api_application_tls_key_add_reply_t * mp)
1580 ECHO_LOG (1,
"Retrying connect %s", uri);
1586 #define foreach_quic_echo_msg \ 1587 _(BIND_URI_REPLY, bind_uri_reply) \ 1588 _(UNBIND_URI_REPLY, unbind_uri_reply) \ 1589 _(DISCONNECT_SESSION_REPLY, disconnect_session_reply) \ 1590 _(APPLICATION_ATTACH_REPLY, application_attach_reply) \ 1591 _(APPLICATION_DETACH_REPLY, application_detach_reply) \ 1592 _(MAP_ANOTHER_SEGMENT, map_another_segment) \ 1593 _(UNMAP_SEGMENT, unmap_segment) \ 1594 _(APPLICATION_TLS_CERT_ADD_REPLY, application_tls_cert_add_reply) \ 1595 _(APPLICATION_TLS_KEY_ADD_REPLY, application_tls_key_add_reply) \ 1596 _(CONNECT_URI_REPLY, connect_uri_reply) \ 1602 vl_msg_api_set_handlers(VL_API_##N, #n, \ 1603 vl_api_##n##_t_handler, \ 1605 vl_api_##n##_t_endian, \ 1606 vl_api_##n##_t_print, \ 1607 sizeof(vl_api_##n##_t), 1); 1622 "Usage: quic_echo [socket-name SOCKET] [client|server] [uri URI] [OPTIONS]\n" 1623 "Generates traffic and assert correct teardown of the QUIC hoststack\n" 1625 " socket-name PATH Specify the binary socket path to connect to VPP\n" 1626 " use-svm-api Use SVM API to connect to VPP\n" 1627 " test-bytes[:assert] Check data correctness when receiving (assert fails on first error)\n" 1628 " fifo-size N Use N Kb fifos\n" 1629 " rx-buf N Use N Kb RX buffer\n" 1630 " tx-buf N Use N Kb TX test buffer\n" 1631 " appns NAMESPACE Use the namespace NAMESPACE\n" 1632 " all-scope all-scope option\n" 1633 " local-scope local-scope option\n" 1634 " global-scope global-scope option\n" 1635 " secret SECRET set namespace secret\n" 1636 " chroot prefix PATH Use PATH as memory root path\n" 1637 " quic-setup OPT OPT=serverstream : Client open N connections. \n" 1638 " On each one server opens M streams\n" 1639 " OPT=default : Client open N connections.\n" 1640 " On each one client opens M streams\n" 1641 " sclose=[Y|N|W] When a stream is done, pass[N] send[Y] or wait[W] for close\n" 1642 " qclose=[Y|N|W] When a connection is done pass[N] send[Y] or wait[W] for close\n" 1644 " time START:END Time between evts START & END, events being :\n" 1645 " start - Start of the app\n" 1646 " qconnect - first Connection connect sent\n" 1647 " qconnected - last Connection connected\n" 1648 " sconnect - first Stream connect sent\n" 1649 " sconnected - last Stream got connected\n" 1650 " lastbyte - Last expected byte received\n" 1651 " exit - Exiting of the app\n" 1652 " json Output global stats in json\n" 1653 " log=N Set the log level to [0: no output, 1:errors, 2:log]\n" 1654 " max-connects=N Don't do more than N parallel connect_uri\n" 1656 " nclients N[/M] Open N QUIC connections, each one with M streams (M defaults to 1)\n" 1657 " nthreads N Use N busy loop threads for data [in addition to main & msg queue]\n" 1658 " TX=1337[Kb|Mb|GB] Send 1337 [K|M|G]bytes, use TX=RX to reflect the data\n" 1659 " RX=1337[Kb|Mb|GB] Expect 1337 [K|M|G]bytes\n" 1661 "Default configuration is :\n" 1662 " server nclients 1/1 RX=64Kb TX=RX\n" 1663 " client nclients 1/1 RX=64Kb TX=64Kb\n");
1676 u8 default_f_active;
1681 if (
unformat (a,
"chroot prefix %s", &chroot_prefix))
1685 else if (
unformat (a,
"uri %s", &uri))
1691 else if (
unformat (a,
"test-bytes:assert"))
1693 else if (
unformat (a,
"test-bytes"))
1697 else if (
unformat (a,
"use-svm-api"))
1699 else if (
unformat (a,
"fifo-size %d", &tmp))
1701 else if (
unformat (a,
"rx-buf %d", &tmp))
1703 else if (
unformat (a,
"tx-buf %d", &tmp))
1715 else if (
unformat (a,
"all-scope"))
1716 em->
appns_flags |= (APP_OPTIONS_FLAGS_USE_GLOBAL_SCOPE
1717 | APP_OPTIONS_FLAGS_USE_LOCAL_SCOPE);
1718 else if (
unformat (a,
"local-scope"))
1719 em->
appns_flags = APP_OPTIONS_FLAGS_USE_LOCAL_SCOPE;
1720 else if (
unformat (a,
"global-scope"))
1721 em->
appns_flags = APP_OPTIONS_FLAGS_USE_GLOBAL_SCOPE;
1744 else if (
unformat (a,
"time %U:%U",
1791 u32 rpc_queue_size = 64 << 10;
1816 em->
uri =
format (0,
"%s%c",
"quic://0.0.0.0/1234", 0);
1823 for (i = 0; i < n_clients; i++)
1837 cfg->consumer_pid = getpid ();
1839 cfg->q_nitems = rpc_queue_size;
1840 cfg->ring_cfgs = rc;
1848 app_name = em->i_am_master ?
"quic_echo_server" :
"quic_echo_client";
1852 ECHO_FAIL (
"Couldn't connect to vpe, exiting...\n");
1862 ECHO_FAIL (
"Couldn't attach to vpp, did you run <session enable> ?\n");
1865 if (pthread_create (&em->mq_thread_handle,
1871 for (
i = 0;
i < em->n_rx_threads;
i++)
1872 if (pthread_create (&em->data_thread_handles[
i],
1878 if (em->i_am_master)
1883 if (em->output_json)
1892 ECHO_FAIL (
"ECHO-ERROR: Couldn't detach from vpp, exiting...\n");
1896 pthread_join (em->mq_thread_handle, (
void **) &rv);
1899 ECHO_FAIL (
"mq pthread errored %d", rv);
1902 if (em->use_sock_api)
1907 exit (em->has_failed);
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static void * echo_data_thread_fn(void *arg)
volatile u64 accepted_session_count
static u8 svm_msg_q_msg_is_invalid(svm_msg_q_msg_t *msg)
Check if message is invalid.
static void server_send_listen(echo_main_t *em)
#define hash_set(h, key, value)
void * svm_msg_q_msg_data(svm_msg_q_t *mq, svm_msg_q_msg_t *msg)
Get data for message in queue.
static u8 svm_msg_q_ring_is_full(svm_msg_q_t *mq, u32 ring_index)
teardown_stat_t clean_count
static_always_inline void clib_spinlock_unlock(clib_spinlock_t *p)
int vl_socket_client_init_shm(vl_api_shm_elem_config_t *config, int want_pthread)
static_always_inline void clib_spinlock_lock(clib_spinlock_t *p)
static int wait_for_state_change(echo_main_t *em, connection_state_t state, f64 timeout)
int vl_client_connect_to_vlib(const char *svm_name, const char *client_name, int rx_queue_size)
static void session_reset_handler(session_reset_msg_t *mp)
#define hash_unset(h, key)
static void handle_mq_event(session_event_t *e)
clib_spinlock_t sid_vpp_handles_lock
static void echo_disconnect_session(echo_session_t *s, u32 opaque)
static void echo_cleanup_session(echo_main_t *em, echo_session_t *s)
u8 use_sock_api
Flag that decides if socket, instead of svm, api is used to connect to vpp.
uword vpp_event_queue_address
int my_client_index
All VLIB-side message handlers use my_client_index to identify the queue / client.
#define clib_memcpy_fast(a, b, c)
static f64 clib_time_now(clib_time_t *c)
static int app_send_stream(app_session_t *s, u8 *data, u32 len, u8 noblock)
for(i=1;i<=collision_buckets;i++)
int vl_socket_client_connect(char *socket_path, char *client_name, u32 socket_buffer_size)
clib_memset(h->entries, 0, sizeof(h->entries[0])*entries)
volatile connection_state_t state
static void vl_api_unbind_uri_reply_t_handler(vl_api_unbind_uri_reply_t *mp)
static void print_global_json_stats(echo_main_t *em)
static void * echo_mq_thread_fn(void *arg)
static void vl_api_application_attach_reply_t_handler(vl_api_application_attach_reply_t *mp)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
void * vl_msg_api_alloc(int nbytes)
static void vl_api_map_another_segment_t_handler(vl_api_map_another_segment_t *mp)
static void vl_api_application_detach_reply_t_handler(vl_api_application_detach_reply_t *mp)
static int ssvm_segment_attach(char *name, ssvm_segment_type_t type, int fd)
foreach_app_session_field u64 vpp_session_handle
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
u8 * format_api_error(u8 *s, va_list *args)
static const quic_echo_cb_vft_t server_stream_cb_vft
static echo_session_t * echo_session_new(echo_main_t *em)
struct _svm_fifo svm_fifo_t
int connect_to_vpp(char *name)
blocking call, returns on signal or time-out - best used in combination with condvars, with eventfds we don't yield the cpu
struct echo_main_t::@481 timing
void svm_region_exit(void)
static void stop_signal(int signum)
enum ssvm_segment_type_ ssvm_segment_type_t
static void app_alloc_ctrl_evt_to_vpp(svm_msg_q_t *mq, app_session_evt_t *app_evt, u8 evt_type)
volatile u32 n_clients_connected
static void clib_mem_set_thread_index(void)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
static void echo_handle_data(echo_main_t *em, echo_session_t *s, u8 *rx_buf)
static void vl_api_unmap_segment_t_handler(vl_api_unmap_segment_t *mp)
svm_msg_q_t * svm_msg_q_alloc(svm_msg_q_cfg_t *cfg)
Allocate message queue.
volatile u64 bytes_received
#define ECHO_FAIL(_fmt, _args...)
static u32 svm_fifo_max_dequeue(svm_fifo_t *f)
Fifo max bytes to dequeue.
static const u32 test_srv_key_rsa_len
static void echo_free_sessions(echo_main_t *em)
static uword unformat_close(unformat_input_t *input, va_list *args)
static int app_send_io_evt_to_vpp(svm_msg_q_t *mq, u32 session_index, u8 evt_type, u8 noblock)
Send fifo io event to vpp worker thread.
clib_spinlock_t segment_handles_lock
static void session_bound_handler(session_bound_msg_t *mp)
vhost_vring_state_t state
struct vl_shmem_hdr_ * shmem_hdr
Binary API shared-memory segment header pointer.
void quic_echo_process_opts(int argc, char **argv)
void vl_msg_api_send_shmem(svm_queue_t *q, u8 *elem)
char * segment_name
segment name
int svm_msg_q_sub(svm_msg_q_t *mq, svm_msg_q_msg_t *msg, svm_q_conditional_wait_t cond, u32 time)
Consumer dequeue one message from queue.
static void clib_spinlock_init(clib_spinlock_t *p)
vl_api_fib_path_type_t type
int fifo_segment_attach(fifo_segment_main_t *sm, fifo_segment_create_args_t *a)
Attach as slave to a fifo segment.
vpp->client unmap shared memory segment
void vl_set_memory_root_path(const char *name)
static void echo_session_dequeue_notify(echo_session_t *s)
quic_echo_cb_vft_t cb_vft
static void echo_on_accept_connect(session_accepted_msg_t *mp, u32 session_index)
static void echo_check_closed_listener(echo_main_t *em, echo_session_t *s)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static void echo_segment_handle_add_del(echo_main_t *em, u64 segment_handle, u8 add)
volatile u32 n_quic_clients_connected
static void echo_event_didnt_happen(u8 e)
static void vl_api_bind_uri_reply_t_handler(vl_api_bind_uri_reply_t *mp)
static void quic_echo_notify_event(echo_main_t *em, echo_test_evt_t e)
client->vpp, attach application to session layer
static echo_session_t * echo_get_session_from_handle(echo_main_t *em, u64 handle)
void quic_echo_api_hookup(echo_main_t *em)
uword * session_index_by_vpp_handles
#define pool_put(P, E)
Free an object E in pool P.
static int recv_data_chunk(echo_main_t *em, echo_session_t *s, u8 *rx_buf)
static void echo_assert_test_suceeded(echo_main_t *em)
static void vl_api_disconnect_session_reply_t_handler(vl_api_disconnect_session_reply_t *mp)
static void vl_api_application_tls_cert_add_reply_t_handler(vl_api_application_tls_cert_add_reply_t *mp)
#define SESSION_INVALID_INDEX
uword vpp_event_queue_address
static uword echo_unformat_timing_event(unformat_input_t *input, va_list *args)
static void server_run(echo_main_t *em)
static const char test_srv_crt_rsa[]
fifo_segment_main_t segment_main
void clib_time_init(clib_time_t *c)
void application_detach(echo_main_t *em)
data_source_t data_source
API main structure, used by both vpp and binary API clients.
#define clib_atomic_sub_fetch(a, b)
#define ECHO_LOG(lvl, _fmt, _args...)
static void app_send_ctrl_evt_to_vpp(svm_msg_q_t *mq, app_session_evt_t *app_evt)
static void echo_session_prealloc(echo_main_t *em)
u32 segment_size
size of the segment
static u8 svm_fifo_set_event(svm_fifo_t *f)
Set fifo event flag.
echo_session_t * sessions
static void echo_on_accept_error(session_accepted_msg_t *mp, u32 session_index)
clib_error_t * vl_socket_client_recv_fd_msg(int fds[], int n_fds, u32 wait)
static u8 svm_fifo_needs_deq_ntf(svm_fifo_t *f, u32 n_last_deq)
Check if fifo needs dequeue notification.
static int echo_send_rpc(echo_main_t *em, void *fp, void *arg, u32 opaque)
void vl_socket_client_disconnect(void)
static void svm_msg_q_unlock(svm_msg_q_t *mq)
Unlock message queue.
static const quic_echo_cb_vft_t default_cb_vft
#define vec_free(V)
Free vector's memory (no header).
static void print_usage_and_exit(void)
static void vl_api_application_tls_key_add_reply_t_handler(vl_api_application_tls_key_add_reply_t *mp)
void fifo_segment_main_init(fifo_segment_main_t *sm, u64 baseva, u32 timeout_in_seconds)
uword * shared_segment_handles
static void clients_run(echo_main_t *em)
static void echo_initiate_qsession_close_no_stream(echo_main_t *em)
u8 * echo_format_timing_event(u8 *s, va_list *args)
static void echo_on_connected_connect(session_connected_msg_t *mp, u32 session_index)
#define HIGH_SEGMENT_BASEVA
static void test_recv_bytes(echo_main_t *em, echo_session_t *s, u8 *rx_buf, u32 n_read)
blocking call - best used in combination with condvars, for eventfds we don't yield the cpu ...
static int app_recv_stream(app_session_t *s, u8 *buf, u32 len)
int memfd_fd
fd for memfd segments
Application attach reply.
svm_queue_t * vl_input_queue
teardown_stat_t reset_count
static int wait_for_segment_allocation(u64 segment_handle)
static uword unformat_data(unformat_input_t *input, va_list *args)
static const char test_srv_key_rsa[]
#define hash_create(elts, value_bytes)
#define uword_to_pointer(u, type)
static uword hash_elts(void *v)
void svm_msg_q_add_and_unlock(svm_msg_q_t *mq, svm_msg_q_msg_t *msg)
Producer enqueue one message to queue with mutex held.
static void echo_send_connect(u8 *uri, u32 opaque)
volatile u32 nxt_available_sidx
static void session_accepted_handler(session_accepted_msg_t *mp)
u64 app_event_queue_address
static void echo_on_connected_error(session_connected_msg_t *mp, u32 session_index)
client->vpp, attach application to session layer
static void echo_on_accept_recv(session_accepted_msg_t *mp, u32 session_index)
static void echo_on_accept_log_ip(session_accepted_msg_t *mp, u32 session_index)
static void session_connected_handler(session_connected_msg_t *mp)
static uword echo_unformat_quic_setup_vft(unformat_input_t *input, va_list *args)
static void svm_fifo_clear_deq_ntf(svm_fifo_t *f)
Clear the want notification flag and set has notification.
vpp->client, please map an additional shared memory segment
static void init_error_string_table(vat_main_t *vam)
static void echo_session_handle_add_del(echo_main_t *em, u64 handle, u32 sid)
int main(int argc, char **argv)
void svm_msg_q_set_consumer_eventfd(svm_msg_q_t *mq, int fd)
Set event fd for queue consumer.
#define clib_atomic_fetch_add(a, b)
void(* echo_rpc_t)(void *arg, u32 opaque)
ssvm_segment_type_t segment_type
type of segment requested
#define foreach_quic_echo_msg
template key/value backing page structure
bidirectional disconnect API
enum echo_test_evt_ echo_test_evt_t
teardown_stat_t close_count
static void session_disconnected_handler(session_disconnected_msg_t *mp)
struct _quic_echo_cb_vft quic_echo_cb_vft_t
void svm_msg_q_free_msg(svm_msg_q_t *mq, svm_msg_q_msg_t *msg)
Free message buffer.
struct echo_main_t::@480 stats
volatile u64 bytes_to_receive
svm_msg_q_t * our_event_queue
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
void application_send_attach(echo_main_t *em)
static void session_print_stats(echo_main_t *em, echo_session_t *session)
teardown_stat_t active_count
static void echo_on_connected_send(session_connected_msg_t *mp, u32 session_index)
svm_msg_q_t * rpc_msq_queue
void vl_client_disconnect_from_vlib(void)
Application add TLS certificate.
u8 * format_quic_echo_state(u8 *s, va_list *args)
static int send_data_chunk(echo_session_t *s, u8 *tx_buf, int offset, int len)
#define vec_foreach(var, vec)
Vector iterator.
static void echo_update_count_on_session_close(echo_main_t *em, echo_session_t *s)
pthread_t * data_thread_handles
static void vl_api_connect_uri_reply_t_handler(vl_api_connect_uri_reply_t *mp)
static void server_send_unbind(echo_main_t *em)
static void echo_process_rpcs(echo_main_t *em)
svm_queue_t * vl_input_queue
bidirectional disconnect reply API
void * clib_mem_init_thread_safe(void *memory, uword memory_size)
static int svm_msg_q_lock(svm_msg_q_t *mq)
Lock, or block trying, the message queue.
static int mirror_data_chunk(echo_main_t *em, echo_session_t *s, u8 *tx_buf, u64 len)
static void print_global_stats(echo_main_t *em)
svm_msg_q_msg_t svm_msg_q_alloc_msg_w_ring(svm_msg_q_t *mq, u32 ring_index)
Allocate message buffer on ring.
u8 send_stream_disconnects
static const u32 test_srv_crt_rsa_len
u32 * new_segment_indices
return vec of new seg indices