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;
82 (
"p2p ethernet sub-interface on sw_if_index %d with sub id %d already exists\n",
84 return VNET_API_ERROR_SUBIF_ALREADY_EXISTS;
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);
129 *kp = sup_and_sub_key;
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]",};
unformat_function_t unformat_vnet_hw_interface
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
#define hash_set(h, key, value)
void vlib_validate_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
validate a combined counter
vnet_main_t * vnet_get_main(void)
uword * p2p_ethernet_by_key
Hash mapping parent sw_if_index and client mac address to p2p_ethernet sub-interface.
vnet_interface_main_t interface_main
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
#define hash_set_mem(h, key, value)
uword * sub_interface_sw_if_index_by_id
#define VLIB_INIT_FUNCTION(x)
vlib_combined_counter_main_t * combined_sw_if_counters
#define clib_error_return(e, args...)
static clib_error_t * p2p_ethernet_init(vlib_main_t *vm)
Key struct for P2P Ethernet Key fields: parent sw_if_index and client mac address all fields in NET b...
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)
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 hash_unset_mem(h, key)
uword * sw_if_index_by_sup_and_sub
vlib_simple_counter_main_t * sw_if_counters
u32 * p2p_ethernet_by_sw_if_index
static void create_p2pe_key(p2p_key_t *p2pe_key, u32 parent_if_index, u8 *client_mac)
u32 p2p_ethernet_lookup(u32 parent_if_index, u8 *client_mac)
#define VNET_HW_INTERFACE_BOND_INFO_SLAVE
int vnet_delete_sub_interface(u32 sw_if_index)
#define clib_warning(format, args...)
#define clib_memcpy(a, b, c)
static void vnet_interface_counter_unlock(vnet_interface_main_t *im)
#define ETHERNET_INTERFACE_FLAG_ACCEPT_ALL
static clib_error_t * vnet_p2p_ethernet_add_del(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define VLIB_CLI_COMMAND(x,...)
static void vnet_interface_counter_lock(vnet_interface_main_t *im)
void vlib_validate_simple_counter(vlib_simple_counter_main_t *cm, u32 index)
validate a simple counter
uword unformat_ethernet_address(unformat_input_t *input, va_list *args)
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.
static void * clib_mem_alloc(uword size)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define hash_get_mem(h, key)
p2p_ethernet_main_t p2p_main
vnet_sw_interface_type_t type
clib_error_t * vnet_create_sw_interface(vnet_main_t *vnm, vnet_sw_interface_t *template, u32 *sw_if_index)
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)
u32 ethernet_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)