wireguard: add async mode for encryption packets
[vpp.git] / src / vnet / crypto / cli.c
index cef779a..4ee14ac 100644 (file)
@@ -67,7 +67,7 @@ format_vnet_crypto_engine_candidates (u8 * s, va_list * args)
     {
       vec_foreach (e, cm->engines)
        {
-         if (e->enqueue_handlers[id] && e->dequeue_handlers[id])
+         if (e->enqueue_handlers[id] && e->dequeue_handler)
            {
              s = format (s, "%U", format_vnet_crypto_engine, e - cm->engines);
              if (ei == e - cm->engines)
@@ -331,8 +331,8 @@ show_crypto_async_status_command_fn (vlib_main_t * vm,
 
   for (i = skip_master; i < tm->n_vlib_mains; i++)
     {
-      vlib_node_state_t state =
-       vlib_node_get_state (vlib_mains[i], cm->crypto_node_index);
+      vlib_node_state_t state = vlib_node_get_state (
+       vlib_get_main_by_index (i), cm->crypto_node_index);
       if (state == VLIB_NODE_STATE_POLLING)
        vlib_cli_output (vm, "threadId: %-6d POLLING", i);
       if (state == VLIB_NODE_STATE_INTERRUPT)
@@ -435,11 +435,21 @@ VLIB_CLI_COMMAND (set_crypto_async_handler_command, static) =
 };
 /* *INDENT-ON* */
 
+static inline void
+print_crypto_async_dispatch_warning ()
+{
+  clib_warning ("Switching dispatch mode might not work is some situations.");
+  clib_warning
+    ("Use 'show crypto async status' to verify that the nodes' states were set");
+  clib_warning ("and if not, set 'crypto async dispatch' mode again.");
+}
+
 static clib_error_t *
 set_crypto_async_dispatch_polling_command_fn (vlib_main_t * vm,
                                              unformat_input_t * input,
                                              vlib_cli_command_t * cmd)
 {
+  print_crypto_async_dispatch_warning ();
   vnet_crypto_set_async_dispatch_mode (VNET_CRYPTO_ASYNC_DISPATCH_POLLING);
   return 0;
 }
@@ -449,6 +459,7 @@ set_crypto_async_dispatch_interrupt_command_fn (vlib_main_t * vm,
                                                unformat_input_t * input,
                                                vlib_cli_command_t * cmd)
 {
+  print_crypto_async_dispatch_warning ();
   vnet_crypto_set_async_dispatch_mode (VNET_CRYPTO_ASYNC_DISPATCH_INTERRUPT);
   return 0;
 }