55 want_enabled = want_enabled != 0;
91 VLIB_NODE_STATE_DISABLED : VLIB_NODE_STATE_POLLING));
101 u32 if_index = va_arg (*args,
u32);
149 .name =
"Packet generator",
186 rnd = (
u32) (now * 1e6);
219 u32 i, i0, i1, mask, n_bits_left;
260 if (i1 != 0 && n_bits_left > 0)
268 ASSERT ((v[i] & ~mask) == 0);
270 s[i0] |= v[
i] & mask;
279 while (n_bits_left >= 8)
299 ASSERT ((v[i] & ~mask) == 0);
301 s[i0] |= v[
i] & mask;
313 void *packet_data_mask)
443 "pg stream %d buffer #%d",
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static int pg_stream_is_enabled(pg_stream_t *s)
void mpls_sw_interface_enable_disable(mpls_main_t *mm, u32 sw_if_index, u8 is_enable)
#define hash_set(h, key, value)
sll srl srl sll sra u16x4 i
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
static vlib_main_t * vlib_get_main(void)
pg_edit_group_t * edit_groups
static f64 vlib_time_now(vlib_main_t *vm)
uword * stream_index_by_name
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
VNET_DEVICE_CLASS(pg_dev_class)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static clib_error_t * pg_interface_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap. ...
#define hash_set_mem(h, key, value)
#define pool_is_free(P, E)
Use free bitmap to query whether given element is free.
pg_buffer_index_t * buffer_indices
#define VNET_HW_INTERFACE_FLAG_LINK_UP
pg_edit_type_t packet_size_edit_type
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
VNET_HW_INTERFACE_CLASS(pg_interface_class, static)
u8 * fixed_packet_data_mask
static pg_edit_group_t * pg_stream_get_group(pg_stream_t *s, u32 group_index)
#define vec_add(V, E, N)
Add N elements to end of vector V (no header, unspecified alignment)
vnet_main_t * vnet_get_main(void)
static u8 * format_pg_interface_name(u8 *s, va_list *args)
static uword pow2_mask(uword x)
u8 * fixed_packet_data_mask
static uword clib_bitmap_is_zero(uword *ai)
predicate function; is an entire bitmap empty?
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V...
void pg_stream_del(pg_main_t *pg, uword index)
#define PG_STREAM_FLAGS_IS_ENABLED
uword * if_index_by_if_id
static u32 pg_eth_flag_change(vnet_main_t *vnm, vnet_hw_interface_t *hi, u32 flags)
u32 last_increment_packet_size
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
#define hash_unset_mem(h, key)
void ip4_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)
pg_edit_t * non_fixed_edits
static u64 pg_edit_get_value(pg_edit_t *e, int hi_or_lo)
static void pg_stream_free(pg_stream_t *s)
#define pool_put(P, E)
Free an object E in pool P.
#define vec_dup(V)
Return copy of vector (no header, no alignment)
vlib_node_function_t pg_output
static u8 * pg_build_rewrite(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
#define vec_free(V)
Free vector's memory (no header).
u32 pg_interface_add_or_get(pg_main_t *pg, uword if_id)
#define clib_memcpy(a, b, c)
void pg_edit_group_get_fixed_packet_data(pg_stream_t *s, u32 group_index, void *packet_data, void *packet_data_mask)
pg_edit_t * non_fixed_edits
u8 ** replay_packet_templates
static void perform_fixed_edits(pg_stream_t *s)
#define VNET_SW_INTERFACE_FLAG_ADMIN_UP
#define vlib_foreach_rx_tx(v)
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
void pg_stream_enable_disable(pg_main_t *pg, pg_stream_t *s, int want_enabled)
clib_error_t * ethernet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u8 *address, u32 *hw_if_index_return, ethernet_flag_change_function_t flag_change)
void pg_stream_add(pg_main_t *pg, pg_stream_t *s_init)
static void vlib_node_set_state(vlib_main_t *vm, u32 node_index, vlib_node_state_t new_state)
Set node dispatch state.
#define clib_fifo_free(f)
void vlib_buffer_delete_free_list(vlib_main_t *vm, u32 free_list_index)
static uword pg_edit_n_alloc_bytes(pg_edit_t *e)
u32 sw_if_index[VLIB_N_RX_TX]
#define hash_create_vec(elts, key_bytes, value_bytes)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vnet_l3_packet_type_t vnet_link_to_l3_proto(vnet_link_t link)
Convert a link to to an Ethertype.
#define VLIB_BUFFER_DATA_SIZE
#define hash_get_mem(h, key)
static void * clib_mem_alloc_aligned(uword size, uword align)
static void do_edit(pg_stream_t *stream, pg_edit_group_t *g, pg_edit_t *e, uword want_commit)
static u32 random_u32(u32 *seed)
32-bit random number generator
static u32 vlib_num_workers()
#define vec_foreach(var, vec)
Vector iterator.
clib_error_t * vnet_sw_interface_set_flags(vnet_main_t *vnm, u32 sw_if_index, u32 flags)
static void pg_edit_free(pg_edit_t *e)
vnet_device_class_t pg_dev_class
#define CLIB_CACHE_LINE_BYTES
void ip6_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)
pg_interface_t * interfaces
u32 vlib_buffer_create_free_list(vlib_main_t *vm, u32 n_data_bytes, char *fmt,...)
vlib_node_registration_t device_input_node
(constructor) VLIB_REGISTER_NODE (device_input_node)
static vlib_main_t * vlib_get_worker_vlib_main(u32 worker_index)
static u32 vlib_buffer_round_size(u32 size)