crypto: CLI to change dispatch mode 74/40374/5
authorNiyaz Murshed <niyaz.murshed@arm.com>
Wed, 21 Feb 2024 19:54:24 +0000 (19:54 +0000)
committerFan Zhang <fanzhang.oss@gmail.com>
Wed, 28 Feb 2024 13:40:03 +0000 (13:40 +0000)
This change aims to affect crypto_sw_scheduler behavior,
but all the edits end up in vnet/crypto.

After 9a9604b introduced adaptive mode for crypto dispatch,
the performance of async mode at lower rate got worse.

A work around for CSIT test is done by changing dispatch mode via explicit API call
in https://github.com/FDio/vpp/commit/139aba204780f6cc2845b311820a0b4c47517d02

In this change, the CLI is brought back to allow user to fix the
dispatch mode.

set crypto async dispatch mode <polling|interrupt|adaptive>

Type: improvement
Change-Id: I029e98aa25889eddcf62e75a6c78926cdee862ef
Signed-off-by: Niyaz Murshed <niyaz.murshed@arm.com>
src/vnet/crypto/cli.c

index 7c2efa2..5bc070c 100644 (file)
@@ -429,6 +429,45 @@ VLIB_CLI_COMMAND (set_crypto_async_handler_command, static) =
 };
 /* *INDENT-ON* */
 
+static clib_error_t *
+set_crypto_async_dispatch_command_fn (vlib_main_t *vm, unformat_input_t *input,
+                                     vlib_cli_command_t *cmd)
+{
+  unformat_input_t _line_input, *line_input = &_line_input;
+  clib_error_t *error = 0;
+  u8 adaptive = 0;
+  u8 mode = VLIB_NODE_STATE_INTERRUPT;
+
+  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, "polling"))
+       mode = VLIB_NODE_STATE_POLLING;
+      else if (unformat (line_input, "interrupt"))
+       mode = VLIB_NODE_STATE_INTERRUPT;
+      else if (unformat (line_input, "adaptive"))
+       adaptive = 1;
+      else
+       {
+         error = clib_error_return (0, "invalid params");
+         goto done;
+       }
+    }
+
+  vnet_crypto_set_async_dispatch (mode, adaptive);
+done:
+  unformat_free (line_input);
+  return error;
+}
+
+VLIB_CLI_COMMAND (set_crypto_async_dispatch_mode_command, static) = {
+  .path = "set crypto async dispatch mode",
+  .short_help = "set crypto async dispatch mode <polling|interrupt|adaptive>",
+  .function = set_crypto_async_dispatch_command_fn,
+};
+
 /*
  * fd.io coding-style-patch-verification: ON
  *