34 .name =
"device-input",
37 .
state = VLIB_NODE_STATE_DISABLED,
57 .arc_name =
"device-input",
63 .arc_name =
"device-input",
64 .node_name =
"l2-patch",
69 .arc_name =
"device-input",
70 .node_name =
"worker-handoff",
75 .arc_name =
"device-input",
76 .node_name =
"span-input",
81 .arc_name =
"device-input",
82 .node_name =
"ethernet-input",
121 if (cpu_index != 0 &&
122 (cpu_index < vdm->first_worker_cpu_index ||
154 return VNET_API_ERROR_INVALID_INTERFACE;
157 return VNET_API_ERROR_INVALID_INTERFACE;
161 if (old_cpu_index == cpu_index)
175 return VNET_API_ERROR_INVALID_INTERFACE;
199 rt = vlib_node_get_runtime_data (this_vlib_main, si);
201 if (vec_len (rt->devices_and_queues))
202 s = format (s,
" node %U:\n", format_vlib_node_name, vm, si);
204 vec_foreach (dq, rt->devices_and_queues)
206 s = format (s,
" %U queue %u\n",
207 format_vnet_sw_if_index_name, vnm, dq->hw_if_index,
227 .path =
"show interface placement",
228 .short_help =
"show interface placement",
241 u32 hw_if_index = (
u32) ~ 0;
243 u32 cpu_index = (
u32) ~ 0;
254 else if (
unformat (line_input,
"queue %d", &queue_id))
256 else if (
unformat (line_input,
"main", &cpu_index))
258 else if (
unformat (line_input,
"worker %d", &cpu_index))
271 if (hw_if_index == (
u32) ~ 0)
274 if (cpu_index > vdm->last_worker_cpu_index)
276 "please specify valid worker thread or main");
308 .path =
"set interface placement",
309 .short_help =
"set interface placement <interface> [queue <n>] [thread <n> | main]",
327 if (tr && tr->
count > 0)
unformat_function_t unformat_vnet_hw_interface
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static clib_error_t * vnet_device_init(vlib_main_t *vm)
uword first_worker_cpu_index
vnet_main_t * vnet_get_main(void)
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
vnet_device_per_worker_data_t * workers
static clib_error_t * show_device_placement_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
vlib_main_t ** vlib_mains
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
#define VLIB_INIT_FUNCTION(x)
static uword device_input_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define clib_error_return(e, args...)
const u32 device_input_next_node_advance[((VNET_DEVICE_INPUT_N_NEXT_NODES/CLIB_CACHE_LINE_BYTES)+1)*CLIB_CACHE_LINE_BYTES]
vlib_worker_thread_t * vlib_worker_threads
#define clib_bitmap_foreach(i, ai, body)
Macro to iterate across set bits in a bitmap.
uword last_worker_cpu_index
static void * vlib_node_get_runtime_data(vlib_main_t *vm, u32 node_index)
Get node runtime private data by node index.
static int vnet_device_input_unassign_thread(u32 hw_if_index, u16 queue_id, uword cpu_index)
#define vec_del1(v, i)
Delete the element at index I.
#define VNET_DEVICE_INPUT_NEXT_NODES
#define foreach_vlib_main(body)
static clib_error_t * set_device_placement(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 * input_node_cpu_index_by_queue
#define vec_free(V)
Free vector's memory (no header).
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
#define VLIB_CLI_COMMAND(x,...)
vhost_vring_state_t state
uword * thread_registrations_by_name
#define VNET_FEATURES(...)
uword next_worker_cpu_index
u8 device_input_feature_arc_index
Feature arc index for device-input.
VNET_FEATURE_INIT(l2_patch, static)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
static uword ethernet_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
VNET_FEATURE_ARC_INIT(device_input, static)
#define hash_get_mem(h, key)
#define VLIB_REGISTER_NODE(x,...)
static vlib_thread_main_t * vlib_get_thread_main()
#define vec_foreach(var, vec)
Vector iterator.
#define CLIB_CACHE_LINE_BYTES
void vnet_device_input_assign_thread(u32 hw_if_index, u16 queue_id, uword cpu_index)
vnet_feature_main_t feature_main
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static int vnet_device_queue_sort(void *a1, void *a2)
vnet_device_main_t vnet_device_main
vlib_node_registration_t device_input_node
(constructor) VLIB_REGISTER_NODE (device_input_node)