Lines Matching refs:reqctx
133 static inline void chcr_init_hctx_per_wr(struct chcr_ahash_req_ctx *reqctx)
135 memset(&reqctx->hctx_wr, 0, sizeof(struct chcr_hctx_per_wr));
217 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req);
222 if (reqctx->verify == VERIFY_SW) {
224 reqctx->verify = VERIFY_HW;
698 struct chcr_skcipher_req_ctx *reqctx = skcipher_request_ctx(req);
701 skcipher_request_set_tfm(&reqctx->fallback_req, cipher);
702 skcipher_request_set_callback(&reqctx->fallback_req, req->base.flags,
704 skcipher_request_set_crypt(&reqctx->fallback_req, req->src, req->dst,
707 err = op_type ? crypto_skcipher_decrypt(&reqctx->fallback_req) :
708 crypto_skcipher_encrypt(&reqctx->fallback_req);
725 struct chcr_aead_reqctx *reqctx = aead_request_ctx(aead_req);
726 *txqidx = reqctx->txqidx;
727 *rxqidx = reqctx->rxqidx;
734 struct chcr_skcipher_req_ctx *reqctx =
736 *txqidx = reqctx->txqidx;
737 *rxqidx = reqctx->rxqidx;
744 struct chcr_ahash_req_ctx *reqctx =
746 *txqidx = reqctx->txqidx;
747 *rxqidx = reqctx->rxqidx;
815 struct chcr_skcipher_req_ctx *reqctx =
824 unsigned int rx_channel_id = reqctx->rxqidx / ctx->rxq_perchan;
827 nents = sg_nents_xlen(reqctx->dstsg, wrparam->bytes, CHCR_DST_SG_SIZE,
828 reqctx->dst_ofst);
832 nents = sg_nents_xlen(reqctx->srcsg, wrparam->bytes,
833 CHCR_SRC_SG_SIZE, reqctx->src_ofst);
834 temp = reqctx->imm ? roundup(wrparam->bytes, 16) :
853 chcr_req->sec_cpl.seqno_numivs = FILL_SEC_CPL_SCMD0_SEQNO(reqctx->op, 0,
860 if ((reqctx->op == CHCR_DECRYPT_OP) &&
888 + (reqctx->imm ? (wrparam->bytes) : 0);
889 create_wreq(c_ctx(tfm), chcr_req, &(wrparam->req->base), reqctx->imm, 0,
892 reqctx->skb = skb;
894 if (reqctx->op && (ablkctx->ciph_mode ==
898 reqctx->processed + wrparam->bytes - AES_BLOCK_SIZE);
1066 struct chcr_skcipher_req_ctx *reqctx = skcipher_request_ctx(req);
1071 int round = reqctx->last_req_len / AES_BLOCK_SIZE;
1074 memcpy(iv, reqctx->iv, AES_BLOCK_SIZE);
1106 struct chcr_skcipher_req_ctx *reqctx = skcipher_request_ctx(req);
1111 ctr_add_iv(iv, req->iv, (reqctx->processed /
1114 *(__be32 *)(reqctx->iv + CTR_RFC3686_NONCE_SIZE +
1115 CTR_RFC3686_IV_SIZE) = cpu_to_be32((reqctx->processed /
1120 if (reqctx->op)
1140 struct chcr_skcipher_req_ctx *reqctx = skcipher_request_ctx(req);
1145 ctr_add_iv(iv, req->iv, DIV_ROUND_UP(reqctx->processed,
1148 if (!reqctx->partial_req)
1149 memcpy(iv, reqctx->iv, AES_BLOCK_SIZE);
1155 if (!reqctx->op)
1166 struct chcr_skcipher_req_ctx *reqctx = skcipher_request_ctx(req);
1180 if (req->cryptlen == reqctx->processed) {
1187 if (!reqctx->imm) {
1188 bytes = chcr_sg_ent_in_wr(reqctx->srcsg, reqctx->dstsg, 0,
1190 reqctx->src_ofst, reqctx->dst_ofst);
1191 if ((bytes + reqctx->processed) >= req->cryptlen)
1192 bytes = req->cryptlen - reqctx->processed;
1197 bytes = req->cryptlen - reqctx->processed;
1199 err = chcr_update_cipher_iv(req, fw6_pld, reqctx->iv);
1206 memcpy(req->iv, reqctx->init_iv, IV);
1209 reqctx->op);
1215 bytes = adjust_ctr_overflow(reqctx->iv, bytes);
1216 wrparam.qid = u_ctx->lldi.rxq_ids[reqctx->rxqidx];
1226 set_wr_txq(skb, CPL_PRIORITY_DATA, reqctx->txqidx);
1228 reqctx->last_req_len = bytes;
1229 reqctx->processed += bytes;
1254 struct chcr_skcipher_req_ctx *reqctx = skcipher_request_ctx(req);
1263 reqctx->processed = 0;
1264 reqctx->partial_req = 0;
1297 reqctx->imm = (transhdr_len + IV + req->cryptlen) <=
1302 reqctx->imm = 0;
1305 if (!reqctx->imm) {
1309 if ((bytes + reqctx->processed) >= req->cryptlen)
1310 bytes = req->cryptlen - reqctx->processed;
1320 memcpy(reqctx->iv, ablkctx->nonce, CTR_RFC3686_NONCE_SIZE);
1321 memcpy(reqctx->iv + CTR_RFC3686_NONCE_SIZE, req->iv,
1325 *(__be32 *)(reqctx->iv + CTR_RFC3686_NONCE_SIZE +
1327 memcpy(reqctx->init_iv, reqctx->iv, IV);
1331 memcpy(reqctx->iv, req->iv, IV);
1332 memcpy(reqctx->init_iv, req->iv, IV);
1341 reqctx->iv : req->iv,
1345 reqctx->op = op_type;
1346 reqctx->srcsg = req->src;
1347 reqctx->dstsg = req->dst;
1348 reqctx->src_ofst = 0;
1349 reqctx->dst_ofst = 0;
1358 reqctx->processed = bytes;
1359 reqctx->last_req_len = bytes;
1360 reqctx->partial_req = !!(req->cryptlen - reqctx->processed);
1372 struct chcr_skcipher_req_ctx *reqctx = skcipher_request_ctx(req);
1381 reqctx->txqidx = cpu % ctx->ntxq;
1382 reqctx->rxqidx = cpu % ctx->nrxq;
1389 reqctx->txqidx) &&
1395 err = process_cipher(req, u_ctx->lldi.rxq_ids[reqctx->rxqidx],
1400 set_wr_txq(skb, CPL_PRIORITY_DATA, reqctx->txqidx);
1405 reqctx->partial_req = 1;
1417 struct chcr_skcipher_req_ctx *reqctx = skcipher_request_ctx(req);
1426 reqctx->txqidx = cpu % ctx->ntxq;
1427 reqctx->rxqidx = cpu % ctx->nrxq;
1435 reqctx->txqidx) &&
1438 err = process_cipher(req, u_ctx->lldi.rxq_ids[reqctx->rxqidx],
1443 set_wr_txq(skb, CPL_PRIORITY_DATA, reqctx->txqidx);
2025 struct chcr_ahash_req_ctx *reqctx = ahash_request_ctx(req);
2026 struct chcr_hctx_per_wr *hctx_wr = &reqctx->hctx_wr;
2037 reqctx->txqidx = cpu % ctx->ntxq;
2038 reqctx->rxqidx = cpu % ctx->nrxq;
2070 params.scmd1 = reqctx->data_len + params.sg_len;
2073 reqctx->data_len += params.sg_len;
2081 set_wr_txq(skb, CPL_PRIORITY_DATA, reqctx->txqidx);
2092 struct chcr_ahash_req_ctx *reqctx = ahash_request_ctx(req);
2093 struct chcr_hctx_per_wr *hctx_wr = &reqctx->hctx_wr;
2113 if (hctx_wr->isfinal || ((hctx_wr->processed + reqctx->reqlen) ==
2120 memcpy(reqctx->partial_hash,
2127 memcpy(reqctx->partial_hash, input + sizeof(struct cpl_fw6_pld),
2371 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req);
2375 chcr_aead_dma_unmap(&u_ctx->lldi.pdev->dev, req, reqctx->op);
2382 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req);
2389 if (reqctx->op && req->cryptlen < authsize)
2391 if (reqctx->b0_len)
2392 reqctx->scratch_pad = reqctx->iv + IV;
2394 reqctx->scratch_pad = NULL;
2397 reqctx->op);
2447 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req);
2462 unsigned int rx_channel_id = reqctx->rxqidx / ctx->rxq_perchan;
2468 reqctx->b0_len = 0;
2478 (reqctx->op ? -authsize : authsize), CHCR_DST_SG_SIZE, 0);
2486 reqctx->imm = (transhdr_len + req->assoclen + req->cryptlen) <
2488 temp = reqctx->imm ? roundup(req->assoclen + req->cryptlen, 16)
2494 transhdr_len, reqctx->op)) {
2497 return ERR_PTR(chcr_aead_fallback(req, reqctx->op));
2507 temp = (reqctx->op == CHCR_ENCRYPT_OP) ? 0 : authsize;
2531 chcr_req->sec_cpl.seqno_numivs = FILL_SEC_CPL_SCMD0_SEQNO(reqctx->op,
2532 (reqctx->op == CHCR_ENCRYPT_OP) ? 1 : 0,
2540 if (reqctx->op == CHCR_ENCRYPT_OP ||
2568 kctx_len + (reqctx->imm ? (req->assoclen + req->cryptlen) : 0);
2569 create_wreq(a_ctx(tfm), chcr_req, &req->base, reqctx->imm, size,
2571 reqctx->skb = skb;
2585 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req);
2605 reqctx->iv_dma = dma_map_single(dev, reqctx->iv, (IV + reqctx->b0_len),
2607 if (dma_mapping_error(dev, reqctx->iv_dma))
2609 if (reqctx->b0_len)
2610 reqctx->b0_dma = reqctx->iv_dma + IV;
2612 reqctx->b0_dma = 0;
2638 dma_unmap_single(dev, reqctx->iv_dma, IV, DMA_BIDIRECTIONAL);
2646 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req);
2667 dma_unmap_single(dev, reqctx->iv_dma, (IV + reqctx->b0_len),
2687 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req);
2689 if (reqctx->imm) {
2692 if (reqctx->b0_len) {
2693 memcpy(buf, reqctx->scratch_pad, reqctx->b0_len);
2694 buf += reqctx->b0_len;
2700 if (reqctx->b0_len)
2701 ulptx_walk_add_page(&ulp_walk, reqctx->b0_len,
2702 reqctx->b0_dma);
2713 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req);
2720 unsigned int rx_channel_id = reqctx->rxqidx / ctx->rxq_perchan;
2724 dsgl_walk_add_page(&dsgl_walk, IV + reqctx->b0_len, reqctx->iv_dma);
2726 (reqctx->op ? -authsize : authsize);
2736 struct chcr_skcipher_req_ctx *reqctx = skcipher_request_ctx(req);
2739 memcpy(buf, reqctx->iv, IV);
2741 if (reqctx->imm) {
2743 buf, wrparam->bytes, reqctx->processed);
2746 ulptx_walk_add_sg(&ulp_walk, reqctx->srcsg, wrparam->bytes,
2747 reqctx->src_ofst);
2748 reqctx->srcsg = ulp_walk.last_sg;
2749 reqctx->src_ofst = ulp_walk.last_sg_len;
2759 struct chcr_skcipher_req_ctx *reqctx = skcipher_request_ctx(req);
2764 unsigned int rx_channel_id = reqctx->rxqidx / ctx->rxq_perchan;
2768 dsgl_walk_add_sg(&dsgl_walk, reqctx->dstsg, wrparam->bytes,
2769 reqctx->dst_ofst);
2770 reqctx->dstsg = dsgl_walk.last_sg;
2771 reqctx->dst_ofst = dsgl_walk.last_sg_len;
2780 struct chcr_ahash_req_ctx *reqctx = ahash_request_ctx(req);
2782 if (reqctx->hctx_wr.imm) {
2786 memcpy(buf, reqctx->reqbfr, param->bfr_len);
2790 sg_pcopy_to_buffer(reqctx->hctx_wr.srcsg,
2791 sg_nents(reqctx->hctx_wr.srcsg), buf,
2797 reqctx->hctx_wr.dma_addr);
2798 ulptx_walk_add_sg(&ulp_walk, reqctx->hctx_wr.srcsg,
2799 param->sg_len, reqctx->hctx_wr.src_ofst);
2800 reqctx->hctx_wr.srcsg = ulp_walk.last_sg;
2801 reqctx->hctx_wr.src_ofst = ulp_walk.last_sg_len;
2903 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req);
2904 u8 *b0 = reqctx->scratch_pad;
2941 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req);
2955 put_unaligned_be16(assoclen, &reqctx->scratch_pad[16]);
2972 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req);
2975 unsigned int rx_channel_id = reqctx->rxqidx / ctx->rxq_perchan;
3045 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req);
3063 reqctx->b0_len = CCM_B0_SIZE + (assoclen ? CCM_AAD_FIELD_SIZE : 0);
3068 error = aead_ccm_validate_input(reqctx->op, req, aeadctx, sub_type);
3072 + (reqctx->op ? -authsize : authsize),
3081 reqctx->imm = (transhdr_len + req->assoclen + req->cryptlen +
3082 reqctx->b0_len) <= SGE_MAX_WR_LEN;
3083 temp = reqctx->imm ? roundup(req->assoclen + req->cryptlen +
3084 reqctx->b0_len, 16) :
3090 reqctx->b0_len, transhdr_len, reqctx->op)) {
3093 return ERR_PTR(chcr_aead_fallback(req, reqctx->op));
3104 fill_sec_cpl_for_aead(&chcr_req->sec_cpl, dst_size, req, reqctx->op);
3114 error = ccm_format_packet(req, ivptr, sub_type, reqctx->op, assoclen);
3122 kctx_len + (reqctx->imm ? (req->assoclen + req->cryptlen +
3123 reqctx->b0_len) : 0);
3124 create_wreq(a_ctx(tfm), chcr_req, &req->base, reqctx->imm, 0,
3126 reqctx->skb = skb;
3144 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req);
3157 unsigned int rx_channel_id = reqctx->rxqidx / ctx->rxq_perchan;
3163 reqctx->b0_len = 0;
3168 (reqctx->op ? -authsize : authsize),
3176 reqctx->imm = (transhdr_len + req->assoclen + req->cryptlen) <=
3178 temp = reqctx->imm ? roundup(req->assoclen + req->cryptlen, 16) :
3183 transhdr_len, reqctx->op)) {
3187 return ERR_PTR(chcr_aead_fallback(req, reqctx->op));
3198 temp = (reqctx->op == CHCR_ENCRYPT_OP) ? 0 : authsize;
3211 FILL_SEC_CPL_SCMD0_SEQNO(reqctx->op, (reqctx->op ==
3241 kctx_len + (reqctx->imm ? (req->assoclen + req->cryptlen) : 0);
3242 create_wreq(a_ctx(tfm), chcr_req, &req->base, reqctx->imm, size,
3243 transhdr_len, temp, reqctx->verify);
3244 reqctx->skb = skb;
3744 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req);
3760 return chcr_aead_fallback(req, reqctx->op);
3764 reqctx->txqidx) &&
3778 skb = create_wr_fn(req, u_ctx->lldi.rxq_ids[reqctx->rxqidx], size);
3786 set_wr_txq(skb, CPL_PRIORITY_DATA, reqctx->txqidx);
3794 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req);
3799 reqctx->txqidx = cpu % ctx->ntxq;
3800 reqctx->rxqidx = cpu % ctx->nrxq;
3803 reqctx->verify = VERIFY_HW;
3804 reqctx->op = CHCR_ENCRYPT_OP;
3825 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req);
3830 reqctx->txqidx = cpu % ctx->ntxq;
3831 reqctx->rxqidx = cpu % ctx->nrxq;
3836 reqctx->verify = VERIFY_SW;
3839 reqctx->verify = VERIFY_HW;
3841 reqctx->op = CHCR_DECRYPT_OP;