aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-dpdk
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2023-02-17 15:38:05 +0200
committerMatias Elo <matias.elo@nokia.com>2023-03-02 17:12:58 +0200
commit4ae3d2ddee10a614a2b3b779bde11b0117a38f94 (patch)
tree89628555e809c3b539f6d0d23e21f906df8d6c45 /platform/linux-dpdk
parent89b09746724b7ff3816ee1d6096e0110a6dfceaf (diff)
linux-dpdk: crypto: handle dpdk v22.11 crypto session changes
Handle DPDK crypto session API changes introduced in v22.11. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
Diffstat (limited to 'platform/linux-dpdk')
-rw-r--r--platform/linux-dpdk/odp_crypto.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/platform/linux-dpdk/odp_crypto.c b/platform/linux-dpdk/odp_crypto.c
index 713419a14..61d4a12e4 100644
--- a/platform/linux-dpdk/odp_crypto.c
+++ b/platform/linux-dpdk/odp_crypto.c
@@ -35,6 +35,7 @@
#include <rte_crypto.h>
#include <rte_cryptodev.h>
#include <rte_malloc.h>
+#include <rte_version.h>
#include <string.h>
#include <math.h>
@@ -446,7 +447,9 @@ int _odp_crypto_init_global(void)
for (queue_pair = 0; queue_pair < nb_queue_pairs;
queue_pair++) {
qp_conf.mp_session = mp;
+#if RTE_VERSION < RTE_VERSION_NUM(22, 11, 0, 0)
qp_conf.mp_session_private = mp;
+#endif
rc = rte_cryptodev_queue_pair_setup(cdev_id, queue_pair,
&qp_conf,
socket_id);
@@ -1478,6 +1481,7 @@ int odp_crypto_session_create(const odp_crypto_session_param_t *param,
sess_mp = global->session_mempool[socket_id];
/* Setup session */
+#if RTE_VERSION < RTE_VERSION_NUM(22, 11, 0, 0)
rte_session = rte_cryptodev_sym_session_create(sess_mp);
if (rte_session == NULL) {
*status = ODP_CRYPTO_SES_ERR_ENOMEM;
@@ -1491,6 +1495,13 @@ int odp_crypto_session_create(const odp_crypto_session_param_t *param,
*status = ODP_CRYPTO_SES_ERR_ENOMEM;
goto err;
}
+#else
+ rte_session = rte_cryptodev_sym_session_create(cdev_id, first_xform, sess_mp);
+ if (rte_session == NULL) {
+ *status = ODP_CRYPTO_SES_ERR_ENOMEM;
+ goto err;
+ }
+#endif
session->flags.chained_bufs_ok = chained_bufs_ok(param, cdev_id);
if (global->enabled_crypto_dev_qpairs_shared[cdev_id])
@@ -1527,12 +1538,17 @@ int odp_crypto_session_destroy(odp_crypto_session_t _session)
rte_session = session->rte_session;
if (rte_session != NULL) {
+#if RTE_VERSION < RTE_VERSION_NUM(22, 11, 0, 0)
if (rte_cryptodev_sym_session_clear(session->cdev_id,
rte_session) < 0)
return -1;
if (rte_cryptodev_sym_session_free(rte_session) < 0)
return -1;
+#else
+ if (rte_cryptodev_sym_session_free(session->cdev_id, rte_session) < 0)
+ return -1;
+#endif
}
/* remove the crypto_session_entry_t */