summaryrefslogtreecommitdiffstats
path: root/src/plugins/hs_apps/sapi/vpp_echo_common.h
diff options
context:
space:
mode:
authorDave Wallace <dwallacelf@gmail.com>2019-09-25 17:58:24 -0400
committerFlorin Coras <florin.coras@gmail.com>2019-10-09 00:29:41 +0000
commitff5a9b6ecd744ff5c42e6c2388dd31a338ea6a0c (patch)
tree7b756ed4cd8f631db0096b7e7b6dfb71735ea9c2 /src/plugins/hs_apps/sapi/vpp_echo_common.h
parent2fd44a00aa26188ca75f0accd734f21758c199bf (diff)
hsa: fix vpp_echo session close
- Convert asserts in vpp_echo to conditional checks - Refactor error logging for session creation/deletion - Fix session close anomalies - Fix ECHO_* macros - Add rx/tx results different cmdline options to specify pass when counters are different - Update close tests to send more than the fifo sizes of data - Specify rx/tx results diff options for early close tests - Set listen session state to closed on handling unlisten reply Type: fix Signed-off-by: Dave Wallace <dwallacelf@gmail.com> Change-Id: I9d0075fcb18e20829f420da104d69523897b0552
Diffstat (limited to 'src/plugins/hs_apps/sapi/vpp_echo_common.h')
-rw-r--r--src/plugins/hs_apps/sapi/vpp_echo_common.h32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/plugins/hs_apps/sapi/vpp_echo_common.h b/src/plugins/hs_apps/sapi/vpp_echo_common.h
index ea20e2b9e09..a7010d85cb7 100644
--- a/src/plugins/hs_apps/sapi/vpp_echo_common.h
+++ b/src/plugins/hs_apps/sapi/vpp_echo_common.h
@@ -39,12 +39,15 @@
#define foreach_echo_fail_code \
_(ECHO_FAIL_NONE, "ECHO_FAIL_NONE") \
+ _(ECHO_FAIL_USAGE, "ECHO_FAIL_USAGE") \
_(ECHO_FAIL_SEND_IO_EVT, "ECHO_FAIL_SEND_IO_EVT") \
_(ECHO_FAIL_SOCKET_CONNECT, "ECHO_FAIL_SOCKET_CONNECT") \
_(ECHO_FAIL_INIT_SHM_API, "ECHO_FAIL_INIT_SHM_API") \
_(ECHO_FAIL_SHMEM_CONNECT, "ECHO_FAIL_SHMEM_CONNECT") \
_(ECHO_FAIL_TEST_BYTES_ERR, "ECHO_FAIL_TEST_BYTES_ERR") \
_(ECHO_FAIL_BIND, "ECHO_FAIL_BIND") \
+ _(ECHO_FAIL_SESSION_ACCEPTED_BAD_LISTENER, \
+ "ECHO_FAIL_SESSION_ACCEPTED_BAD_LISTENER") \
_(ECHO_FAIL_ACCEPTED_WAIT_FOR_SEG_ALLOC, \
"ECHO_FAIL_ACCEPTED_WAIT_FOR_SEG_ALLOC") \
_(ECHO_FAIL_SESSION_CONNECT, "ECHO_FAIL_SESSION_CONNECT") \
@@ -65,6 +68,7 @@
_(ECHO_FAIL_VL_API_APP_ATTACH, "ECHO_FAIL_VL_API_APP_ATTACH") \
_(ECHO_FAIL_VL_API_MISSING_SEGMENT_NAME, \
"ECHO_FAIL_VL_API_MISSING_SEGMENT_NAME") \
+ _(ECHO_FAIL_VL_API_NULL_APP_MQ, "ECHO_FAIL_VL_API_NULL_APP_MQ") \
_(ECHO_FAIL_VL_API_RECV_FD_MSG, "ECHO_FAIL_VL_API_RECV_FD_MSG") \
_(ECHO_FAIL_VL_API_SVM_FIFO_SEG_ATTACH, \
"ECHO_FAIL_VL_API_SVM_FIFO_SEG_ATTACH") \
@@ -101,15 +105,24 @@ typedef enum
extern char *echo_fail_code_str[];
-#define CHECK(fail, expected, result, _fmt, _args...) \
- if (expected != result) \
- ECHO_FAIL (fail, "expected %d, got %d : " _fmt, expected, \
- result, ##_args); \
+#define CHECK_SAME(fail, expected, result, _fmt, _args...) \
+do { \
+ if ((expected) != (result)) \
+ ECHO_FAIL ((fail), "expected same (%d, got %d) : "_fmt, \
+ (expected), (result), ##_args); \
+} while (0)
+
+#define CHECK_DIFF(fail, expected, result, _fmt, _args...) \
+do { \
+ if ((expected) == (result)) \
+ ECHO_FAIL ((fail), "expected different (both %d) : "_fmt, \
+ (expected), ##_args); \
+} while (0)
#define ECHO_FAIL(fail, _fmt, _args...) \
- { \
+do { \
echo_main_t *em = &echo_main; \
- em->has_failed = fail; \
+ em->has_failed = (fail); \
if (vec_len(em->fail_descr)) \
em->fail_descr = format(em->fail_descr, " | %s (%d): "_fmt, \
echo_fail_code_str[fail], fail, ##_args); \
@@ -119,7 +132,7 @@ extern char *echo_fail_code_str[];
em->time_to_stop = 1; \
if (em->log_lvl > 0) \
clib_warning ("%v", em->fail_descr); \
- }
+} while (0)
#define ECHO_LOG(lvl, _fmt,_args...) \
{ \
@@ -270,6 +283,8 @@ typedef struct
/* State of the connection, shared between msg RX thread and main thread */
volatile connection_state_t state;
volatile u8 time_to_stop; /* Signal variables */
+ u8 rx_results_diff; /* Rx results will be different than cfg */
+ u8 tx_results_diff; /* Tx results will be different than cfg */
u8 has_failed; /* stores the exit code */
u8 *fail_descr; /* vector containing fail description */
@@ -359,6 +374,9 @@ u8 *format_ip46_address (u8 * s, va_list * args);
uword unformat_data (unformat_input_t * input, va_list * args);
u8 *format_api_error (u8 * s, va_list * args);
void init_error_string_table ();
+u8 *echo_format_session (u8 * s, va_list * args);
+u8 *echo_format_session_type (u8 * s, va_list * args);
+u8 *echo_format_session_state (u8 * s, va_list * args);
u8 *echo_format_app_state (u8 * s, va_list * args);
uword echo_unformat_close (unformat_input_t * input, va_list * args);
uword echo_unformat_timing_event (unformat_input_t * input, va_list * args);