From e3b70df8243e6655bcefb295cffcada322ac9b57 Mon Sep 17 00:00:00 2001 From: Dave Wallace Date: Wed, 30 Oct 2019 16:49:35 +0000 Subject: hsa: vpp_echo fifo size is u32 - Fix cli / config fifo size to only accept u32 size input. - Make cli / config fifo-size input type handling to be the same as vpp hoststack - Clean up vpp_echo usage output - Clean up json close stats labels to make them less confusing Type: fix Change-Id: I3aa2247f75a4ce284be9e7c0adc71ba488bfbf2b Signed-off-by: Dave Wallace --- src/plugins/hs_apps/sapi/vpp_echo.c | 34 ++++++++++++++++---------- src/plugins/hs_apps/sapi/vpp_echo_proto_quic.c | 4 +-- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/plugins/hs_apps/sapi/vpp_echo.c b/src/plugins/hs_apps/sapi/vpp_echo.c index e460aa2bf25..93291e7e7b6 100644 --- a/src/plugins/hs_apps/sapi/vpp_echo.c +++ b/src/plugins/hs_apps/sapi/vpp_echo.c @@ -154,9 +154,9 @@ print_global_json_stats (echo_main_t * em) fformat (stdout, " \"closing\": {\n"); fformat (stdout, " \"reset\": { \"q\": %d, \"s\": %d },\n", em->stats.reset_count.q, em->stats.reset_count.s); - fformat (stdout, " \"close\": { \"q\": %d, \"s\": %d },\n", + fformat (stdout, " \"recv evt\": { \"q\": %d, \"s\": %d },\n", em->stats.close_count.q, em->stats.close_count.s); - fformat (stdout, " \"active\": { \"q\": %d, \"s\": %d },\n", + fformat (stdout, " \"send evt\": { \"q\": %d, \"s\": %d },\n", em->stats.active_count.q, em->stats.active_count.s); fformat (stdout, " \"clean\": { \"q\": %d, \"s\": %d }\n", em->stats.clean_count.q, em->stats.clean_count.s); @@ -844,17 +844,17 @@ print_usage_and_exit (void) " socket-name PATH Specify the binary socket path to connect to VPP\n" " use-svm-api Use SVM API to connect to VPP\n" " test-bytes[:assert] Check data correctness when receiving (assert fails on first error)\n" - " fifo-size N Use N Kb fifos\n" + " fifo-size N[K|M|G] Use N[K|M|G] fifos\n" " mq-size N Use N event slots for vpp_echo <-> vpp events\n" - " rx-buf N[Kb|Mb|GB] Use N[Kb|Mb|GB] RX buffer\n" - " tx-buf N[Kb|Mb|GB] Use N[Kb|Mb|GB] TX test buffer\n" + " rx-buf N[K|M|G] Use N[Kb|Mb|GB] RX buffer\n" + " tx-buf N[K|M|G] Use N[Kb|Mb|GB] TX test buffer\n" " appns NAMESPACE Use the namespace NAMESPACE\n" " all-scope all-scope option\n" " local-scope local-scope option\n" " global-scope global-scope option\n" " secret SECRET set namespace secret\n" " chroot prefix PATH Use PATH as memory root path\n" - " sclose=[Y|N|W] When a stream is done, pass[N] send[Y] or wait[W] for close\n" + " sclose=[Y|N|W] When stream is done, send[Y]|nop[N]|wait[W] for close\n" "\n" " time START:END Time between evts START & END, events being :\n" " start - Start of the app\n" @@ -871,8 +871,8 @@ print_usage_and_exit (void) "\n" " nclients N Open N clients sending data\n" " nthreads N Use N busy loop threads for data [in addition to main & msg queue]\n" - " TX=1337[Kb|Mb|GB] Send 1337 [K|M|G]bytes, use TX=RX to reflect the data\n" - " RX=1337[Kb|Mb|GB] Expect 1337 [K|M|G]bytes\n" "\n"); + " TX=1337[K|M|G]|RX Send 1337 [K|M|G]bytes, use TX=RX to reflect the data\n" + " RX=1337[K|M|G] Expect 1337 [K|M|G]bytes\n" "\n"); for (i = 0; i < TRANSPORT_N_PROTO; i++) { echo_proto_cb_vft_t *vft = em->available_proto_cb_vft[i]; @@ -880,8 +880,8 @@ print_usage_and_exit (void) vft->print_usage_cb (); } fprintf (stderr, "\nDefault configuration is :\n" - " server nclients 1/1 RX=64Kb TX=RX\n" - " client nclients 1/1 RX=64Kb TX=64Kb\n"); + " server nclients 1 [quic-streams 1] RX=64Kb TX=RX\n" + " client nclients 1 [quic-streams 1] RX=64Kb TX=64Kb\n"); exit (ECHO_FAIL_USAGE); } @@ -917,10 +917,10 @@ echo_process_opts (int argc, char **argv) { echo_main_t *em = &echo_main; unformat_input_t _argv, *a = &_argv; - u32 tmp; u8 *chroot_prefix; u8 *uri = 0; u8 default_f_active; + uword tmp; unformat_init_command_line (a, argv); while (unformat_check_input (a) != UNFORMAT_END_OF_INPUT) @@ -943,8 +943,16 @@ echo_process_opts (int argc, char **argv) ; else if (unformat (a, "use-svm-api")) em->use_sock_api = 0; - else if (unformat (a, "fifo-size %d", &tmp)) - em->fifo_size = tmp << 10; + else if (unformat (a, "fifo-size %U", unformat_memory_size, &tmp)) + { + if (tmp >= 0x100000000ULL) + { + fprintf (stderr, + "ERROR: fifo-size %ld (0x%lx) too large\n", tmp, tmp); + print_usage_and_exit (); + } + em->fifo_size = tmp; + } else if (unformat (a, "prealloc-fifos %u", &em->prealloc_fifo_pairs)) ; else diff --git a/src/plugins/hs_apps/sapi/vpp_echo_proto_quic.c b/src/plugins/hs_apps/sapi/vpp_echo_proto_quic.c index db777c8178c..e85c1f3e1eb 100644 --- a/src/plugins/hs_apps/sapi/vpp_echo_proto_quic.c +++ b/src/plugins/hs_apps/sapi/vpp_echo_proto_quic.c @@ -487,9 +487,9 @@ quic_echo_print_usage_cb () " On each one server opens M streams\n" " OPT=default : Client open N connections.\n" " On each one client opens M streams\n" - " qclose=[Y|N|W] When a connection is done pass[N] send[Y] or wait[W] for close\n" + " qclose=[Y|N|W] When connection is done send[Y]|nop[N]|wait[W] for close\n" "\n" - " nclients N[/M] Open N QUIC connections, each one with M streams (M defaults to 1)\n"); + " quic-streams N Open N QUIC streams (defaults to 1)\n"); } echo_proto_cb_vft_t quic_echo_proto_cb_vft = { -- cgit 1.2.3-korg