summaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/ipsec/ipsec.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/dpdk/ipsec/ipsec.c')
-rw-r--r--src/plugins/dpdk/ipsec/ipsec.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/plugins/dpdk/ipsec/ipsec.c b/src/plugins/dpdk/ipsec/ipsec.c
index 5933cf9573e..b8cfc7e6b78 100644
--- a/src/plugins/dpdk/ipsec/ipsec.c
+++ b/src/plugins/dpdk/ipsec/ipsec.c
@@ -329,11 +329,8 @@ create_sym_session (struct rte_cryptodev_sym_session **session,
struct rte_crypto_sym_xform auth_xform = { 0 };
struct rte_crypto_sym_xform *xfs;
struct rte_cryptodev_sym_session **s;
- crypto_session_key_t key = { 0 };
clib_error_t *erorr = 0;
- key.drv_id = res->drv_id;
- key.sa_idx = sa_idx;
sa = pool_elt_at_index (im->sad, sa_idx);
@@ -399,7 +396,7 @@ create_sym_session (struct rte_cryptodev_sym_session **session,
goto done;
}
- hash_set (data->session_by_drv_id_and_sa_index, key.val, session[0]);
+ add_session_by_drv_and_sa_idx (session[0], data, res->drv_id, sa_idx);
done:
clib_spinlock_unlock_if_init (&data->lockp);
@@ -486,7 +483,6 @@ add_del_sa_session (u32 sa_index, u8 is_add)
dpdk_crypto_main_t *dcm = &dpdk_crypto_main;
crypto_data_t *data;
struct rte_cryptodev_sym_session *s;
- crypto_session_key_t key = { 0 };
uword *val;
u32 drv_id;
@@ -510,23 +506,19 @@ add_del_sa_session (u32 sa_index, u8 is_add)
return 0;
}
- key.sa_idx = sa_index;
-
/* *INDENT-OFF* */
vec_foreach (data, dcm->data)
{
clib_spinlock_lock_if_init (&data->lockp);
val = hash_get (data->session_by_sa_index, sa_index);
- s = (struct rte_cryptodev_sym_session *) val;
- if (s)
+ if (val)
{
+ s = (struct rte_cryptodev_sym_session *) val[0];
vec_foreach_index (drv_id, dcm->drv)
{
- key.drv_id = drv_id;
- val = hash_get (data->session_by_drv_id_and_sa_index, key.val);
- s = (struct rte_cryptodev_sym_session *) val;
- if (s)
- hash_unset (data->session_by_drv_id_and_sa_index, key.val);
+ val = (uword*) get_session_by_drv_and_sa_idx (data, drv_id, sa_index);
+ if (val)
+ add_session_by_drv_and_sa_idx(NULL, data, drv_id, sa_index);
}
hash_unset (data->session_by_sa_index, sa_index);
@@ -913,6 +905,8 @@ crypto_create_session_drv_pool (vlib_main_t * vm, crypto_dev_t * dev)
vec_validate (data->session_drv, dev->drv_id);
vec_validate (data->session_drv_failed, dev->drv_id);
+ vec_validate_aligned (data->session_by_drv_id_and_sa_index, 32,
+ CLIB_CACHE_LINE_BYTES);
if (data->session_drv[dev->drv_id])
return NULL;
@@ -989,7 +983,6 @@ crypto_disable (void)
vec_free (dcm->data);
vec_free (dcm->workers_main);
- vec_free (dcm->sa_session);
vec_free (dcm->dev);
vec_free (dcm->resource);
vec_free (dcm->cipher_algs);