#define __included_vpp_echo_common_h__
#include <vnet/session/application_interface.h>
-#include <vpp/api/vpe_msg_enum.h>
-
-#define vl_typedefs /* define message structures */
-#include <vpp/api/vpe_all_api_h.h>
-#undef vl_typedefs
-
-/* declare message handlers for each api */
-
-#define vl_endianfun /* define message structures */
-#include <vpp/api/vpe_all_api_h.h>
-#undef vl_endianfun
-
-/* instantiate all the print functions we know about */
-#define vl_print(handle, ...)
-#define vl_printfun
-#include <vpp/api/vpe_all_api_h.h>
-#undef vl_printfun
+#include <vnet/format_fns.h>
+#include <vnet/session/session.api_enum.h>
+#include <vnet/session/session.api_types.h>
#define TIMEOUT 10.0
#define LOGGING_BATCH (100)
+#define LOG_EVERY_N_IDLE_CYCLES (1e8)
+#define ECHO_MQ_SEG_HANDLE ((u64) ~0 - 1)
+
+#define ECHO_INVALID_SEGMENT_INDEX ((u32) ~0)
+#define ECHO_INVALID_SEGMENT_HANDLE ((u64) ~0)
#define foreach_echo_fail_code \
_(ECHO_FAIL_NONE, "ECHO_FAIL_NONE") \
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
typedef union session_connected_bundled_msg_
{
session_connected_msg_t *mp;
- vl_api_connect_uri_reply_t *bmp;
} session_connected_bundled_msg_t;
typedef struct echo_proto_cb_vft_
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 */
u32 my_client_index; /* API client handle */
u8 *uri; /* The URI we're playing with */
+ u8 *app_name;
u32 n_uris; /* Cycle through adjacent ips */
ip46_address_t lcl_ip; /* Local ip for client */
u8 lcl_ip_set;
svm_msg_q_t *ctrl_mq; /* Our control queue (towards vpp) */
clib_time_t clib_time; /* For deadman timers */
u8 *socket_name;
+ u8 use_app_socket_api;
+ clib_socket_t app_api_sock;
int i_am_master;
u32 *listen_session_indexes; /* vec of vpp listener sessions */
volatile u32 listen_session_cnt;
uword *shared_segment_handles; /* Hash table : segment_names -> 1 */
clib_spinlock_t segment_handles_lock; /* Hash table lock */
echo_proto_cb_vft_t *proto_cb_vft;
- svm_msg_q_t *rpc_msq_queue; /* MQ between quic_echo threads */
+ svm_msg_q_t rpc_msq_queue; /* MQ between quic_echo threads */
fifo_segment_main_t segment_main;
/* State of the connection, shared between msg RX thread and main thread */
u32 prealloc_fifo_pairs;
u64 rx_buf_size;
u64 tx_buf_size;
- data_source_t data_source; /* Use no/dummy/mirrored data */
+ data_source_t data_source; /* Use no/placeholder/mirrored data */
u8 send_stream_disconnects; /* actively send disconnect */
u8 output_json; /* Output stats as JSON */
volatile u8 wait_for_gdb; /* Wait for gdb to attach */
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;
/* 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 */
{
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_segment_attach (u64 segment_handle, char *name,
+ ssvm_segment_type_t type, int fd);
+u32 echo_segment_lookup (u64 segment_handle);
+void echo_segment_detach (u64 segment_handle);
+int echo_attach_session (uword segment_handle, uword rxf_offset,
+ uword mq_offset, uword txf_offset, echo_session_t *s);
+int echo_segment_attach_mq (uword segment_handle, uword mq_offset,
+ u32 mq_index, svm_msg_q_t **mq);
+svm_fifo_chunk_t *echo_segment_alloc_chunk (uword segment_handle,
+ u32 slice_index, u32 size,
+ uword *offset);
/* Binary API */
void echo_api_hookup (echo_main_t * em);
void echo_send_add_cert_key (echo_main_t * em);
void echo_send_del_cert_key (echo_main_t * em);
+int echo_bapi_recv_fd (echo_main_t *em, int *fds, int n_fds);
+
+/* Session socket API */
+int echo_sapi_attach (echo_main_t *em);
+int echo_sapi_add_cert_key (echo_main_t *em);
+int echo_sapi_del_cert_key (echo_main_t *em);
+int echo_api_connect_app_socket (echo_main_t *em);
+int echo_sapi_detach (echo_main_t *em);
+int echo_sapi_recv_fd (echo_main_t *em, int *fds, int n_fds);
#endif /* __included_vpp_echo_common_h__ */