{
struct stat sb;
if (stat ((char *) a->pcap_file_name, &sb) != -1)
- return clib_error_return (0, "Cannot create pcap file");
+ return clib_error_return (0, "pcap file '%s' does not exist.",
+ a->pcap_file_name);
}
pi = pool_elt_at_index (pg->interfaces, a->dev_instance);
enable_disable_stream (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
{
+ unformat_input_t _line_input, *line_input = &_line_input;
pg_main_t *pg = &pg_main;
int is_enable = cmd->function_arg != 0;
u32 stream_index = ~0;
- if (unformat (input, "%U", unformat_eof))
- ;
- else if (unformat (input, "%U", unformat_hash_vec_string,
- pg->stream_index_by_name, &stream_index))
- ;
- else
- return clib_error_create ("unknown input `%U'",
- format_unformat_error, input);
+ if (!unformat_user (input, unformat_line_input, line_input))
+ goto doit;
+
+ while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (line_input, "%U", unformat_hash_vec_string,
+ pg->stream_index_by_name, &stream_index))
+ ;
+ else
+ return clib_error_create ("unknown input `%U'",
+ format_unformat_error, line_input);
+ }
+ unformat_free (line_input);
+doit:
pg_enable_disable (stream_index, is_enable);
return 0;
while (*junk_after_name && *junk_after_name != ' ')
junk_after_name++;
*junk_after_name = 0;
- s = format (s, "edit-funtion %s, ", function_name);
+ s = format (s, "edit-function %s, ", function_name);
vec_free (function_name);
}
s->min_packet_bytes = pm.min_packet_bytes;
s->max_packet_bytes = pm.max_packet_bytes;
s->buffer_bytes = pm.max_packet_bytes;
- /* For PCAP buffers we never re-use buffers. */
- s->flags |= PG_STREAM_FLAGS_DISABLE_BUFFER_RECYCLE;
if (s->n_packets_limit == 0)
s->n_packets_limit = vec_len (pm.packets_read);
unformat_vnet_sw_interface, vnm,
&s.sw_if_index[VLIB_RX]))
;
+ else if (unformat (input, "tx-interface %U",
+ unformat_vnet_sw_interface, vnm,
+ &s.sw_if_index[VLIB_TX]))
+ ;
else if (unformat (input, "pcap %s", &pcap_file_name))
;
else if (unformat_user (input, unformat_pg_stream_parameter, &s))
;
- else if (unformat (input, "no-recycle"))
- s.flags |= PG_STREAM_FLAGS_DISABLE_BUFFER_RECYCLE;
-
else
{
error = clib_error_create ("unknown input `%U'",
{
pg_main_t *pg = &pg_main;
unformat_input_t _line_input, *line_input = &_line_input;
- u32 if_id;
+ u32 if_id, gso_enabled = 0, gso_size = 0;
clib_error_t *error = NULL;
if (!unformat_user (input, unformat_line_input, line_input))
{
if (unformat (line_input, "interface pg%u", &if_id))
;
-
+ else if (unformat (line_input, "gso-enabled"))
+ {
+ gso_enabled = 1;
+ if (unformat (line_input, "gso-size %u", &gso_size))
+ ;
+ else
+ {
+ error = clib_error_create ("gso enabled but gso size missing");
+ goto done;
+ }
+ }
else
{
error = clib_error_create ("unknown input `%U'",
}
}
- pg_interface_add_or_get (pg, if_id);
+ pg_interface_add_or_get (pg, if_id, gso_enabled, gso_size);
done:
unformat_free (line_input);
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (create_pg_if_cmd, static) = {
.path = "create packet-generator",
- .short_help = "create packet-generator interface <interface name>",
+ .short_help = "create packet-generator interface <interface name> [gso-enabled gso-size <size>]",
.function = create_pg_if_cmd_fn,
};
/* *INDENT-ON* */