-static clib_error_t *
-show_device_placement_fn (vlib_main_t * vm, unformat_input_t * input,
- vlib_cli_command_t * cmd)
-{
- u8 *s = 0;
- vnet_main_t *vnm = vnet_get_main ();
- vnet_device_input_runtime_t *rt;
- vnet_device_and_queue_t *dq;
- vlib_node_t *pn = vlib_get_node_by_name (vm, (u8 *) "device-input");
- uword si;
- int index = 0;
-
- /* *INDENT-OFF* */
- foreach_vlib_main (({
- clib_bitmap_foreach (si, pn->sibling_bitmap,
- ({
- rt = vlib_node_get_runtime_data (this_vlib_main, si);
-
- if (vec_len (rt->devices_and_queues))
- s = format (s, " node %U:\n", format_vlib_node_name, vm, si);
-
- vec_foreach (dq, rt->devices_and_queues)
- {
- s = format (s, " %U queue %u (%s)\n",
- format_vnet_sw_if_index_name, vnm, dq->hw_if_index,
- dq->queue_id,
- dq->mode == VNET_DEVICE_INPUT_MODE_POLLING ?
- "polling" : "interrupt");
- }
- }));
- if (vec_len (s) > 0)
- {
- vlib_cli_output(vm, "Thread %u (%v):\n%v", index,
- vlib_worker_threads[index].name, s);
- vec_reset_length (s);
- }
- index++;
- }));
- /* *INDENT-ON* */
-
- 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);