summaryrefslogtreecommitdiffstats
path: root/src/vnet/interface_cli.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/interface_cli.c')
-rw-r--r--src/vnet/interface_cli.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/vnet/interface_cli.c b/src/vnet/interface_cli.c
index bee813f5874..28f24ae3977 100644
--- a/src/vnet/interface_cli.c
+++ b/src/vnet/interface_cli.c
@@ -1886,6 +1886,89 @@ VLIB_CLI_COMMAND (cmd_set_if_rx_placement,static) = {
};
/* *INDENT-ON* */
+clib_error_t *
+set_interface_rss_queues (vlib_main_t * vm, u32 hw_if_index,
+ clib_bitmap_t * bitmap)
+{
+ vnet_main_t *vnm = vnet_get_main ();
+ vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, hw_if_index);
+
+ return vnet_hw_interface_set_rss_queues (vnm, hi, bitmap);
+}
+
+static clib_error_t *
+set_interface_rss_queues_fn (vlib_main_t * vm,
+ unformat_input_t * input,
+ vlib_cli_command_t * cmd)
+{
+ clib_error_t *error = 0;
+ unformat_input_t _line_input, *line_input = &_line_input;
+ vnet_main_t *vnm = vnet_get_main ();
+ u32 hw_if_index = (u32) ~ 0;
+ clib_bitmap_t *bitmap = NULL;
+
+ if (!unformat_user (input, unformat_line_input, line_input))
+ return 0;
+
+ while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat
+ (line_input, "%U", unformat_vnet_hw_interface, vnm, &hw_if_index))
+ ;
+ else
+ if (unformat (line_input, "list %U", unformat_bitmap_list, &bitmap))
+ ;
+ else
+ {
+ error = clib_error_return (0, "parse error: '%U'",
+ format_unformat_error, line_input);
+ unformat_free (line_input);
+ goto done;
+ }
+ }
+
+ unformat_free (line_input);
+
+ if (hw_if_index == (u32) ~ 0)
+ {
+ error = clib_error_return (0, "please specify valid interface name");
+ goto done;
+ }
+
+ if (bitmap == NULL)
+ {
+ error = clib_error_return (0, "please specify the valid rss queues");
+ goto done;
+ }
+
+ error = set_interface_rss_queues (vm, hw_if_index, bitmap);
+
+done:
+ if (bitmap)
+ clib_bitmap_free (bitmap);
+
+ return (error);
+}
+
+/*?
+ * This command is used to set the rss queues of a given interface
+ * Not all the interfaces support this operation.
+ * To display the current rss queues, use the command
+ * '<em>show hardware-interfaces</em>'.
+ *
+ * @cliexpar
+ * Example of how to set the rss queues to 0,2-5,7 of an interface:
+ * @cliexstart{set interface rss queues VirtualFunctionEthernet18/1/0 list 0,2-5,7}
+ * @cliexend
+?*/
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (cmd_set_interface_rss_queues,static) = {
+ .path = "set interface rss queues",
+ .short_help = "set interface rss queues <interface> <list <queue-list>>",
+ .function = set_interface_rss_queues_fn,
+};
+/* *INDENT-ON* */
+
static u8 *
format_vnet_pcap (u8 * s, va_list * args)
{