|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
51 u8 * client_mac,
u32 p2pe_subif_id,
int is_add,
58 u32 p2pe_sw_if_index = ~0;
66 if (p2pe_sw_if_index == ~0)
72 return VNET_API_ERROR_BOND_SLAVE_NOT_ALLOWED;
75 ((
u64) (
hi->sw_if_index) << 32) | (
u64) p2pe_subif_id;
82 (
"p2p ethernet sub-interface on sw_if_index %d with sub id %d already exists\n",
83 hi->sw_if_index, p2pe_subif_id);
84 return VNET_API_ERROR_SUBIF_ALREADY_EXISTS;
89 .sup_sw_if_index =
hi->sw_if_index,
90 .sub.id = p2pe_subif_id
94 sizeof (
template.p2p.client_mac));
97 return VNET_API_ERROR_SUBIF_CREATE_FAILED;
116 [
i], p2pe_sw_if_index);
126 ((
u64) (
hi->sw_if_index) << 32) | (
u64) p2pe_subif_id;
129 *kp = sup_and_sub_key;
130 hash_set (
hi->sub_interface_sw_if_index_by_id, p2pe_subif_id,
141 *p2pe_if_index = p2pe_sw_if_index;
147 "p2p-ethernet-input",
148 parent_if_index, 1, 0, 0);
160 return VNET_API_ERROR_SUBIF_ALREADY_EXISTS;
164 if (p2pe_sw_if_index == ~0)
165 return VNET_API_ERROR_SUBIF_DOESNT_EXIST;
177 "p2p-ethernet-input",
178 parent_if_index, 0, 0, 0);
203 u32 hw_if_index = ~0;
214 else if (
unformat (input,
"sub-id %d", &sub_id))
222 if (hw_if_index == ~0)
226 if (sub_id == ~0 && is_add)
233 case VNET_API_ERROR_BOND_SLAVE_NOT_ALLOWED:
235 "not allowed as parent interface belongs to a BondEthernet interface");
238 "p2p ethernet for given parent interface and client mac already exists");
241 "couldn't create p2p ethernet subinterface");
244 "p2p ethernet for given parent interface and client mac doesn't exist");
254 "p2p_ethernet <intfc> <mac-address> [sub-id <id> | del]",};
vnet_interface_main_t * im
p2p_ethernet_main_t p2p_main
uword unformat_ethernet_address(unformat_input_t *input, va_list *args)
static vlib_cli_command_t p2p_ethernet_add_del_command
(constructor) VLIB_CLI_COMMAND (p2p_ethernet_add_del_command)
#define hash_set(h, key, value)
vnet_sw_interface_type_t type
#define clib_memcpy(d, s, n)
u32 ethernet_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
uword * p2p_ethernet_by_key
Hash mapping parent sw_if_index and client mac address to p2p_ethernet sub-interface.
#define clib_error_return(e, args...)
@ VNET_FLOOD_CLASS_NORMAL
static clib_error_t * p2p_ethernet_init(vlib_main_t *vm)
#define hash_set_mem(h, key, value)
void vlib_validate_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
validate a combined counter
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
vlib_simple_counter_main_t * sw_if_counters
int p2p_ethernet_add_del(vlib_main_t *vm, u32 parent_if_index, u8 *client_mac, u32 p2pe_subif_id, int is_add, u32 *p2pe_if_index)
#define hash_create_mem(elts, key_bytes, value_bytes)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define hash_unset_mem(h, key)
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
vnet_main_t * vnet_get_main(void)
clib_error_t * vnet_create_sw_interface(vnet_main_t *vnm, vnet_sw_interface_t *template, u32 *sw_if_index)
static void vlib_zero_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
Clear a combined counter Clears the set of per-thread counters.
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
#define VLIB_CLI_COMMAND(x,...)
#define VNET_HW_INTERFACE_BOND_INFO_SLAVE
unformat_function_t unformat_vnet_hw_interface
static clib_error_t * vnet_p2p_ethernet_add_del(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vlib_combined_counter_main_t * combined_sw_if_counters
Key struct for P2P Ethernet Key fields: parent sw_if_index and client mac address all fields in NET b...
#define hash_get_mem(h, key)
static void vnet_interface_counter_unlock(vnet_interface_main_t *im)
static void vlib_zero_simple_counter(vlib_simple_counter_main_t *cm, u32 index)
Clear a simple counter Clears the set of per-thread u16 counters, and the u64 counter.
u32 p2p_ethernet_lookup(u32 parent_if_index, u8 *client_mac)
static void create_p2pe_key(p2p_key_t *p2pe_key, u32 parent_if_index, u8 *client_mac)
u32 * p2p_ethernet_by_sw_if_index
#define VLIB_INIT_FUNCTION(x)
void vlib_validate_simple_counter(vlib_simple_counter_main_t *cm, u32 index)
validate a simple counter
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
#define ETHERNET_INTERFACE_FLAG_ACCEPT_ALL
uword * sw_if_index_by_sup_and_sub
@ VNET_SW_INTERFACE_TYPE_P2P
#define clib_warning(format, args...)
static void vnet_interface_counter_lock(vnet_interface_main_t *im)
static void * clib_mem_alloc(uword size)
int vnet_delete_sub_interface(u32 sw_if_index)
vnet_interface_main_t interface_main