[2/2] crypto/qat: fix thread-safety issue in the crc
Checks
Commit Message
This patch fixes CRC thread-safety issue in the QAT PMD.
Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
---
drivers/crypto/qat/qat_sym.h | 3 +--
drivers/crypto/qat/qat_sym_session.c | 3 +++
drivers/crypto/qat/qat_sym_session.h | 2 ++
3 files changed, 6 insertions(+), 2 deletions(-)
@@ -291,8 +291,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_CRC32_ETH, RTE_NET_CRC_AVX512);
}
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"
@@ -150,6 +151,7 @@ struct qat_sym_session {
uint8_t is_wireless;
uint32_t slice_types;
enum qat_sym_proto_flag qat_proto_flag;
+ struct rte_net_crc crc;
qat_sym_build_request_t build_request[2];
#ifndef RTE_QAT_OPENSSL
IMB_MGR *mb_mgr;