hsa: vpp_echo remove redundant unformat function 76/22676/3
authorDave Wallace <dwallacelf@gmail.com>
Fri, 11 Oct 2019 15:13:39 +0000 (15:13 +0000)
committerFlorin Coras <florin.coras@gmail.com>
Fri, 11 Oct 2019 20:05:52 +0000 (20:05 +0000)
Type: refactor

Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Change-Id: Ifae49981458cd3ef9e2c79d64040b2076ad93869

src/plugins/hs_apps/sapi/vpp_echo.c
src/plugins/hs_apps/sapi/vpp_echo_common.c
src/plugins/hs_apps/sapi/vpp_echo_common.h

index 4392168..7bc651e 100644 (file)
@@ -950,9 +950,11 @@ echo_process_opts (int argc, char **argv)
        em->fifo_size = tmp << 10;
       else if (unformat (a, "prealloc-fifos %u", &em->prealloc_fifo_pairs))
        ;
-      else if (unformat (a, "rx-buf %U", unformat_data, &em->rx_buf_size))
+      else
+       if (unformat (a, "rx-buf %U", unformat_data_size, &em->rx_buf_size))
        ;
-      else if (unformat (a, "tx-buf %U", unformat_data, &em->tx_buf_size))
+      else
+       if (unformat (a, "tx-buf %U", unformat_data_size, &em->tx_buf_size))
        ;
       else if (unformat (a, "mq-size %d", &em->evt_q_size))
        ;
@@ -981,9 +983,10 @@ echo_process_opts (int argc, char **argv)
        ;
       else if (unformat (a, "TX=RX"))
        em->data_source = ECHO_RX_DATA_SOURCE;
-      else if (unformat (a, "TX=%U", unformat_data, &em->bytes_to_send))
+      else if (unformat (a, "TX=%U", unformat_data_size, &em->bytes_to_send))
        ;
-      else if (unformat (a, "RX=%U", unformat_data, &em->bytes_to_receive))
+      else if (unformat (a, "RX=%U", unformat_data_size,
+                        &em->bytes_to_receive))
        ;
       else if (unformat (a, "rx-results-diff"))
        em->rx_results_diff = 1;
index 06ce45c..be847b5 100644 (file)
@@ -113,30 +113,6 @@ format_ip46_address (u8 * s, va_list * args)
     format (s, "%U", format_ip6_address, &ip46->ip6);
 }
 
-uword
-unformat_data (unformat_input_t * input, va_list * args)
-{
-  u64 _a;
-  u64 *a = va_arg (*args, u64 *);
-  if (unformat (input, "%lluGb", &_a))
-    *a = _a << 30;
-  else if (unformat (input, "%lluG", &_a))
-    *a = _a << 30;
-  else if (unformat (input, "%lluMb", &_a))
-    *a = _a << 20;
-  else if (unformat (input, "%lluM", &_a))
-    *a = _a << 20;
-  else if (unformat (input, "%lluKb", &_a))
-    *a = _a << 10;
-  else if (unformat (input, "%lluK", &_a))
-    *a = _a << 10;
-  else if (unformat (input, "%llu", a))
-    ;
-  else
-    return 0;
-  return 1;
-}
-
 u8 *
 format_api_error (u8 * s, va_list * args)
 {
index a7010d8..de7d8c0 100644 (file)
@@ -299,8 +299,8 @@ typedef struct
   u64 bytes_to_receive;                /* target per stream */
   u32 fifo_size;
   u32 prealloc_fifo_pairs;
-  u32 rx_buf_size;
-  u32 tx_buf_size;
+  u64 rx_buf_size;
+  u64 tx_buf_size;
   data_source_t data_source;   /* Use no/dummy/mirrored data */
   u8 send_stream_disconnects;  /* actively send disconnect */
   u8 output_json;              /* Output stats as JSON */
@@ -371,7 +371,6 @@ typedef struct
 u8 *format_ip4_address (u8 * s, va_list * args);
 u8 *format_ip6_address (u8 * s, va_list * args);
 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);