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++)
144 vec_len (hws[SRP_RING_OUTER]->hw_address));
197 u32 old_hw_class_index,
u32 new_hw_class_index)
228 if (dc->hw_class_change)
229 dc->hw_class_change (vnm, ir->
hw_if_index, new_hw_class_index);
263 if (memcmp (&si->
config, &c[0], sizeof (c[0])))
271 #define VNET_SIMULATED_SRP_TX_NEXT_SRP_INPUT VNET_INTERFACE_TX_N_NEXT 278 u32 n_left_from, n_left_to_next, n_copy, * from, * to_next;
279 u32 next_index = VNET_SIMULATED_SRP_TX_NEXT_SRP_INPUT;
286 while (n_left_from > 0)
290 n_copy =
clib_min (n_left_from, n_left_to_next);
293 n_left_to_next -= n_copy;
294 n_left_from -= n_copy;
295 for (i = 0; i < n_copy; i++)
308 static u8 * format_simulated_srp_name (
u8 * s, va_list * args)
310 u32 dev_instance = va_arg (*args,
u32);
311 return format (s,
"fake-srp%d", dev_instance);
315 .name =
"Simulated srp",
316 .format_device_name = format_simulated_srp_name,
317 .tx_function = simulated_srp_interface_tx,
336 address[5] = instance;
340 srp_simulated_device_class.index,
362 VNET_SIMULATED_SRP_TX_NEXT_SRP_INPUT);
363 ASSERT (slot == VNET_SIMULATED_SRP_TX_NEXT_SRP_INPUT);
370 .path =
"srp create-interfaces",
371 .short_help =
"Create simulated srp interface",
372 .function = create_simulated_srp_interfaces,
#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() srp_hw_enable_function_t(struct srp_interface_t *si, u32 wrap_enable)
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)
uword vlib_node_add_named_next_with_slot(vlib_main_t *vm, uword node, char *name, uword slot)
#define clib_memcpy_fast(a, b, c)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
static void srp_header_compute_parity(srp_header_t *h)
void srp_interface_enable_ips(u32 hw_if_index)
struct _vnet_device_class vnet_device_class_t
#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 clib_memcpy(d, s, n)
#define vec_add(V, E, N)
Add N elements to end of vector V (no header, unspecified alignment)
srp_interface_t * interface_pool
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]
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).
uword * interface_index_by_hw_if_index
f64 wait_to_restore_idle_delay
VNET_HW_INTERFACE_CLASS(ethernet_hw_interface_class)
#define vec_free(V)
Free vector's memory (no header).
#define clib_warning(format, args...)
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,...)
void() srp_hw_wrap_function_t(u32 hw_if_index, u32 wrap_enable)
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_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)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
void vnet_sw_interface_set_mtu(vnet_main_t *vnm, u32 sw_if_index, u32 mtu)
void unserialize_srp_main(serialize_main_t *m, va_list *va)
VNET_DEVICE_CLASS(ethernet_simulated_device_class)
srp_interface_config_t config
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.
static uword pool_elts(void *v)
Number of active elements in a pool.