From 7f050d9749bbf16c0d16625d52d94e0811f284c7 Mon Sep 17 00:00:00 2001 From: Niyaz Murshed Date: Wed, 21 Feb 2024 19:54:24 +0000 Subject: crypto: CLI to change dispatch mode 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 Type: improvement Change-Id: I029e98aa25889eddcf62e75a6c78926cdee862ef Signed-off-by: Niyaz Murshed --- src/vnet/crypto/cli.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'src/vnet/crypto') diff --git a/src/vnet/crypto/cli.c b/src/vnet/crypto/cli.c index 7c2efa2cf64..5bc070c73c2 100644 --- a/src/vnet/crypto/cli.c +++ b/src/vnet/crypto/cli.c @@ -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 ", + .function = set_crypto_async_dispatch_command_fn, +}; + /* * fd.io coding-style-patch-verification: ON * -- cgit 1.2.3-korg