19 #include <vnet/devices/pci/ige.h> 20 #include <vnet/devices/pci/ixge.h> 21 #include <vnet/devices/pci/ixgev.h> 49 s =
format (s,
"SWAP: dst now %U src now %U sw_if_index %d next_index %d",
57 #define foreach_hw_driver_next \ 66 #define foreach_mac_swap_error \ 67 _(SWAPS, "mac addresses swapped") 70 #define _(sym,str) MAC_SWAP_ERROR_##sym, 77 #define _(sym,string) string, 107 u32 n_left_from, * from, * to_next;
118 while (n_left_from > 0)
123 to_next, n_left_to_next);
125 while (n_left_from >= 4 && n_left_to_next >= 2)
130 u32 sw_if_index0, sw_if_index1;
151 to_next[0] = bi0 = from[0];
152 to_next[1] = bi1 = from[1];
180 sw_if_index0, next0);
202 sw_if_index1, next1);
210 em->
counters[node_counter_base_index + MAC_SWAP_ERROR_SWAPS] += 2;
228 tmp0a |= tmp0b & 0xFFFF;
230 tmp1a |= tmp1b & 0xFFFF;
254 to_next, n_left_to_next,
255 bi0, bi1, next0, next1);
258 while (n_left_from > 0 && n_left_to_next > 0)
294 sw_if_index0, next0);
302 em->
counters[node_counter_base_index + MAC_SWAP_ERROR_SWAPS] += 1;
313 tmp0a |= tmp0b & 0xFFFF;
327 to_next, n_left_to_next,
340 .vector_size =
sizeof (
u32),
366 #define _(a) ixge_set_next_node (IXGE_RX_NEXT_##a##_INPUT, "mac-swap"); 369 #define _(a) ixgev_set_next_node (IXGEV_RX_NEXT_##a##_INPUT, "mac-swap"); 372 #define _(a) ige_set_next_node (IGE_RX_NEXT_##a##_INPUT, "mac-swap"); void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
#define hash_set(h, key, value)
always_inline vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
struct _vlib_node_registration vlib_node_registration_t
always_inline void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#define foreach_hw_driver_next
vnet_main_t * vnet_get_main(void)
u8 * format_ethernet_address(u8 *s, va_list *args)
#define VLIB_INIT_FUNCTION(x)
#define foreach_mac_swap_error
static u8 * format_swap_trace(u8 *s, va_list *args)
mac_swap_main_t mac_swap_main
always_inline void * vlib_frame_vector_args(vlib_frame_t *f)
clib_error_t * mac_swap_init(vlib_main_t *vm)
vlib_error_main_t error_main
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
always_inline void vlib_buffer_reset(vlib_buffer_t *b)
Reset current header & length to state they were in when packet was received.
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
#define CLIB_PREFETCH(addr, size, type)
#define clib_memcpy(a, b, c)
always_inline vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
#define hash_create(elts, value_bytes)
static vlib_node_registration_t mac_swap_node
(constructor) VLIB_REGISTER_NODE (mac_swap_node)
#define VLIB_NODE_FLAG_TRACE
always_inline uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
#define VLIB_BUFFER_IS_TRACED
static char * mac_swap_error_strings[]
always_inline void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define VLIB_REGISTER_NODE(x,...)
static uword mac_swap_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
always_inline vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
uword * next_node_index_by_sw_if_index