|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
24 #ifndef CLIB_MARCH_VARIANT
28 #define foreach_bond_input_error \
30 _(IF_DOWN, "interface down") \
31 _(PASSIVE_IF, "traffic received on passive interface") \
32 _(PASS_THRU, "pass through (CDP, LLDP, slow protocols)")
36 #define _(f,s) BOND_INPUT_ERROR_##f,
55 s =
format (s,
"src %U, dst %U, %U -> %U",
81 return ((eth->
type == htons (ETHERNET_TYPE_CDP)) ||
83 (snap->protocol == htons (0x2000)) &&
84 (snap->oui[0] == 0) && (snap->oui[1] == 0) &&
85 (snap->oui[2] == 0x0C)));
91 u32 * n_rx_packets,
u32 * n_rx_bytes)
93 u16 *ethertype_p, ethertype;
103 if (
PREDICT_TRUE ((ethertype != htons (ETHERNET_TYPE_SLOW_PROTOCOLS))
105 && (ethertype != htons (ETHERNET_TYPE_802_1_LLDP))))
114 vlan = (
void *) (eth + 1);
115 ethertype_p = &vlan->
type;
117 if (ethertype ==
ntohs (ETHERNET_TYPE_VLAN))
120 ethertype_p = &vlan->
type;
123 if (
PREDICT_TRUE ((ethertype != htons (ETHERNET_TYPE_SLOW_PROTOCOLS))
124 && (ethertype != htons (ETHERNET_TYPE_CDP))
125 && (ethertype != htons (ETHERNET_TYPE_802_1_LLDP))))
139 u32 * last_member_sw_if_index,
u32 member_sw_if_index,
149 if (
PREDICT_TRUE (*last_member_sw_if_index == member_sw_if_index))
152 *last_member_sw_if_index = member_sw_if_index;
164 *bond_sw_if_index = member_sw_if_index;
165 *
error =
node->errors[BOND_INPUT_ERROR_IF_DOWN];
172 *bond_sw_if_index = member_sw_if_index;
173 *
error =
node->errors[BOND_INPUT_ERROR_PASSIVE_IF];
187 u32 tmp0, tmp1, tmp2, tmp3;
205 u32 last_member_sw_if_index = ~0;
206 u32 bond_sw_if_index = 0;
209 u32 n_rx_bytes = 0, n_rx_packets = 0;
265 last_member_sw_if_index) > 1))
279 &n_rx_packets, &n_rx_bytes);
281 &n_rx_packets, &n_rx_bytes);
283 &n_rx_packets, &n_rx_bytes);
285 &n_rx_packets, &n_rx_bytes);
298 &n_rx_packets, &n_rx_bytes);
308 &n_rx_packets, &n_rx_bytes);
318 &n_rx_packets, &n_rx_bytes);
328 &n_rx_packets, &n_rx_bytes);
348 &n_rx_packets, &n_rx_bytes);
389 BOND_INPUT_ERROR_NONE,
frame->n_vectors);
391 return frame->n_vectors;
402 .name =
"bond-input",
403 .vector_size =
sizeof (
u32),
420 .arc_name =
"device-input",
421 .node_name =
"bond-input",
void bond_disable_collecting_distributing(vlib_main_t *vm, member_if_t *mif)
vlib_node_registration_t bond_input_node
(constructor) VLIB_REGISTER_NODE (bond_input_node)
static uword vnet_sw_interface_is_link_up(vnet_main_t *vnm, u32 sw_if_index)
vlib_buffer_t * bufs[VLIB_FRAME_SIZE]
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
static void bond_update_next(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *last_member_sw_if_index, u32 member_sw_if_index, u32 *bond_sw_if_index, vlib_buffer_t *b, u32 *next_index, vlib_error_t *error)
nat44_ei_hairpin_src_next_t next_index
static bond_if_t * bond_get_bond_if_by_dev_instance(u32 dev_instance)
static_always_inline int ethernet_frame_is_tagged(u16 type)
u8 * format_ethernet_address(u8 *s, va_list *args)
vlib_get_buffers(vm, from, b, n_left_from)
@ VLIB_NODE_TYPE_INTERNAL
vlib_main_t vlib_node_runtime_t * node
@ VNET_SW_INTERFACE_FLAG_ADMIN_UP
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
@ VNET_HW_INTERFACE_FLAG_LINK_UP
static void bond_sw_if_idx_rewrite(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_buffer_t *b, u32 bond_sw_if_index, u32 *n_rx_packets, u32 *n_rx_bytes)
vlib_buffer_enqueue_to_next(vm, node, from,(u16 *) nexts, frame->n_vectors)
static void vlib_error_count(vlib_main_t *vm, uword node_index, uword counter, uword increment)
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
static_always_inline u32 vnet_get_feature_count(u8 arc, u32 sw_if_index)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
#define VLIB_NODE_FN(node)
VNET_FEATURE_INIT(lb_nat4_in2out_node_fn, static)
static clib_error_t * bond_hw_interface_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
vnet_main_t * vnet_get_main(void)
ethernet_header_t ethernet
#define VLIB_NODE_FLAG_TRACE
static char * bond_input_error_strings[]
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define static_always_inline
#define clib_mem_unaligned(pointer, type)
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION(bond_hw_interface_up_down)
#define foreach_bond_input_error
#define ALWAYS_ASSERT(truth)
@ VNET_INTERFACE_COUNTER_RX
struct _vlib_node_registration vlib_node_registration_t
vlib_combined_counter_main_t * combined_sw_if_counters
u16 current_length
Nbytes between current data and the end of this buffer.
static uword vnet_sw_interface_is_admin_up(vnet_main_t *vnm, u32 sw_if_index)
static clib_error_t * bond_sw_interface_up_down(vnet_main_t *vnm, u32 sw_if_index, u32 flags)
format_function_t format_vnet_sw_if_index_name
static_always_inline void bond_update_next_x4(vlib_buffer_t *b0, vlib_buffer_t *b1, vlib_buffer_t *b2, vlib_buffer_t *b3)
description fragment has unexpected format
static vnet_sw_interface_t * vnet_get_hw_sw_interface(vnet_main_t *vnm, u32 hw_if_index)
static clib_error_t * bond_input_init(vlib_main_t *vm)
#define VLIB_INIT_FUNCTION(x)
u8 * format_ethernet_header_with_length(u8 *s, va_list *args)
void bond_enable_collecting_distributing(vlib_main_t *vm, member_if_t *mif)
static member_if_t * bond_get_member_by_sw_if_index(u32 sw_if_index)
VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION(bond_sw_interface_up_down)
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define VNET_FEATURES(...)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
u16 nexts[VLIB_FRAME_SIZE]
vl_api_interface_index_t sw_if_index
u32 sw_if_indices[VLIB_FRAME_SIZE]
vl_api_fib_path_type_t type
static u8 * format_bond_input_trace(u8 *s, va_list *args)
vnet_interface_main_t interface_main
vlib_increment_combined_counter(ccm, ti, sw_if_index, n_buffers, n_bytes)
#define vlib_prefetch_buffer_data(b, type)
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)
static_always_inline u8 packet_is_cdp(ethernet_header_t *eth)
vl_api_wireguard_peer_flags_t flags