49 .path =
"packet-generator",
50 .short_help =
"Packet generator commands",
61 u32 stream_index = ~0;
73 if (stream_index == ~0)
75 pg_stream_enable_disable (pg, s, is_enable);
88 .path =
"packet-generator enable-stream",
89 .short_help =
"Enable packet generator streams",
95 .path =
"packet-generator disable-stream",
96 .short_help =
"Disable packet generator streams",
107 return format (s,
"%=16s%=12s%=16s%s",
108 "Name",
"Enabled",
"Count",
"Parameters");
110 s =
format (s,
"%-16v%=12s%16Ld",
121 v =
format (v,
"size %d%c%d, ",
153 vlib_cli_output (vm,
"%U", format_pg_stream, s);
161 .path =
"show packet-generator",
162 .short_help =
"Show packet generator streams",
174 memset (&pm, 0,
sizeof (pm));
193 if (
unformat (input,
"limit %f", &x))
196 else if (
unformat (input,
"rate %f", &x))
241 int sub_input_given = 0;
245 char * pcap_file_name;
254 if (
unformat (input,
"name %v", &tmp))
261 else if (
unformat (input,
"node %U",
270 else if (
unformat (input,
"node %U",
274 else if (
unformat (input,
"interface %U",
278 else if (
unformat (input,
"pcap %s", &pcap_file_name))
281 else if (! sub_input_given
288 else if (
unformat (input,
"no-recycle"))
303 if (! sub_input_given && ! pcap_file_name)
323 if (pcap_file_name != 0)
338 (
"failed to parse packet data from `%U'",
354 .path =
"packet-generator new",
356 .short_help =
"Create packet generator stream",
358 "Create packet generator stream\n" 362 "name STRING sets stream name\n" 363 "interface STRING interface for stream output \n" 364 "node NODE-NAME node for stream output\n" 365 "data STRING specifies packet data\n",
386 .path =
"packet-generator delete",
388 .short_help =
"Delete stream with given name",
398 u32 stream_index = ~0;
429 .path =
"packet-generator configure",
430 .short_help =
"Change packet generator stream parameters",
unformat_function_t unformat_vnet_hw_interface
void pg_stream_add(pg_main_t *pg, pg_stream_t *s_init)
sll srl srl sll sra u16x4 i
static clib_error_t * show_streams(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static u8 * format_pg_stream(u8 *s, va_list *va)
static uword unformat_pg_stream_parameter(unformat_input_t *input, va_list *args)
uword * stream_index_by_name
unformat_function_t unformat_vnet_sw_interface
pg_edit_type_t packet_size_edit_type
void pg_stream_del(pg_main_t *pg, uword index)
vnet_main_t * vnet_get_main(void)
#define pool_foreach(VAR, POOL, BODY)
#define VLIB_INIT_FUNCTION(x)
uword unformat_pg_payload(unformat_input_t *input, va_list *args)
always_inline uword pool_elts(void *v)
static clib_error_t * del_stream(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define pool_elt_at_index(p, i)
#define VLIB_BUFFER_DEFAULT_FREE_LIST_BYTES
#define clib_error_create(args...)
#define PG_STREAM_FLAGS_DISABLE_BUFFER_RECYCLE
unformat_function_t unformat_hash_vec_string
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static clib_error_t * validate_stream(pg_stream_t *s)
clib_error_t * pcap_read(pcap_main_t *pm)
static clib_error_t * new_stream(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static clib_error_t * pg_pcap_read(pg_stream_t *s, char *file_name)
#define vec_free(V)
Free vector's memory (no header).
unformat_function_t * unformat_edit
always_inline vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
u8 ** replay_packet_templates
#define VLIB_CLI_COMMAND(x,...)
always_inline void pg_stream_free(pg_stream_t *s)
always_inline int pg_stream_is_enabled(pg_stream_t *s)
void pg_stream_enable_disable(pg_main_t *pg, pg_stream_t *s, int is_enable)
static clib_error_t * enable_disable_stream(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static clib_error_t * change_stream_parameters(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 sw_if_index[VLIB_N_RX_TX]
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
unformat_function_t unformat_vlib_node
f64 rate_packets_per_second
static clib_error_t * pg_cli_init(vlib_main_t *vm)
#define clib_error_return(e, args...)