52 #define foreach_worker_handoff_error \ 53 _(CONGESTION_DROP, "congestion drop") 57 #define _(sym,str) WORKER_HANDOFF_ERROR_##sym, 64 #define _(sym,string) string, 78 format (s,
"worker-handoff: sw_if_index %d, next_worker %d, buffer 0x%x",
91 u32 n_enq, n_left_from, *from;
101 while (n_left_from > 0)
135 && (b[0]->
flags & VLIB_BUFFER_IS_TRACED)))
153 if (n_enq < frame->n_vectors)
155 WORKER_HANDOFF_ERROR_CONGESTION_DROP,
163 .name =
"worker-handoff",
164 .vector_size =
sizeof (
u32),
181 uword * bitmap,
int enable_disable)
190 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
194 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
197 return VNET_API_ERROR_INVALID_WORKER;
223 sw_if_index, enable_disable, 0, 0);
234 int enable_disable = 1;
244 else if (
unformat (input,
"workers %U", unformat_bitmap_list, &bitmap))
249 else if (
unformat (input,
"symmetrical"))
251 else if (
unformat (input,
"asymmetrical"))
257 if (sw_if_index == ~0)
272 case VNET_API_ERROR_INVALID_SW_IF_INDEX:
276 case VNET_API_ERROR_INVALID_WORKER:
280 case VNET_API_ERROR_UNIMPLEMENTED:
282 "Device driver doesn't support redirection");
299 .path =
"set interface handoff",
301 "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) ...
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
#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.
#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.
#define VLIB_NODE_FUNCTION_MULTIARCH(node, fn)
#define clib_bitmap_foreach(i, ai, body)
Macro to iterate across set bits in a bitmap.
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_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
u32 node_index
Node index.
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,...)
#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_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
#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)
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
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)
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()
u16 flags
Copy of main node flags.
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
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)
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)