45 #ifndef CLIB_MARCH_VARIANT 56 #define foreach_worker_handoff_error \ 57 _(CONGESTION_DROP, "congestion drop") 61 #define _(sym,str) WORKER_HANDOFF_ERROR_##sym, 68 #define _(sym,string) string, 82 format (s,
"worker-handoff: sw_if_index %d, next_worker %d, buffer 0x%x",
93 u32 n_enq, n_left_from, *from;
97 n_left_from =
frame->n_vectors;
103 while (n_left_from > 0)
137 && (b[0]->
flags & VLIB_BUFFER_IS_TRACED)))
153 thread_indices,
frame->n_vectors, 1);
155 if (n_enq < frame->n_vectors)
157 WORKER_HANDOFF_ERROR_CONGESTION_DROP,
158 frame->n_vectors - n_enq);
159 return frame->n_vectors;
164 .name =
"worker-handoff",
165 .vector_size =
sizeof (
u32),
179 #ifndef CLIB_MARCH_VARIANT 182 uword * bitmap,
int enable_disable)
191 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
195 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
198 return VNET_API_ERROR_INVALID_WORKER;
224 sw_if_index, enable_disable, 0, 0);
235 int enable_disable = 1;
245 else if (
unformat (input,
"workers %U", unformat_bitmap_list, &bitmap))
250 else if (
unformat (input,
"symmetrical"))
252 else if (
unformat (input,
"asymmetrical"))
258 if (sw_if_index == ~0)
273 case VNET_API_ERROR_INVALID_SW_IF_INDEX:
277 case VNET_API_ERROR_INVALID_WORKER:
281 case VNET_API_ERROR_UNIMPLEMENTED:
283 "Device driver doesn't support redirection");
300 .path =
"set interface handoff",
302 "set interface handoff <interface-name> workers <workers-list> [symmetrical|asymmetrical]",
#define vec_validate(V, I)
Make sure vector is long enough for given index (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.
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)
#define clib_bitmap_foreach(i, ai)
Macro to iterate across set bits in a bitmap.
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
#define VLIB_NODE_FN(node)
#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)
description fragment has unexpected format
#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...)
#define vlib_call_init_function(vm, x)
static u32 vlib_get_buffer_index(vlib_main_t *vm, void *p)
Translate buffer pointer into buffer index.
vl_api_fib_path_type_t type
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
static uword clib_bitmap_last_set(uword *ai)
Return the higest numbered set bit in a bitmap.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
per_inteface_handoff_data_t * if_data
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
static u64 eth_get_sym_key(ethernet_header_t *h0)
static char * worker_handoff_error_strings[]
#define VLIB_REGISTER_NODE(x,...)
sll srl srl sll sra u16x4 i
#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.
vlib_main_t vlib_node_runtime_t * node
#define VLIB_CLI_COMMAND(x,...)
static clib_error_t * set_interface_handoff_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
uword * thread_registrations_by_name
#define foreach_worker_handoff_error
static uword is_pow2(uword x)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
VLIB buffer representation.
vnet_sw_interface_t * sw_interfaces
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static_always_inline u32 vlib_buffer_enqueue_to_thread(vlib_main_t *vm, u32 frame_queue_index, u32 *buffer_indices, u16 *thread_indices, u32 n_packets, int drop_on_congestion)
#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()
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static_always_inline void vlib_get_buffers(vlib_main_t *vm, u32 *bi, vlib_buffer_t **b, int count)
Translate array of buffer indices into buffer pointers.
#define VLIB_NODE_FLAG_TRACE
int interface_handoff_enable_disable(vlib_main_t *vm, u32 sw_if_index, uword *bitmap, int enable_disable)
vl_api_interface_index_t sw_if_index
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)