48 #define foreach_ethernet_input_next \ 49 _ (PUNT, "error-punt") \ 50 _ (DROP, "error-drop") \ 51 _ (LLC, "llc-input") \ 52 _ (IP4_INPUT, "ip4-input") \ 53 _ (IP4_INPUT_NCS, "ip4-input-no-checksum") 57 #define _(s,n) ETHERNET_INPUT_NEXT_##s, 82 s =
format (s,
", hw-if-index %u, sw-if-index %u",
107 u16 * outer_id,
u16 * inner_id,
u32 * match_flags)
119 b0->
flags |= VNET_BUFFER_F_L2_HDR_OFFSET_VALID;
123 *type = clib_net_to_host_u16 (e0->
type);
134 *type = clib_net_to_host_u16 (e0[0]);
159 *outer_id = tag & 0xfff;
163 *type = clib_net_to_host_u16 (h0->
type);
168 if (*type == ETHERNET_TYPE_VLAN)
177 *inner_id = tag & 0xfff;
179 *type = clib_net_to_host_u16 (h0->
type);
183 if (*type == ETHERNET_TYPE_VLAN)
206 u32 * new_sw_if_index,
u8 * error0,
u32 * is_l2)
211 qinq_intf, new_sw_if_index, error0, is_l2);
228 *error0 = ETHERNET_ERROR_L3_MAC_MISMATCH;
234 *error0 = (*new_sw_if_index) != ~0 ? (*error0) : ETHERNET_ERROR_DOWN;
245 b0->
flags |= VNET_BUFFER_F_L3_HDR_OFFSET_VALID;
250 *next0 = ETHERNET_INPUT_NEXT_DROP;
264 else if (type0 == ETHERNET_TYPE_IP4)
268 else if (type0 == ETHERNET_TYPE_IP6)
272 else if (type0 == ETHERNET_TYPE_MPLS)
298 *next0 = ETHERNET_INPUT_NEXT_LLC;
310 "l3_hdr_offset must follow l2_hdr_offset");
316 u32 flags = VNET_BUFFER_F_L2_HDR_OFFSET_VALID |
317 VNET_BUFFER_F_L3_HDR_OFFSET_VALID;
319 #ifdef CLIB_HAVE_VEC256 330 adv, -adv, 0, 0, adv, -adv, 0, 0,
331 adv, -adv, 0, 0, adv, -adv, 0, 0
418 u32 flags = VNET_BUFFER_F_L2_HDR_OFFSET_VALID |
419 VNET_BUFFER_F_L3_HDR_OFFSET_VALID;
438 #ifdef CLIB_HAVE_VEC128 439 u64x2 r = u64x2_load_unaligned (((
u8 *) & e->
type) - 6);
440 etype[
offset] = ((u16x8) r)[3];
456 return (etype < 0x600) ? ETHERNET_INPUT_NEXT_LLC :
492 int main_is_l3,
int check_dmac)
504 u16 vlan1 = clib_net_to_host_u16 (t[0]) & 0xFFF;
505 u16 vlan2 = clib_net_to_host_u16 (t[2]) & 0xFFF;
506 u32 matched, is_l2, new_sw_if_index;
510 vif = &vlan_table->
vlans[vlan1];
512 qif = &qinq_table->
vlans[vlan2];
513 l->
err = ETHERNET_ERROR_NONE;
514 l->
type = clib_net_to_host_u16 (t[1]);
516 if (l->
type == ETHERNET_TYPE_VLAN)
518 l->
type = clib_net_to_host_u16 (t[3]);
522 qif, &new_sw_if_index, &l->
err,
531 l->
err = ETHERNET_ERROR_NONE;
533 is_l2 = main_is_l3 == 0;
538 vif, qif, &new_sw_if_index,
551 clib_net_to_host_u64 (0xffffffffffffffff) :
552 clib_net_to_host_u64 (0xffffffff00000000);
555 l->
err = ETHERNET_ERROR_DOWN;
563 l->
adv = is_l2 ? 0 : l->
len;
566 l->
next = ETHERNET_INPUT_NEXT_DROP;
569 else if (l->
type == ETHERNET_TYPE_IP4)
571 else if (l->
type == ETHERNET_TYPE_IP6)
573 else if (l->
type == ETHERNET_TYPE_MPLS)
580 if (l->
next == ETHERNET_INPUT_NEXT_PUNT)
581 l->
err = ETHERNET_ERROR_UNKNOWN_TYPE;
585 if (check_dmac && l->
adv > 0 && dmac_bad)
587 l->
err = ETHERNET_ERROR_L3_MAC_MISMATCH;
588 next[0] = ETHERNET_INPUT_NEXT_PUNT;
597 if (l->
err == ETHERNET_ERROR_NONE)
617 "VLIB_FRAME_SIZE must be power of 8");
621 u32 * buffer_indices,
u32 n_packets,
int main_is_l3,
622 int ip4_cksum_ok,
int dmac_check)
632 u16 next_ip4, next_ip6, next_mpls, next_l2;
633 u16 et_ip4 = clib_host_to_net_u16 (ETHERNET_TYPE_IP4);
634 u16 et_ip6 = clib_host_to_net_u16 (ETHERNET_TYPE_IP6);
635 u16 et_mpls = clib_host_to_net_u16 (ETHERNET_TYPE_MPLS);
636 u16 et_vlan = clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
637 u16 et_dot1ad = clib_host_to_net_u16 (ETHERNET_TYPE_DOT1AD);
638 i32 n_left = n_packets;
642 from = buffer_indices;
708 u64 mask = clib_net_to_host_u64 (0xFFFFFFFFFFFF0000);
709 u64 igbit = clib_net_to_host_u64 (0x0100000000000000);
712 u8 *dmac_bad = dmacs_bad;
716 #ifdef CLIB_HAVE_VEC256 717 u64x4 igbit4 = u64x4_splat (igbit);
718 u64x4 mask4 = u64x4_splat (mask);
719 u64x4 hwaddr4 = u64x4_splat (hwaddr);
723 r0 = u64x4_load_unaligned (dmac + 0) & mask4;
724 r1 = u64x4_load_unaligned (dmac + 4) & mask4;
726 r0 = (r0 != hwaddr4) & ((r0 & igbit4) == 0);
727 r1 = (r1 != hwaddr4) & ((r1 & igbit4) == 0);
746 r0 = (r0 != hwaddr) && ((r0 & igbit) == 0);
747 r1 = (r1 != hwaddr) && ((r1 & igbit) == 0);
748 r2 = (r2 != hwaddr) && ((r2 & igbit) == 0);
749 r3 = (r3 != hwaddr) && ((r3 & igbit) == 0);
769 if (next_ip4 == ETHERNET_INPUT_NEXT_IP4_INPUT && ip4_cksum_ok)
770 next_ip4 = ETHERNET_INPUT_NEXT_IP4_INPUT_NCS;
772 #ifdef CLIB_HAVE_VEC256 773 u16x16 et16_ip4 = u16x16_splat (et_ip4);
774 u16x16 et16_ip6 = u16x16_splat (et_ip6);
775 u16x16 et16_mpls = u16x16_splat (et_mpls);
776 u16x16 et16_vlan = u16x16_splat (et_vlan);
777 u16x16 et16_dot1ad = u16x16_splat (et_dot1ad);
778 u16x16 next16_ip4 = u16x16_splat (next_ip4);
779 u16x16 next16_ip6 = u16x16_splat (next_ip6);
780 u16x16 next16_mpls = u16x16_splat (next_mpls);
781 u16x16 next16_l2 = u16x16_splat (next_l2);
783 u16x16 stairs = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
797 #ifdef CLIB_HAVE_VEC256 801 u16x16 e16 = u16x16_load_unaligned (etype);
804 r += (e16 == et16_ip4) & next16_ip4;
805 r += (e16 == et16_ip6) & next16_ip6;
806 r += (e16 == et16_mpls) & next16_mpls;
809 r = ((e16 != et16_vlan) & (e16 != et16_dot1ad)) & next16_l2;
810 u16x16_store_unaligned (r, next);
812 if (!u16x16_is_all_zero (r == zero))
814 if (u16x16_is_all_zero (r))
816 u16x16_store_unaligned (u16x16_splat (i) + stairs,
817 slowpath_indices + n_slowpath);
822 for (
int j = 0; j < 16; j++)
824 slowpath_indices[n_slowpath++] = i + j;
835 if (main_is_l3 && etype[0] == et_ip4)
837 else if (main_is_l3 && etype[0] == et_ip6)
839 else if (main_is_l3 && etype[0] == et_mpls)
841 else if (main_is_l3 == 0 &&
842 etype[0] != et_vlan && etype[0] != et_dot1ad)
847 slowpath_indices[n_slowpath++] =
i;
860 u16 *si = slowpath_indices;
861 u32 last_unknown_etype = ~0;
862 u32 last_unknown_next = ~0;
865 .tag = tags[si[0]] ^ -1LL,
874 u16 etype = etypes[
i];
876 if (etype == et_vlan)
880 &dot1q_lookup, dmacs_bad[i], 0,
881 main_is_l3, dmac_check);
884 else if (etype == et_dot1ad)
888 &dot1ad_lookup, dmacs_bad[i], 1,
889 main_is_l3, dmac_check);
894 if (last_unknown_etype != etype)
896 last_unknown_etype = etype;
897 etype = clib_host_to_net_u16 (etype);
900 if (dmac_check && main_is_l3 && dmacs_bad[i])
903 b->
error = node->
errors[ETHERNET_ERROR_L3_MAC_MISMATCH];
904 nexts[
i] = ETHERNET_INPUT_NEXT_PUNT;
907 nexts[
i] = last_unknown_next;
976 if (b0->
flags & VLIB_BUFFER_IS_TRACED)
1020 u32 * from,
u32 n_packets,
1026 u32 n_left_from, next_index, *to_next;
1027 u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
1029 u32 cached_sw_if_index = ~0;
1030 u32 cached_is_l2 = 0;
1038 n_left_from = n_packets;
1042 stats_n_packets = stats_n_bytes = 0;
1044 while (n_left_from > 0)
1050 while (n_left_from >= 4 && n_left_to_next >= 2)
1054 u8 next0, next1, error0, error1;
1055 u16 type0, orig_type0, type1, orig_type1;
1056 u16 outer_id0, inner_id0, outer_id1, inner_id1;
1057 u32 match_flags0, match_flags1;
1058 u32 old_sw_if_index0, new_sw_if_index0, len0, old_sw_if_index1,
1059 new_sw_if_index1, len1;
1087 n_left_to_next -= 2;
1093 error0 = error1 = ETHERNET_ERROR_NONE;
1095 type0 = clib_net_to_host_u16 (e0->
type);
1097 type1 = clib_net_to_host_u16 (e1->
type);
1102 b0->
flags |= VNET_BUFFER_F_L2_HDR_OFFSET_VALID;
1103 b1->
flags |= VNET_BUFFER_F_L2_HDR_OFFSET_VALID;
1112 u32 sw_if_index0, sw_if_index1;
1116 is_l20 = cached_is_l2;
1125 cached_sw_if_index = sw_if_index0;
1140 b0->
flags |= VNET_BUFFER_F_L3_HDR_OFFSET_VALID;
1141 b1->
flags |= VNET_BUFFER_F_L3_HDR_OFFSET_VALID;
1152 error0 = ETHERNET_ERROR_L3_MAC_MISMATCH;
1156 error1 = ETHERNET_ERROR_L3_MAC_MISMATCH;
1172 &orig_type0, &outer_id0, &inner_id0, &match_flags0);
1177 &orig_type1, &outer_id1, &inner_id1, &match_flags1);
1189 &main_intf0, &vlan_intf0, &qinq_intf0);
1198 &main_intf1, &vlan_intf1, &qinq_intf1);
1205 qinq_intf0, &new_sw_if_index0, &error0, &is_l20);
1212 qinq_intf1, &new_sw_if_index1, &error1, &is_l21);
1217 ETHERNET_ERROR_NONE ? old_sw_if_index0 : new_sw_if_index0;
1220 ETHERNET_ERROR_NONE ? old_sw_if_index1 : new_sw_if_index1;
1223 if (((new_sw_if_index0 != ~0)
1224 && (new_sw_if_index0 != old_sw_if_index0))
1225 || ((new_sw_if_index1 != ~0)
1226 && (new_sw_if_index1 != old_sw_if_index1)))
1234 stats_n_packets += 2;
1235 stats_n_bytes += len0 + len1;
1238 (!(new_sw_if_index0 == stats_sw_if_index
1239 && new_sw_if_index1 == stats_sw_if_index)))
1241 stats_n_packets -= 2;
1242 stats_n_bytes -= len0 + len1;
1244 if (new_sw_if_index0 != old_sw_if_index0
1245 && new_sw_if_index0 != ~0)
1247 interface_main.combined_sw_if_counters
1251 new_sw_if_index0, 1,
1253 if (new_sw_if_index1 != old_sw_if_index1
1254 && new_sw_if_index1 != ~0)
1256 interface_main.combined_sw_if_counters
1260 new_sw_if_index1, 1,
1263 if (new_sw_if_index0 == new_sw_if_index1)
1265 if (stats_n_packets > 0)
1272 stats_n_packets, stats_n_bytes);
1273 stats_n_packets = stats_n_bytes = 0;
1275 stats_sw_if_index = new_sw_if_index0;
1281 is_l20 = is_l21 = 0;
1294 n_left_to_next, bi0, bi1, next0,
1298 while (n_left_from > 0 && n_left_to_next > 0)
1303 u16 type0, orig_type0;
1304 u16 outer_id0, inner_id0;
1306 u32 old_sw_if_index0, new_sw_if_index0, len0;
1315 if (n_left_from > 1)
1329 n_left_to_next -= 1;
1333 error0 = ETHERNET_ERROR_NONE;
1335 type0 = clib_net_to_host_u16 (e0->
type);
1339 b0->
flags |= VNET_BUFFER_F_L2_HDR_OFFSET_VALID;
1350 is_l20 = cached_is_l2;
1354 cached_sw_if_index = sw_if_index0;
1367 b0->
flags |= VNET_BUFFER_F_L3_HDR_OFFSET_VALID;
1376 error0 = ETHERNET_ERROR_L3_MAC_MISMATCH;
1388 &orig_type0, &outer_id0, &inner_id0, &match_flags0);
1399 &main_intf0, &vlan_intf0, &qinq_intf0);
1406 qinq_intf0, &new_sw_if_index0, &error0, &is_l20);
1411 ETHERNET_ERROR_NONE ? old_sw_if_index0 : new_sw_if_index0;
1422 if ((new_sw_if_index0 != ~0)
1423 && (new_sw_if_index0 != old_sw_if_index0))
1429 stats_n_packets += 1;
1430 stats_n_bytes += len0;
1436 stats_n_packets -= 1;
1437 stats_n_bytes -= len0;
1439 if (new_sw_if_index0 != ~0)
1443 thread_index, new_sw_if_index0, 1, len0);
1444 if (stats_n_packets > 0)
1450 stats_sw_if_index, stats_n_packets, stats_n_bytes);
1451 stats_n_packets = stats_n_bytes = 0;
1453 stats_sw_if_index = new_sw_if_index0;
1468 to_next, n_left_to_next,
1476 if (stats_n_packets > 0)
1481 thread_index, stats_sw_if_index, stats_n_packets, stats_n_bytes);
1492 u32 n_packets = frame->n_vectors;
1514 u32 n_packets = from_frame->n_vectors;
1526 u32 n_packets = from_frame->n_vectors;
1569 u32 p2pe_sw_if_index =
1571 if (p2pe_sw_if_index == ~0)
1749 #ifndef CLIB_MARCH_VARIANT 1846 u32 unsupported = 0;
1890 #define ethernet_error(n,c,s) s, 1892 #undef ethernet_error 1897 .name =
"ethernet-input",
1899 .vector_size =
sizeof (
u32),
1905 #define _(s,n) [ETHERNET_INPUT_NEXT_##s] = n, 1915 .name =
"ethernet-input-type",
1917 .vector_size =
sizeof (
u32),
1920 #define _(s,n) [ETHERNET_INPUT_NEXT_##s] = n, 1927 .name =
"ethernet-input-not-l2",
1929 .vector_size =
sizeof (
u32),
1932 #define _(s,n) [ETHERNET_INPUT_NEXT_##s] = n, 1939 #ifndef CLIB_MARCH_VARIANT 1963 ETHERNET_INPUT_NEXT_DROP);
1965 ETHERNET_INPUT_NEXT_PUNT);
1987 u32 ethertype,
u32 next_index)
2015 if (ethertype == ETHERNET_TYPE_IP4)
2019 else if (ethertype == ETHERNET_TYPE_IP6)
2023 else if (ethertype == ETHERNET_TYPE_MPLS)
2036 __attribute__ ((unused))
vlan_table_t *invalid_vlan_table;
2037 __attribute__ ((unused))
qinq_table_t *invalid_qinq_table;
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION(bond_sw_interface_up_down)
static_always_inline void identify_subint(vnet_hw_interface_t *hi, vlib_buffer_t *b0, u32 match_flags, main_intf_t *main_intf, vlan_intf_t *vlan_intf, qinq_intf_t *qinq_intf, u32 *new_sw_if_index, u8 *error0, u32 *is_l2)
STATIC_ASSERT_OFFSET_OF(vlib_buffer_t, current_data, 0)
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 thread_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
u8 runtime_data[0]
Function dependent node-runtime data.
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)
#define pool_alloc(P, N)
Allocate N more free elements to pool (unspecified alignment).
vnet_interface_main_t interface_main
vnet_p2p_sub_interface_t p2p
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
int vnet_hw_interface_rx_redirect_to_node(vnet_main_t *vnm, u32 hw_if_index, u32 node_index)
u16x16 u64x4 static_always_inline u32 u8x32_msb_mask(u8x32 v)
void ethernet_register_l2_input(vlib_main_t *vm, u32 node_index)
#define clib_memcpy_fast(a, b, c)
static_always_inline void eth_input_tag_lookup(vlib_main_t *vm, vnet_main_t *vnm, vlib_node_runtime_t *node, vnet_hw_interface_t *hi, u64 tag, u16 *next, vlib_buffer_t *b, eth_input_tag_lookup_t *l, u8 dmac_bad, int is_dot1ad, int main_is_l3, int check_dmac)
#define SUBINT_CONFIG_MATCH_0_TAG
#define ethernet_buffer_header_size(b)
Determine the size of the Ethernet headers of the current frame in the buffer.
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
static subint_config_t * ethernet_sw_interface_get_config(vnet_main_t *vnm, u32 sw_if_index, u32 *flags, u32 *unsupported)
#define STRUCT_OFFSET_OF(t, f)
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
subint_config_t inner_any_subint
#define VLIB_NODE_FN(node)
vlib_error_t * errors
Vector of errors for this node.
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
static_always_inline void u64x4_scatter(u64x4 r, void *p0, void *p1, void *p2, void *p3)
static clib_error_t * ethernet_sw_interface_add_del(vnet_main_t *vnm, u32 sw_if_index, u32 is_create)
epu16_epi64 epu8_epi64 epu8_epi64 epi16_epi64 i16x16
vlib_node_registration_t ethernet_input_node
(constructor) VLIB_REGISTER_NODE (ethernet_input_node)
ethernet_main_t ethernet_main
represenation of a pipe interface
#define static_always_inline
#define VLIB_INIT_FUNCTION(x)
static uword ethernet_address_cast(u8 *a)
static_always_inline u16 eth_input_next_by_type(u16 etype)
void ethernet_set_rx_redirect(vnet_main_t *vnm, vnet_hw_interface_t *hi, u32 enable)
clib_error_t * next_by_ethertype_init(next_by_ethertype_t *l3_next)
#define ETH_INPUT_FRAME_F_SINGLE_SW_IF_IDX
vlib_combined_counter_main_t * combined_sw_if_counters
#define sparse_vec_validate(v, i)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
subint_config_t default_subint
#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 char * ethernet_error_strings[]
epu8_epi32 epu16_epi32 u64x2
struct vnet_sub_interface_t::@208::@209::@211 flags
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static clib_error_t * ethernet_input_init(vlib_main_t *vm)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
subint_config_t single_tag_subint
u32 * sparse_index_by_input_next_index
static ethernet_type_info_t * ethernet_get_type_info(ethernet_main_t *em, ethernet_type_t type)
static_always_inline u64x4 u64x4_gather(void *p0, void *p1, void *p2, void *p3)
#define ETH_INPUT_FRAME_F_IP4_CKSUM_OK
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static_always_inline void eth_input_process_frame(vlib_main_t *vm, vlib_node_runtime_t *node, vnet_hw_interface_t *hi, u32 *buffer_indices, u32 n_packets, int main_is_l3, int ip4_cksum_ok, int dmac_check)
vlib_node_registration_t ethernet_input_type_node
(constructor) VLIB_REGISTER_NODE (ethernet_input_type_node)
#define ethernet_buffer_set_vlan_count(b, v)
Sets the number of VLAN headers in the current Ethernet frame in the buffer.
#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 SUBINT_CONFIG_MATCH_3_TAG
vnet_hw_interface_class_t ethernet_hw_interface_class
u8 next_by_ethertype_register_called
subint_config_t untagged_subint
static_always_inline void u32x8_scatter_one(u32x8 r, int index, void *p)
u32 p2p_ethernet_lookup(u32 parent_if_index, u8 *client_mac)
u8 * format_ethernet_header_with_length(u8 *s, va_list *args)
#define SUBINT_CONFIG_VALID
#define VLIB_REGISTER_NODE(x,...)
static_always_inline void eth_input_single_int(vlib_main_t *vm, vlib_node_runtime_t *node, vnet_hw_interface_t *hi, u32 *from, u32 n_pkts, int ip4_cksum_ok)
qinq_intf_t vlans[ETHERNET_N_VLAN]
VNET_SW_INTERFACE_ADD_DEL_FUNCTION(ethernet_sw_interface_add_del)
struct vnet_sub_interface_t::@208 eth
#define CLIB_PREFETCH(addr, size, type)
static_always_inline void vlib_buffer_enqueue_to_next(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *buffers, u16 *nexts, uword count)
static int ethernet_mac_address_equal(const u8 *a, const u8 *b)
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
#define ETHERNET_INTERFACE_FLAG_ACCEPT_ALL
#define vlib_prefetch_buffer_data(b, type)
static u32 eth_identify_subint(vnet_hw_interface_t *hi, u32 match_flags, main_intf_t *main_intf, vlan_intf_t *vlan_intf, qinq_intf_t *qinq_intf, u32 *new_sw_if_index, u8 *error0, u32 *is_l2)
static void * vlib_frame_scalar_args(vlib_frame_t *f)
Get pointer to frame scalar data.
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.
#define SUBINT_CONFIG_MATCH_1_TAG
static_always_inline void parse_header(ethernet_input_variant_t variant, vlib_buffer_t *b0, u16 *type, u16 *orig_type, u16 *outer_id, u16 *inner_id, u32 *match_flags)
static_always_inline void eth_input_adv_and_flags_x1(vlib_buffer_t **b, int is_l3)
static void eth_vlan_table_lookups(ethernet_main_t *em, vnet_main_t *vnm, u32 port_sw_if_index0, u16 first_ethertype, u16 outer_id, u16 inner_id, vnet_hw_interface_t **hi, main_intf_t **main_intf, vlan_intf_t **vlan_intf, qinq_intf_t **qinq_intf)
static uword sparse_vec_index(void *v, uword sparse_index)
static_always_inline void ethernet_input_inline(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *from, u32 n_packets, ethernet_input_variant_t variant)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
u8 * format_ethernet_header(u8 *s, va_list *args)
void ethernet_register_l3_redirect(vlib_main_t *vm, u32 node_index)
void ethernet_sw_interface_set_l2_mode_noport(vnet_main_t *vnm, u32 sw_if_index, u32 l2)
static_always_inline int ethernet_frame_is_tagged(u16 type)
static_always_inline void determine_next_node(ethernet_main_t *em, ethernet_input_variant_t variant, u32 is_l20, u32 type0, vlib_buffer_t *b0, u8 *error0, u8 *next0)
void ethernet_register_input_type(vlib_main_t *vm, ethernet_type_t type, u32 node_index)
#define clib_error_report(e)
static u8 * format_ethernet_input_trace(u8 *s, va_list *va)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
STATIC_ASSERT(STRUCT_OFFSET_OF(vnet_buffer_opaque_t, l2_hdr_offset)==STRUCT_OFFSET_OF(vnet_buffer_opaque_t, l3_hdr_offset) - 2, "l3_hdr_offset must follow l2_hdr_offset")
vlan_intf_t vlans[ETHERNET_N_VLAN]
#define SUBINT_CONFIG_MATCH_2_TAG
clib_error_t * next_by_ethertype_register(next_by_ethertype_t *l3_next, u32 ethertype, u32 next_index)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define vec_elt(v, i)
Get vector value at index i.
subint_config_t subint
Sub-interface config.
vlib_node_registration_t ethernet_input_not_l2_node
(constructor) VLIB_REGISTER_NODE (ethernet_input_not_l2_node)
struct _vlib_node_registration vlib_node_registration_t
template key/value backing page structure
#define foreach_ethernet_input_next
#define SUBINT_CONFIG_P2P
void l2bvi_register_input_type(vlib_main_t *vm, ethernet_type_t type, u32 node_index)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
pipe_t * pipe_get(u32 sw_if_index)
Get the pipe instnace based on one end.
static_always_inline int ethernet_frame_is_any_tagged_x2(u16 type0, u16 type1)
VLIB buffer representation.
static_always_inline void eth_input_adv_and_flags_x4(vlib_buffer_t **b, int is_l3)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static clib_error_t * ethernet_init(vlib_main_t *vm)
void ethernet_sw_interface_set_l2_mode(vnet_main_t *vnm, u32 sw_if_index, u32 l2)
struct clib_bihash_value offset
template key/value backing page structure
vnet_pcap_t pcap[VLIB_N_RX_TX]
p2p_ethernet_main_t p2p_main
vnet_sw_interface_type_t type
#define u16x16_blend(v1, v2, mask)
u16 flags
Copy of main node flags.
next_by_ethertype_t l3_next
subint_config_t * p2p_subif_pool
static clib_error_t * ethernet_sw_interface_up_down(vnet_main_t *vnm, u32 sw_if_index, u32 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
#define CLIB_CACHE_LINE_BYTES
static void * sparse_vec_new(uword elt_bytes, uword sparse_index_bits)
ethernet_interface_t * interfaces
static_always_inline void eth_input_update_if_counters(vlib_main_t *vm, vnet_main_t *vnm, eth_input_tag_lookup_t *l)
static_always_inline void eth_input_get_etype_and_tags(vlib_buffer_t **b, u16 *etype, u64 *tags, u64 *dmacs, int offset, int dmac_check)
static void pcap_add_buffer(pcap_main_t *pm, struct vlib_main_t *vm, u32 buffer_index, u32 n_bytes_in_trace)
Add buffer (vlib_buffer_t) to the trace.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static_always_inline void ethernet_input_trace(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
static void ethernet_setup_node(vlib_main_t *vm, u32 node_index)
uword unformat_ethernet_header(unformat_input_t *input, va_list *args)
#define SPARSE_VEC_INVALID_INDEX