diff options
author | Radu Nicolau <radu.nicolau@intel.com> | 2018-03-12 13:52:41 +0000 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2018-05-22 12:09:23 +0000 |
commit | de412ce51f6f9ca879a09e49594b907e9e99a7ed (patch) | |
tree | 742832ae6b6ce5f53de3771462c302bac069b7d4 /src/plugins/dpdk/ipsec/ipsec.c | |
parent | 1c8ff632159213042d23b687a1d487a4c58a217d (diff) |
CSIT-928 dpdk/ipsec: performance improvement
Replace hash with a vector to improve performance.
Plus other minor performance improvements.
Change-Id: I3f0ebd909782ce3727f6360ce5ff5ddd131f8574
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Diffstat (limited to 'src/plugins/dpdk/ipsec/ipsec.c')
-rw-r--r-- | src/plugins/dpdk/ipsec/ipsec.c | 23 |
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); |