- vec_free (s);
- return 0;
-}
-
-/* *INDENT-OFF* */
-VLIB_CLI_COMMAND (memif_delete_command, static) = {
- .path = "show interface placement",
- .short_help = "show interface placement",
- .function = show_device_placement_fn,
-};
-/* *INDENT-ON* */
-
-static clib_error_t *
-set_device_placement (vlib_main_t * vm, unformat_input_t * input,
- vlib_cli_command_t * cmd)
-{
- clib_error_t *error = 0;
- unformat_input_t _line_input, *line_input = &_line_input;
- vnet_main_t *vnm = vnet_get_main ();
- vnet_device_main_t *vdm = &vnet_device_main;
- vnet_device_input_mode_t mode;
- u32 hw_if_index = (u32) ~ 0;
- u32 queue_id = (u32) 0;
- u32 thread_index = (u32) ~ 0;
- int rv;
-
- if (!unformat_user (input, unformat_line_input, line_input))
- return 0;
-
- while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat
- (line_input, "%U", unformat_vnet_hw_interface, vnm, &hw_if_index))
- ;
- else if (unformat (line_input, "queue %d", &queue_id))
- ;
- else if (unformat (line_input, "main", &thread_index))
- thread_index = 0;
- else if (unformat (line_input, "worker %d", &thread_index))
- thread_index += vdm->first_worker_thread_index;
- else
- {
- error = clib_error_return (0, "parse error: '%U'",
- format_unformat_error, line_input);
- unformat_free (line_input);
- return error;
- }
- }
-
- unformat_free (line_input);
-
- if (hw_if_index == (u32) ~ 0)
- return clib_error_return (0, "please specify valid interface name");
-
- if (thread_index > vdm->last_worker_thread_index)
- return clib_error_return (0,
- "please specify valid worker thread or main");
-
- rv = vnet_device_input_get_mode (vnm, hw_if_index, queue_id, &mode);
-
- if (rv)
- return clib_error_return (0, "not found");
-
- rv = vnet_device_input_unassign_thread (vnm, hw_if_index, queue_id,
- thread_index);
-
- if (rv)
- return clib_error_return (0, "not found");
-
- vnet_device_input_assign_thread (vnm, hw_if_index, queue_id, thread_index);
- vnet_device_input_set_mode (vnm, hw_if_index, queue_id, mode);
-
- return 0;
-}
-
-/*?
- * This command is used to assign a given interface, and optionally a
- * given queue, to a different thread. If the '<em>queue</em>' is not provided,
- * it defaults to 0.
- *
- * @cliexpar
- * Example of how to display the interface placement:
- * @cliexstart{show interface placement}
- * Thread 1 (vpp_wk_0):
- * GigabitEthernet0/8/0 queue 0
- * GigabitEthernet0/9/0 queue 0
- * Thread 2 (vpp_wk_1):
- * GigabitEthernet0/8/0 queue 1
- * GigabitEthernet0/9/0 queue 1
- * @cliexend
- * Example of how to assign a interface and queue to a thread:
- * @cliexcmd{set interface placement GigabitEthernet0/8/0 queue 1 thread 1}
-?*/
-/* *INDENT-OFF* */
-VLIB_CLI_COMMAND (cmd_set_dpdk_if_placement,static) = {
- .path = "set interface placement",
- .short_help = "set interface placement <interface> [queue <n>] [thread <n> | main]",
- .function = set_device_placement,
-};
-/* *INDENT-ON* */