66 format (s,
"worker-handoff: sw_if_index %d, next_worker %d, buffer 0x%x",
79 u32 n_left_from, *from;
85 u32 n_left_to_next_worker = 0, *to_next_worker = 0;
86 u32 next_worker_index = 0;
87 u32 current_worker_index = ~0;
101 while (n_left_from > 0)
149 next_worker_index += ihd0->
workers[index0];
151 if (next_worker_index != current_worker_index)
158 handoff_queue_elt_by_worker_index);
162 current_worker_index = next_worker_index;
166 to_next_worker[0] = bi0;
168 n_left_to_next_worker--;
170 if (n_left_to_next_worker == 0)
174 current_worker_index = ~0;
175 handoff_queue_elt_by_worker_index[next_worker_index] = 0;
180 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
195 for (i = 0; i <
vec_len (handoff_queue_elt_by_worker_index); i++)
197 if (handoff_queue_elt_by_worker_index[i])
199 hf = handoff_queue_elt_by_worker_index[
i];
207 handoff_queue_elt_by_worker_index[
i] = 0;
212 congested_handoff_queue_by_worker_index[
i] =
216 current_worker_index = ~0;
223 .name =
"worker-handoff",
224 .vector_size =
sizeof (
u32),
239 uword * bitmap,
int enable_disable)
248 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
252 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
255 return VNET_API_ERROR_INVALID_WORKER;
279 sw_if_index, enable_disable, 0, 0);
289 u32 sw_if_index = ~0;
290 int enable_disable = 1;
305 else if (
unformat (input,
"symmetrical"))
307 else if (
unformat (input,
"asymmetrical"))
313 if (sw_if_index == ~0)
328 case VNET_API_ERROR_INVALID_SW_IF_INDEX:
332 case VNET_API_ERROR_INVALID_WORKER:
336 case VNET_API_ERROR_UNIMPLEMENTED:
338 "Device driver doesn't support redirection");
355 .path =
"set interface handoff",
357 "set interface handoff <interface-name> workers <workers-list> [symmetrical|asymmetrical]",
377 s =
format (s,
"handoff-dispatch: sw_if_index %d next_index %d buffer 0x%x",
382 #define foreach_handoff_dispatch_error \ 383 _(EXAMPLE, "example packets") 387 #define _(sym,str) HANDOFF_DISPATCH_ERROR_##sym, 394 #define _(sym,string) string, 403 u32 n_left_from, *from, *to_next;
410 while (n_left_from > 0)
416 while (n_left_from >= 4 && n_left_to_next >= 2)
421 u32 sw_if_index0, sw_if_index1;
435 to_next[0] = bi0 = from[0];
436 to_next[1] = bi1 = from[1];
476 to_next, n_left_to_next,
477 bi0, bi1, next0, next1);
480 while (n_left_from > 0 && n_left_to_next > 0)
516 to_next, n_left_to_next,
529 .name =
"handoff-dispatch",
530 .vector_size =
sizeof (
u32),
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
handoff_main_t handoff_main
u64(* hash_fn)(ethernet_header_t *)
vnet_main_t * vnet_get_main(void)
vnet_interface_main_t interface_main
clib_error_t * threads_init(vlib_main_t *vm)
u32 vlib_frame_queue_main_init(u32 node_index, u32 frame_queue_nelts)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static u64 clib_xxhash(u64 key)
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
unformat_function_t unformat_vnet_sw_interface
u32 buffer_index[VLIB_FRAME_SIZE]
static void vlib_trace_buffer(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, vlib_buffer_t *b, int follow_chain)
#define VLIB_INIT_FUNCTION(x)
static u8 * format_worker_handoff_trace(u8 *s, va_list *args)
clib_error_t * handoff_init(vlib_main_t *vm)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define clib_error_return(e, args...)
static u8 * format_handoff_dispatch_trace(u8 *s, va_list *args)
#define vlib_call_init_function(vm, x)
#define VLIB_NODE_FUNCTION_MULTIARCH(node, fn)
#define clib_bitmap_foreach(i, ai, body)
Macro to iterate across set bits in a bitmap.
vlib_node_registration_t handoff_dispatch_node
(constructor) VLIB_REGISTER_NODE (handoff_dispatch_node)
static uword clib_bitmap_last_set(uword *ai)
Return the higest numbered set bit in a bitmap.
vlib_node_registration_t handoff_node
static vlib_frame_queue_elt_t * vlib_get_worker_handoff_queue_elt(u32 frame_queue_index, u32 vlib_worker_index, vlib_frame_queue_elt_t **handoff_queue_elt_by_worker_index)
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
Finish enqueueing two buffers forward in the graph.
per_inteface_handoff_data_t * if_data
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
static uword handoff_dispatch_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static u64 eth_get_sym_key(ethernet_header_t *h0)
#define VLIB_REGISTER_NODE(x,...)
#define vec_free(V)
Free vector's memory (no header).
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
#define foreach_handoff_dispatch_error
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
#define VLIB_CLI_COMMAND(x,...)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
static clib_error_t * set_interface_handoff_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
static char * handoff_dispatch_error_strings[]
vlib_trace_main_t trace_main
uword * thread_registrations_by_name
static uword is_pow2(uword x)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
struct _vlib_node_registration vlib_node_registration_t
#define VLIB_NODE_FLAG_IS_HANDOFF
static uword worker_handoff_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static uword unformat_bitmap_list(unformat_input_t *input, va_list *va)
unformat a list of bit ranges into a bitmap (eg "0-3,5-7,11" )
vnet_sw_interface_t * sw_interfaces
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static void vlib_put_frame_queue_elt(vlib_frame_queue_elt_t *hf)
#define hash_get_mem(h, key)
static u64 eth_get_key(ethernet_header_t *h0)
vnet_sw_interface_type_t type
static vlib_thread_main_t * vlib_get_thread_main()
u16 flags
Copy of main node flags.
#define VLIB_NODE_FLAG_TRACE
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
int interface_handoff_enable_disable(vlib_main_t *vm, u32 sw_if_index, uword *bitmap, int enable_disable)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
vlib_node_registration_t worker_handoff_node
(constructor) VLIB_REGISTER_NODE (worker_handoff_node)