[v2,2/3] crypto/qat: use process safe crc api
Checks
Commit Message
This patch replaces thread-unsafe CRC functions
with the safe ones.
Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
---
doc/guides/cryptodevs/qat.rst | 6 ++++++
drivers/crypto/qat/qat_sym.h | 6 ++----
drivers/crypto/qat/qat_sym_session.c | 3 +++
drivers/crypto/qat/qat_sym_session.h | 2 ++
4 files changed, 13 insertions(+), 4 deletions(-)
@@ -148,6 +148,12 @@ Limitations
DOCSIS security protocol.
* Multi-segment buffers are not supported for combined Crypto-CRC DOCSIS
security protocol.
+* Max SIMD bitwidth (--force-max-simd-bitwidth) in multi-process may be ignored
+ by QAT in certain scenarios. In use cases where CRC computation is needed and
+ the device does not support it internally, the CRC context is created by the session;
+ therefore, the SIMD config used in the process that created the session will be persisant
+ across all processes. It is an undefined behavior when different process binaries are
+ compiled with different SIMD capabilities when using software CRC.
Extra notes on KASUMI F9
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -267,8 +267,7 @@ qat_crc_verify(struct qat_sym_session *ctx, struct rte_crypto_op *op)
crc_data = rte_pktmbuf_mtod_offset(sym_op->m_src, uint8_t *,
crc_data_ofs);
- crc = rte_net_crc_calc(crc_data, crc_data_len,
- RTE_NET_CRC32_ETH);
+ crc = rte_net_crc(&ctx->crc, crc_data, crc_data_len);
if (crc != *(uint32_t *)(crc_data + crc_data_len))
op->status = RTE_CRYPTO_OP_STATUS_AUTH_FAILED;
@@ -291,8 +290,7 @@ qat_crc_generate(struct qat_sym_session *ctx,
crc_data = rte_pktmbuf_mtod_offset(sym_op->m_src, uint8_t *,
sym_op->auth.data.offset);
crc = (uint32_t *)(crc_data + crc_data_len);
- *crc = rte_net_crc_calc(crc_data, crc_data_len,
- RTE_NET_CRC32_ETH);
+ *crc = rte_net_crc(&ctx->crc, crc_data, crc_data_len);
}
}
@@ -3176,6 +3176,9 @@ qat_sec_session_set_docsis_parameters(struct rte_cryptodev *dev,
ret = qat_sym_session_configure_crc(dev, xform, session);
if (ret < 0)
return ret;
+ } else {
+ /* Initialize crc algorithm */
+ session->crc = rte_net_crc_set(RTE_NET_CRC_AVX512, RTE_NET_CRC32_ETH);
}
qat_sym_session_finalize(session);
@@ -7,6 +7,7 @@
#include <rte_crypto.h>
#include <cryptodev_pmd.h>
#include <rte_security.h>
+#include <rte_net_crc.h>
#include "qat_common.h"
#include "icp_qat_hw.h"
@@ -151,6 +152,7 @@ struct qat_sym_session {
uint32_t slice_types;
enum qat_sym_proto_flag qat_proto_flag;
qat_sym_build_request_t build_request[2];
+ struct rte_net_crc crc;
#ifndef RTE_QAT_OPENSSL
IMB_MGR *mb_mgr;
alignas(16) uint64_t expkey[4 * 15];