Lines Matching refs:creq

30 	struct mv_cesa_ahash_req *creq = ahash_request_ctx(req);  in mv_cesa_ahash_req_iter_init()  local
31 unsigned int len = req->nbytes + creq->cache_ptr; in mv_cesa_ahash_req_iter_init()
33 if (!creq->last_req) in mv_cesa_ahash_req_iter_init()
38 iter->src.op_offset = creq->cache_ptr; in mv_cesa_ahash_req_iter_init()
96 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); in mv_cesa_ahash_dma_last_cleanup() local
98 mv_cesa_ahash_dma_free_padding(&creq->req.dma); in mv_cesa_ahash_dma_last_cleanup()
103 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); in mv_cesa_ahash_dma_cleanup() local
105 dma_unmap_sg(cesa_dev->dev, req->src, creq->src_nents, DMA_TO_DEVICE); in mv_cesa_ahash_dma_cleanup()
106 mv_cesa_ahash_dma_free_cache(&creq->req.dma); in mv_cesa_ahash_dma_cleanup()
107 mv_cesa_dma_cleanup(&creq->base); in mv_cesa_ahash_dma_cleanup()
112 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); in mv_cesa_ahash_cleanup() local
114 if (mv_cesa_req_get_type(&creq->base) == CESA_DMA_REQ) in mv_cesa_ahash_cleanup()
120 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); in mv_cesa_ahash_last_cleanup() local
122 if (mv_cesa_req_get_type(&creq->base) == CESA_DMA_REQ) in mv_cesa_ahash_last_cleanup()
126 static int mv_cesa_ahash_pad_len(struct mv_cesa_ahash_req *creq) in mv_cesa_ahash_pad_len() argument
130 index = creq->len & CESA_HASH_BLOCK_SIZE_MSK; in mv_cesa_ahash_pad_len()
136 static int mv_cesa_ahash_pad_req(struct mv_cesa_ahash_req *creq, u8 *buf) in mv_cesa_ahash_pad_req() argument
142 padlen = mv_cesa_ahash_pad_len(creq); in mv_cesa_ahash_pad_req()
145 if (creq->algo_le) { in mv_cesa_ahash_pad_req()
146 __le64 bits = cpu_to_le64(creq->len << 3); in mv_cesa_ahash_pad_req()
150 __be64 bits = cpu_to_be64(creq->len << 3); in mv_cesa_ahash_pad_req()
160 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); in mv_cesa_ahash_std_step() local
161 struct mv_cesa_ahash_std_req *sreq = &creq->req.std; in mv_cesa_ahash_std_step()
162 struct mv_cesa_engine *engine = creq->base.engine; in mv_cesa_ahash_std_step()
170 mv_cesa_adjust_op(engine, &creq->op_tmpl); in mv_cesa_ahash_std_step()
172 memcpy(engine->sram_pool, &creq->op_tmpl, in mv_cesa_ahash_std_step()
173 sizeof(creq->op_tmpl)); in mv_cesa_ahash_std_step()
175 memcpy_toio(engine->sram, &creq->op_tmpl, in mv_cesa_ahash_std_step()
176 sizeof(creq->op_tmpl)); in mv_cesa_ahash_std_step()
181 writel_relaxed(creq->state[i], in mv_cesa_ahash_std_step()
185 if (creq->cache_ptr) { in mv_cesa_ahash_std_step()
188 creq->cache, creq->cache_ptr); in mv_cesa_ahash_std_step()
191 creq->cache, creq->cache_ptr); in mv_cesa_ahash_std_step()
194 len = min_t(size_t, req->nbytes + creq->cache_ptr - sreq->offset, in mv_cesa_ahash_std_step()
197 if (!creq->last_req) { in mv_cesa_ahash_std_step()
202 if (len - creq->cache_ptr) in mv_cesa_ahash_std_step()
204 engine, req->src, creq->src_nents, in mv_cesa_ahash_std_step()
205 CESA_SA_DATA_SRAM_OFFSET + creq->cache_ptr, in mv_cesa_ahash_std_step()
206 len - creq->cache_ptr, sreq->offset); in mv_cesa_ahash_std_step()
208 op = &creq->op_tmpl; in mv_cesa_ahash_std_step()
212 if (creq->last_req && sreq->offset == req->nbytes && in mv_cesa_ahash_std_step()
213 creq->len <= CESA_SA_DESC_MAC_SRC_TOTAL_LEN_MAX) { in mv_cesa_ahash_std_step()
223 creq->len <= CESA_SA_DESC_MAC_SRC_TOTAL_LEN_MAX) { in mv_cesa_ahash_std_step()
224 mv_cesa_set_mac_op_total_len(op, creq->len); in mv_cesa_ahash_std_step()
226 int trailerlen = mv_cesa_ahash_pad_len(creq) + 8; in mv_cesa_ahash_std_step()
232 memcpy(creq->cache, in mv_cesa_ahash_std_step()
237 memcpy_fromio(creq->cache, in mv_cesa_ahash_std_step()
243 i = mv_cesa_ahash_pad_req(creq, creq->cache); in mv_cesa_ahash_std_step()
248 creq->cache, i); in mv_cesa_ahash_std_step()
252 creq->cache, i); in mv_cesa_ahash_std_step()
275 creq->cache_ptr = new_cache_ptr; in mv_cesa_ahash_std_step()
286 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); in mv_cesa_ahash_std_process() local
287 struct mv_cesa_ahash_std_req *sreq = &creq->req.std; in mv_cesa_ahash_std_process()
289 if (sreq->offset < (req->nbytes - creq->cache_ptr)) in mv_cesa_ahash_std_process()
297 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); in mv_cesa_ahash_dma_prepare() local
298 struct mv_cesa_req *basereq = &creq->base; in mv_cesa_ahash_dma_prepare()
305 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); in mv_cesa_ahash_std_prepare() local
306 struct mv_cesa_ahash_std_req *sreq = &creq->req.std; in mv_cesa_ahash_std_prepare()
313 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); in mv_cesa_ahash_dma_step() local
314 struct mv_cesa_req *base = &creq->base; in mv_cesa_ahash_dma_step()
322 for (i = 0; i < ARRAY_SIZE(creq->state); i++) in mv_cesa_ahash_dma_step()
323 writel_relaxed(creq->state[i], engine->regs + in mv_cesa_ahash_dma_step()
333 struct mv_cesa_ahash_req *creq = ahash_request_ctx(ahashreq); in mv_cesa_ahash_step() local
335 if (mv_cesa_req_get_type(&creq->base) == CESA_DMA_REQ) in mv_cesa_ahash_step()
344 struct mv_cesa_ahash_req *creq = ahash_request_ctx(ahashreq); in mv_cesa_ahash_process() local
346 if (mv_cesa_req_get_type(&creq->base) == CESA_DMA_REQ) in mv_cesa_ahash_process()
347 return mv_cesa_dma_process(&creq->base, status); in mv_cesa_ahash_process()
355 struct mv_cesa_ahash_req *creq = ahash_request_ctx(ahashreq); in mv_cesa_ahash_complete() local
356 struct mv_cesa_engine *engine = creq->base.engine; in mv_cesa_ahash_complete()
362 if (mv_cesa_req_get_type(&creq->base) == CESA_DMA_REQ && in mv_cesa_ahash_complete()
363 (creq->base.chain.last->flags & CESA_TDMA_TYPE_MSK) == in mv_cesa_ahash_complete()
371 data = creq->base.chain.last->op->ctx.hash.hash; in mv_cesa_ahash_complete()
373 creq->state[i] = le32_to_cpu(data[i]); in mv_cesa_ahash_complete()
378 creq->state[i] = readl_relaxed(engine->regs + in mv_cesa_ahash_complete()
380 if (creq->last_req) { in mv_cesa_ahash_complete()
385 if (creq->algo_le) { in mv_cesa_ahash_complete()
389 result[i] = cpu_to_le32(creq->state[i]); in mv_cesa_ahash_complete()
394 result[i] = cpu_to_be32(creq->state[i]); in mv_cesa_ahash_complete()
406 struct mv_cesa_ahash_req *creq = ahash_request_ctx(ahashreq); in mv_cesa_ahash_prepare() local
408 creq->base.engine = engine; in mv_cesa_ahash_prepare()
410 if (mv_cesa_req_get_type(&creq->base) == CESA_DMA_REQ) in mv_cesa_ahash_prepare()
419 struct mv_cesa_ahash_req *creq = ahash_request_ctx(ahashreq); in mv_cesa_ahash_req_cleanup() local
421 if (creq->last_req) in mv_cesa_ahash_req_cleanup()
426 if (creq->cache_ptr) in mv_cesa_ahash_req_cleanup()
427 sg_pcopy_to_buffer(ahashreq->src, creq->src_nents, in mv_cesa_ahash_req_cleanup()
428 creq->cache, in mv_cesa_ahash_req_cleanup()
429 creq->cache_ptr, in mv_cesa_ahash_req_cleanup()
430 ahashreq->nbytes - creq->cache_ptr); in mv_cesa_ahash_req_cleanup()
443 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); in mv_cesa_ahash_init() local
445 memset(creq, 0, sizeof(*creq)); in mv_cesa_ahash_init()
453 creq->op_tmpl = *tmpl; in mv_cesa_ahash_init()
454 creq->len = 0; in mv_cesa_ahash_init()
455 creq->algo_le = algo_le; in mv_cesa_ahash_init()
471 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); in mv_cesa_ahash_cache_req() local
474 if (creq->cache_ptr + req->nbytes < CESA_MAX_HASH_BLOCK_SIZE && in mv_cesa_ahash_cache_req()
475 !creq->last_req) { in mv_cesa_ahash_cache_req()
481 sg_pcopy_to_buffer(req->src, creq->src_nents, in mv_cesa_ahash_cache_req()
482 creq->cache + creq->cache_ptr, in mv_cesa_ahash_cache_req()
485 creq->cache_ptr += req->nbytes; in mv_cesa_ahash_cache_req()
521 struct mv_cesa_ahash_req *creq, in mv_cesa_ahash_dma_add_cache() argument
524 struct mv_cesa_ahash_dma_req *ahashdreq = &creq->req.dma; in mv_cesa_ahash_dma_add_cache()
527 if (!creq->cache_ptr) in mv_cesa_ahash_dma_add_cache()
534 memcpy(ahashdreq->cache, creq->cache, creq->cache_ptr); in mv_cesa_ahash_dma_add_cache()
539 creq->cache_ptr, in mv_cesa_ahash_dma_add_cache()
547 struct mv_cesa_ahash_req *creq, in mv_cesa_ahash_dma_last_req() argument
550 struct mv_cesa_ahash_dma_req *ahashdreq = &creq->req.dma; in mv_cesa_ahash_dma_last_req()
559 if (creq->len <= CESA_SA_DESC_MAC_SRC_TOTAL_LEN_MAX && frag_len) { in mv_cesa_ahash_dma_last_req()
560 op = mv_cesa_dma_add_frag(chain, &creq->op_tmpl, frag_len, in mv_cesa_ahash_dma_last_req()
565 mv_cesa_set_mac_op_total_len(op, creq->len); in mv_cesa_ahash_dma_last_req()
589 trailerlen = mv_cesa_ahash_pad_req(creq, ahashdreq->padding); in mv_cesa_ahash_dma_last_req()
602 op = mv_cesa_dma_add_frag(chain, &creq->op_tmpl, frag_len + len, in mv_cesa_ahash_dma_last_req()
623 return mv_cesa_dma_add_frag(chain, &creq->op_tmpl, trailerlen - padoff, in mv_cesa_ahash_dma_last_req()
629 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); in mv_cesa_ahash_dma_req_init() local
632 struct mv_cesa_req *basereq = &creq->base; in mv_cesa_ahash_dma_req_init()
643 if (!mv_cesa_mac_op_is_first_frag(&creq->op_tmpl)) in mv_cesa_ahash_dma_req_init()
646 if (creq->src_nents) { in mv_cesa_ahash_dma_req_init()
647 ret = dma_map_sg(cesa_dev->dev, req->src, creq->src_nents, in mv_cesa_ahash_dma_req_init()
662 ret = mv_cesa_ahash_dma_add_cache(&basereq->chain, creq, flags); in mv_cesa_ahash_dma_req_init()
685 &creq->op_tmpl, in mv_cesa_ahash_dma_req_init()
702 if (creq->last_req) in mv_cesa_ahash_dma_req_init()
703 op = mv_cesa_ahash_dma_last_req(&basereq->chain, &iter, creq, in mv_cesa_ahash_dma_req_init()
706 op = mv_cesa_dma_add_frag(&basereq->chain, &creq->op_tmpl, in mv_cesa_ahash_dma_req_init()
729 if (!creq->last_req) in mv_cesa_ahash_dma_req_init()
730 creq->cache_ptr = req->nbytes + creq->cache_ptr - in mv_cesa_ahash_dma_req_init()
733 creq->cache_ptr = 0; in mv_cesa_ahash_dma_req_init()
753 dma_unmap_sg(cesa_dev->dev, req->src, creq->src_nents, DMA_TO_DEVICE); in mv_cesa_ahash_dma_req_init()
763 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); in mv_cesa_ahash_req_init() local
765 creq->src_nents = sg_nents_for_len(req->src, req->nbytes); in mv_cesa_ahash_req_init()
766 if (creq->src_nents < 0) { in mv_cesa_ahash_req_init()
768 return creq->src_nents; in mv_cesa_ahash_req_init()
784 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); in mv_cesa_ahash_queue_req() local
799 ret = mv_cesa_queue_req(&req->base, &creq->base); in mv_cesa_ahash_queue_req()
809 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); in mv_cesa_ahash_update() local
811 creq->len += req->nbytes; in mv_cesa_ahash_update()
818 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); in mv_cesa_ahash_final() local
819 struct mv_cesa_op_ctx *tmpl = &creq->op_tmpl; in mv_cesa_ahash_final()
821 mv_cesa_set_mac_op_total_len(tmpl, creq->len); in mv_cesa_ahash_final()
822 creq->last_req = true; in mv_cesa_ahash_final()
830 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); in mv_cesa_ahash_finup() local
831 struct mv_cesa_op_ctx *tmpl = &creq->op_tmpl; in mv_cesa_ahash_finup()
833 creq->len += req->nbytes; in mv_cesa_ahash_finup()
834 mv_cesa_set_mac_op_total_len(tmpl, creq->len); in mv_cesa_ahash_finup()
835 creq->last_req = true; in mv_cesa_ahash_finup()
844 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); in mv_cesa_ahash_export() local
850 *len = creq->len; in mv_cesa_ahash_export()
851 memcpy(hash, creq->state, digsize); in mv_cesa_ahash_export()
853 memcpy(cache, creq->cache, creq->cache_ptr); in mv_cesa_ahash_export()
862 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); in mv_cesa_ahash_import() local
874 mv_cesa_update_op_cfg(&creq->op_tmpl, in mv_cesa_ahash_import()
878 creq->len = len; in mv_cesa_ahash_import()
879 memcpy(creq->state, hash, digsize); in mv_cesa_ahash_import()
880 creq->cache_ptr = 0; in mv_cesa_ahash_import()
886 memcpy(creq->cache, cache, cache_ptr); in mv_cesa_ahash_import()
887 creq->cache_ptr = cache_ptr; in mv_cesa_ahash_import()
894 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); in mv_cesa_md5_init() local
901 creq->state[0] = MD5_H0; in mv_cesa_md5_init()
902 creq->state[1] = MD5_H1; in mv_cesa_md5_init()
903 creq->state[2] = MD5_H2; in mv_cesa_md5_init()
904 creq->state[3] = MD5_H3; in mv_cesa_md5_init()
964 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); in mv_cesa_sha1_init() local
971 creq->state[0] = SHA1_H0; in mv_cesa_sha1_init()
972 creq->state[1] = SHA1_H1; in mv_cesa_sha1_init()
973 creq->state[2] = SHA1_H2; in mv_cesa_sha1_init()
974 creq->state[3] = SHA1_H3; in mv_cesa_sha1_init()
975 creq->state[4] = SHA1_H4; in mv_cesa_sha1_init()
1035 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); in mv_cesa_sha256_init() local
1042 creq->state[0] = SHA256_H0; in mv_cesa_sha256_init()
1043 creq->state[1] = SHA256_H1; in mv_cesa_sha256_init()
1044 creq->state[2] = SHA256_H2; in mv_cesa_sha256_init()
1045 creq->state[3] = SHA256_H3; in mv_cesa_sha256_init()
1046 creq->state[4] = SHA256_H4; in mv_cesa_sha256_init()
1047 creq->state[5] = SHA256_H5; in mv_cesa_sha256_init()
1048 creq->state[6] = SHA256_H6; in mv_cesa_sha256_init()
1049 creq->state[7] = SHA256_H7; in mv_cesa_sha256_init()