hsa: vpp_echo fifo size is u32 04/23104/2
authorDave Wallace <dwallacelf@gmail.com>
Wed, 30 Oct 2019 16:49:35 +0000 (16:49 +0000)
committerFlorin Coras <florin.coras@gmail.com>
Wed, 30 Oct 2019 19:51:33 +0000 (19:51 +0000)
- 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 <dwallacelf@gmail.com>
src/plugins/hs_apps/sapi/vpp_echo.c
src/plugins/hs_apps/sapi/vpp_echo_proto_quic.c

index e460aa2..93291e7 100644 (file)
@@ -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
index db777c8..e85c1f3 100644 (file)
@@ -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 = {