Lines Matching refs:sg
31 struct scatterlist sg[0]; member
79 struct scatterlist *sg; in skcipher_free_async_sgls() local
89 for_each_sg(sgl, sg, n, i) in skcipher_free_async_sgls()
90 put_page(sg_page(sg)); in skcipher_free_async_sgls()
125 struct scatterlist *sg = NULL; in skcipher_alloc_sgl() local
129 sg = sgl->sg; in skcipher_alloc_sgl()
131 if (!sg || sgl->cur >= MAX_SGL_ENTS) { in skcipher_alloc_sgl()
133 sizeof(sgl->sg[0]) * (MAX_SGL_ENTS + 1), in skcipher_alloc_sgl()
138 sg_init_table(sgl->sg, MAX_SGL_ENTS + 1); in skcipher_alloc_sgl()
141 if (sg) in skcipher_alloc_sgl()
142 sg_chain(sg, MAX_SGL_ENTS + 1, sgl->sg); in skcipher_alloc_sgl()
155 struct scatterlist *sg; in skcipher_pull_sgl() local
161 sg = sgl->sg; in skcipher_pull_sgl()
164 int plen = min_t(int, used, sg[i].length); in skcipher_pull_sgl()
166 if (!sg_page(sg + i)) in skcipher_pull_sgl()
169 sg[i].length -= plen; in skcipher_pull_sgl()
170 sg[i].offset += plen; in skcipher_pull_sgl()
175 if (sg[i].length) in skcipher_pull_sgl()
178 put_page(sg_page(sg + i)); in skcipher_pull_sgl()
179 sg_assign_page(sg + i, NULL); in skcipher_pull_sgl()
184 sizeof(*sgl) + sizeof(sgl->sg[0]) * in skcipher_pull_sgl()
346 struct scatterlist *sg; in skcipher_sendmsg() local
353 sg = sgl->sg + sgl->cur - 1; in skcipher_sendmsg()
355 PAGE_SIZE - sg->offset - sg->length); in skcipher_sendmsg()
357 err = memcpy_from_msg(page_address(sg_page(sg)) + in skcipher_sendmsg()
358 sg->offset + sg->length, in skcipher_sendmsg()
363 sg->length += len; in skcipher_sendmsg()
364 ctx->merge = (sg->offset + sg->length) & in skcipher_sendmsg()
386 sg = sgl->sg; in skcipher_sendmsg()
388 sg_unmark_end(sg + sgl->cur - 1); in skcipher_sendmsg()
393 sg_assign_page(sg + i, alloc_page(GFP_KERNEL)); in skcipher_sendmsg()
395 if (!sg_page(sg + i)) in skcipher_sendmsg()
398 err = memcpy_from_msg(page_address(sg_page(sg + i)), in skcipher_sendmsg()
401 __free_page(sg_page(sg + i)); in skcipher_sendmsg()
402 sg_assign_page(sg + i, NULL); in skcipher_sendmsg()
406 sg[i].length = plen; in skcipher_sendmsg()
415 sg_mark_end(sg + sgl->cur - 1); in skcipher_sendmsg()
464 sg_unmark_end(sgl->sg + sgl->cur - 1); in skcipher_sendpage()
466 sg_mark_end(sgl->sg + sgl->cur); in skcipher_sendpage()
468 sg_set_page(sgl->sg + sgl->cur, page, size, offset); in skcipher_sendpage()
485 struct scatterlist *sg; in skcipher_all_sg_nents() local
489 sg = sgl->sg; in skcipher_all_sg_nents()
491 while (!sg->length) in skcipher_all_sg_nents()
492 sg++; in skcipher_all_sg_nents()
494 nents += sg_nents(sg); in skcipher_all_sg_nents()
510 struct scatterlist *sg; in skcipher_recvmsg_async() local
533 sreq->tsg = kcalloc(tx_nents, sizeof(*sg), GFP_KERNEL); in skcipher_recvmsg_async()
553 sg = sgl->sg; in skcipher_recvmsg_async()
555 while (!sg->length) in skcipher_recvmsg_async()
556 sg++; in skcipher_recvmsg_async()
560 used = min_t(unsigned long, used, sg->length); in skcipher_recvmsg_async()
584 sg_set_page(sreq->tsg + txbufs++, sg_page(sg), sg->length, in skcipher_recvmsg_async()
585 sg->offset); in skcipher_recvmsg_async()
615 skcipher_request_set_crypt(req, sreq->tsg, sreq->first_sgl.sgl.sg, in skcipher_recvmsg_async()
647 struct scatterlist *sg; in skcipher_recvmsg_sync() local
676 sg = sgl->sg; in skcipher_recvmsg_sync()
678 while (!sg->length) in skcipher_recvmsg_sync()
679 sg++; in skcipher_recvmsg_sync()
681 skcipher_request_set_crypt(&ctx->req, sg, ctx->rsgl.sg, used, in skcipher_recvmsg_sync()