From: Kai Ye <yekai13@huawei.com>
To: <herbert@gondor.apana.org.au>
Cc: <linux-crypto@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<wangzhou1@hisilicon.com>, <yekai13@huawei.com>
Subject: [PATCH v2 5/5] crypto: hisilicon/sgl - fix the sg buf unmap
Date: Tue, 30 Mar 2021 15:39:06 +0800 [thread overview]
Message-ID: <1617089946-48078-6-git-send-email-yekai13@huawei.com> (raw)
In-Reply-To: <1617089946-48078-1-git-send-email-yekai13@huawei.com>
Add clear data operation for sge data.
Signed-off-by: Kai Ye <yekai13@huawei.com>
---
drivers/crypto/hisilicon/sgl.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/crypto/hisilicon/sgl.c b/drivers/crypto/hisilicon/sgl.c
index c618aaf..7a58ab3 100644
--- a/drivers/crypto/hisilicon/sgl.c
+++ b/drivers/crypto/hisilicon/sgl.c
@@ -189,6 +189,18 @@ static void update_hw_sgl_sum_sge(struct hisi_acc_hw_sgl *hw_sgl, u16 sum)
hw_sgl->entry_sum_in_chain = cpu_to_le16(sum);
}
+static void clear_hw_sgl_sge(struct hisi_acc_hw_sgl *hw_sgl)
+{
+ struct acc_hw_sge *hw_sge = hw_sgl->sge_entries;
+ int i;
+
+ for (i = 0; i < hw_sgl->entry_sum_in_sgl; i++) {
+ hw_sge[i].page_ctrl = NULL;
+ hw_sge[i].buf = 0;
+ hw_sge[i].len = 0;
+ }
+}
+
/**
* hisi_acc_sg_buf_map_to_hw_sgl - Map a scatterlist to a hw sgl.
* @dev: The device which hw sgl belongs to.
@@ -266,7 +278,7 @@ void hisi_acc_sg_buf_unmap(struct device *dev, struct scatterlist *sgl,
return;
dma_unmap_sg(dev, sgl, sg_nents(sgl), DMA_BIDIRECTIONAL);
-
+ clear_hw_sgl_sge(hw_sgl);
hw_sgl->entry_sum_in_chain = 0;
hw_sgl->entry_sum_in_sgl = 0;
hw_sgl->entry_length_in_sgl = 0;
--
2.8.1
next prev parent reply other threads:[~2021-03-30 7:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-30 7:39 [PATCH v2 0/5] bug fix and clear coding style Kai Ye
2021-03-30 7:39 ` [PATCH v2 1/5] crypto: hisilicon/sgl - fixup " Kai Ye
2021-03-30 7:53 ` Joe Perches
2021-03-30 7:39 ` [PATCH v2 2/5] crypto: hisilicon/sgl - delete unneeded variable initialization Kai Ye
2021-03-30 7:39 ` [PATCH v2 3/5] crypto: hisilicon/sgl - add some dfx logs Kai Ye
2021-03-30 7:56 ` Joe Perches
2021-03-30 9:24 ` yekai(A)
2021-03-30 7:39 ` [PATCH v2 4/5] crypto: hisilicon/sgl - fix the soft sg map to hardware sg Kai Ye
2021-03-30 7:39 ` Kai Ye [this message]
2021-04-09 7:43 ` [PATCH v2 5/5] crypto: hisilicon/sgl - fix the sg buf unmap Herbert Xu
2021-03-31 9:30 [PATCH v2 0/5] bug fix and clear coding style Kai Ye
2021-03-31 9:30 ` [PATCH v2 5/5] crypto: hisilicon/sgl - fix the sg buf unmap Kai Ye
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1617089946-48078-6-git-send-email-yekai13@huawei.com \
--to=yekai13@huawei.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wangzhou1@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®