55 want_enabled = want_enabled != 0;
91 VLIB_NODE_STATE_DISABLED : VLIB_NODE_STATE_POLLING));
105 s =
format (s,
"%Ubuffer 0x%x: %U",
120 u32 if_index = va_arg (*args,
u32);
169 .name =
"Packet generator",
207 rnd = (
u32) (now * 1e6);
242 u32 i, i0, i1, mask, n_bits_left;
283 if (i1 != 0 && n_bits_left > 0)
291 ASSERT ((v[i] & ~mask) == 0);
293 s[i0] |= v[
i] & mask;
302 while (n_bits_left >= 8)
322 ASSERT ((v[i] & ~mask) == 0);
324 s[i0] |= v[
i] & mask;
336 void *packet_data_mask)
#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)
#define hash_set(h, key, value)
vnet_main_t * vnet_get_main(void)
pg_edit_group_t * edit_groups
#define clib_memcpy_fast(a, b, c)
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
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)
void pg_stream_change(pg_main_t *pg, pg_stream_t *s)
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)
vl_api_interface_index_t sw_if_index
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?
vnet_hw_interface_flags_t flags
#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)
format_function_t format_vnet_buffer
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_always_inline u32 vlib_buffer_get_default_data_size(vlib_main_t *vm)
u8 * format_ethernet_header_with_length(u8 *s, va_list *args)
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).
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
vlib_main_t vlib_node_runtime_t * node
static void perform_fixed_edits(pg_stream_t *s)
u8 pre_data[VLIB_BUFFER_PRE_DATA_SIZE]
Space for inserting data before buffer start.
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
u32 pg_interface_add_or_get(pg_main_t *pg, uword if_id, u8 gso_enabled, u32 gso_size)
void pg_stream_enable_disable(pg_main_t *pg, pg_stream_t *s, int want_enabled)
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)
static vlib_main_t * vlib_get_main(void)
static uword pg_edit_n_alloc_bytes(pg_edit_t *e)
static u8 * format_pg_output_trace(u8 *s, va_list *va)
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)
clib_error_t * ethernet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, const u8 *address, u32 *hw_if_index_return, ethernet_flag_change_function_t flag_change)
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
vnet_l3_packet_type_t vnet_link_to_l3_proto(vnet_link_t link)
Convert a link to to an Ethertype.
#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
clib_error_t * vnet_sw_interface_set_flags(vnet_main_t *vnm, u32 sw_if_index, vnet_sw_interface_flags_t flags)
static u32 vlib_num_workers()
#define vec_foreach(var, vec)
Vector iterator.
static void pg_edit_free(pg_edit_t *e)
vnet_device_class_t pg_dev_class
#define CLIB_CACHE_LINE_BYTES
pg_interface_t * interfaces
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)