summaryrefslogtreecommitdiffstats
path: root/src/vnet/pg/cli.c
diff options
context:
space:
mode:
authorChristian E. Hopps <chopps@chopps.org>2019-09-27 12:59:30 -0400
committerDave Barach <openvpp@barachs.net>2019-10-03 16:54:28 +0000
commit87d7bac5cf2ebdc7820e1edaadc2cc3b6d111cf2 (patch)
treeeafd0c6385923294367a0db2a565cb1b9a18ae32 /src/vnet/pg/cli.c
parent4ec6f6bc7788f3c356a022ea5fd019ca4e815747 (diff)
misc: add "maxframe" and "rate" to packet-generator cli.
Allow for setting the maximum number of generated packets to be included in the frame passed to next nodes. This is very important for testing code which may be susceptible to multi-frame vs single-frame bugs (e.g., code that is doing re-ordering where packets may be buffered between frames). Update: - remove redundant packet "rate" option. - reduce n_max_frame to u32 as that's what pulled from the CLI. Type: feature Signed-off-by: Christian E. Hopps <chopps@chopps.org> Change-Id: Ie362bbb110b2cf01d9f65c559bbe9101e17b7fdc Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'src/vnet/pg/cli.c')
-rw-r--r--src/vnet/pg/cli.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/vnet/pg/cli.c b/src/vnet/pg/cli.c
index d7e9ca04743..c43ff903e75 100644
--- a/src/vnet/pg/cli.c
+++ b/src/vnet/pg/cli.c
@@ -336,7 +336,7 @@ new_stream (vlib_main_t * vm,
{
clib_error_t *error = 0;
u8 *tmp = 0;
- u32 hw_if_index;
+ u32 maxframe, hw_if_index;
unformat_input_t sub_input = { 0 };
int sub_input_given = 0;
vnet_main_t *vnm = vnet_get_main ();
@@ -349,7 +349,9 @@ new_stream (vlib_main_t * vm,
s.max_packet_bytes = s.min_packet_bytes = 64;
s.buffer_bytes = vlib_buffer_get_default_data_size (vm);
s.if_id = 0;
+ s.n_max_frame = VLIB_FRAME_SIZE;
pcap_file_name = 0;
+
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (input, "name %v", &tmp))
@@ -374,7 +376,8 @@ new_stream (vlib_main_t * vm,
else if (unformat (input, "node %U",
unformat_vlib_node, vm, &s.node_index))
;
-
+ else if (unformat (input, "maxframe %u", &maxframe))
+ s.n_max_frame = s.n_max_frame < maxframe ? s.n_max_frame : maxframe;
else if (unformat (input, "worker %u", &s.worker_index))
;
@@ -485,7 +488,9 @@ VLIB_CLI_COMMAND (new_stream_cli, static) = {
"interface STRING interface for stream output \n"
"node NODE-NAME node for stream output\n"
"data STRING specifies packet data\n"
- "pcap FILENAME read packet data from pcap file\n",
+ "pcap FILENAME read packet data from pcap file\n"
+ "rate PPS rate to transfer packet data\n"
+ "maxframe NPKTS maximum number of packets per frame\n",
};
/* *INDENT-ON* */