48 const void * dst_address)
55 uword n_bytes =
sizeof (h[0]);
58 #define _(a,b) case VNET_LINK_##a: type = ETHERNET_TYPE_##b; break 80 h->
srp.mode = SRP_MODE_data;
96 serialize_integer (m, si->rings[SRP_RING_OUTER].hw_if_index, sizeof (u32));
97 serialize_integer (m, si->rings[SRP_RING_INNER].hw_if_index, sizeof (u32));
106 for (i = 0; i < n_ifs; i++)
116 u32 * hw_if_indices = va_arg (*va,
u32 *);
146 .name =
"vnet_srp_register_interface",
160 if (vm->
mc_main && redistribute)
166 hw_if_indices_by_side[0],
180 memset (si, 0,
sizeof (si[0]));
193 vec_len (hws[SRP_RING_OUTER]->hw_address));
246 u32 old_hw_class_index,
u32 new_hw_class_index)
277 if (dc->hw_class_change)
278 dc->hw_class_change (vnm, ir->
hw_if_index, new_hw_class_index);
326 .name =
"vnet_srp_interface_config",
344 if (memcmp (&si->
config, &c[0], sizeof (c[0])))
354 #define VNET_SIMULATED_SRP_TX_NEXT_SRP_INPUT VNET_INTERFACE_TX_N_NEXT 362 u32 n_left_from, n_left_to_next, n_copy, * from, * to_next;
363 u32 next_index = VNET_SIMULATED_SRP_TX_NEXT_SRP_INPUT;
370 while (n_left_from > 0)
374 n_copy =
clib_min (n_left_from, n_left_to_next);
376 clib_memcpy (to_next, from, n_copy *
sizeof (from[0]));
377 n_left_to_next -= n_copy;
378 n_left_from -= n_copy;
379 for (i = 0; i < n_copy; i++)
392 static u8 * format_simulated_srp_name (
u8 * s, va_list * args)
394 u32 dev_instance = va_arg (*args,
u32);
395 return format (s,
"fake-srp%d", dev_instance);
399 .name =
"Simulated srp",
400 .format_device_name = format_simulated_srp_name,
401 .tx_function = simulated_srp_interface_tx,
417 memset (address, 0,
sizeof (address));
420 address[5] = instance;
424 srp_simulated_device_class.index,
446 VNET_SIMULATED_SRP_TX_NEXT_SRP_INPUT);
447 ASSERT (slot == VNET_SIMULATED_SRP_TX_NEXT_SRP_INPUT);
454 .path =
"srp create-interfaces",
455 .short_help =
"Create simulated srp interface",
456 .function = create_simulated_srp_interfaces,
static void serialize_srp_interface_config_msg(serialize_main_t *m, va_list *va)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
#define hash_set(h, key, value)
sll srl srl sll sra u16x4 i
static void vlib_signal_one_time_waiting_process(vlib_main_t *vm, vlib_one_time_waiting_process_t *p)
#define hash_unset(h, key)
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)
static void unserialize_srp_register_interface_msg(serialize_main_t *m, va_list *va)
uword vlib_node_add_named_next_with_slot(vlib_main_t *vm, uword node, char *name, uword slot)
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
MC_SERIALIZE_MSG(vnet_sw_interface_set_flags_msg, static)
void( srp_hw_wrap_function_t)(u32 hw_if_index, u32 wrap_enable)
static void srp_header_compute_parity(srp_header_t *h)
#define pool_is_free(P, E)
Use free bitmap to query whether given element is free.
void srp_interface_enable_ips(u32 hw_if_index)
struct _vnet_device_class vnet_device_class_t
#define mc_serialize(mc, msg, args...)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
void srp_interface_get_interface_config(u32 hw_if_index, srp_interface_config_t *c)
ethernet_header_t ethernet
#define vec_add(V, E, N)
Add N elements to end of vector V (no header, unspecified alignment)
srp_interface_t * interface_pool
static void unserialize_srp_interface_config_msg(serialize_main_t *m, va_list *va)
u8 * format_ethernet_address(u8 *s, va_list *args)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
static vnet_device_class_t * vnet_get_device_class(vnet_main_t *vnm, u32 dev_class_index)
void srp_register_interface(u32 *hw_if_indices_by_side)
static uword srp_is_valid_class_for_interface(vnet_main_t *vnm, u32 hw_if_index, u32 hw_class_index)
static void srp_setup_node(vlib_main_t *vm, u32 node_index)
static srp_interface_t * srp_get_interface_from_vnet_hw_interface(u32 hw_if_index)
static void srp_register_interface_helper(u32 *hw_if_indices_by_side, u32 redistribute)
u32 vnet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u32 hw_class_index, u32 hw_instance)
static void srp_interface_hw_class_change(vnet_main_t *vnm, u32 hw_if_index, u32 old_hw_class_index, u32 new_hw_class_index)
void serialize_srp_main(serialize_main_t *m, va_list *va)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
void srp_interface_set_hw_enable_function(u32 hw_if_index, srp_hw_enable_function_t *f)
srp_interface_ring_t rings[SRP_N_RING]
vlib_one_time_waiting_process_t * srp_register_interface_waiting_process_pool
#define pool_put(P, E)
Free an object E in pool P.
vnet_hw_interface_class_t srp_hw_interface_class
srp_hw_wrap_function_t * hw_wrap_function
static u8 * srp_build_rewrite(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
#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).
serialize_function_t unserialize_f64
uword * interface_index_by_hw_if_index
f64 wait_to_restore_idle_delay
VNET_HW_INTERFACE_CLASS(ethernet_hw_interface_class)
clib_error_t * serialize(serialize_main_t *m,...)
#define vec_free(V)
Free vector's memory (no header).
#define clib_warning(format, args...)
#define clib_memcpy(a, b, c)
static void unserialize_integer(serialize_main_t *m, void *x, u32 n_bytes)
static void serialize_integer(serialize_main_t *m, u64 x, u32 n_bytes)
void vnet_hw_interface_init_for_class(vnet_main_t *vnm, u32 hw_if_index, u32 hw_class_index, u32 hw_instance)
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.
u8 * format_srp_device(u8 *s, va_list *args)
void srp_interface_set_interface_config(u32 hw_if_index, srp_interface_config_t *c)
void srp_interface_set_hw_wrap_function(u32 hw_if_index, srp_hw_wrap_function_t *f)
srp_hw_enable_function_t * hw_enable_function
#define VLIB_CLI_COMMAND(x,...)
u32 max_l3_packet_bytes[VLIB_N_RX_TX]
uword unformat_ethernet_address(unformat_input_t *input, va_list *args)
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
static void * vlib_frame_args(vlib_frame_t *f)
Get pointer to frame scalar data.
clib_error_t * unserialize(serialize_main_t *m,...)
static void vlib_node_set_state(vlib_main_t *vm, u32 node_index, vlib_node_state_t new_state)
Set node dispatch state.
vlib_node_registration_t srp_ips_process_node
static uword vnet_sw_interface_is_admin_up(vnet_main_t *vnm, u32 sw_if_index)
uword * srp_register_interface_waiting_process_pool_index_by_hw_if_index
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
void unserialize_srp_main(serialize_main_t *m, va_list *va)
static void serialize_srp_register_interface_msg(serialize_main_t *m, va_list *va)
void( srp_hw_enable_function_t)(struct srp_interface_t *si, u32 wrap_enable)
VNET_DEVICE_CLASS(ethernet_simulated_device_class)
srp_interface_config_t config
struct vlib_main_t * vlib_main
void ethernet_update_adjacency(vnet_main_t *vnm, u32 sw_if_index, u32 ai)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
serialize_function_t serialize_f64
static void vlib_current_process_wait_for_one_time_event(vlib_main_t *vm, vlib_one_time_waiting_process_t *p)
static uword pool_elts(void *v)
Number of active elements in a pool.