LCOV - code coverage report
Current view: top level - drivers/crypto/qat - qat_sym.h (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 85 0.0 %
Date: 2024-12-01 18:57:19 Functions: 0 7 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 56 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright(c) 2015-2022 Intel Corporation
       3                 :            :  */
       4                 :            : 
       5                 :            : #ifndef _QAT_SYM_H_
       6                 :            : #define _QAT_SYM_H_
       7                 :            : 
       8                 :            : #include <cryptodev_pmd.h>
       9                 :            : #include <rte_net_crc.h>
      10                 :            : 
      11                 :            : #ifdef BUILD_QAT_SYM
      12                 :            : #ifdef RTE_QAT_OPENSSL
      13                 :            : #include <openssl/evp.h>
      14                 :            : #endif
      15                 :            : #include <rte_security_driver.h>
      16                 :            : 
      17                 :            : #include "qat_common.h"
      18                 :            : #include "qat_sym_session.h"
      19                 :            : #include "qat_crypto.h"
      20                 :            : #include "qat_logs.h"
      21                 :            : 
      22                 :            : #define BYTE_LENGTH    8
      23                 :            : /* bpi is only used for partial blocks of DES and AES
      24                 :            :  * so AES block len can be assumed as max len for iv, src and dst
      25                 :            :  */
      26                 :            : #define BPI_MAX_ENCR_IV_LEN ICP_QAT_HW_AES_BLK_SZ
      27                 :            : 
      28                 :            : /** Intel(R) QAT Symmetric Crypto PMD name */
      29                 :            : #define CRYPTODEV_NAME_QAT_SYM_PMD      crypto_qat
      30                 :            : 
      31                 :            : /* Internal capabilities */
      32                 :            : #define QAT_SYM_CAP_MIXED_CRYPTO        (1 << 0)
      33                 :            : #define QAT_SYM_CAP_CIPHER_CRC          (1 << 1)
      34                 :            : #define QAT_SYM_CAP_VALID               (1 << 31)
      35                 :            : 
      36                 :            : /**
      37                 :            :  * Macro to add a sym capability
      38                 :            :  * helper function to add an sym capability
      39                 :            :  * <n: name> <b: block size> <k: key size> <d: digest size>
      40                 :            :  * <a: aad_size> <i: iv_size>
      41                 :            :  **/
      42                 :            : #define QAT_SYM_PLAIN_AUTH_CAP(n, b, d)                                 \
      43                 :            :         {                                                               \
      44                 :            :                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,                     \
      45                 :            :                 {.sym = {                                               \
      46                 :            :                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,        \
      47                 :            :                         {.auth = {                                      \
      48                 :            :                                 .algo = RTE_CRYPTO_AUTH_##n,            \
      49                 :            :                                 b, d                                    \
      50                 :            :                         }, }                                            \
      51                 :            :                 }, }                                                    \
      52                 :            :         }
      53                 :            : 
      54                 :            : #define QAT_SYM_AUTH_CAP(n, b, k, d, a, i)                              \
      55                 :            :         {                                                               \
      56                 :            :                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,                     \
      57                 :            :                 {.sym = {                                               \
      58                 :            :                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,        \
      59                 :            :                         {.auth = {                                      \
      60                 :            :                                 .algo = RTE_CRYPTO_AUTH_##n,            \
      61                 :            :                                 b, k, d, a, i                           \
      62                 :            :                         }, }                                            \
      63                 :            :                 }, }                                                    \
      64                 :            :         }
      65                 :            : 
      66                 :            : #define QAT_SYM_AEAD_CAP(n, b, k, d, a, i)                              \
      67                 :            :         {                                                               \
      68                 :            :                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,                     \
      69                 :            :                 {.sym = {                                               \
      70                 :            :                         .xform_type = RTE_CRYPTO_SYM_XFORM_AEAD,        \
      71                 :            :                         {.aead = {                                      \
      72                 :            :                                 .algo = RTE_CRYPTO_AEAD_##n,            \
      73                 :            :                                 b, k, d, a, i                           \
      74                 :            :                         }, }                                            \
      75                 :            :                 }, }                                                    \
      76                 :            :         }
      77                 :            : 
      78                 :            : #define QAT_SYM_CIPHER_CAP(n, b, k, i)                                  \
      79                 :            :         {                                                               \
      80                 :            :                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,                     \
      81                 :            :                 {.sym = {                                               \
      82                 :            :                         .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,      \
      83                 :            :                         {.cipher = {                                    \
      84                 :            :                                 .algo = RTE_CRYPTO_CIPHER_##n,          \
      85                 :            :                                 b, k, i                                 \
      86                 :            :                         }, }                                            \
      87                 :            :                 }, }                                                    \
      88                 :            :         }
      89                 :            : 
      90                 :            : /*
      91                 :            :  * Maximum number of SGL entries
      92                 :            :  */
      93                 :            : #define QAT_SYM_SGL_MAX_NUMBER  16
      94                 :            : 
      95                 :            : /* Maximum data length for single pass GMAC: 2^14-1 */
      96                 :            : #define QAT_AES_GMAC_SPC_MAX_SIZE 16383
      97                 :            : 
      98                 :            : /* Digest length for GCM Algo is 16 bytes */
      99                 :            : #define GCM_256_DIGEST_LEN 16
     100                 :            : 
     101                 :            : /* IV length for GCM algo is 12 bytes */
     102                 :            : #define GCM_IV_LENGTH_GEN_LCE 12
     103                 :            : 
     104                 :            : struct qat_sym_session;
     105                 :            : 
     106                 :            : struct __rte_cache_aligned qat_sym_sgl {
     107                 :            :         qat_sgl_hdr;
     108                 :            :         struct qat_flat_buf buffers[QAT_SYM_SGL_MAX_NUMBER];
     109                 :            : } __rte_packed;
     110                 :            : 
     111                 :            : struct qat_sym_op_cookie {
     112                 :            :         struct qat_sym_sgl qat_sgl_src;
     113                 :            :         struct qat_sym_sgl qat_sgl_dst;
     114                 :            :         phys_addr_t qat_sgl_src_phys_addr;
     115                 :            :         phys_addr_t qat_sgl_dst_phys_addr;
     116                 :            :         union {
     117                 :            :                 /* Used for Single-Pass AES-GMAC only */
     118                 :            :                 struct {
     119                 :            :                         alignas(RTE_CACHE_LINE_SIZE) struct icp_qat_hw_cipher_algo_blk cd_cipher
     120                 :            :                                         __rte_packed;
     121                 :            :                         phys_addr_t cd_phys_addr;
     122                 :            :                 } spc_gmac;
     123                 :            :         } opt;
     124                 :            :         uint8_t digest_null[4];
     125                 :            :         phys_addr_t digest_null_phys_addr;
     126                 :            :         enum rte_crypto_op_status status;
     127                 :            : };
     128                 :            : 
     129                 :            : struct qat_sym_dp_ctx {
     130                 :            :         struct qat_sym_session *session;
     131                 :            :         uint32_t tail;
     132                 :            :         uint32_t head;
     133                 :            :         uint16_t cached_enqueue;
     134                 :            :         uint16_t cached_dequeue;
     135                 :            : };
     136                 :            : 
     137                 :            : uint16_t
     138                 :            : qat_sym_enqueue_burst(void *qp, struct rte_crypto_op **ops,
     139                 :            :                 uint16_t nb_ops);
     140                 :            : 
     141                 :            : uint16_t
     142                 :            : qat_sym_dequeue_burst(void *qp, struct rte_crypto_op **ops,
     143                 :            :                 uint16_t nb_ops);
     144                 :            : 
     145                 :            : uint16_t
     146                 :            : qat_sym_dequeue_burst_gen_lce(void *qp, struct rte_crypto_op **ops, uint16_t nb_ops);
     147                 :            : 
     148                 :            : #ifdef RTE_QAT_OPENSSL
     149                 :            : /** Encrypt a single partial block
     150                 :            :  *  Depends on openssl libcrypto
     151                 :            :  *  Uses ECB+XOR to do CFB encryption, same result, more performant
     152                 :            :  */
     153                 :            : static inline int
     154                 :          0 : bpi_cipher_encrypt(uint8_t *src, uint8_t *dst,
     155                 :            :                 uint8_t *iv, int ivlen, int srclen,
     156                 :            :                 void *bpi_ctx)
     157                 :            : {
     158                 :            :         EVP_CIPHER_CTX *ctx = (EVP_CIPHER_CTX *)bpi_ctx;
     159                 :            :         int encrypted_ivlen;
     160                 :            :         uint8_t encrypted_iv[BPI_MAX_ENCR_IV_LEN];
     161                 :            :         uint8_t *encr = encrypted_iv;
     162                 :            : 
     163                 :            :         /* ECB method: encrypt the IV, then XOR this with plaintext */
     164         [ #  # ]:          0 :         if (EVP_EncryptUpdate(ctx, encrypted_iv, &encrypted_ivlen, iv, ivlen)
     165                 :            :                                                                 <= 0)
     166                 :          0 :                 goto cipher_encrypt_err;
     167                 :            : 
     168         [ #  # ]:          0 :         for (; srclen != 0; --srclen, ++dst, ++src, ++encr)
     169                 :          0 :                 *dst = *src ^ *encr;
     170                 :            : 
     171                 :            :         return 0;
     172                 :            : 
     173                 :            : cipher_encrypt_err:
     174                 :          0 :         QAT_DP_LOG(ERR, "libcrypto ECB cipher encrypt failed");
     175                 :          0 :         return -EINVAL;
     176                 :            : }
     177                 :            : #else
     178                 :            : static __rte_always_inline void
     179                 :            : bpi_cipher_ipsec(uint8_t *src, uint8_t *dst, uint8_t *iv, int srclen,
     180                 :            :                 uint64_t *expkey, IMB_MGR *m, uint8_t docsis_key_len)
     181                 :            : {
     182                 :            :         if (docsis_key_len == ICP_QAT_HW_AES_128_KEY_SZ)
     183                 :            :                 IMB_AES128_CFB_ONE(m, dst, src, (uint64_t *)iv, expkey, srclen);
     184                 :            :         else if (docsis_key_len == ICP_QAT_HW_AES_256_KEY_SZ)
     185                 :            :                 IMB_AES256_CFB_ONE(m, dst, src, (uint64_t *)iv, expkey, srclen);
     186                 :            :         else if (docsis_key_len == ICP_QAT_HW_DES_KEY_SZ)
     187                 :            :                 des_cfb_one(dst, src, (uint64_t *)iv, expkey, srclen);
     188                 :            : }
     189                 :            : #endif
     190                 :            : 
     191                 :            : static inline uint32_t
     192                 :          0 : qat_bpicipher_postprocess(struct qat_sym_session *ctx,
     193                 :            :                                 struct rte_crypto_op *op)
     194                 :            : {
     195                 :          0 :         int block_len = qat_cipher_get_block_size(ctx->qat_cipher_alg);
     196                 :            :         struct rte_crypto_sym_op *sym_op = op->sym;
     197         [ #  # ]:          0 :         uint8_t last_block_len = block_len > 0 ?
     198                 :          0 :                         sym_op->cipher.data.length % block_len : 0;
     199                 :            : 
     200         [ #  # ]:          0 :         if (last_block_len > 0 &&
     201         [ #  # ]:          0 :                         ctx->qat_dir == ICP_QAT_HW_CIPHER_ENCRYPT) {
     202                 :            : 
     203                 :            :                 /* Encrypt last block */
     204                 :            :                 uint8_t *last_block, *dst, *iv;
     205                 :            :                 uint32_t last_block_offset;
     206                 :            : 
     207                 :          0 :                 last_block_offset = sym_op->cipher.data.offset +
     208                 :          0 :                                 sym_op->cipher.data.length - last_block_len;
     209                 :          0 :                 last_block = rte_pktmbuf_mtod_offset(sym_op->m_src, uint8_t *,
     210                 :            :                                                      last_block_offset);
     211                 :            : 
     212         [ #  # ]:          0 :                 if (unlikely(sym_op->m_dst != NULL))
     213                 :            :                         /* out-of-place operation (OOP) */
     214                 :          0 :                         dst = rte_pktmbuf_mtod_offset(sym_op->m_dst,
     215                 :            :                                                       uint8_t *,
     216                 :            :                                                       last_block_offset);
     217                 :            :                 else
     218                 :            :                         dst = last_block;
     219                 :            : 
     220         [ #  # ]:          0 :                 if (last_block_len < sym_op->cipher.data.length)
     221                 :            :                         /* use previous block ciphertext as IV */
     222                 :          0 :                         iv = dst - block_len;
     223                 :            :                 else
     224                 :            :                         /* runt block, i.e. less than one full block */
     225                 :          0 :                         iv = rte_crypto_op_ctod_offset(op, uint8_t *,
     226                 :            :                                         ctx->cipher_iv.offset);
     227                 :            : 
     228                 :            : #if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG
     229                 :            :                 QAT_DP_HEXDUMP_LOG(DEBUG, "BPI: src before post-process:",
     230                 :            :                         last_block, last_block_len);
     231                 :            :                 if (sym_op->m_dst != NULL)
     232                 :            :                         QAT_DP_HEXDUMP_LOG(DEBUG,
     233                 :            :                                 "BPI: dst before post-process:",
     234                 :            :                                 dst, last_block_len);
     235                 :            : #endif
     236                 :            : #ifdef RTE_QAT_OPENSSL
     237                 :          0 :                 bpi_cipher_encrypt(last_block, dst, iv, block_len,
     238                 :            :                                 last_block_len, ctx->bpi_ctx);
     239                 :            : #else
     240                 :            :                 bpi_cipher_ipsec(last_block, dst, iv, last_block_len, ctx->expkey,
     241                 :            :                         ctx->mb_mgr, ctx->docsis_key_len);
     242                 :            : #endif
     243                 :            : #if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG
     244                 :            :                 QAT_DP_HEXDUMP_LOG(DEBUG, "BPI: src after post-process:",
     245                 :            :                                 last_block, last_block_len);
     246                 :            :                 if (sym_op->m_dst != NULL)
     247                 :            :                         QAT_DP_HEXDUMP_LOG(DEBUG,
     248                 :            :                                 "BPI: dst after post-process:",
     249                 :            :                                 dst, last_block_len);
     250                 :            : #endif
     251                 :            :         }
     252                 :          0 :         return sym_op->cipher.data.length - last_block_len;
     253                 :            : }
     254                 :            : 
     255                 :            : static inline void
     256                 :          0 : qat_crc_verify(struct qat_sym_session *ctx, struct rte_crypto_op *op)
     257                 :            : {
     258                 :            :         struct rte_crypto_sym_op *sym_op = op->sym;
     259                 :            :         uint32_t crc_data_ofs, crc_data_len, crc;
     260                 :            :         uint8_t *crc_data;
     261                 :            : 
     262         [ #  # ]:          0 :         if (ctx->qat_dir == ICP_QAT_HW_CIPHER_DECRYPT &&
     263         [ #  # ]:          0 :                         sym_op->auth.data.length != 0) {
     264                 :            : 
     265                 :          0 :                 crc_data_ofs = sym_op->auth.data.offset;
     266                 :            :                 crc_data_len = sym_op->auth.data.length;
     267                 :          0 :                 crc_data = rte_pktmbuf_mtod_offset(sym_op->m_src, uint8_t *,
     268                 :            :                                 crc_data_ofs);
     269                 :            : 
     270                 :          0 :                 crc = rte_net_crc_calc(crc_data, crc_data_len,
     271                 :            :                                 RTE_NET_CRC32_ETH);
     272                 :            : 
     273         [ #  # ]:          0 :                 if (crc != *(uint32_t *)(crc_data + crc_data_len))
     274                 :          0 :                         op->status = RTE_CRYPTO_OP_STATUS_AUTH_FAILED;
     275                 :            :         }
     276                 :          0 : }
     277                 :            : 
     278                 :            : static inline void
     279                 :          0 : qat_crc_generate(struct qat_sym_session *ctx,
     280                 :            :                         struct rte_crypto_op *op)
     281                 :            : {
     282                 :            :         struct rte_crypto_sym_op *sym_op = op->sym;
     283                 :            :         uint32_t *crc, crc_data_len;
     284                 :            :         uint8_t *crc_data;
     285                 :            : 
     286         [ #  # ]:          0 :         if (ctx->qat_dir == ICP_QAT_HW_CIPHER_ENCRYPT &&
     287         [ #  # ]:          0 :                         sym_op->auth.data.length != 0 &&
     288         [ #  # ]:          0 :                         sym_op->m_src->nb_segs == 1) {
     289                 :            : 
     290                 :            :                 crc_data_len = sym_op->auth.data.length;
     291                 :          0 :                 crc_data = rte_pktmbuf_mtod_offset(sym_op->m_src, uint8_t *,
     292                 :            :                                 sym_op->auth.data.offset);
     293                 :          0 :                 crc = (uint32_t *)(crc_data + crc_data_len);
     294                 :          0 :                 *crc = rte_net_crc_calc(crc_data, crc_data_len,
     295                 :            :                                 RTE_NET_CRC32_ETH);
     296                 :            :         }
     297                 :          0 : }
     298                 :            : 
     299                 :            : static inline void
     300                 :          0 : qat_sym_preprocess_requests(void **ops, uint16_t nb_ops)
     301                 :            : {
     302                 :            :         struct rte_crypto_op *op;
     303                 :            :         struct qat_sym_session *ctx;
     304                 :            :         uint16_t i;
     305                 :            : 
     306         [ #  # ]:          0 :         for (i = 0; i < nb_ops; i++) {
     307                 :          0 :                 op = (struct rte_crypto_op *)ops[i];
     308                 :            : 
     309         [ #  # ]:          0 :                 if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) {
     310                 :          0 :                         ctx = SECURITY_GET_SESS_PRIV(op->sym->session);
     311                 :            : 
     312                 :            : #ifdef RTE_QAT_OPENSSL
     313         [ #  # ]:          0 :                         if (ctx == NULL || ctx->bpi_ctx == NULL)
     314                 :            : #else
     315                 :            :                         if (ctx == NULL || ctx->mb_mgr == NULL)
     316                 :            : #endif
     317                 :          0 :                                 continue;
     318                 :            : 
     319         [ #  # ]:          0 :                         if (ctx->qat_cmd != ICP_QAT_FW_LA_CMD_CIPHER_CRC)
     320                 :          0 :                                 qat_crc_generate(ctx, op);
     321                 :            :                 }
     322                 :            :         }
     323                 :          0 : }
     324                 :            : 
     325                 :            : static __rte_always_inline int
     326                 :          0 : qat_sym_process_response(void **op, uint8_t *resp, void *op_cookie,
     327                 :            :                 uint64_t *dequeue_err_count __rte_unused)
     328                 :            : {
     329                 :            :         struct icp_qat_fw_comn_resp *resp_msg =
     330                 :            :                         (struct icp_qat_fw_comn_resp *)resp;
     331                 :          0 :         struct rte_crypto_op *rx_op = (struct rte_crypto_op *)(uintptr_t)
     332                 :          0 :                         (resp_msg->opaque_data);
     333                 :            :         struct qat_sym_session *sess;
     334                 :            :         uint8_t is_docsis_sec;
     335                 :            :         struct qat_sym_op_cookie *cookie = NULL;
     336                 :            : 
     337                 :            : #if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG
     338                 :            :         QAT_DP_HEXDUMP_LOG(DEBUG, "qat_response:", (uint8_t *)resp_msg,
     339                 :            :                         sizeof(struct icp_qat_fw_comn_resp));
     340                 :            : #endif
     341                 :            : 
     342         [ #  # ]:          0 :         if (rx_op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) {
     343                 :            :                 /*
     344                 :            :                  * Assuming at this point that if it's a security
     345                 :            :                  * op, that this is for DOCSIS
     346                 :            :                  */
     347                 :          0 :                 sess = SECURITY_GET_SESS_PRIV(rx_op->sym->session);
     348                 :            :                 is_docsis_sec = 1;
     349                 :            :         } else {
     350                 :          0 :                 sess = CRYPTODEV_GET_SYM_SESS_PRIV(rx_op->sym->session);
     351                 :            :                 is_docsis_sec = 0;
     352                 :            :         }
     353                 :            : 
     354                 :          0 :         if (ICP_QAT_FW_COMN_STATUS_FLAG_OK !=
     355         [ #  # ]:          0 :                         ICP_QAT_FW_COMN_RESP_CRYPTO_STAT_GET(
     356                 :            :                         resp_msg->comn_hdr.comn_status)) {
     357                 :            : 
     358                 :          0 :                 rx_op->status = RTE_CRYPTO_OP_STATUS_AUTH_FAILED;
     359                 :            :         } else {
     360                 :          0 :                 rx_op->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
     361                 :            : 
     362                 :            : #ifdef RTE_QAT_OPENSSL
     363         [ #  # ]:          0 :                 if (sess->bpi_ctx) {
     364                 :            : #else
     365                 :            :                 if (sess->mb_mgr) {
     366                 :            : #endif
     367                 :          0 :                         qat_bpicipher_postprocess(sess, rx_op);
     368   [ #  #  #  # ]:          0 :                         if (is_docsis_sec && sess->qat_cmd !=
     369                 :            :                                                 ICP_QAT_FW_LA_CMD_CIPHER_CRC)
     370                 :          0 :                                 qat_crc_verify(sess, rx_op);
     371                 :            :                 }
     372                 :            :         }
     373                 :            : 
     374         [ #  # ]:          0 :         if (sess->is_single_pass_gmac) {
     375                 :            :                 struct qat_sym_op_cookie *cookie =
     376                 :            :                                 (struct qat_sym_op_cookie *) op_cookie;
     377                 :          0 :                 memset(cookie->opt.spc_gmac.cd_cipher.key, 0,
     378                 :          0 :                                 sess->auth_key_length);
     379                 :            :         }
     380                 :            : 
     381                 :            :         cookie = (struct qat_sym_op_cookie *) op_cookie;
     382         [ #  # ]:          0 :         if (cookie->status == RTE_CRYPTO_OP_STATUS_INVALID_ARGS) {
     383                 :          0 :                 rx_op->status = cookie->status;
     384                 :          0 :                 cookie->status = 0;
     385                 :            :         }
     386                 :            : 
     387                 :          0 :         *op = (void *)rx_op;
     388                 :            : 
     389                 :            :         /*
     390                 :            :          * return 1 as dequeue op only move on to the next op
     391                 :            :          * if one was ready to return to API
     392                 :            :          */
     393                 :          0 :         return 1;
     394                 :            : }
     395                 :            : 
     396                 :            : static __rte_always_inline int
     397                 :          0 : qat_sym_process_response_gen_lce(void **op, uint8_t *resp, void *op_cookie __rte_unused,
     398                 :            :                 uint64_t *dequeue_err_count __rte_unused)
     399                 :            : {
     400                 :            :         struct icp_qat_fw_comn_resp *resp_msg = (struct icp_qat_fw_comn_resp *)resp;
     401                 :          0 :         struct rte_crypto_op *rx_op = (struct rte_crypto_op *)(uintptr_t) (resp_msg->opaque_data);
     402                 :            :         struct qat_sym_session *sess;
     403                 :            : 
     404                 :            : #if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG
     405                 :            :         QAT_DP_HEXDUMP_LOG(DEBUG, "qat_response:", (uint8_t *)resp_msg,
     406                 :            :                         sizeof(struct icp_qat_fw_comn_resp));
     407                 :            : #endif
     408                 :            : 
     409                 :          0 :         sess = CRYPTODEV_GET_SYM_SESS_PRIV(rx_op->sym->session);
     410                 :            : 
     411                 :          0 :         rx_op->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
     412                 :            : 
     413         [ #  # ]:          0 :         if (ICP_QAT_FW_COMN_STATUS_FLAG_OK != ICP_QAT_FW_COMN_RESP_UNSUPPORTED_REQUEST_STAT_GET(
     414                 :            :                         resp_msg->comn_hdr.comn_status))
     415                 :          0 :                 rx_op->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
     416                 :            : 
     417         [ #  # ]:          0 :         else if (ICP_QAT_FW_COMN_STATUS_FLAG_OK != ICP_QAT_FW_COMN_RESP_INVALID_PARAM_STAT_GET(
     418                 :            :                         resp_msg->comn_hdr.comn_status))
     419                 :          0 :                 rx_op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
     420                 :            : 
     421         [ #  # ]:          0 :         if (sess->qat_dir == ICP_QAT_HW_CIPHER_DECRYPT) {
     422         [ #  # ]:          0 :                 if (ICP_QAT_FW_LA_VER_STATUS_FAIL == ICP_QAT_FW_COMN_RESP_CRYPTO_STAT_GET(
     423                 :            :                                 resp_msg->comn_hdr.comn_status))
     424                 :          0 :                         rx_op->status =      RTE_CRYPTO_OP_STATUS_AUTH_FAILED;
     425                 :            :         }
     426                 :            : 
     427                 :          0 :         *op = (void *)rx_op;
     428                 :            : 
     429                 :            :         /*
     430                 :            :          * return 1 as dequeue op only move on to the next op
     431                 :            :          * if one was ready to return to API
     432                 :            :          */
     433                 :          0 :         return 1;
     434                 :            : }
     435                 :            : 
     436                 :            : int
     437                 :            : qat_sym_configure_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
     438                 :            :         struct rte_crypto_raw_dp_ctx *raw_dp_ctx,
     439                 :            :         enum rte_crypto_op_sess_type sess_type,
     440                 :            :         union rte_cryptodev_session_ctx session_ctx, uint8_t is_update);
     441                 :            : 
     442                 :            : int
     443                 :            : qat_sym_get_dp_ctx_size(struct rte_cryptodev *dev);
     444                 :            : 
     445                 :            : void
     446                 :            : qat_sym_init_op_cookie(void *cookie);
     447                 :            : 
     448                 :            : #if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG
     449                 :            : static __rte_always_inline void
     450                 :            : qat_sym_debug_log_dump(struct icp_qat_fw_la_bulk_req *qat_req,
     451                 :            :                 struct qat_sym_session *ctx,
     452                 :            :                 struct rte_crypto_vec *vec, uint32_t vec_len,
     453                 :            :                 struct rte_crypto_va_iova_ptr *cipher_iv,
     454                 :            :                 struct rte_crypto_va_iova_ptr *auth_iv,
     455                 :            :                 struct rte_crypto_va_iova_ptr *aad,
     456                 :            :                 struct rte_crypto_va_iova_ptr *digest)
     457                 :            : {
     458                 :            :         uint32_t i;
     459                 :            : 
     460                 :            :         QAT_DP_HEXDUMP_LOG(DEBUG, "qat_req:", qat_req,
     461                 :            :                         sizeof(struct icp_qat_fw_la_bulk_req));
     462                 :            :         for (i = 0; i < vec_len; i++)
     463                 :            :                 QAT_DP_HEXDUMP_LOG(DEBUG, "src_data:", vec[i].base, vec[i].len);
     464                 :            :         if (cipher_iv && ctx->cipher_iv.length > 0)
     465                 :            :                 QAT_DP_HEXDUMP_LOG(DEBUG, "cipher iv:", cipher_iv->va,
     466                 :            :                                 ctx->cipher_iv.length);
     467                 :            :         if (auth_iv && ctx->auth_iv.length > 0)
     468                 :            :                 QAT_DP_HEXDUMP_LOG(DEBUG, "auth iv:", auth_iv->va,
     469                 :            :                                 ctx->auth_iv.length);
     470                 :            :         if (aad && ctx->aad_len > 0)
     471                 :            :                 QAT_DP_HEXDUMP_LOG(DEBUG, "aad:", aad->va,
     472                 :            :                                 ctx->aad_len);
     473                 :            :         if (digest && ctx->digest_length > 0)
     474                 :            :                 QAT_DP_HEXDUMP_LOG(DEBUG, "digest:", digest->va,
     475                 :            :                                 ctx->digest_length);
     476                 :            : }
     477                 :            : #else
     478                 :            : static __rte_always_inline void
     479                 :            : qat_sym_debug_log_dump(struct icp_qat_fw_la_bulk_req *qat_req __rte_unused,
     480                 :            :                 struct qat_sym_session *ctx __rte_unused,
     481                 :            :                 struct rte_crypto_vec *vec __rte_unused,
     482                 :            :                 uint32_t vec_len __rte_unused,
     483                 :            :                 struct rte_crypto_va_iova_ptr *cipher_iv __rte_unused,
     484                 :            :                 struct rte_crypto_va_iova_ptr *auth_iv __rte_unused,
     485                 :            :                 struct rte_crypto_va_iova_ptr *aad __rte_unused,
     486                 :            :                 struct rte_crypto_va_iova_ptr *digest __rte_unused)
     487                 :            : {
     488                 :            : }
     489                 :            : #endif
     490                 :            : 
     491                 :            : #else
     492                 :            : 
     493                 :            : static inline void
     494                 :            : qat_sym_preprocess_requests(void **ops __rte_unused,
     495                 :            :                                 uint16_t nb_ops __rte_unused)
     496                 :            : {
     497                 :            : }
     498                 :            : 
     499                 :            : static inline void
     500                 :            : qat_sym_process_response(void **op __rte_unused, uint8_t *resp __rte_unused,
     501                 :            :         void *op_cookie __rte_unused, uint64_t *dequeue_err_count __rte_unused)
     502                 :            : {
     503                 :            : }
     504                 :            : 
     505                 :            : static inline void
     506                 :            : qat_sym_process_response_gen_lce(void **op __rte_unused, uint8_t *resp __rte_unused,
     507                 :            :         void *op_cookie __rte_unused, uint64_t *dequeue_err_count __rte_unused)
     508                 :            : {
     509                 :            : }
     510                 :            : 
     511                 :            : #endif /* BUILD_QAT_SYM */
     512                 :            : #endif /* _QAT_SYM_H_ */

Generated by: LCOV version 1.14