X-Git-Url: https://gerrit.fd.io/r/gitweb?p=vpp.git;a=blobdiff_plain;f=src%2Fplugins%2Fhs_apps%2Fsapi%2Fvpp_echo_common.h;h=f01bb0390f6a810441255327b88b55c258e3dab2;hp=5588b279327ae881ad71efc99b2f42ab0331cae0;hb=07063b8ea;hpb=f98e59b86d886ad819e98e88b672dbd7c9560edf diff --git a/src/plugins/hs_apps/sapi/vpp_echo_common.h b/src/plugins/hs_apps/sapi/vpp_echo_common.h index 5588b279327..f01bb0390f6 100644 --- a/src/plugins/hs_apps/sapi/vpp_echo_common.h +++ b/src/plugins/hs_apps/sapi/vpp_echo_common.h @@ -37,6 +37,7 @@ #define TIMEOUT 10.0 #define LOGGING_BATCH (100) +#define LOG_EVERY_N_IDLE_CYCLES (1e8) #define foreach_echo_fail_code \ _(ECHO_FAIL_NONE, "ECHO_FAIL_NONE") \ @@ -94,6 +95,7 @@ _(ECHO_FAIL_MISSING_START_EVENT, "ECHO_FAIL_MISSING_START_EVENT") \ _(ECHO_FAIL_MISSING_END_EVENT, "ECHO_FAIL_MISSING_END_EVENT") \ _(ECHO_FAIL_TEST_ASSERT_RX_TOTAL, "ECHO_FAIL_TEST_ASSERT_RX_TOTAL") \ + _(ECHO_FAIL_UNIDIRECTIONAL, "ECHO_FAIL_UNIDIRECTIONAL") \ _(ECHO_FAIL_TEST_ASSERT_TX_TOTAL, "ECHO_FAIL_TEST_ASSERT_TX_TOTAL") \ _(ECHO_FAIL_TEST_ASSERT_ALL_SESSIONS_CLOSED, \ "ECHO_FAIL_TEST_ASSERT_ALL_SESSIONS_CLOSED") \ @@ -144,12 +146,13 @@ do { \ clib_warning (_fmt, ##_args); \ } -#define ECHO_REGISTER_PROTO(proto, vft) \ - static void __clib_constructor \ - vpp_echo_init_##proto () \ - { \ - echo_main_t *em = &echo_main; \ - em->available_proto_cb_vft[proto] = &vft; \ +#define ECHO_REGISTER_PROTO(proto, vft) \ + static void __clib_constructor \ + vpp_echo_init_##proto () \ + { \ + echo_main_t *em = &echo_main; \ + vec_validate (em->available_proto_cb_vft, proto); \ + em->available_proto_cb_vft[proto] = &vft; \ } typedef struct @@ -261,6 +264,20 @@ typedef struct teardown_stat_ u32 s; /* stream sessions */ } teardown_stat_t; +typedef struct echo_stats_ +{ + u64 tx_total; + u64 rx_total; + u64 tx_expected; + u64 rx_expected; + teardown_stat_t reset_count; /* received reset from vpp */ + teardown_stat_t close_count; /* received close from vpp */ + teardown_stat_t active_count; /* sent close to vpp */ + teardown_stat_t clean_count; /* cleaned up stale session */ + teardown_stat_t connected_count; /* connected sessions count */ + teardown_stat_t accepted_count; /* connected sessions count */ +} echo_stats_t; + typedef struct { svm_queue_t *vl_input_queue; /* vpe input queue */ @@ -317,6 +334,8 @@ typedef struct u32 evt_q_size; /* Size of the vpp MQ (app<->vpp events) */ u32 ckpair_index; /* Cert key pair used */ u8 crypto_engine; /* crypto engine used */ + u8 connect_flag; /* flags to pass to mq connect */ + u32 periodic_stats_delta; /* seconds between periodic stats */ u8 *appns_id; u64 appns_flags; @@ -338,21 +357,11 @@ typedef struct /* VNET_API_ERROR_FOO -> "Foo" hash table */ uword *error_string_by_error_number; - echo_proto_cb_vft_t *available_proto_cb_vft[TRANSPORT_N_PROTO]; + echo_proto_cb_vft_t **available_proto_cb_vft; - struct - { - u64 tx_total; - u64 rx_total; - u64 tx_expected; - u64 rx_expected; - teardown_stat_t reset_count; /* received reset from vpp */ - teardown_stat_t close_count; /* received close from vpp */ - teardown_stat_t active_count; /* sent close to vpp */ - teardown_stat_t clean_count; /* cleaned up stale session */ - teardown_stat_t connected_count; /* connected sessions count */ - teardown_stat_t accepted_count; /* connected sessions count */ - } stats; + echo_stats_t stats; + echo_stats_t last_stat_sampling; /* copy of stats at last sampling */ + f64 last_stat_sampling_ts; struct /* Event based timing : start & end depend on CLI specified events */ { @@ -424,13 +433,16 @@ void echo_session_handle_add_del (echo_main_t * em, u64 handle, u32 sid); echo_session_t *echo_session_new (echo_main_t * em); int echo_send_rpc (echo_main_t * em, void *fp, echo_rpc_args_t * args); echo_session_t *echo_get_session_from_handle (echo_main_t * em, u64 handle); -int wait_for_segment_allocation (u64 segment_handle); int wait_for_state_change (echo_main_t * em, connection_state_t state, f64 timeout); void echo_notify_event (echo_main_t * em, echo_test_evt_t e); void echo_session_print_stats (echo_main_t * em, echo_session_t * session); u8 *echo_format_crypto_engine (u8 * s, va_list * args); uword echo_unformat_crypto_engine (unformat_input_t * input, va_list * args); +u8 *echo_format_bytes_per_sec (u8 * s, va_list * args); +int echo_ssvm_segment_attach (char *name, ssvm_segment_type_t type, int fd); +void echo_segment_handle_add_del (echo_main_t * em, u64 segment_handle, + u8 add); /* Binary API */