16 #ifndef __included_vpp_echo_common_h__ 17 #define __included_vpp_echo_common_h__ 33 #define vl_print(handle, ...) 40 #define foreach_echo_fail_code \ 41 _(ECHO_FAIL_NONE, "ECHO_FAIL_NONE") \ 42 _(ECHO_FAIL_SEND_IO_EVT, "ECHO_FAIL_SEND_IO_EVT") \ 43 _(ECHO_FAIL_SOCKET_CONNECT, "ECHO_FAIL_SOCKET_CONNECT") \ 44 _(ECHO_FAIL_INIT_SHM_API, "ECHO_FAIL_INIT_SHM_API") \ 45 _(ECHO_FAIL_SHMEM_CONNECT, "ECHO_FAIL_SHMEM_CONNECT") \ 46 _(ECHO_FAIL_TEST_BYTES_ERR, "ECHO_FAIL_TEST_BYTES_ERR") \ 47 _(ECHO_FAIL_BIND, "ECHO_FAIL_BIND") \ 48 _(ECHO_FAIL_ACCEPTED_WAIT_FOR_SEG_ALLOC, \ 49 "ECHO_FAIL_ACCEPTED_WAIT_FOR_SEG_ALLOC") \ 50 _(ECHO_FAIL_SESSION_CONNECT, "ECHO_FAIL_SESSION_CONNECT") \ 51 _(ECHO_FAIL_CONNECTED_WAIT_FOR_SEG_ALLOC, \ 52 "ECHO_FAIL_CONNECTED_WAIT_FOR_SEG_ALLOC") \ 53 _(ECHO_FAIL_APP_ATTACH, "ECHO_FAIL_APP_ATTACH") \ 54 _(ECHO_FAIL_SERVER_DISCONNECT_TIMEOUT, \ 55 "ECHO_FAIL_SERVER_DISCONNECT_TIMEOUT") \ 56 _(ECHO_FAIL_INVALID_URI, "ECHO_FAIL_INVALID_URI") \ 57 _(ECHO_FAIL_PROTOCOL_NOT_SUPPORTED, \ 58 "ECHO_FAIL_PROTOCOL_NOT_SUPPORTED") \ 59 _(ECHO_FAIL_CONNECT_TO_VPP, "ECHO_FAIL_CONNECT_TO_VPP") \ 60 _(ECHO_FAIL_ATTACH_TO_VPP, "ECHO_FAIL_ATTACH_TO_VPP") \ 61 _(ECHO_FAIL_1ST_PTHREAD_CREATE, "ECHO_FAIL_1ST_PTHREAD_CREATE") \ 62 _(ECHO_FAIL_PTHREAD_CREATE, "ECHO_FAIL_PTHREAD_CREATE") \ 63 _(ECHO_FAIL_DETACH, "ECHO_FAIL_DETACH") \ 64 _(ECHO_FAIL_MQ_PTHREAD, "ECHO_FAIL_MQ_PTHREAD") \ 65 _(ECHO_FAIL_VL_API_APP_ATTACH, "ECHO_FAIL_VL_API_APP_ATTACH") \ 66 _(ECHO_FAIL_VL_API_MISSING_SEGMENT_NAME, \ 67 "ECHO_FAIL_VL_API_MISSING_SEGMENT_NAME") \ 68 _(ECHO_FAIL_VL_API_RECV_FD_MSG, "ECHO_FAIL_VL_API_RECV_FD_MSG") \ 69 _(ECHO_FAIL_VL_API_SVM_FIFO_SEG_ATTACH, \ 70 "ECHO_FAIL_VL_API_SVM_FIFO_SEG_ATTACH") \ 71 _(ECHO_FAIL_VL_API_FIFO_SEG_ATTACH, \ 72 "ECHO_FAIL_VL_API_FIFO_SEG_ATTACH") \ 73 _(ECHO_FAIL_VL_API_DETACH_REPLY, "ECHO_FAIL_VL_API_DETACH_REPLY") \ 74 _(ECHO_FAIL_VL_API_BIND_URI_REPLY, "ECHO_FAIL_VL_API_BIND_URI_REPLY") \ 75 _(ECHO_FAIL_VL_API_UNBIND_REPLY, "ECHO_FAIL_VL_API_UNBIND_REPLY") \ 76 _(ECHO_FAIL_VL_API_DISCONNECT_SESSION_REPLY, \ 77 "ECHO_FAIL_VL_API_DISCONNECT_SESSION_REPLY") \ 78 _(ECHO_FAIL_VL_API_TLS_CERT_ADD_REPLY, \ 79 "ECHO_FAIL_VL_API_TLS_CERT_ADD_REPLY") \ 80 _(ECHO_FAIL_VL_API_TLS_KEY_ADD_REPLY, \ 81 "ECHO_FAIL_VL_API_TLS_KEY_ADD_REPLY") \ 82 _(ECHO_FAIL_GET_SESSION_FROM_HANDLE, \ 83 "ECHO_FAIL_GET_SESSION_FROM_HANDLE") \ 84 _(ECHO_FAIL_QUIC_WRONG_CONNECT, "ECHO_FAIL_QUIC_WRONG_CONNECT") \ 85 _(ECHO_FAIL_QUIC_WRONG_ACCEPT, "ECHO_FAIL_QUIC_WRONG_ACCEPT") \ 86 _(ECHO_FAIL_TCP_BAPI_CONNECT, "ECHO_FAIL_TCP_BAPI_CONNECT") \ 87 _(ECHO_FAIL_UDP_BAPI_CONNECT, "ECHO_FAIL_UDP_BAPI_CONNECT") \ 88 _(ECHO_FAIL_MISSING_START_EVENT, "ECHO_FAIL_MISSING_START_EVENT") \ 89 _(ECHO_FAIL_MISSING_END_EVENT, "ECHO_FAIL_MISSING_END_EVENT") \ 90 _(ECHO_FAIL_TEST_ASSERT_RX_TOTAL, "ECHO_FAIL_TEST_ASSERT_RX_TOTAL") \ 91 _(ECHO_FAIL_TEST_ASSERT_TX_TOTAL, "ECHO_FAIL_TEST_ASSERT_TX_TOTAL") \ 92 _(ECHO_FAIL_TEST_ASSERT_ALL_SESSIONS_CLOSED, \ 93 "ECHO_FAIL_TEST_ASSERT_ALL_SESSIONS_CLOSED") 97 #define _(sym, str) sym, 104 #define CHECK(fail, expected, result, _fmt, _args...) \ 105 if (expected != result) \ 106 ECHO_FAIL (fail, "expected %d, got %d : " _fmt, expected, \ 109 #define ECHO_FAIL(fail, _fmt, _args...) \ 111 echo_main_t *em = &echo_main; \ 112 em->has_failed = fail; \ 113 if (vec_len(em->fail_descr)) \ 114 em->fail_descr = format(em->fail_descr, " | %s (%d): "_fmt, \ 115 echo_fail_code_str[fail], fail, ##_args); \ 117 em->fail_descr = format(0, "%s (%d): "_fmt, \ 118 echo_fail_code_str[fail], fail, ##_args); \ 119 em->time_to_stop = 1; \ 120 if (em->log_lvl > 0) \ 121 clib_warning ("%v", em->fail_descr); \ 124 #define ECHO_LOG(lvl, _fmt,_args...) \ 126 echo_main_t *em = &echo_main; \ 127 if (em->log_lvl > lvl) \ 128 clib_warning (_fmt, ##_args); \ 131 #define ECHO_REGISTER_PROTO(proto, vft) \ 132 static void __clib_constructor \ 133 vpp_echo_init_##proto () \ 135 echo_main_t *em = &echo_main; \ 136 em->available_proto_cb_vft[proto] = &vft; \ 142 #define _(type, name) type name; 214 vl_api_connect_uri_reply_t *
bmp;
228 void (*set_defaults_before_opts_cb) (void);
229 void (*set_defaults_after_opts_cb) (void);
230 void (*print_usage_cb) (void);
#define foreach_app_session_field
flag for dgram mode
volatile u64 accepted_session_count
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
teardown_stat_t clean_count
u8 * format_ip46_address(u8 *s, va_list *args)
uword unformat_data(unformat_input_t *input, va_list *args)
vl_api_connect_uri_reply_t * bmp
echo_session_t * sessions
clib_spinlock_t sid_vpp_handles_lock
u8 use_sock_api
Flag that decides if socket, instead of svm, api is used to connect to vpp.
svm_queue_t * vl_input_queue
uword unformat_ip6_address(unformat_input_t *input, va_list *args)
void echo_send_listen(echo_main_t *em)
echo_session_t * echo_session_new(echo_main_t *em)
u8 * echo_format_timing_event(u8 *s, va_list *args)
int wait_for_state_change(echo_main_t *em, connection_state_t state, f64 timeout)
void echo_send_attach(echo_main_t *em)
volatile connection_state_t state
void echo_send_detach(echo_main_t *em)
echo_session_t * echo_get_session_from_handle(echo_main_t *em, u64 handle)
foreach_app_session_field u64 vpp_session_handle
volatile u32 n_clients_connected
volatile u64 bytes_received
void echo_api_hookup(echo_main_t *em)
void echo_send_connect(u8 *uri, u32 opaque)
#define foreach_echo_fail_code
u8 * format_api_error(u8 *s, va_list *args)
clib_spinlock_t segment_handles_lock
vhost_vring_state_t state
struct teardown_stat_ teardown_stat_t
void init_error_string_table()
pthread_t mq_thread_handle
uword echo_unformat_timing_event(unformat_input_t *input, va_list *args)
uword unformat_ip4_address(unformat_input_t *input, va_list *args)
uword echo_unformat_close(unformat_input_t *input, va_list *args)
u8 * format_transport_proto(u8 *s, va_list *args)
uword * error_string_by_error_number
uword unformat_transport_proto(unformat_input_t *input, va_list *args)
fifo_segment_main_t segment_main
data_source_t data_source
u8 * format_ip4_address(u8 *s, va_list *args)
enum echo_test_evt_ echo_test_evt_t
svm_msg_q_t * our_event_queue
int echo_send_rpc(echo_main_t *em, void *fp, void *arg, u32 opaque)
u8 * format_ip6_address(u8 *s, va_list *args)
uword * shared_segment_handles
u32 *volatile data_thread_args
void echo_session_handle_add_del(echo_main_t *em, u64 handle, u32 sid)
union session_connected_bundled_msg_ session_connected_bundled_msg_t
teardown_stat_t reset_count
void echo_notify_event(echo_main_t *em, echo_test_evt_t e)
volatile u32 nxt_available_sidx
char * echo_fail_code_str[]
int wait_for_segment_allocation(u64 segment_handle)
struct echo_proto_cb_vft_ echo_proto_cb_vft_t
void echo_send_unbind(echo_main_t *em)
void echo_send_disconnect_session(u64 handle, u32 opaque)
teardown_stat_t close_count
volatile u64 bytes_to_receive
void echo_session_print_stats(echo_main_t *em, echo_session_t *session)
teardown_stat_t active_count
uword * session_index_by_vpp_handles
struct _svm_queue svm_queue_t
svm_msg_q_t * rpc_msq_queue
echo_proto_cb_vft_t * proto_cb_vft
pthread_t * data_thread_handles
void(* echo_rpc_t)(void *arg, u32 opaque)
session_connected_msg_t * mp
u8 send_stream_disconnects
u8 * echo_format_app_state(u8 *s, va_list *args)