26 #define foreach_bond_input_error \ 28 _(IF_DOWN, "interface down") \ 29 _(NO_SLAVE, "no slave") \ 30 _(NO_BOND, "no bond interface")\ 31 _(PASS_THRU, "pass through") 35 #define _(f,s) BOND_INPUT_ERROR_##f, 54 s =
format (s,
"src %U, dst %U, %U -> %U",
74 return ((eth->
type == htons (ETHERNET_TYPE_CDP)) ||
76 (snap->protocol == htons (0x2000)) &&
77 (snap->oui[0] == 0) && (snap->oui[1] == 0) &&
78 (snap->oui[2] == 0x0C)));
88 u16 *ethertype_p, ethertype;
105 htons (ETHERNET_TYPE_SLOW_PROTOCOLS))
109 (ETHERNET_TYPE_802_1_LLDP))))
125 BOND_INPUT_ERROR_PASS_THRU, 1);
130 vlan = (
void *) (eth + 1);
131 ethertype_p = &vlan->
type;
133 if (ethertype == ntohs (ETHERNET_TYPE_VLAN))
136 ethertype_p = &vlan->
type;
140 htons (ETHERNET_TYPE_SLOW_PROTOCOLS))
142 htons (ETHERNET_TYPE_CDP))
145 (ETHERNET_TYPE_802_1_LLDP))))
161 BOND_INPUT_ERROR_PASS_THRU, 1);
168 BOND_INPUT_ERROR_IF_DOWN, 1);
174 BOND_INPUT_ERROR_NO_SLAVE, 1);
180 BOND_INPUT_ERROR_NO_BOND, 1);
194 u32 bi0, bi1, bi2, bi3;
197 u32 *from, *to_next, n_left_from, n_left_to_next;
199 u32 next0, next1, next2, next3;
202 u32 sw_if_index, sw_if_index1, sw_if_index2, sw_if_index3;
215 while (n_left_from > 0)
220 while (n_left_from >= 12 && n_left_to_next >= 4)
350 to_next, n_left_to_next,
351 bi0, bi1, bi2, bi3, next0, next1,
355 while (n_left_from > 0 && n_left_to_next > 0)
401 to_next, n_left_to_next,
408 BOND_INPUT_ERROR_NONE, frame->
n_vectors);
424 .name =
"bond-input",
425 .vector_size =
sizeof (
u32),
442 .arc_name =
"device-input",
443 .node_name =
"bond-input",
#define foreach_bond_input_error
static void vnet_device_increment_rx_packets(u32 thread_index, u64 count)
VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION(bond_sw_interface_up_down)
static u32 vlib_get_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt)
vnet_main_t * vnet_get_main(void)
static clib_error_t * bond_input_init(vlib_main_t *vm)
vnet_interface_main_t interface_main
static void vlib_error_count(vlib_main_t *vm, uword node_index, uword counter, uword increment)
static void bond_sw_if_index_rewrite(vlib_main_t *vm, vlib_node_runtime_t *node, slave_if_t *sif, ethernet_header_t *eth, vlib_buffer_t *b0)
#define vlib_validate_buffer_enqueue_x4(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, bi2, bi3, next0, next1, next2, next3)
Finish enqueueing four buffers forward in the graph.
static void vlib_increment_simple_counter(vlib_simple_counter_main_t *cm, u32 thread_index, u32 index, u64 increment)
Increment a simple counter.
#define VNET_HW_INTERFACE_FLAG_LINK_UP
void bond_enable_collecting_distributing(vlib_main_t *vm, slave_if_t *sif)
format_function_t format_vnet_sw_if_index_name
static vnet_sw_interface_t * vnet_get_hw_sw_interface(vnet_main_t *vnm, u32 hw_if_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_HW_INTERFACE_LINK_UP_DOWN_FUNCTION(bond_hw_interface_up_down)
vlib_node_registration_t bond_input_node
(constructor) VLIB_REGISTER_NODE (bond_input_node)
#define static_always_inline
u8 * format_ethernet_address(u8 *s, va_list *args)
#define VLIB_INIT_FUNCTION(x)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
static clib_error_t * bond_sw_interface_up_down(vnet_main_t *vnm, u32 sw_if_index, u32 flags)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
vlib_simple_counter_main_t * sw_if_counters
u32 node_index
Node index.
static_always_inline void vnet_feature_next(u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)
static u8 * format_bond_input_trace(u8 *s, va_list *args)
#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 void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
u8 * format_ethernet_header_with_length(u8 *s, va_list *args)
#define VLIB_REGISTER_NODE(x,...)
static_always_inline uword vlib_get_thread_index(void)
#define CLIB_PREFETCH(addr, size, type)
ethernet_header_t ethernet
void bond_disable_collecting_distributing(vlib_main_t *vm, slave_if_t *sif)
VNET_FEATURE_INIT(bond_input, static)
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.
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
#define VNET_SW_INTERFACE_FLAG_ADMIN_UP
static uword bond_input_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static_always_inline u8 packet_is_cdp(ethernet_header_t *eth)
static bond_if_t * bond_get_master_by_dev_instance(u32 dev_instance)
static_always_inline int ethernet_frame_is_tagged(u16 type)
static char * bond_input_error_strings[]
#define VNET_FEATURES(...)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define VLIB_BUFFER_TRACE_TRAJECTORY_INIT(b)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static clib_error_t * bond_hw_interface_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
#define clib_mem_unaligned(pointer, type)
static slave_if_t * bond_get_slave_by_sw_if_index(u32 sw_if_index)
static void vlib_set_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt, u32 count)
#define CLIB_CACHE_LINE_BYTES
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
VLIB_NODE_FUNCTION_MULTIARCH(ethernet_input_not_l2_node, ethernet_input_not_l2)