24e34edd5861c28af203d460dfb08cfa5a426e73
[openwrt/staging/thess.git] /
1 From 38cf5533d7a876f75088bacc1277046f30005f28 Mon Sep 17 00:00:00 2001
2 From: Christian Lamparter <chunkeey@gmail.com>
3 Date: Mon, 22 Apr 2019 13:26:01 +0200
4 Subject: [PATCH 12/15] crypto: crypto4xx - get rid of redundant using_sd
5 variable
6
7 using_sd is used as a stand-in for sa_command_0.bf.scatter
8 that we need to set anyway, so we might as well just prevent
9 double-accounting.
10
11 Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
12 Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
13 ---
14 drivers/crypto/amcc/crypto4xx_core.c | 6 ++----
15 drivers/crypto/amcc/crypto4xx_core.h | 1 -
16 2 files changed, 2 insertions(+), 5 deletions(-)
17
18 --- a/drivers/crypto/amcc/crypto4xx_core.c
19 +++ b/drivers/crypto/amcc/crypto4xx_core.c
20 @@ -535,7 +535,7 @@ static void crypto4xx_cipher_done(struct
21
22 req = skcipher_request_cast(pd_uinfo->async_req);
23
24 - if (pd_uinfo->using_sd) {
25 + if (pd_uinfo->sa_va->sa_command_0.bf.scatter) {
26 crypto4xx_copy_pkt_to_dst(dev, pd, pd_uinfo,
27 req->cryptlen, req->dst);
28 } else {
29 @@ -589,7 +589,7 @@ static void crypto4xx_aead_done(struct c
30 u32 icv[AES_BLOCK_SIZE];
31 int err = 0;
32
33 - if (pd_uinfo->using_sd) {
34 + if (pd_uinfo->sa_va->sa_command_0.bf.scatter) {
35 crypto4xx_copy_pkt_to_dst(dev, pd, pd_uinfo,
36 pd->pd_ctl_len.bf.pkt_len,
37 dst);
38 @@ -883,7 +883,6 @@ int crypto4xx_build_pd(struct crypto_asy
39 * we know application give us dst a whole piece of memory
40 * no need to use scatter ring.
41 */
42 - pd_uinfo->using_sd = 0;
43 pd_uinfo->first_sd = 0xffffffff;
44 sa->sa_command_0.bf.scatter = 0;
45 pd->dest = (u32)dma_map_page(dev->core_dev->device,
46 @@ -897,7 +896,6 @@ int crypto4xx_build_pd(struct crypto_asy
47 u32 sd_idx = fst_sd;
48 nbytes = datalen;
49 sa->sa_command_0.bf.scatter = 1;
50 - pd_uinfo->using_sd = 1;
51 pd_uinfo->first_sd = fst_sd;
52 sd = crypto4xx_get_sdp(dev, &sd_dma, sd_idx);
53 pd->dest = sd_dma;
54 --- a/drivers/crypto/amcc/crypto4xx_core.h
55 +++ b/drivers/crypto/amcc/crypto4xx_core.h
56 @@ -64,7 +64,6 @@ union shadow_sa_buf {
57 struct pd_uinfo {
58 struct crypto4xx_device *dev;
59 u32 state;
60 - u32 using_sd;
61 u32 first_gd; /* first gather discriptor
62 used by this packet */
63 u32 num_gd; /* number of gather discriptor