Lines Matching refs:reqctx
129 static inline void chcr_init_hctx_per_wr(struct chcr_ahash_req_ctx *reqctx)
131 memset(&reqctx->hctx_wr, 0, sizeof(struct chcr_hctx_per_wr));
213 struct chcr_aead_reqctx *reqctx = aead_request_ctx_dma(req);
218 if (reqctx->verify == VERIFY_SW) {
220 reqctx->verify = VERIFY_HW;
694 struct chcr_skcipher_req_ctx *reqctx = skcipher_request_ctx(req);
697 skcipher_request_set_tfm(&reqctx->fallback_req, cipher);
698 skcipher_request_set_callback(&reqctx->fallback_req, req->base.flags,
700 skcipher_request_set_crypt(&reqctx->fallback_req, req->src, req->dst,
703 err = op_type ? crypto_skcipher_decrypt(&reqctx->fallback_req) :
704 crypto_skcipher_encrypt(&reqctx->fallback_req);
721 struct chcr_aead_reqctx *reqctx = aead_request_ctx_dma(aead_req);
722 *txqidx = reqctx->txqidx;
723 *rxqidx = reqctx->rxqidx;
730 struct chcr_skcipher_req_ctx *reqctx =
732 *txqidx = reqctx->txqidx;
733 *rxqidx = reqctx->rxqidx;
740 struct chcr_ahash_req_ctx *reqctx =
742 *txqidx = reqctx->txqidx;
743 *rxqidx = reqctx->rxqidx;
808 struct chcr_skcipher_req_ctx *reqctx =
817 unsigned int rx_channel_id = reqctx->rxqidx / ctx->rxq_perchan;
820 nents = sg_nents_xlen(reqctx->dstsg, wrparam->bytes, CHCR_DST_SG_SIZE,
821 reqctx->dst_ofst);
825 nents = sg_nents_xlen(reqctx->srcsg, wrparam->bytes,
826 CHCR_SRC_SG_SIZE, reqctx->src_ofst);
827 temp = reqctx->imm ? roundup(wrparam->bytes, 16) :
846 chcr_req->sec_cpl.seqno_numivs = FILL_SEC_CPL_SCMD0_SEQNO(reqctx->op, 0,
853 if ((reqctx->op == CHCR_DECRYPT_OP) &&
881 + (reqctx->imm ? (wrparam->bytes) : 0);
882 create_wreq(c_ctx(tfm), chcr_req, &(wrparam->req->base), reqctx->imm, 0,
885 reqctx->skb = skb;
887 if (reqctx->op && (ablkctx->ciph_mode ==
891 reqctx->processed + wrparam->bytes - AES_BLOCK_SIZE);
1059 struct chcr_skcipher_req_ctx *reqctx = skcipher_request_ctx(req);
1064 int round = reqctx->last_req_len / AES_BLOCK_SIZE;
1067 memcpy(iv, reqctx->iv, AES_BLOCK_SIZE);
1099 struct chcr_skcipher_req_ctx *reqctx = skcipher_request_ctx(req);
1104 ctr_add_iv(iv, req->iv, (reqctx->processed /
1107 *(__be32 *)(reqctx->iv + CTR_RFC3686_NONCE_SIZE +
1108 CTR_RFC3686_IV_SIZE) = cpu_to_be32((reqctx->processed /
1113 if (reqctx->op)
1133 struct chcr_skcipher_req_ctx *reqctx = skcipher_request_ctx(req);
1138 ctr_add_iv(iv, req->iv, DIV_ROUND_UP(reqctx->processed,
1141 if (!reqctx->partial_req)
1142 memcpy(iv, reqctx->iv, AES_BLOCK_SIZE);
1148 if (!reqctx->op)
1159 struct chcr_skcipher_req_ctx *reqctx = skcipher_request_ctx(req);
1173 if (req->cryptlen == reqctx->processed) {
1180 if (!reqctx->imm) {
1181 bytes = chcr_sg_ent_in_wr(reqctx->srcsg, reqctx->dstsg, 0,
1183 reqctx->src_ofst, reqctx->dst_ofst);
1184 if ((bytes + reqctx->processed) >= req->cryptlen)
1185 bytes = req->cryptlen - reqctx->processed;
1190 bytes = req->cryptlen - reqctx->processed;
1192 err = chcr_update_cipher_iv(req, fw6_pld, reqctx->iv);
1199 memcpy(req->iv, reqctx->init_iv, IV);
1202 reqctx->op);
1208 bytes = adjust_ctr_overflow(reqctx->iv, bytes);
1209 wrparam.qid = u_ctx->lldi.rxq_ids[reqctx->rxqidx];
1219 set_wr_txq(skb, CPL_PRIORITY_DATA, reqctx->txqidx);
1221 reqctx->last_req_len = bytes;
1222 reqctx->processed += bytes;
1247 struct chcr_skcipher_req_ctx *reqctx = skcipher_request_ctx(req);
1256 reqctx->processed = 0;
1257 reqctx->partial_req = 0;
1290 reqctx->imm = (transhdr_len + IV + req->cryptlen) <=
1295 reqctx->imm = 0;
1298 if (!reqctx->imm) {
1302 if ((bytes + reqctx->processed) >= req->cryptlen)
1303 bytes = req->cryptlen - reqctx->processed;
1313 memcpy(reqctx->iv, ablkctx->nonce, CTR_RFC3686_NONCE_SIZE);
1314 memcpy(reqctx->iv + CTR_RFC3686_NONCE_SIZE, req->iv,
1318 *(__be32 *)(reqctx->iv + CTR_RFC3686_NONCE_SIZE +
1320 memcpy(reqctx->init_iv, reqctx->iv, IV);
1324 memcpy(reqctx->iv, req->iv, IV);
1325 memcpy(reqctx->init_iv, req->iv, IV);
1334 reqctx->iv : req->iv,
1338 reqctx->op = op_type;
1339 reqctx->srcsg = req->src;
1340 reqctx->dstsg = req->dst;
1341 reqctx->src_ofst = 0;
1342 reqctx->dst_ofst = 0;
1351 reqctx->processed = bytes;
1352 reqctx->last_req_len = bytes;
1353 reqctx->partial_req = !!(req->cryptlen - reqctx->processed);
1365 struct chcr_skcipher_req_ctx *reqctx = skcipher_request_ctx(req);
1374 reqctx->txqidx = cpu % ctx->ntxq;
1375 reqctx->rxqidx = cpu % ctx->nrxq;
1382 reqctx->txqidx) &&
1388 err = process_cipher(req, u_ctx->lldi.rxq_ids[reqctx->rxqidx],
1393 set_wr_txq(skb, CPL_PRIORITY_DATA, reqctx->txqidx);
1398 reqctx->partial_req = 1;
1410 struct chcr_skcipher_req_ctx *reqctx = skcipher_request_ctx(req);
1419 reqctx->txqidx = cpu % ctx->ntxq;
1420 reqctx->rxqidx = cpu % ctx->nrxq;
1428 reqctx->txqidx) &&
1431 err = process_cipher(req, u_ctx->lldi.rxq_ids[reqctx->rxqidx],
1436 set_wr_txq(skb, CPL_PRIORITY_DATA, reqctx->txqidx);
2019 struct chcr_ahash_req_ctx *reqctx = ahash_request_ctx(req);
2020 struct chcr_hctx_per_wr *hctx_wr = &reqctx->hctx_wr;
2031 reqctx->txqidx = cpu % ctx->ntxq;
2032 reqctx->rxqidx = cpu % ctx->nrxq;
2064 params.scmd1 = reqctx->data_len + params.sg_len;
2067 reqctx->data_len += params.sg_len;
2075 set_wr_txq(skb, CPL_PRIORITY_DATA, reqctx->txqidx);
2086 struct chcr_ahash_req_ctx *reqctx = ahash_request_ctx(req);
2087 struct chcr_hctx_per_wr *hctx_wr = &reqctx->hctx_wr;
2107 if (hctx_wr->isfinal || ((hctx_wr->processed + reqctx->reqlen) ==
2114 memcpy(reqctx->partial_hash,
2121 memcpy(reqctx->partial_hash, input + sizeof(struct cpl_fw6_pld),
2366 struct chcr_aead_reqctx *reqctx = aead_request_ctx_dma(req);
2370 chcr_aead_dma_unmap(&u_ctx->lldi.pdev->dev, req, reqctx->op);
2377 struct chcr_aead_reqctx *reqctx = aead_request_ctx_dma(req);
2384 if (reqctx->op && req->cryptlen < authsize)
2386 if (reqctx->b0_len)
2387 reqctx->scratch_pad = reqctx->iv + IV;
2389 reqctx->scratch_pad = NULL;
2392 reqctx->op);
2442 struct chcr_aead_reqctx *reqctx = aead_request_ctx_dma(req);
2457 unsigned int rx_channel_id = reqctx->rxqidx / ctx->rxq_perchan;
2463 reqctx->b0_len = 0;
2473 (reqctx->op ? -authsize : authsize), CHCR_DST_SG_SIZE, 0);
2481 reqctx->imm = (transhdr_len + req->assoclen + req->cryptlen) <
2483 temp = reqctx->imm ? roundup(req->assoclen + req->cryptlen, 16)
2489 transhdr_len, reqctx->op)) {
2492 return ERR_PTR(chcr_aead_fallback(req, reqctx->op));
2502 temp = (reqctx->op == CHCR_ENCRYPT_OP) ? 0 : authsize;
2526 chcr_req->sec_cpl.seqno_numivs = FILL_SEC_CPL_SCMD0_SEQNO(reqctx->op,
2527 (reqctx->op == CHCR_ENCRYPT_OP) ? 1 : 0,
2535 if (reqctx->op == CHCR_ENCRYPT_OP ||
2563 kctx_len + (reqctx->imm ? (req->assoclen + req->cryptlen) : 0);
2564 create_wreq(a_ctx(tfm), chcr_req, &req->base, reqctx->imm, size,
2566 reqctx->skb = skb;
2580 struct chcr_aead_reqctx *reqctx = aead_request_ctx_dma(req);
2600 reqctx->iv_dma = dma_map_single(dev, reqctx->iv, (IV + reqctx->b0_len),
2602 if (dma_mapping_error(dev, reqctx->iv_dma))
2604 if (reqctx->b0_len)
2605 reqctx->b0_dma = reqctx->iv_dma + IV;
2607 reqctx->b0_dma = 0;
2633 dma_unmap_single(dev, reqctx->iv_dma, IV, DMA_BIDIRECTIONAL);
2641 struct chcr_aead_reqctx *reqctx = aead_request_ctx_dma(req);
2662 dma_unmap_single(dev, reqctx->iv_dma, (IV + reqctx->b0_len),
2682 struct chcr_aead_reqctx *reqctx = aead_request_ctx_dma(req);
2684 if (reqctx->imm) {
2687 if (reqctx->b0_len) {
2688 memcpy(buf, reqctx->scratch_pad, reqctx->b0_len);
2689 buf += reqctx->b0_len;
2695 if (reqctx->b0_len)
2696 ulptx_walk_add_page(&ulp_walk, reqctx->b0_len,
2697 reqctx->b0_dma);
2708 struct chcr_aead_reqctx *reqctx = aead_request_ctx_dma(req);
2715 unsigned int rx_channel_id = reqctx->rxqidx / ctx->rxq_perchan;
2719 dsgl_walk_add_page(&dsgl_walk, IV + reqctx->b0_len, reqctx->iv_dma);
2721 (reqctx->op ? -authsize : authsize);
2731 struct chcr_skcipher_req_ctx *reqctx = skcipher_request_ctx(req);
2734 memcpy(buf, reqctx->iv, IV);
2736 if (reqctx->imm) {
2738 buf, wrparam->bytes, reqctx->processed);
2741 ulptx_walk_add_sg(&ulp_walk, reqctx->srcsg, wrparam->bytes,
2742 reqctx->src_ofst);
2743 reqctx->srcsg = ulp_walk.last_sg;
2744 reqctx->src_ofst = ulp_walk.last_sg_len;
2754 struct chcr_skcipher_req_ctx *reqctx = skcipher_request_ctx(req);
2759 unsigned int rx_channel_id = reqctx->rxqidx / ctx->rxq_perchan;
2763 dsgl_walk_add_sg(&dsgl_walk, reqctx->dstsg, wrparam->bytes,
2764 reqctx->dst_ofst);
2765 reqctx->dstsg = dsgl_walk.last_sg;
2766 reqctx->dst_ofst = dsgl_walk.last_sg_len;
2775 struct chcr_ahash_req_ctx *reqctx = ahash_request_ctx(req);
2777 if (reqctx->hctx_wr.imm) {
2781 memcpy(buf, reqctx->reqbfr, param->bfr_len);
2785 sg_pcopy_to_buffer(reqctx->hctx_wr.srcsg,
2786 sg_nents(reqctx->hctx_wr.srcsg), buf,
2792 reqctx->hctx_wr.dma_addr);
2793 ulptx_walk_add_sg(&ulp_walk, reqctx->hctx_wr.srcsg,
2794 param->sg_len, reqctx->hctx_wr.src_ofst);
2795 reqctx->hctx_wr.srcsg = ulp_walk.last_sg;
2796 reqctx->hctx_wr.src_ofst = ulp_walk.last_sg_len;
2898 struct chcr_aead_reqctx *reqctx = aead_request_ctx_dma(req);
2899 u8 *b0 = reqctx->scratch_pad;
2936 struct chcr_aead_reqctx *reqctx = aead_request_ctx_dma(req);
2950 put_unaligned_be16(assoclen, &reqctx->scratch_pad[16]);
2967 struct chcr_aead_reqctx *reqctx = aead_request_ctx_dma(req);
2970 unsigned int rx_channel_id = reqctx->rxqidx / ctx->rxq_perchan;
3040 struct chcr_aead_reqctx *reqctx = aead_request_ctx_dma(req);
3058 reqctx->b0_len = CCM_B0_SIZE + (assoclen ? CCM_AAD_FIELD_SIZE : 0);
3063 error = aead_ccm_validate_input(reqctx->op, req, aeadctx, sub_type);
3067 + (reqctx->op ? -authsize : authsize),
3076 reqctx->imm = (transhdr_len + req->assoclen + req->cryptlen +
3077 reqctx->b0_len) <= SGE_MAX_WR_LEN;
3078 temp = reqctx->imm ? roundup(req->assoclen + req->cryptlen +
3079 reqctx->b0_len, 16) :
3085 reqctx->b0_len, transhdr_len, reqctx->op)) {
3088 return ERR_PTR(chcr_aead_fallback(req, reqctx->op));
3099 fill_sec_cpl_for_aead(&chcr_req->sec_cpl, dst_size, req, reqctx->op);
3109 error = ccm_format_packet(req, ivptr, sub_type, reqctx->op, assoclen);
3117 kctx_len + (reqctx->imm ? (req->assoclen + req->cryptlen +
3118 reqctx->b0_len) : 0);
3119 create_wreq(a_ctx(tfm), chcr_req, &req->base, reqctx->imm, 0,
3121 reqctx->skb = skb;
3139 struct chcr_aead_reqctx *reqctx = aead_request_ctx_dma(req);
3152 unsigned int rx_channel_id = reqctx->rxqidx / ctx->rxq_perchan;
3158 reqctx->b0_len = 0;
3163 (reqctx->op ? -authsize : authsize),
3171 reqctx->imm = (transhdr_len + req->assoclen + req->cryptlen) <=
3173 temp = reqctx->imm ? roundup(req->assoclen + req->cryptlen, 16) :
3178 transhdr_len, reqctx->op)) {
3182 return ERR_PTR(chcr_aead_fallback(req, reqctx->op));
3193 temp = (reqctx->op == CHCR_ENCRYPT_OP) ? 0 : authsize;
3206 FILL_SEC_CPL_SCMD0_SEQNO(reqctx->op, (reqctx->op ==
3236 kctx_len + (reqctx->imm ? (req->assoclen + req->cryptlen) : 0);
3237 create_wreq(a_ctx(tfm), chcr_req, &req->base, reqctx->imm, size,
3238 transhdr_len, temp, reqctx->verify);
3239 reqctx->skb = skb;
3740 struct chcr_aead_reqctx *reqctx = aead_request_ctx_dma(req);
3756 return chcr_aead_fallback(req, reqctx->op);
3760 reqctx->txqidx) &&
3774 skb = create_wr_fn(req, u_ctx->lldi.rxq_ids[reqctx->rxqidx], size);
3782 set_wr_txq(skb, CPL_PRIORITY_DATA, reqctx->txqidx);
3790 struct chcr_aead_reqctx *reqctx = aead_request_ctx_dma(req);
3795 reqctx->txqidx = cpu % ctx->ntxq;
3796 reqctx->rxqidx = cpu % ctx->nrxq;
3799 reqctx->verify = VERIFY_HW;
3800 reqctx->op = CHCR_ENCRYPT_OP;
3821 struct chcr_aead_reqctx *reqctx = aead_request_ctx_dma(req);
3826 reqctx->txqidx = cpu % ctx->ntxq;
3827 reqctx->rxqidx = cpu % ctx->nrxq;
3832 reqctx->verify = VERIFY_SW;
3835 reqctx->verify = VERIFY_HW;
3837 reqctx->op = CHCR_DECRYPT_OP;