aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/hs_apps/sapi
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/hs_apps/sapi')
-rw-r--r--src/plugins/hs_apps/sapi/vpp_echo.c26
-rw-r--r--src/plugins/hs_apps/sapi/vpp_echo_common.h14
2 files changed, 20 insertions, 20 deletions
diff --git a/src/plugins/hs_apps/sapi/vpp_echo.c b/src/plugins/hs_apps/sapi/vpp_echo.c
index 7bc651e5a4a..feb39f8db5e 100644
--- a/src/plugins/hs_apps/sapi/vpp_echo.c
+++ b/src/plugins/hs_apps/sapi/vpp_echo.c
@@ -43,22 +43,18 @@ static void
echo_assert_test_suceeded (echo_main_t * em)
{
if (em->rx_results_diff)
- CHECK_DIFF (ECHO_FAIL_TEST_ASSERT_RX_TOTAL,
- em->n_clients * em->bytes_to_receive, em->stats.rx_total,
- "Invalid amount of data received");
+ CHECK_DIFF (ECHO_FAIL_TEST_ASSERT_RX_TOTAL, em->stats.rx_expected,
+ em->stats.rx_total, "Invalid amount of data received");
else
- CHECK_SAME (ECHO_FAIL_TEST_ASSERT_RX_TOTAL,
- em->n_clients * em->bytes_to_receive, em->stats.rx_total,
- "Invalid amount of data received");
+ CHECK_SAME (ECHO_FAIL_TEST_ASSERT_RX_TOTAL, em->stats.rx_expected,
+ em->stats.rx_total, "Invalid amount of data received");
if (em->tx_results_diff)
- CHECK_DIFF (ECHO_FAIL_TEST_ASSERT_TX_TOTAL,
- em->n_clients * em->bytes_to_send, em->stats.tx_total,
- "Invalid amount of data sent");
+ CHECK_DIFF (ECHO_FAIL_TEST_ASSERT_TX_TOTAL, em->stats.tx_expected,
+ em->stats.tx_total, "Invalid amount of data sent");
else
- CHECK_SAME (ECHO_FAIL_TEST_ASSERT_TX_TOTAL,
- em->n_clients * em->bytes_to_send, em->stats.tx_total,
- "Invalid amount of data sent");
+ CHECK_SAME (ECHO_FAIL_TEST_ASSERT_TX_TOTAL, em->stats.tx_expected,
+ em->stats.tx_total, "Invalid amount of data sent");
clib_spinlock_lock (&em->sid_vpp_handles_lock);
CHECK_SAME (ECHO_FAIL_TEST_ASSERT_ALL_SESSIONS_CLOSED,
@@ -242,8 +238,7 @@ echo_update_count_on_session_close (echo_main_t * em, echo_session_t * s)
clib_atomic_fetch_add (&em->stats.tx_total, s->bytes_sent);
clib_atomic_fetch_add (&em->stats.rx_total, s->bytes_received);
- if (PREDICT_FALSE (em->stats.rx_total ==
- em->n_clients * em->bytes_to_receive))
+ if (PREDICT_FALSE (em->stats.rx_total == em->stats.rx_expected))
echo_notify_event (em, ECHO_EVT_LAST_BYTE);
}
@@ -1118,6 +1113,9 @@ main (int argc, char **argv)
if (em->proto_cb_vft->set_defaults_after_opts_cb)
em->proto_cb_vft->set_defaults_after_opts_cb ();
+ em->stats.rx_expected = em->bytes_to_receive * em->n_clients;
+ em->stats.tx_expected = em->bytes_to_send * em->n_clients;
+
vec_validate (em->data_thread_handles, em->n_rx_threads);
vec_validate (em->data_thread_args, em->n_clients);
for (i = 0; i < em->n_clients; i++)
diff --git a/src/plugins/hs_apps/sapi/vpp_echo_common.h b/src/plugins/hs_apps/sapi/vpp_echo_common.h
index de7d8c04ad0..f1472510314 100644
--- a/src/plugins/hs_apps/sapi/vpp_echo_common.h
+++ b/src/plugins/hs_apps/sapi/vpp_echo_common.h
@@ -108,15 +108,15 @@ extern char *echo_fail_code_str[];
#define CHECK_SAME(fail, expected, result, _fmt, _args...) \
do { \
if ((expected) != (result)) \
- ECHO_FAIL ((fail), "expected same (%d, got %d) : "_fmt, \
- (expected), (result), ##_args); \
+ ECHO_FAIL ((fail), "expected same (%lld, got %lld) : "_fmt, \
+ (u64)(expected), (u64)(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); \
+ ECHO_FAIL ((fail), "expected different (both %lld) : "_fmt, \
+ (u64)(expected), ##_args); \
} while (0)
#define ECHO_FAIL(fail, _fmt, _args...) \
@@ -124,10 +124,10 @@ do { \
echo_main_t *em = &echo_main; \
em->has_failed = (fail); \
if (vec_len(em->fail_descr)) \
- em->fail_descr = format(em->fail_descr, " | %s (%d): "_fmt, \
+ em->fail_descr = format(em->fail_descr, " | %s (%u): "_fmt, \
echo_fail_code_str[fail], fail, ##_args); \
else \
- em->fail_descr = format(0, "%s (%d): "_fmt, \
+ em->fail_descr = format(0, "%s (%u): "_fmt, \
echo_fail_code_str[fail], fail, ##_args); \
em->time_to_stop = 1; \
if (em->log_lvl > 0) \
@@ -333,6 +333,8 @@ typedef 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 */