aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/ipsec/ipsec.c
diff options
context:
space:
mode:
authorFan Zhang <roy.fan.zhang@intel.com>2020-04-29 14:00:03 +0100
committerDamjan Marion <dmarion@me.com>2020-04-30 14:38:33 +0000
commitf539578bac8b64886b57c460c9d74273e6613f8b (patch)
tree190e09705fe1ebb46ca86a48c19de49fcaf0cbb0 /src/plugins/dpdk/ipsec/ipsec.c
parent162330f25aeec09694fffaaa31ba9b318620eb9c (diff)
crypto: introduce async crypto infra
Type: feature Signed-off-by: Damjan Marion <damarion@cisco.com> Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com> Signed-off-by: Piotr Bronowski <piotrx.bronowski@intel.com> Signed-off-by: Dariusz Kazimierski <dariuszx.kazimierski@intel.com> Signed-off-by: Piotr Kleski <piotrx.kleski@intel.com> Change-Id: I4c3fcccf55c36842b7b48aed260fef2802b5c54b
Diffstat (limited to 'src/plugins/dpdk/ipsec/ipsec.c')
-rw-r--r--src/plugins/dpdk/ipsec/ipsec.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/src/plugins/dpdk/ipsec/ipsec.c b/src/plugins/dpdk/ipsec/ipsec.c
index 8837756554f..ad638db65d4 100644
--- a/src/plugins/dpdk/ipsec/ipsec.c
+++ b/src/plugins/dpdk/ipsec/ipsec.c
@@ -991,6 +991,24 @@ crypto_disable (void)
vec_free (dcm->auth_algs);
}
+static clib_error_t *
+dpdk_ipsec_enable_disable (int is_enable)
+{
+ vlib_main_t *vm = vlib_get_main ();
+ vlib_thread_main_t *tm = vlib_get_thread_main ();
+ vlib_node_t *node = vlib_get_node_by_name (vm, (u8 *) "dpdk-crypto-input");
+ u32 skip_master = vlib_num_workers () > 0;
+ u32 n_mains = tm->n_vlib_mains;
+ u32 i;
+
+ ASSERT (node);
+ for (i = skip_master; i < n_mains; i++)
+ vlib_node_set_state (vlib_mains[i], node->index, is_enable != 0 ?
+ VLIB_NODE_STATE_POLLING : VLIB_NODE_STATE_DISABLED);
+
+ return 0;
+}
+
static uword
dpdk_ipsec_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
vlib_frame_t * f)
@@ -1000,7 +1018,7 @@ dpdk_ipsec_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
vlib_thread_main_t *tm = vlib_get_thread_main ();
crypto_worker_main_t *cwm;
clib_error_t *error = NULL;
- u32 i, skip_master, n_mains;
+ u32 skip_master, n_mains;
n_mains = tm->n_vlib_mains;
skip_master = vlib_num_workers () > 0;
@@ -1055,14 +1073,14 @@ dpdk_ipsec_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
"dpdk-esp6-decrypt",
"dpdk-esp6-decrypt",
dpdk_ipsec_check_support,
- add_del_sa_session);
- int rv = ipsec_select_esp_backend (im, idx);
- ASSERT (rv == 0);
-
- vlib_node_t *node = vlib_get_node_by_name (vm, (u8 *) "dpdk-crypto-input");
- ASSERT (node);
- for (i = skip_master; i < n_mains; i++)
- vlib_node_set_state (vlib_mains[i], node->index, VLIB_NODE_STATE_POLLING);
+ add_del_sa_session,
+ dpdk_ipsec_enable_disable);
+ int rv;
+ if (im->esp_current_backend == ~0)
+ {
+ rv = ipsec_select_esp_backend (im, idx);
+ ASSERT (rv == 0);
+ }
return 0;
}