19 #include <vnet/devices/pci/ige.h> 20 #include <vnet/devices/pci/ixge.h> 21 #include <vnet/devices/pci/ixgev.h> 52 s =
format (s,
"SWAP: dst now %U src now %U sw_if_index %d next_index %d",
58 #define foreach_hw_driver_next \ 67 #define foreach_mac_swap_error \ 68 _(SWAPS, "mac addresses swapped") 72 #define _(sym,str) MAC_SWAP_ERROR_##sym, 79 #define _(sym,string) string, 109 u32 n_left_from, *from, *to_next;
120 while (n_left_from > 0)
126 while (n_left_from >= 4 && n_left_to_next >= 2)
131 u32 sw_if_index0, sw_if_index1;
152 to_next[0] = bi0 = from[0];
153 to_next[1] = bi1 = from[1];
182 sw_if_index0, next0);
205 sw_if_index1, next1);
213 em->
counters[node_counter_base_index + MAC_SWAP_ERROR_SWAPS] += 2;
231 tmp0a |= tmp0b & 0xFFFF;
233 tmp1a |= tmp1b & 0xFFFF;
259 to_next, n_left_to_next,
260 bi0, bi1, next0, next1);
263 while (n_left_from > 0 && n_left_to_next > 0)
300 sw_if_index0, next0);
308 em->
counters[node_counter_base_index + MAC_SWAP_ERROR_SWAPS] += 1;
319 tmp0a |= tmp0b & 0xFFFF;
334 to_next, n_left_to_next,
348 .vector_size =
sizeof (
u32),
376 #define _(a) ixge_set_next_node (IXGE_RX_NEXT_##a##_INPUT, "mac-swap"); 379 #define _(a) ixgev_set_next_node (IXGEV_RX_NEXT_##a##_INPUT, "mac-swap"); 382 #define _(a) ige_set_next_node (IGE_RX_NEXT_##a##_INPUT, "mac-swap");
#define hash_set(h, key, value)
static void vlib_buffer_reset(vlib_buffer_t *b)
Reset current header & length to state they were in when packet was received.
vnet_main_t * vnet_get_main(void)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
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.
struct _vlib_node_registration vlib_node_registration_t
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
#define foreach_hw_driver_next
u8 * format_ethernet_address(u8 *s, va_list *args)
#define VLIB_INIT_FUNCTION(x)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define foreach_mac_swap_error
static u8 * format_swap_trace(u8 *s, va_list *args)
mac_swap_main_t mac_swap_main
clib_error_t * mac_swap_init(vlib_main_t *vm)
vlib_error_main_t error_main
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
Finish enqueueing two buffers forward in the graph.
#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).
#define CLIB_PREFETCH(addr, size, type)
#define VLIB_BUFFER_IS_TRACED
#define clib_memcpy(a, b, c)
#define hash_create(elts, value_bytes)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
static vlib_node_registration_t mac_swap_node
(constructor) VLIB_REGISTER_NODE (mac_swap_node)
#define VLIB_NODE_FLAG_TRACE
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static char * mac_swap_error_strings[]
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define VLIB_REGISTER_NODE(x,...)
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
u16 flags
Copy of main node flags.
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.
static 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