diff options
author | Dave Wallace <dwallacelf@gmail.com> | 2019-10-11 15:13:39 +0000 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2019-10-11 20:05:52 +0000 |
commit | 4d62365ad69bd4c9e763712f89593e5c725a1ab7 (patch) | |
tree | fcf5818517a5d25d5ef816749c32f66b25ccbcbe | |
parent | 6df2c7954126a316f86908526c3bb4d649f06597 (diff) |
hsa: vpp_echo remove redundant unformat function
Type: refactor
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Change-Id: Ifae49981458cd3ef9e2c79d64040b2076ad93869
-rw-r--r-- | src/plugins/hs_apps/sapi/vpp_echo.c | 11 | ||||
-rw-r--r-- | src/plugins/hs_apps/sapi/vpp_echo_common.c | 24 | ||||
-rw-r--r-- | src/plugins/hs_apps/sapi/vpp_echo_common.h | 5 |
3 files changed, 9 insertions, 31 deletions
diff --git a/src/plugins/hs_apps/sapi/vpp_echo.c b/src/plugins/hs_apps/sapi/vpp_echo.c index 4392168aff2..7bc651e5a4a 100644 --- a/src/plugins/hs_apps/sapi/vpp_echo.c +++ b/src/plugins/hs_apps/sapi/vpp_echo.c @@ -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; diff --git a/src/plugins/hs_apps/sapi/vpp_echo_common.c b/src/plugins/hs_apps/sapi/vpp_echo_common.c index 06ce45c66c9..be847b57ace 100644 --- a/src/plugins/hs_apps/sapi/vpp_echo_common.c +++ b/src/plugins/hs_apps/sapi/vpp_echo_common.c @@ -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) { diff --git a/src/plugins/hs_apps/sapi/vpp_echo_common.h b/src/plugins/hs_apps/sapi/vpp_echo_common.h index a7010d85cb7..de7d8c04ad0 100644 --- a/src/plugins/hs_apps/sapi/vpp_echo_common.h +++ b/src/plugins/hs_apps/sapi/vpp_echo_common.h @@ -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); |