1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2015-2022 Intel Corporation
5 #include <openssl/evp.h>
7 #include <rte_mempool.h>
9 #include <rte_crypto_sym.h>
10 #include <rte_bus_pci.h>
11 #include <rte_byteorder.h>
14 #include "dev/qat_crypto_pmd_gens.h"
16 uint8_t qat_sym_driver_id;
18 struct qat_crypto_gen_dev_ops qat_sym_gen_dev_ops[QAT_N_GENS];
21 qat_sym_init_op_cookie(void *op_cookie)
23 struct qat_sym_op_cookie *cookie = op_cookie;
25 cookie->qat_sgl_src_phys_addr =
26 rte_mempool_virt2iova(cookie) +
27 offsetof(struct qat_sym_op_cookie,
30 cookie->qat_sgl_dst_phys_addr =
31 rte_mempool_virt2iova(cookie) +
32 offsetof(struct qat_sym_op_cookie,
35 cookie->opt.spc_gmac.cd_phys_addr =
36 rte_mempool_virt2iova(cookie) +
37 offsetof(struct qat_sym_op_cookie,
38 opt.spc_gmac.cd_cipher);
42 set_cipher_iv(uint16_t iv_length, uint16_t iv_offset,
43 struct icp_qat_fw_la_cipher_req_params *cipher_param,
44 struct rte_crypto_op *op,
45 struct icp_qat_fw_la_bulk_req *qat_req)
47 /* copy IV into request if it fits */
48 if (iv_length <= sizeof(cipher_param->u.cipher_IV_array)) {
49 rte_memcpy(cipher_param->u.cipher_IV_array,
50 rte_crypto_op_ctod_offset(op, uint8_t *,
54 ICP_QAT_FW_LA_CIPH_IV_FLD_FLAG_SET(
55 qat_req->comn_hdr.serv_specif_flags,
56 ICP_QAT_FW_CIPH_IV_64BIT_PTR);
57 cipher_param->u.s.cipher_IV_ptr =
58 rte_crypto_op_ctophys_offset(op,
63 /** Set IV for CCM is special case, 0th byte is set to q-1
64 * where q is padding of nonce in 16 byte block
67 set_cipher_iv_ccm(uint16_t iv_length, uint16_t iv_offset,
68 struct icp_qat_fw_la_cipher_req_params *cipher_param,
69 struct rte_crypto_op *op, uint8_t q, uint8_t aad_len_field_sz)
71 rte_memcpy(((uint8_t *)cipher_param->u.cipher_IV_array) +
72 ICP_QAT_HW_CCM_NONCE_OFFSET,
73 rte_crypto_op_ctod_offset(op, uint8_t *,
74 iv_offset) + ICP_QAT_HW_CCM_NONCE_OFFSET,
76 *(uint8_t *)&cipher_param->u.cipher_IV_array[0] =
77 q - ICP_QAT_HW_CCM_NONCE_OFFSET;
80 rte_memcpy(&op->sym->aead.aad.data[ICP_QAT_HW_CCM_NONCE_OFFSET],
81 rte_crypto_op_ctod_offset(op, uint8_t *,
82 iv_offset) + ICP_QAT_HW_CCM_NONCE_OFFSET,
86 /** Handle Single-Pass AES-GMAC on QAT GEN3 */
88 handle_spc_gmac(struct qat_sym_session *ctx, struct rte_crypto_op *op,
89 struct qat_sym_op_cookie *cookie,
90 struct icp_qat_fw_la_bulk_req *qat_req)
92 static const uint32_t ver_key_offset =
93 sizeof(struct icp_qat_hw_auth_setup) +
94 ICP_QAT_HW_GALOIS_128_STATE1_SZ +
95 ICP_QAT_HW_GALOIS_H_SZ + ICP_QAT_HW_GALOIS_LEN_A_SZ +
96 ICP_QAT_HW_GALOIS_E_CTR0_SZ +
97 sizeof(struct icp_qat_hw_cipher_config);
98 struct icp_qat_fw_cipher_cd_ctrl_hdr *cipher_cd_ctrl =
99 (void *) &qat_req->cd_ctrl;
100 struct icp_qat_fw_la_cipher_req_params *cipher_param =
101 (void *) &qat_req->serv_specif_rqpars;
102 uint32_t data_length = op->sym->auth.data.length;
104 /* Fill separate Content Descriptor for this op */
105 rte_memcpy(cookie->opt.spc_gmac.cd_cipher.key,
106 ctx->auth_op == ICP_QAT_HW_AUTH_GENERATE ?
108 RTE_PTR_ADD(&ctx->cd, ver_key_offset),
109 ctx->auth_key_length);
110 cookie->opt.spc_gmac.cd_cipher.cipher_config.val =
111 ICP_QAT_HW_CIPHER_CONFIG_BUILD(
112 ICP_QAT_HW_CIPHER_AEAD_MODE,
114 ICP_QAT_HW_CIPHER_NO_CONVERT,
115 (ctx->auth_op == ICP_QAT_HW_AUTH_GENERATE ?
116 ICP_QAT_HW_CIPHER_ENCRYPT :
117 ICP_QAT_HW_CIPHER_DECRYPT));
118 QAT_FIELD_SET(cookie->opt.spc_gmac.cd_cipher.cipher_config.val,
120 QAT_CIPHER_AEAD_HASH_CMP_LEN_BITPOS,
121 QAT_CIPHER_AEAD_HASH_CMP_LEN_MASK);
122 cookie->opt.spc_gmac.cd_cipher.cipher_config.reserved =
123 ICP_QAT_HW_CIPHER_CONFIG_BUILD_UPPER(data_length);
125 /* Update the request */
126 qat_req->cd_pars.u.s.content_desc_addr =
127 cookie->opt.spc_gmac.cd_phys_addr;
128 qat_req->cd_pars.u.s.content_desc_params_sz = RTE_ALIGN_CEIL(
129 sizeof(struct icp_qat_hw_cipher_config) +
130 ctx->auth_key_length, 8) >> 3;
131 qat_req->comn_mid.src_length = data_length;
132 qat_req->comn_mid.dst_length = 0;
134 cipher_param->spc_aad_addr = 0;
135 cipher_param->spc_auth_res_addr = op->sym->auth.digest.phys_addr;
136 cipher_param->spc_aad_sz = data_length;
137 cipher_param->reserved = 0;
138 cipher_param->spc_auth_res_sz = ctx->digest_length;
140 qat_req->comn_hdr.service_cmd_id = ICP_QAT_FW_LA_CMD_CIPHER;
141 cipher_cd_ctrl->cipher_cfg_offset = 0;
142 ICP_QAT_FW_COMN_CURR_ID_SET(cipher_cd_ctrl, ICP_QAT_FW_SLICE_CIPHER);
143 ICP_QAT_FW_COMN_NEXT_ID_SET(cipher_cd_ctrl, ICP_QAT_FW_SLICE_DRAM_WR);
144 ICP_QAT_FW_LA_SINGLE_PASS_PROTO_FLAG_SET(
145 qat_req->comn_hdr.serv_specif_flags,
146 ICP_QAT_FW_LA_SINGLE_PASS_PROTO);
147 ICP_QAT_FW_LA_PROTO_SET(
148 qat_req->comn_hdr.serv_specif_flags,
149 ICP_QAT_FW_LA_NO_PROTO);
153 qat_sym_build_request(void *in_op, uint8_t *out_msg,
154 void *op_cookie, __rte_unused enum qat_device_gen qat_dev_gen)
157 struct qat_sym_session *ctx = NULL;
158 struct icp_qat_fw_la_cipher_req_params *cipher_param;
159 struct icp_qat_fw_la_cipher_20_req_params *cipher_param20;
160 struct icp_qat_fw_la_auth_req_params *auth_param;
161 register struct icp_qat_fw_la_bulk_req *qat_req;
162 uint8_t do_auth = 0, do_cipher = 0, do_aead = 0;
163 uint32_t cipher_len = 0, cipher_ofs = 0;
164 uint32_t auth_len = 0, auth_ofs = 0;
165 uint32_t min_ofs = 0;
166 uint64_t src_buf_start = 0, dst_buf_start = 0;
167 uint64_t auth_data_end = 0;
169 uint8_t in_place = 1;
170 int alignment_adjustment = 0;
172 struct rte_crypto_op *op = (struct rte_crypto_op *)in_op;
173 struct qat_sym_op_cookie *cookie =
174 (struct qat_sym_op_cookie *)op_cookie;
176 if (unlikely(op->type != RTE_CRYPTO_OP_TYPE_SYMMETRIC)) {
177 QAT_DP_LOG(ERR, "QAT PMD only supports symmetric crypto "
178 "operation requests, op (%p) is not a "
179 "symmetric operation.", op);
183 if (unlikely(op->sess_type == RTE_CRYPTO_OP_SESSIONLESS)) {
184 QAT_DP_LOG(ERR, "QAT PMD only supports session oriented"
185 " requests, op (%p) is sessionless.", op);
187 } else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
188 ctx = (struct qat_sym_session *)get_sym_session_private_data(
189 op->sym->session, qat_sym_driver_id);
190 #ifdef RTE_LIB_SECURITY
192 ctx = (struct qat_sym_session *)get_sec_session_private_data(
193 op->sym->sec_session);
195 if (unlikely(ctx->bpi_ctx == NULL)) {
196 QAT_DP_LOG(ERR, "QAT PMD only supports security"
197 " operation requests for"
198 " DOCSIS, op (%p) is not for"
201 } else if (unlikely(((op->sym->m_dst != NULL) &&
202 (op->sym->m_dst != op->sym->m_src)) ||
203 op->sym->m_src->nb_segs > 1)) {
204 QAT_DP_LOG(ERR, "OOP and/or multi-segment"
205 " buffers not supported for"
206 " DOCSIS security.");
207 op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
214 if (unlikely(ctx == NULL)) {
215 QAT_DP_LOG(ERR, "Session was not created for this device");
219 qat_req = (struct icp_qat_fw_la_bulk_req *)out_msg;
220 rte_mov128((uint8_t *)qat_req, (const uint8_t *)&(ctx->fw_req));
221 qat_req->comn_mid.opaque_data = (uint64_t)(uintptr_t)op;
222 cipher_param = (void *)&qat_req->serv_specif_rqpars;
223 cipher_param20 = (void *)&qat_req->serv_specif_rqpars;
224 auth_param = (void *)((uint8_t *)cipher_param +
225 ICP_QAT_FW_HASH_REQUEST_PARAMETERS_OFFSET);
227 if ((ctx->qat_cmd == ICP_QAT_FW_LA_CMD_HASH_CIPHER ||
228 ctx->qat_cmd == ICP_QAT_FW_LA_CMD_CIPHER_HASH) &&
230 /* AES-GCM or AES-CCM */
231 if (ctx->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_GALOIS_128 ||
232 ctx->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_GALOIS_64 ||
233 (ctx->qat_cipher_alg == ICP_QAT_HW_CIPHER_ALGO_AES128
234 && ctx->qat_mode == ICP_QAT_HW_CIPHER_CTR_MODE
235 && ctx->qat_hash_alg ==
236 ICP_QAT_HW_AUTH_ALGO_AES_CBC_MAC)) {
242 } else if (ctx->qat_cmd == ICP_QAT_FW_LA_CMD_AUTH || ctx->is_gmac) {
245 } else if (ctx->qat_cmd == ICP_QAT_FW_LA_CMD_CIPHER) {
252 if (ctx->qat_cipher_alg ==
253 ICP_QAT_HW_CIPHER_ALGO_SNOW_3G_UEA2 ||
254 ctx->qat_cipher_alg == ICP_QAT_HW_CIPHER_ALGO_KASUMI ||
255 ctx->qat_cipher_alg ==
256 ICP_QAT_HW_CIPHER_ALGO_ZUC_3G_128_EEA3) {
259 (op->sym->cipher.data.length % BYTE_LENGTH != 0) ||
260 (op->sym->cipher.data.offset % BYTE_LENGTH != 0))) {
262 "SNOW3G/KASUMI/ZUC in QAT PMD only supports byte aligned values");
263 op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
266 cipher_len = op->sym->cipher.data.length >> 3;
267 cipher_ofs = op->sym->cipher.data.offset >> 3;
269 } else if (ctx->bpi_ctx) {
270 /* DOCSIS - only send complete blocks to device.
271 * Process any partial block using CFB mode.
272 * Even if 0 complete blocks, still send this to device
273 * to get into rx queue for post-process and dequeuing
275 cipher_len = qat_bpicipher_preprocess(ctx, op);
276 cipher_ofs = op->sym->cipher.data.offset;
278 cipher_len = op->sym->cipher.data.length;
279 cipher_ofs = op->sym->cipher.data.offset;
282 set_cipher_iv(ctx->cipher_iv.length, ctx->cipher_iv.offset,
283 cipher_param, op, qat_req);
284 min_ofs = cipher_ofs;
289 if (ctx->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_SNOW_3G_UIA2 ||
290 ctx->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_KASUMI_F9 ||
292 ICP_QAT_HW_AUTH_ALGO_ZUC_3G_128_EIA3) {
294 (op->sym->auth.data.offset % BYTE_LENGTH != 0) ||
295 (op->sym->auth.data.length % BYTE_LENGTH != 0))) {
297 "For SNOW3G/KASUMI/ZUC, QAT PMD only supports byte aligned values");
298 op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
301 auth_ofs = op->sym->auth.data.offset >> 3;
302 auth_len = op->sym->auth.data.length >> 3;
304 auth_param->u1.aad_adr =
305 rte_crypto_op_ctophys_offset(op,
306 ctx->auth_iv.offset);
308 } else if (ctx->qat_hash_alg ==
309 ICP_QAT_HW_AUTH_ALGO_GALOIS_128 ||
311 ICP_QAT_HW_AUTH_ALGO_GALOIS_64) {
313 set_cipher_iv(ctx->auth_iv.length,
315 cipher_param, op, qat_req);
316 auth_ofs = op->sym->auth.data.offset;
317 auth_len = op->sym->auth.data.length;
319 auth_param->u1.aad_adr = 0;
320 auth_param->u2.aad_sz = 0;
323 auth_ofs = op->sym->auth.data.offset;
324 auth_len = op->sym->auth.data.length;
329 if (ctx->qat_hash_alg != ICP_QAT_HW_AUTH_ALGO_NULL ||
330 ctx->auth_op == ICP_QAT_HW_AUTH_VERIFY)
331 auth_param->auth_res_addr =
332 op->sym->auth.digest.phys_addr;
338 * This address may used for setting AAD physical pointer
339 * into IV offset from op
341 rte_iova_t aad_phys_addr_aead = op->sym->aead.aad.phys_addr;
342 if (ctx->qat_hash_alg ==
343 ICP_QAT_HW_AUTH_ALGO_GALOIS_128 ||
345 ICP_QAT_HW_AUTH_ALGO_GALOIS_64) {
347 set_cipher_iv(ctx->cipher_iv.length,
348 ctx->cipher_iv.offset,
349 cipher_param, op, qat_req);
351 } else if (ctx->qat_hash_alg ==
352 ICP_QAT_HW_AUTH_ALGO_AES_CBC_MAC) {
354 /* In case of AES-CCM this may point to user selected
355 * memory or iv offset in crypto_op
357 uint8_t *aad_data = op->sym->aead.aad.data;
358 /* This is true AAD length, it not includes 18 bytes of
361 uint8_t aad_ccm_real_len = 0;
362 uint8_t aad_len_field_sz = 0;
363 uint32_t msg_len_be =
364 rte_bswap32(op->sym->aead.data.length);
366 if (ctx->aad_len > ICP_QAT_HW_CCM_AAD_DATA_OFFSET) {
367 aad_len_field_sz = ICP_QAT_HW_CCM_AAD_LEN_INFO;
368 aad_ccm_real_len = ctx->aad_len -
369 ICP_QAT_HW_CCM_AAD_B0_LEN -
370 ICP_QAT_HW_CCM_AAD_LEN_INFO;
373 * aad_len not greater than 18, so no actual aad
374 * data, then use IV after op for B0 block
376 aad_data = rte_crypto_op_ctod_offset(op,
378 ctx->cipher_iv.offset);
380 rte_crypto_op_ctophys_offset(op,
381 ctx->cipher_iv.offset);
384 uint8_t q = ICP_QAT_HW_CCM_NQ_CONST -
385 ctx->cipher_iv.length;
387 aad_data[0] = ICP_QAT_HW_CCM_BUILD_B0_FLAGS(
389 ctx->digest_length, q);
391 if (q > ICP_QAT_HW_CCM_MSG_LEN_MAX_FIELD_SIZE) {
392 memcpy(aad_data + ctx->cipher_iv.length +
393 ICP_QAT_HW_CCM_NONCE_OFFSET +
394 (q - ICP_QAT_HW_CCM_MSG_LEN_MAX_FIELD_SIZE),
395 (uint8_t *)&msg_len_be,
396 ICP_QAT_HW_CCM_MSG_LEN_MAX_FIELD_SIZE);
398 memcpy(aad_data + ctx->cipher_iv.length +
399 ICP_QAT_HW_CCM_NONCE_OFFSET,
400 (uint8_t *)&msg_len_be
401 + (ICP_QAT_HW_CCM_MSG_LEN_MAX_FIELD_SIZE
405 if (aad_len_field_sz > 0) {
406 *(uint16_t *)&aad_data[ICP_QAT_HW_CCM_AAD_B0_LEN]
407 = rte_bswap16(aad_ccm_real_len);
409 if ((aad_ccm_real_len + aad_len_field_sz)
410 % ICP_QAT_HW_CCM_AAD_B0_LEN) {
414 pad_len = ICP_QAT_HW_CCM_AAD_B0_LEN -
415 ((aad_ccm_real_len + aad_len_field_sz) %
416 ICP_QAT_HW_CCM_AAD_B0_LEN);
417 pad_idx = ICP_QAT_HW_CCM_AAD_B0_LEN +
418 aad_ccm_real_len + aad_len_field_sz;
419 memset(&aad_data[pad_idx],
425 set_cipher_iv_ccm(ctx->cipher_iv.length,
426 ctx->cipher_iv.offset,
432 cipher_len = op->sym->aead.data.length;
433 cipher_ofs = op->sym->aead.data.offset;
434 auth_len = op->sym->aead.data.length;
435 auth_ofs = op->sym->aead.data.offset;
437 auth_param->u1.aad_adr = aad_phys_addr_aead;
438 auth_param->auth_res_addr = op->sym->aead.digest.phys_addr;
439 min_ofs = op->sym->aead.data.offset;
442 if (op->sym->m_src->nb_segs > 1 ||
443 (op->sym->m_dst && op->sym->m_dst->nb_segs > 1))
446 /* adjust for chain case */
447 if (do_cipher && do_auth)
448 min_ofs = cipher_ofs < auth_ofs ? cipher_ofs : auth_ofs;
450 if (unlikely(min_ofs >= rte_pktmbuf_data_len(op->sym->m_src) && do_sgl))
453 if (unlikely((op->sym->m_dst != NULL) &&
454 (op->sym->m_dst != op->sym->m_src))) {
455 /* Out-of-place operation (OOP)
456 * Don't align DMA start. DMA the minimum data-set
457 * so as not to overwrite data in dest buffer
461 rte_pktmbuf_iova_offset(op->sym->m_src, min_ofs);
463 rte_pktmbuf_iova_offset(op->sym->m_dst, min_ofs);
467 /* In-place operation
468 * Start DMA at nearest aligned address below min_ofs
471 rte_pktmbuf_iova_offset(op->sym->m_src, min_ofs)
472 & QAT_64_BTYE_ALIGN_MASK;
474 if (unlikely((rte_pktmbuf_iova(op->sym->m_src) -
475 rte_pktmbuf_headroom(op->sym->m_src))
477 /* alignment has pushed addr ahead of start of mbuf
478 * so revert and take the performance hit
481 rte_pktmbuf_iova_offset(op->sym->m_src,
484 dst_buf_start = src_buf_start;
486 /* remember any adjustment for later, note, can be +/- */
487 alignment_adjustment = src_buf_start -
488 rte_pktmbuf_iova_offset(op->sym->m_src, min_ofs);
491 if (do_cipher || do_aead) {
492 cipher_param->cipher_offset =
493 (uint32_t)rte_pktmbuf_iova_offset(
494 op->sym->m_src, cipher_ofs) - src_buf_start;
495 cipher_param->cipher_length = cipher_len;
497 cipher_param->cipher_offset = 0;
498 cipher_param->cipher_length = 0;
501 if (!ctx->is_single_pass) {
502 /* Do not let to overwrite spc_aad len */
503 if (do_auth || do_aead) {
504 auth_param->auth_off =
505 (uint32_t)rte_pktmbuf_iova_offset(
506 op->sym->m_src, auth_ofs) - src_buf_start;
507 auth_param->auth_len = auth_len;
509 auth_param->auth_off = 0;
510 auth_param->auth_len = 0;
514 qat_req->comn_mid.dst_length =
515 qat_req->comn_mid.src_length =
516 (cipher_param->cipher_offset + cipher_param->cipher_length)
517 > (auth_param->auth_off + auth_param->auth_len) ?
518 (cipher_param->cipher_offset + cipher_param->cipher_length)
519 : (auth_param->auth_off + auth_param->auth_len);
521 if (do_auth && do_cipher) {
522 /* Handle digest-encrypted cases, i.e.
523 * auth-gen-then-cipher-encrypt and
524 * cipher-decrypt-then-auth-verify
526 /* First find the end of the data */
528 uint32_t remaining_off = auth_param->auth_off +
529 auth_param->auth_len + alignment_adjustment + oop_shift;
530 struct rte_mbuf *sgl_buf =
532 op->sym->m_src : op->sym->m_dst);
534 while (remaining_off >= rte_pktmbuf_data_len(sgl_buf)
535 && sgl_buf->next != NULL) {
536 remaining_off -= rte_pktmbuf_data_len(sgl_buf);
537 sgl_buf = sgl_buf->next;
540 auth_data_end = (uint64_t)rte_pktmbuf_iova_offset(
541 sgl_buf, remaining_off);
543 auth_data_end = (in_place ?
544 src_buf_start : dst_buf_start) +
545 auth_param->auth_off + auth_param->auth_len;
547 /* Then check if digest-encrypted conditions are met */
548 if ((auth_param->auth_off + auth_param->auth_len <
549 cipher_param->cipher_offset +
550 cipher_param->cipher_length) &&
551 (op->sym->auth.digest.phys_addr ==
553 /* Handle partial digest encryption */
554 if (cipher_param->cipher_offset +
555 cipher_param->cipher_length <
556 auth_param->auth_off +
557 auth_param->auth_len +
559 qat_req->comn_mid.dst_length =
560 qat_req->comn_mid.src_length =
561 auth_param->auth_off +
562 auth_param->auth_len +
564 struct icp_qat_fw_comn_req_hdr *header =
566 ICP_QAT_FW_LA_DIGEST_IN_BUFFER_SET(
567 header->serv_specif_flags,
568 ICP_QAT_FW_LA_DIGEST_IN_BUFFER);
574 ICP_QAT_FW_COMN_PTR_TYPE_SET(qat_req->comn_hdr.comn_req_flags,
575 QAT_COMN_PTR_TYPE_SGL);
576 ret = qat_sgl_fill_array(op->sym->m_src,
577 (int64_t)(src_buf_start - rte_pktmbuf_iova(op->sym->m_src)),
578 &cookie->qat_sgl_src,
579 qat_req->comn_mid.src_length,
580 QAT_SYM_SGL_MAX_NUMBER);
583 QAT_DP_LOG(ERR, "QAT PMD Cannot fill sgl array");
588 qat_req->comn_mid.dest_data_addr =
589 qat_req->comn_mid.src_data_addr =
590 cookie->qat_sgl_src_phys_addr;
592 ret = qat_sgl_fill_array(op->sym->m_dst,
593 (int64_t)(dst_buf_start -
594 rte_pktmbuf_iova(op->sym->m_dst)),
595 &cookie->qat_sgl_dst,
596 qat_req->comn_mid.dst_length,
597 QAT_SYM_SGL_MAX_NUMBER);
600 QAT_DP_LOG(ERR, "QAT PMD can't fill sgl array");
604 qat_req->comn_mid.src_data_addr =
605 cookie->qat_sgl_src_phys_addr;
606 qat_req->comn_mid.dest_data_addr =
607 cookie->qat_sgl_dst_phys_addr;
609 qat_req->comn_mid.src_length = 0;
610 qat_req->comn_mid.dst_length = 0;
612 qat_req->comn_mid.src_data_addr = src_buf_start;
613 qat_req->comn_mid.dest_data_addr = dst_buf_start;
616 if (ctx->is_single_pass) {
619 cipher_param20->spc_aad_addr =
620 op->sym->aead.aad.phys_addr;
621 cipher_param20->spc_auth_res_addr =
622 op->sym->aead.digest.phys_addr;
624 cipher_param->spc_aad_addr =
625 op->sym->aead.aad.phys_addr;
626 cipher_param->spc_auth_res_addr =
627 op->sym->aead.digest.phys_addr;
629 } else if (ctx->is_single_pass_gmac &&
630 op->sym->auth.data.length <= QAT_AES_GMAC_SPC_MAX_SIZE) {
631 /* Handle Single-Pass AES-GMAC */
632 handle_spc_gmac(ctx, op, cookie, qat_req);
635 #if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG
636 QAT_DP_HEXDUMP_LOG(DEBUG, "qat_req:", qat_req,
637 sizeof(struct icp_qat_fw_la_bulk_req));
638 QAT_DP_HEXDUMP_LOG(DEBUG, "src_data:",
639 rte_pktmbuf_mtod(op->sym->m_src, uint8_t*),
640 rte_pktmbuf_data_len(op->sym->m_src));
642 uint8_t *cipher_iv_ptr = rte_crypto_op_ctod_offset(op,
644 ctx->cipher_iv.offset);
645 QAT_DP_HEXDUMP_LOG(DEBUG, "cipher iv:", cipher_iv_ptr,
646 ctx->cipher_iv.length);
650 if (ctx->auth_iv.length) {
651 uint8_t *auth_iv_ptr = rte_crypto_op_ctod_offset(op,
653 ctx->auth_iv.offset);
654 QAT_DP_HEXDUMP_LOG(DEBUG, "auth iv:", auth_iv_ptr,
655 ctx->auth_iv.length);
657 QAT_DP_HEXDUMP_LOG(DEBUG, "digest:", op->sym->auth.digest.data,
662 QAT_DP_HEXDUMP_LOG(DEBUG, "digest:", op->sym->aead.digest.data,
664 QAT_DP_HEXDUMP_LOG(DEBUG, "aad:", op->sym->aead.aad.data,