X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Favf%2Fcli.c;h=391ff25567a49864cf760d18c53817e2671981a9;hb=1a319aadc68c218f741a7cb23acbe70c4addae92;hp=29c2a6b1f6ea9abbca556bd31e14610518948fac;hpb=66bb7dd64ee2377103e18b96f1e6bf6405de44b5;p=vpp.git diff --git a/src/plugins/avf/cli.c b/src/plugins/avf/cli.c index 29c2a6b1f6e..391ff25567a 100644 --- a/src/plugins/avf/cli.c +++ b/src/plugins/avf/cli.c @@ -30,35 +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, "name %s", &args.name)) + else if (unformat (input, "num-tx-queues %u", &tmp)) + args.txq_num = tmp; + 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); @@ -67,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 " @@ -75,33 +70,26 @@ VLIB_CLI_COMMAND (avf_create_command, static) = { "[num-rx-queues ]", .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, @@ -117,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 " @@ -125,42 +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_main_t *am = &avf_main; 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, @@ -170,7 +149,7 @@ avf_test_command_fn (vlib_main_t * vm, unformat_input_t * input, if (hw == NULL || avf_device_class.index != hw->dev_class_index) return clib_error_return (0, "not a AVF interface"); - ad = pool_elt_at_index (am->devices, hw->dev_instance); + ad = avf_get_device (hw->dev_instance); if (enable_elog) ad->flags |= AVF_DEVICE_F_ELOG; @@ -184,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 [ | sw_if_index ] [irq] " "[elog-on] [elog-off]", .function = avf_test_command_fn, }; -/* *INDENT-ON* */ clib_error_t * avf_cli_init (vlib_main_t * vm)