pg: add support for ip mode through cli
Type: improvement
@@ -689,6 +689,7 @@ create_pg_if_cmd_fn (vlib_main_t * vm,
unformat_input_t _line_input, *line_input = &_line_input;
u32 if_id, gso_enabled = 0, gso_size = 0, coalesce_enabled = 0;
clib_error_t *error = NULL;
+ pg_interface_mode_t mode = PG_MODE_ETHERNET;
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
@@ -710,6 +711,10 @@ create_pg_if_cmd_fn (vlib_main_t * vm,
goto done;
}
}
+ else if (unformat (line_input, "mode ip4"))
+ mode = PG_MODE_IP4;
+ else if (unformat (line_input, "mode ip6"))
+ mode = PG_MODE_IP6;
else
{
error = clib_error_create ("unknown input `%U'",
@@ -719,7 +724,7 @@ create_pg_if_cmd_fn (vlib_main_t * vm,
}
pg_interface_add_or_get (pg, if_id, gso_enabled, gso_size, coalesce_enabled,
- PG_MODE_ETHERNET);
+ mode);
done:
unformat_free (line_input);
@@ -731,7 +736,8 @@ done:
VLIB_CLI_COMMAND (create_pg_if_cmd, static) = {
.path = "create packet-generator",
.short_help = "create packet-generator interface <interface name>"
- " [gso-enabled gso-size <size> [coalesce-enabled]]",
+ " [gso-enabled gso-size <size> [coalesce-enabled]]"
+ " [mode <ethernet | ip4 | ip6>]",
.function = create_pg_if_cmd_fn,
};
/* *INDENT-ON* */
