|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
48 const void * dst_address)
58 #define _(a,b) case VNET_LINK_##a: type = ETHERNET_TYPE_##b; break
73 clib_memcpy (
h->ethernet.dst_address, dst_address, sizeof (
h->ethernet.dst_address));
75 clib_memset (
h->ethernet.dst_address, ~0, sizeof (
h->ethernet.dst_address));
77 h->ethernet.type = clib_host_to_net_u16 (
type);
80 h->srp.mode = SRP_MODE_data;
106 for (
i = 0;
i < n_ifs;
i++)
136 si->rings[s].ring = s;
147 si->config.wait_to_restore_idle_delay = 60;
148 si->config.ips_tx_interval = 1;
159 si->hw_wrap_function =
f;
165 si->hw_enable_function =
f;
173 si->ips_process_enable = 1;
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);
235 if (
si->hw_enable_function)
236 si->hw_enable_function (
si, to_srp);
263 if (memcmp (&
si->config, &
c[0], sizeof (
c[0])))
271 #define VNET_SIMULATED_SRP_TX_NEXT_SRP_INPUT VNET_INTERFACE_TX_N_NEXT
293 n_left_to_next -= 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,
340 srp_simulated_device_class.index,
348 hi->min_packet_bytes = 40 + 16;
360 (
vm,
hi->tx_node_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,
static u8 * srp_build_rewrite(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
void srp_interface_set_hw_enable_function(u32 hw_if_index, srp_hw_enable_function_t *f)
static void srp_register_interface_helper(u32 *hw_if_indices_by_side, u32 redistribute)
uword unformat_ethernet_address(unformat_input_t *input, va_list *args)
static void serialize_integer(serialize_main_t *m, u64 x, u32 n_bytes)
vlib_node_registration_t srp_ips_process_node
#define vec_add(V, E, N)
Add N elements to end of vector V (no header, unspecified alignment)
void vnet_hw_interface_init_for_class(vnet_main_t *vnm, u32 hw_if_index, u32 hw_class_index, u32 hw_instance)
void vnet_sw_interface_set_mtu(vnet_main_t *vnm, u32 sw_if_index, u32 mtu)
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
struct _vnet_device_class vnet_device_class_t
VNET_DEVICE_CLASS(ethernet_simulated_device_class)
#define clib_memcpy(d, s, n)
nat44_ei_hairpin_src_next_t next_index
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static void vlib_node_set_state(vlib_main_t *vm, u32 node_index, vlib_node_state_t new_state)
Set node dispatch state.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
u8 * format_ethernet_address(u8 *s, va_list *args)
uword * interface_index_by_hw_if_index
vlib_main_t vlib_node_runtime_t * node
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static vnet_device_class_t * vnet_get_device_class(vnet_main_t *vnm, u32 dev_class_index)
void srp_interface_set_hw_wrap_function(u32 hw_if_index, srp_hw_wrap_function_t *f)
vnet_hw_if_output_node_runtime_t * r
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
srp_interface_t * interface_pool
static srp_interface_t * srp_get_interface_from_vnet_hw_interface(u32 hw_if_index)
u8 * format_srp_device(u8 *s, va_list *args)
#define hash_set(h, key, value)
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)
#define pool_foreach(VAR, POOL)
Iterate through pool.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
void() srp_hw_enable_function_t(struct srp_interface_t *si, u32 wrap_enable)
void unserialize_srp_main(serialize_main_t *m, va_list *va)
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
vnet_main_t * vnet_get_main(void)
void srp_interface_set_interface_config(u32 hw_if_index, srp_interface_config_t *c)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static void unserialize_integer(serialize_main_t *m, void *x, u32 n_bytes)
vnet_hw_interface_class_t srp_hw_interface_class
sll srl srl sll sra u16x4 i
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static void srp_header_compute_parity(srp_header_t *h)
#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,...)
uword vlib_node_add_named_next_with_slot(vlib_main_t *vm, uword node, char *name, uword slot)
static uword vnet_sw_interface_is_admin_up(vnet_main_t *vnm, u32 sw_if_index)
#define vec_free(V)
Free vector's memory (no header).
VNET_HW_INTERFACE_CLASS(ethernet_hw_interface_class)
void serialize_srp_main(serialize_main_t *m, va_list *va)
void ethernet_update_adjacency(vnet_main_t *vnm, u32 sw_if_index, u32 ai)
description fragment has unexpected format
vlib_put_next_frame(vm, node, next_index, 0)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
void() srp_hw_wrap_function_t(u32 hw_if_index, u32 wrap_enable)
void srp_register_interface(u32 *hw_if_indices_by_side)
static uword pool_elts(void *v)
Number of active elements in a pool.
static void srp_setup_node(vlib_main_t *vm, u32 node_index)
static uword srp_is_valid_class_for_interface(vnet_main_t *vnm, u32 hw_if_index, u32 hw_class_index)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
void srp_interface_enable_ips(u32 hw_if_index)
void srp_interface_get_interface_config(u32 hw_if_index, srp_interface_config_t *c)
#define clib_warning(format, args...)
vl_api_interface_index_t sw_if_index
#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).
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)
VLIB buffer representation.