|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
61 const static u8 ethernet_mcast_dst_mac[] = {
62 0x1, 0x0, 0x5e, 0x0, 0x0, 0x0,
65 return (ethernet_mcast_dst_mac);
71 const static u8 ethernet_mcast_dst_mac[] = {
72 0x33, 0x33, 0x00, 0x0, 0x0, 0x0,
75 return (ethernet_mcast_dst_mac);
101 if (sub_sw != sup_sw)
134 #define _(a,b) case VNET_LINK_##a: type = ETHERNET_TYPE_##b; break
151 sizeof (
h->dst_address));
156 clib_memcpy (
h->dst_address, dst_address, sizeof (
h->dst_address));
166 clib_host_to_net_u16 (ETHERNET_TYPE_DOT1AD) :
167 clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
170 outer->
type = clib_host_to_net_u16 (
type);
179 clib_host_to_net_u16 (ETHERNET_TYPE_DOT1AD) :
180 clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
183 outer->
type = clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
186 inner->
type = clib_host_to_net_u16 (
type);
191 h->type = clib_host_to_net_u16 (
type);
226 adj->rewrite_header.sw_if_index,
330 u32 *result = va_arg (*args,
u32 *);
341 *result = hw_if_index;
352 u32 * hw_if_index_return,
366 dev_class_index, dev_instance,
368 *hw_if_index_return = hw_if_index;
374 hi->min_packet_bytes =
hi->min_supported_packet_bytes =
376 hi->max_packet_bytes =
hi->max_supported_packet_bytes =
502 u32 new_rx_sw_if_index = ~0;
503 u32 new_tx_sw_if_index = ~0;
522 u32 sw_if_index0, sw_if_index1, sw_if_index2, sw_if_index3;
523 u32 not_all_match_config;
540 not_all_match_config = (sw_if_index0 ^ sw_if_index1)
541 ^ (sw_if_index2 ^ sw_if_index3);
542 not_all_match_config += sw_if_index0 ^ new_rx_sw_if_index;
593 != new_rx_sw_if_index))
616 != new_rx_sw_if_index))
639 != new_rx_sw_if_index))
662 != new_rx_sw_if_index))
690 != new_rx_sw_if_index))
718 return frame->n_vectors;
724 u32 dev_instance = va_arg (*args,
u32);
725 return format (s,
"loop%d", dev_instance);
761 #define LOOPBACK_MAX_INSTANCE (16 * 1024)
832 u8 is_specified,
u32 user_instance)
846 *sw_if_indexp = (
u32) ~ 0;
857 return VNET_API_ERROR_INVALID_REGISTRATION;
876 ethernet_simulated_device_class.index,
instance,
address, &hw_if_index,
881 rv = VNET_API_ERROR_INVALID_REGISTRATION;
918 u32 user_instance = 0;
926 if (
unformat (input,
"instance %d", &user_instance))
933 is_specified, user_instance);
956 .path =
"loopback create-interface",
957 .short_help =
"loopback create-interface [mac <mac-addr>] [instance <instance>]",
975 .path =
"create loopback interface",
976 .short_help =
"create loopback interface [mac <mac-addr>] [instance <instance>]",
986 return (
i->hw_class_index ==
1022 return &if_addr->
mac;
1038 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
1041 if (hw == 0 || hw->
dev_class_index != ethernet_simulated_device_class.index)
1042 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
1045 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
1055 u32 * sub_sw_if_index)
1070 return (VNET_API_ERROR_VLAN_ALREADY_EXISTS);
1077 template.sub.id =
id;
1078 template.sub.eth.raw_flags =
flags;
1079 template.sub.eth.outer_vlan_id = outer_vlan_id;
1080 template.sub.eth.inner_vlan_id = inner_vlan_id;
1083 return (VNET_API_ERROR_UNSPECIFIED);
1086 *kp = sup_and_sub_key;
1088 hash_set (
hi->sub_interface_sw_if_index_by_id,
id, *sub_sw_if_index);
1102 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
1111 u64 sup_and_sub_key =
1118 rv = VNET_API_ERROR_INVALID_SUB_SW_IF_INDEX;
1172 rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
1192 .path =
"loopback delete-interface",
1193 .short_help =
"loopback delete-interface intfc <interface>",
1210 .path =
"delete loopback interface",
1211 .short_help =
"delete loopback interface intfc <interface>",
1225 .path =
"delete sub-interface",
1226 .short_help =
"delete sub-interface <interface>",
#define ETHERNET_INTERFACE_FLAG_DEFAULT_L3
u32() ethernet_flag_change_function_t(vnet_main_t *vnm, struct vnet_hw_interface_t *hi, u32 flags)
#define VNET_SIMULATED_ETHERNET_TX_NEXT_ETHERNET_INPUT
vlan_intf_t vlans[ETHERNET_N_VLAN]
static uword simulated_ethernet_interface_tx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Echo packets back to ethernet/l2-input.
vnet_interface_main_t * im
uword unformat_ethernet_address(unformat_input_t *input, va_list *args)
fib_protocol_t ia_nh_proto
The protocol of the neighbor/peer.
static vlib_cli_command_t delete_simulated_ethernet_interface_command
(constructor) VLIB_CLI_COMMAND (delete_simulated_ethernet_interface_command)
u8 * ethernet_build_rewrite(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
build a rewrite string to use for sending packets of type 'link_type' to 'dst_address'
@ IP_LOOKUP_NEXT_ARP
This packet matches an "incomplete adjacency" and packets need to be passed to ARP to find rewrite st...
@ VNET_SW_INTERFACE_TYPE_PIPE
vnet_sw_interface_type_t type
vlib_buffer_t * bufs[VLIB_FRAME_SIZE]
uword unformat_ethernet_interface(unformat_input_t *input, va_list *args)
void vnet_sw_interface_set_mtu(vnet_main_t *vnm, u32 sw_if_index, u32 mtu)
#define VNET_REWRITE_FOR_SW_INTERFACE_ADDRESS_BROADCAST
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
VNET_DEVICE_CLASS(ethernet_simulated_device_class)
#define clib_memcpy(d, s, n)
@ VNET_INTERFACE_COUNTER_TX
@ VNET_HW_INTERFACE_CAP_SUPPORTS_MAC_FILTER
nat44_ei_hairpin_src_next_t next_index
static void ethernet_setup_node(vlib_main_t *vm, u32 node_index)
static void ethernet_set_mac(vnet_hw_interface_t *hi, ethernet_interface_t *ei, const u8 *mac_address)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
u8 * format_ethernet_address(u8 *s, va_list *args)
vlib_get_buffers(vm, from, b, n_left_from)
#define ETHERNET_INTERFACE_FLAG_STATUS_L3
vlib_main_t vlib_node_runtime_t * node
@ IP_LOOKUP_NEXT_GLEAN
This packet matches an "interface route" and packets need to be passed to ARP to find rewrite string ...
vnet_p2p_sub_interface_t p2p
static clib_error_t * ethernet_config(vlib_main_t *vm, unformat_input_t *input)
@ VNET_SW_INTERFACE_TYPE_SUB
#define clib_error_return(e, args...)
@ VNET_FLOOD_CLASS_NORMAL
@ IP_LOOKUP_NEXT_LOCAL
This packet is for one of our own IP addresses.
int vnet_create_loopback_interface(u32 *sw_if_indexp, u8 *mac_address, u8 is_specified, u32 user_instance)
@ ADJ_NBR_REWRITE_FLAG_COMPLETE
An indication that the rewrite is complete, i.e.
static vlib_cli_command_t delete_sub_interface_command
(constructor) VLIB_CLI_COMMAND (delete_sub_interface_command)
static int loopback_instance_free(u32 instance)
@ VNET_SW_INTERFACE_FLAG_ADMIN_UP
#define pool_put(P, E)
Free an object E in pool P.
static void ethernet_interface_address_copy(ethernet_interface_address_t *dst, const u8 *mac)
ethernet_interface_t * ethernet_get_interface(ethernet_main_t *em, u32 hw_if_index)
@ IP_LOOKUP_NEXT_MIDCHAIN
This packets follow a mid-chain adjacency.
vnet_hw_interface_class_t ethernet_hw_interface_class
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
mac_address_t * ethernet_interface_add_del_address(ethernet_main_t *em, u32 hw_if_index, const u8 *address, u8 is_add)
static clib_error_t * ethernet_mac_change(vnet_hw_interface_t *hi, const u8 *old_address, const u8 *mac_address)
#define vec_delete(V, N, M)
Delete N elements starting at element M.
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
@ VNET_HW_INTERFACE_FLAG_LINK_UP
static vlib_cli_command_t delete_loopback_interface_command
(constructor) VLIB_CLI_COMMAND (delete_loopback_interface_command)
vlib_buffer_enqueue_to_next(vm, node, from,(u16 *) nexts, frame->n_vectors)
#define clib_error_report(e)
vnet_link_t ia_link
link/ether-type 1 bytes
void adj_glean_update_rewrite(adj_index_t adj_index)
adj_glean_update_rewrite
int vnet_delete_loopback_interface(u32 sw_if_index)
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_put_index(p, i)
Free pool element with given index.
static uword clib_bitmap_first_clear(uword *ai)
Return the lowest numbered clear bit in a bitmap.
ethernet_address_change_function_t * function
void adj_mcast_update_rewrite(adj_index_t adj_index, u8 *rewrite, u8 offset)
adj_mcast_update_rewrite
#define VLIB_CONFIG_FUNCTION(x, n,...)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
void vnet_delete_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
#define hash_set(h, key, value)
static int ethernet_mac_address_equal(const u8 *a, const u8 *b)
struct vnet_sub_interface_t::@368 eth
#define LOOPBACK_MAX_INSTANCE
ethernet_interface_t * interfaces
@ IP_LOOKUP_NEXT_MCAST_MIDCHAIN
Multicast Midchain Adjacency.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
@ IP_LOOKUP_NEXT_DROP
Adjacency to drop this packet.
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
ip_lookup_next_t lookup_next_index
Next hop after ip4-lookup.
u32 default_mtu
Default interface MTU.
clib_error_t * ethernet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, const u8 *address, u32 *hw_if_index_return, ethernet_flag_change_function_t flag_change)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
vnet_main_t * vnet_get_main(void)
struct clib_bihash_value offset
template key/value backing page structure
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static clib_error_t * delete_simulated_ethernet_interfaces(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
clib_error_t * vnet_create_sw_interface(vnet_main_t *vnm, vnet_sw_interface_t *template, u32 *sw_if_index)
vnet_flood_class_t flood_class
void vnet_delete_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
static void hash_unset_mem_free(uword **h, const void *key)
@ IP_LOOKUP_NEXT_REWRITE
This packet is to be rewritten and forwarded to the next processing node.
#define hash_set_mem(h, key, value)
static clib_error_t * simulated_ethernet_mac_change(vnet_hw_interface_t *hi, const u8 *old_address, const u8 *mac_address)
sll srl srl sll sra u16x4 i
#define VNET_SIMULATED_ETHERNET_TX_NEXT_L2_INPUT
@ IP_LOOKUP_NEXT_PUNT
Adjacency to punt this packet.
#define ETHERNET_INTERFACE_FLAG_MTU
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
manual_print typedef address
#define VLIB_CLI_COMMAND(x,...)
@ IP_LOOKUP_NEXT_BCAST
Broadcast Adjacency.
int vnet_delete_sub_interface(u32 sw_if_index)
unformat_function_t unformat_vnet_hw_interface
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap.
ethernet_address_change_ctx_t * address_change_callbacks
Functions to call when interface hw address changes.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
vlib_combined_counter_main_t * combined_sw_if_counters
vnet_sw_interface_t * sw_interfaces
uword vlib_node_add_named_next_with_slot(vlib_main_t *vm, uword node, char *name, uword slot)
u32 ethernet_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
int vnet_create_sub_interface(u32 sw_if_index, u32 id, u32 flags, u16 inner_vlan_id, u16 outer_vlan_id, u32 *sub_sw_if_index)
void ethernet_delete_interface(vnet_main_t *vnm, u32 hw_if_index)
@ IP_LOOKUP_NEXT_ICMP_ERROR
This packets needs to go to ICMP error.
uword * bm_loopback_instances
struct vnet_sub_interface_t::@368::@369::@371 flags
static const u8 * ethernet_ip6_mcast_dst_addr(void)
VNET_HW_INTERFACE_CLASS(ethernet_hw_interface_class)
template key/value backing page structure
static u8 * format_simulated_ethernet_name(u8 *s, va_list *args)
uword unformat_ethernet_header(unformat_input_t *input, va_list *args)
#define hash_get_mem(h, key)
void ethernet_update_adjacency(vnet_main_t *vnm, u32 sw_if_index, u32 ai)
ethernet_main_t ethernet_main
void default_update_adjacency(vnet_main_t *vnm, u32 sw_if_index, u32 ai)
Default adjacency update function.
format_function_t format_vnet_sw_if_index_name
unformat_function_t unformat_vnet_sw_interface
description fragment has unexpected format
@ VNET_FLOOD_CLASS_NO_FLOOD
static vnet_sw_interface_t * vnet_get_hw_sw_interface(vnet_main_t *vnm, u32 hw_if_index)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
u8 * format_ethernet_header_with_length(u8 *s, va_list *args)
static const u8 * ethernet_ip4_mcast_dst_addr(void)
#define ETHERNET_MIN_PACKET_BYTES
static clib_error_t * create_simulated_ethernet_interfaces(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static clib_error_t * delete_sub_interface(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_foreach(var, vec)
Vector iterator.
#define hash_unset(h, key)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
void adj_nbr_update_rewrite(adj_index_t adj_index, adj_nbr_rewrite_flag_t flags, u8 *rewrite)
adj_nbr_update_rewrite
#define ETHERNET_INTERFACE_FLAGS_STATUS_MASK
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
static vlib_main_t * vlib_get_main(void)
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
void ip_neighbor_update(vnet_main_t *vnm, adj_index_t ai)
static clib_error_t * simulated_ethernet_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
#define ETHERNET_INTERFACE_FLAG_ACCEPT_ALL
static u32 loopback_instance_alloc(u8 is_specified, u32 want)
static vlib_cli_command_t create_simulated_ethernet_interface_command
(constructor) VLIB_CLI_COMMAND (create_simulated_ethernet_interface_command)
uword * sw_if_index_by_sup_and_sub
@ IP_LOOKUP_NEXT_MCAST
Multicast Adjacency.
@ VNET_SW_INTERFACE_TYPE_P2P
#define ETHERNET_MAX_PACKET_BYTES
#define ETHERNET_INTERFACE_FLAGS_SET_OPN_MASK
u16 nexts[VLIB_FRAME_SIZE]
ethernet_flag_change_function_t * flag_change
static vnet_sw_interface_t * vnet_get_sup_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
vl_api_interface_index_t sw_if_index
ethernet_interface_address_t * secondary_addrs
ethernet_interface_address_t address
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
static void * clib_mem_alloc(uword size)
vl_api_fib_path_type_t type
u32 vnet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u32 hw_class_index, u32 hw_instance)
vnet_interface_main_t interface_main
vlib_increment_combined_counter(ccm, ti, sw_if_index, n_buffers, n_bytes)
static vlib_cli_command_t create_loopback_interface_command
(constructor) VLIB_CLI_COMMAND (create_loopback_interface_command)
VLIB buffer representation.
manual_print typedef u8 mac_address[6]
vl_api_wireguard_peer_flags_t flags