diff options
Diffstat (limited to 'src/plugins/avf/cli.c')
-rw-r--r-- | src/plugins/avf/cli.c | 62 |
1 files changed, 19 insertions, 43 deletions
diff --git a/src/plugins/avf/cli.c b/src/plugins/avf/cli.c index 47b4b9236f2..391ff25567a 100644 --- a/src/plugins/avf/cli.c +++ b/src/plugins/avf/cli.c @@ -30,37 +30,31 @@ static clib_error_t * avf_create_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { - unformat_input_t _line_input, *line_input = &_line_input; avf_create_if_args_t args; u32 tmp; clib_memset (&args, 0, sizeof (avf_create_if_args_t)); - /* Get a line of input. */ - if (!unformat_user (input, unformat_line_input, line_input)) - return 0; - - while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) + while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { - if (unformat (line_input, "%U", unformat_vlib_pci_addr, &args.addr)) + if (unformat (input, "%U", unformat_vlib_pci_addr, &args.addr)) ; - else if (unformat (line_input, "elog")) + else if (unformat (input, "elog")) args.enable_elog = 1; - else if (unformat (line_input, "rx-queue-size %u", &tmp)) + else if (unformat (input, "rx-queue-size %u", &tmp)) args.rxq_size = tmp; - else if (unformat (line_input, "tx-queue-size %u", &tmp)) + else if (unformat (input, "tx-queue-size %u", &tmp)) args.txq_size = tmp; - else if (unformat (line_input, "num-rx-queues %u", &tmp)) + else if (unformat (input, "num-rx-queues %u", &tmp)) args.rxq_num = tmp; - else if (unformat (line_input, "num-tx-queues %u", &tmp)) + else if (unformat (input, "num-tx-queues %u", &tmp)) args.txq_num = tmp; - else if (unformat (line_input, "name %s", &args.name)) + else if (unformat (input, "name %s", &args.name)) ; else return clib_error_return (0, "unknown input `%U'", format_unformat_error, input); } - unformat_free (line_input); avf_create_if (vm, &args); @@ -69,7 +63,6 @@ avf_create_command_fn (vlib_main_t * vm, unformat_input_t * input, return args.error; } -/* *INDENT-OFF* */ VLIB_CLI_COMMAND (avf_create_command, static) = { .path = "create interface avf", .short_help = "create interface avf <pci-address> " @@ -77,33 +70,26 @@ VLIB_CLI_COMMAND (avf_create_command, static) = { "[num-rx-queues <size>]", .function = avf_create_command_fn, }; -/* *INDENT-ON* */ static clib_error_t * avf_delete_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { - unformat_input_t _line_input, *line_input = &_line_input; u32 sw_if_index = ~0; vnet_hw_interface_t *hw; vnet_main_t *vnm = vnet_get_main (); - /* Get a line of input. */ - if (!unformat_user (input, unformat_line_input, line_input)) - return 0; - - while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) + while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { - if (unformat (line_input, "sw_if_index %d", &sw_if_index)) + if (unformat (input, "sw_if_index %d", &sw_if_index)) ; - else if (unformat (line_input, "%U", unformat_vnet_sw_interface, - vnm, &sw_if_index)) + else if (unformat (input, "%U", unformat_vnet_sw_interface, vnm, + &sw_if_index)) ; else return clib_error_return (0, "unknown input `%U'", format_unformat_error, input); } - unformat_free (line_input); if (sw_if_index == ~0) return clib_error_return (0, @@ -119,7 +105,6 @@ avf_delete_command_fn (vlib_main_t * vm, unformat_input_t * input, return 0; } -/* *INDENT-OFF* */ VLIB_CLI_COMMAND (avf_delete_command, static) = { .path = "delete interface avf", .short_help = "delete interface avf " @@ -127,41 +112,34 @@ VLIB_CLI_COMMAND (avf_delete_command, static) = { .function = avf_delete_command_fn, .is_mp_safe = 1, }; -/* *INDENT-ON* */ static clib_error_t * avf_test_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { - unformat_input_t _line_input, *line_input = &_line_input; u32 sw_if_index = ~0; vnet_hw_interface_t *hw; avf_device_t *ad; vnet_main_t *vnm = vnet_get_main (); int test_irq = 0, enable_elog = 0, disable_elog = 0; - /* Get a line of input. */ - if (!unformat_user (input, unformat_line_input, line_input)) - return 0; - - while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) + while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { - if (unformat (line_input, "sw_if_index %d", &sw_if_index)) + if (unformat (input, "sw_if_index %d", &sw_if_index)) ; - else if (unformat (line_input, "irq")) + else if (unformat (input, "irq")) test_irq = 1; - else if (unformat (line_input, "elog-on")) + else if (unformat (input, "elog-on")) enable_elog = 1; - else if (unformat (line_input, "elog-off")) + else if (unformat (input, "elog-off")) disable_elog = 1; - else if (unformat (line_input, "%U", unformat_vnet_sw_interface, - vnm, &sw_if_index)) + else if (unformat (input, "%U", unformat_vnet_sw_interface, vnm, + &sw_if_index)) ; else return clib_error_return (0, "unknown input `%U'", format_unformat_error, input); } - unformat_free (line_input); if (sw_if_index == ~0) return clib_error_return (0, @@ -185,14 +163,12 @@ avf_test_command_fn (vlib_main_t * vm, unformat_input_t * input, return 0; } -/* *INDENT-OFF* */ VLIB_CLI_COMMAND (avf_test_command, static) = { .path = "test avf", .short_help = "test avf [<interface> | sw_if_index <sw_idx>] [irq] " "[elog-on] [elog-off]", .function = avf_test_command_fn, }; -/* *INDENT-ON* */ clib_error_t * avf_cli_init (vlib_main_t * vm) |