From ebc27d1b683296e09704880e379f1fc026b57a85 Mon Sep 17 00:00:00 2001 From: Franck Lenormand Date: Wed, 8 Sep 2021 12:29:52 +0530 Subject: [PATCH] crypto/dpaa_sec: force inline keys to save space This patch improve storage and performance by force inline of the keys. Signed-off-by: Franck Lenormand Signed-off-by: Gagandeep Singh Acked-by: Akhil Goyal --- drivers/crypto/dpaa_sec/dpaa_sec.c | 35 ++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index d6c101362a..fa4d276ead 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright 2017-2019 NXP + * Copyright 2017-2021 NXP * */ @@ -263,14 +263,31 @@ dpaa_sec_prep_pdcp_cdb(dpaa_sec_session *ses) p_authdata = &authdata; } - if (rta_inline_pdcp_query(authdata.algtype, - cipherdata.algtype, - ses->pdcp.sn_size, - ses->pdcp.hfn_ovd)) { - cipherdata.key = - (size_t)rte_dpaa_mem_vtop((void *) - (size_t)cipherdata.key); - cipherdata.key_type = RTA_DATA_PTR; + if (ses->pdcp.sdap_enabled) { + int nb_keys_to_inline = + rta_inline_pdcp_sdap_query(authdata.algtype, + cipherdata.algtype, + ses->pdcp.sn_size, + ses->pdcp.hfn_ovd); + if (nb_keys_to_inline >= 1) { + cipherdata.key = (size_t)rte_dpaa_mem_vtop((void *) + (size_t)cipherdata.key); + cipherdata.key_type = RTA_DATA_PTR; + } + if (nb_keys_to_inline >= 2) { + authdata.key = (size_t)rte_dpaa_mem_vtop((void *) + (size_t)authdata.key); + authdata.key_type = RTA_DATA_PTR; + } + } else { + if (rta_inline_pdcp_query(authdata.algtype, + cipherdata.algtype, + ses->pdcp.sn_size, + ses->pdcp.hfn_ovd)) { + cipherdata.key = (size_t)rte_dpaa_mem_vtop((void *) + (size_t)cipherdata.key); + cipherdata.key_type = RTA_DATA_PTR; + } } if (ses->pdcp.domain == RTE_SECURITY_PDCP_MODE_CONTROL) { -- 2.20.1