59 format (s,
"worker-handoff: sw_if_index %d, next_worker %d, buffer 0x%x",
72 u32 n_left_from, *from;
78 u32 n_left_to_next_worker = 0, *to_next_worker = 0;
79 u32 next_worker_index = 0;
80 u32 current_worker_index = ~0;
94 while (n_left_from > 0)
142 next_worker_index += ihd0->
workers[index0];
144 if (next_worker_index != current_worker_index)
150 handoff_queue_elt_by_worker_index);
154 current_worker_index = next_worker_index;
158 to_next_worker[0] = bi0;
160 n_left_to_next_worker--;
162 if (n_left_to_next_worker == 0)
166 current_worker_index = ~0;
167 handoff_queue_elt_by_worker_index[next_worker_index] = 0;
187 for (i = 0; i <
vec_len (handoff_queue_elt_by_worker_index); i++)
189 if (handoff_queue_elt_by_worker_index[i])
191 hf = handoff_queue_elt_by_worker_index[
i];
199 handoff_queue_elt_by_worker_index[
i] = 0;
204 congested_handoff_queue_by_worker_index[
i] =
208 current_worker_index = ~0;
215 .name =
"worker-handoff",
216 .vector_size =
sizeof (
u32),
229 uword * bitmap,
int enable_disable)
239 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
243 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
246 return VNET_API_ERROR_INVALID_WORKER;
274 u32 sw_if_index = ~0;
275 int enable_disable = 1;
293 if (sw_if_index == ~0)
308 case VNET_API_ERROR_INVALID_SW_IF_INDEX:
312 case VNET_API_ERROR_INVALID_WORKER:
316 case VNET_API_ERROR_UNIMPLEMENTED:
318 "Device driver doesn't support redirection");
329 .path =
"set interface handoff",
331 "set interface handoff <interface-name> workers <workers-list>",
351 s =
format (s,
"handoff-dispatch: sw_if_index %d next_index %d buffer 0x%x",
359 #define foreach_handoff_dispatch_error \ 360 _(EXAMPLE, "example packets") 364 #define _(sym,str) HANDOFF_DISPATCH_ERROR_##sym, 371 #define _(sym,string) string, 380 u32 n_left_from, *from, *to_next;
387 while (n_left_from > 0)
393 while (n_left_from >= 4 && n_left_to_next >= 2)
398 u32 sw_if_index0, sw_if_index1;
412 to_next[0] = bi0 = from[0];
413 to_next[1] = bi1 = from[1];
453 to_next, n_left_to_next,
454 bi0, bi1, next0, next1);
457 while (n_left_from > 0 && n_left_to_next > 0)
493 to_next, n_left_to_next,
506 .name =
"handoff-dispatch",
507 .vector_size =
sizeof (
u32),
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
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.
sll srl srl sll sra u16x4 i
handoff_main_t handoff_main
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
vnet_interface_main_t interface_main
int vnet_hw_interface_rx_redirect_to_node(vnet_main_t *vnm, u32 hw_if_index, u32 node_index)
clib_error_t * threads_init(vlib_main_t *vm)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static u64 clib_xxhash(u64 key)
struct _vlib_node_registration vlib_node_registration_t
#define BUFFER_HANDOFF_NEXT_VALID
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]
u32 handoff_dispatch_node_index
static void vlib_trace_buffer(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, vlib_buffer_t *b, int follow_chain)
vnet_main_t * vnet_get_main(void)
#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 vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static u8 * format_handoff_dispatch_trace(u8 *s, va_list *args)
#define vlib_call_init_function(vm, x)
static vlib_frame_queue_elt_t * dpdk_get_handoff_queue_elt(u32 vlib_worker_index, vlib_frame_queue_elt_t **handoff_queue_elt_by_worker_index)
#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)
#define VLIB_NODE_FLAG_IS_HANDOFF
static uword clib_bitmap_last_set(uword *ai)
Return the higest numbered set bit in a bitmap.
vlib_node_registration_t handoff_node
static void vlib_put_handoff_queue_elt(vlib_frame_queue_elt_t *hf)
#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)
#define vec_free(V)
Free vector's memory (no header).
static vlib_thread_main_t * vlib_get_thread_main()
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
#define foreach_handoff_dispatch_error
static clib_error_t * set_interface_handoff_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define VLIB_NODE_FLAG_TRACE
static char * handoff_dispatch_error_strings[]
vlib_trace_main_t trace_main
uword * thread_registrations_by_name
#define VLIB_BUFFER_IS_TRACED
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)
static uword worker_handoff_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
VLIB_CLI_COMMAND(set_interface_ip_source_and_port_range_check_command, static)
#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.
#define hash_get_mem(h, key)
static u64 eth_get_key(ethernet_header_t *h0)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define VLIB_NODE_FUNCTION_MULTIARCH(node, fn)
#define VLIB_REGISTER_NODE(x,...)
vnet_sw_interface_type_t type
#define clib_error_return(e, args...)
#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_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.
vlib_node_registration_t worker_handoff_node
(constructor) VLIB_REGISTER_NODE (worker_handoff_node)