aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanne Peltonen <janne.peltonen@nokia.com>2023-04-28 12:45:18 +0300
committerMatias Elo <matias.elo@nokia.com>2023-05-02 16:15:34 +0300
commit2ee162f6e5f0f09fa2901f442ffdafa030ba4c84 (patch)
tree41a8c24ecf7bf61100690a26960d35e57a27298a
parentf18d3fcffabcbf3af1028f77e21dfb7f73b85648 (diff)
linux-dpdk: crypto: use a session flag to distinguish aead sessions
Use a new session flag to distinguish AEAD sessions from other sessions in crypto operations to avoid comparing the cipher algorithm ID with every AEAD algorithm ID. This avoids increasing the checking overhead when more AEAD algorithms get added. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
-rw-r--r--platform/linux-dpdk/odp_crypto.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/platform/linux-dpdk/odp_crypto.c b/platform/linux-dpdk/odp_crypto.c
index 0a70cb10d..a757f273a 100644
--- a/platform/linux-dpdk/odp_crypto.c
+++ b/platform/linux-dpdk/odp_crypto.c
@@ -82,6 +82,7 @@ typedef struct crypto_session_entry_s {
struct {
unsigned int cdev_qpairs_shared:1;
unsigned int chained_bufs_ok:1;
+ unsigned int aead:1;
} flags;
uint8_t cdev_id;
@@ -1446,6 +1447,8 @@ int odp_crypto_session_create(const odp_crypto_session_param_t *param,
session->p = *param;
if (cipher_is_aead(param->cipher_alg)) {
+ session->flags.aead = 1;
+
if (crypto_fill_aead_xform(&cipher_xform, &session->p) < 0) {
*status = ODP_CRYPTO_SES_ERR_CIPHER;
goto err;
@@ -1458,6 +1461,8 @@ int odp_crypto_session_create(const odp_crypto_session_param_t *param,
} else {
odp_bool_t do_cipher_first;
+ session->flags.aead = 0;
+
if (crypto_fill_cipher_xform(&cipher_xform, &session->p) < 0) {
*status = ODP_CRYPTO_SES_ERR_CIPHER;
goto err;
@@ -1914,7 +1919,7 @@ static void op_prepare(crypto_op_t *ops[],
continue;
}
- if (cipher_is_aead(session->p.cipher_alg)) {
+ if (session->flags.aead) {
crypto_fill_aead_param(session, op->state.pkt, &param[n], rte_op);
} else {
if (odp_unlikely(!is_op_supported(session, &param[n]))) {