Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/810136/?format=api
{ "id": 810136, "url": "http://patchwork.ozlabs.org/api/patches/810136/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/1504615144-29770-17-git-send-email-gilad@benyossef.com/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1504615144-29770-17-git-send-email-gilad@benyossef.com>", "list_archive_url": null, "date": "2017-09-05T12:38:55", "name": "[v8,16/20] crypto: tcrypt: move to generic async completion", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": true, "hash": "ba72195d10503233e69671677f4f466263af0de2", "submitter": { "id": 11198, "url": "http://patchwork.ozlabs.org/api/people/11198/?format=api", "name": "Gilad Ben-Yossef", "email": "gilad@benyossef.com" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/1504615144-29770-17-git-send-email-gilad@benyossef.com/mbox/", "series": [ { "id": 1573, "url": "http://patchwork.ozlabs.org/api/series/1573/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=1573", "date": "2017-09-05T12:38:39", "name": "simplify crypto wait for async op", "version": 8, "mbox": "http://patchwork.ozlabs.org/series/1573/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/810136/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/810136/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xmmf83Lj0z9sRm\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 5 Sep 2017 22:45:36 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752196AbdIEMnU (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 5 Sep 2017 08:43:20 -0400", "from foss.arm.com ([217.140.101.70]:39814 \"EHLO foss.arm.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751036AbdIEMnN (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tTue, 5 Sep 2017 08:43:13 -0400", "from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249])\n\tby usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D544E1688;\n\tTue, 5 Sep 2017 05:43:12 -0700 (PDT)", "from gby.kfn.arm.com (unknown [10.45.48.140])\n\tby usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id\n\tCCC563F3E1; Tue, 5 Sep 2017 05:43:02 -0700 (PDT)" ], "From": "Gilad Ben-Yossef <gilad@benyossef.com>", "To": "Herbert Xu <herbert@gondor.apana.org.au>,\n\t\"David S. Miller\" <davem@davemloft.net>,\n\tJonathan Corbet <corbet@lwn.net>, David Howells <dhowells@redhat.com>,\n\tTom Lendacky <thomas.lendacky@amd.com>, Gary Hook <gary.hook@amd.com>,\n\tBoris Brezillon <boris.brezillon@free-electrons.com>,\n\tArnaud Ebalard <arno@natisbad.org>,\n\tMatthias Brugger <matthias.bgg@gmail.com>,\n\tAlasdair Kergon <agk@redhat.com>,\n\tMike Snitzer <snitzer@redhat.com>, dm-devel@redhat.com,\n\tShaohua Li <shli@kernel.org>, Steve French <sfrench@samba.org>,\n\t\"Theodore Y. Ts'o\" <tytso@mit.edu>, Jaegeuk Kim <jaegeuk@kernel.org>,\n\tSteffen Klassert <steffen.klassert@secunet.com>,\n\tAlexey Kuznetsov <kuznet@ms2.inr.ac.ru>,\n\tHideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,\n\tMimi Zohar <zohar@linux.vnet.ibm.com>,\n\tDmitry Kasatkin <dmitry.kasatkin@gmail.com>,\n\tJames Morris <james.l.morris@oracle.com>,\n\t\"Serge E. Hallyn\" <serge@hallyn.com>, linux-crypto@vger.kernel.org,\n\tlinux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tkeyrings@vger.kernel.org, linux-arm-kernel@lists.infradead.org,\n\tlinux-mediatek@lists.infradead.org, linux-raid@vger.kernel.org,\n\tlinux-cifs@vger.kernel.org, samba-technical@lists.samba.org,\n\tlinux-fscrypt@vger.kernel.org, netdev@vger.kernel.org,\n\tlinux-ima-devel@lists.sourceforge.net,\n\tlinux-ima-user@lists.sourceforge.net,\n\tlinux-security-module@vger.kernel.org", "Cc": "Ofir Drang <ofir.drang@arm.com>", "Subject": "[PATCH v8 16/20] crypto: tcrypt: move to generic async completion", "Date": "Tue, 5 Sep 2017 15:38:55 +0300", "Message-Id": "<1504615144-29770-17-git-send-email-gilad@benyossef.com>", "X-Mailer": "git-send-email 2.1.4", "In-Reply-To": "<1504615144-29770-1-git-send-email-gilad@benyossef.com>", "References": "<1504615144-29770-1-git-send-email-gilad@benyossef.com>", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "tcrypt starts several async crypto ops and waits for their completions.\nMove it over to generic code doing the same.\n\nSigned-off-by: Gilad Ben-Yossef <gilad@benyossef.com>\n---\n crypto/tcrypt.c | 84 +++++++++++++++++----------------------------------------\n 1 file changed, 25 insertions(+), 59 deletions(-)", "diff": "diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c\nindex 0022a18..802aa81 100644\n--- a/crypto/tcrypt.c\n+++ b/crypto/tcrypt.c\n@@ -79,34 +79,11 @@ static char *check[] = {\n \tNULL\n };\n \n-struct tcrypt_result {\n-\tstruct completion completion;\n-\tint err;\n-};\n-\n-static void tcrypt_complete(struct crypto_async_request *req, int err)\n-{\n-\tstruct tcrypt_result *res = req->data;\n-\n-\tif (err == -EINPROGRESS)\n-\t\treturn;\n-\n-\tres->err = err;\n-\tcomplete(&res->completion);\n-}\n-\n static inline int do_one_aead_op(struct aead_request *req, int ret)\n {\n-\tif (ret == -EINPROGRESS || ret == -EBUSY) {\n-\t\tstruct tcrypt_result *tr = req->base.data;\n+\tstruct crypto_wait *wait = req->base.data;\n \n-\t\tret = wait_for_completion_interruptible(&tr->completion);\n-\t\tif (!ret)\n-\t\t\tret = tr->err;\n-\t\treinit_completion(&tr->completion);\n-\t}\n-\n-\treturn ret;\n+\treturn crypto_wait_req(ret, wait);\n }\n \n static int test_aead_jiffies(struct aead_request *req, int enc,\n@@ -248,7 +225,7 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs,\n \tchar *axbuf[XBUFSIZE];\n \tunsigned int *b_size;\n \tunsigned int iv_len;\n-\tstruct tcrypt_result result;\n+\tstruct crypto_wait wait;\n \n \tiv = kzalloc(MAX_IVLEN, GFP_KERNEL);\n \tif (!iv)\n@@ -284,7 +261,7 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs,\n \t\tgoto out_notfm;\n \t}\n \n-\tinit_completion(&result.completion);\n+\tcrypto_init_wait(&wait);\n \tprintk(KERN_INFO \"\\ntesting speed of %s (%s) %s\\n\", algo,\n \t\t\tget_driver_name(crypto_aead, tfm), e);\n \n@@ -296,7 +273,7 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs,\n \t}\n \n \taead_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,\n-\t\t\t\t tcrypt_complete, &result);\n+\t\t\t\t crypto_req_done, &wait);\n \n \ti = 0;\n \tdo {\n@@ -397,21 +374,16 @@ static void test_hash_sg_init(struct scatterlist *sg)\n \n static inline int do_one_ahash_op(struct ahash_request *req, int ret)\n {\n-\tif (ret == -EINPROGRESS || ret == -EBUSY) {\n-\t\tstruct tcrypt_result *tr = req->base.data;\n+\tstruct crypto_wait *wait = req->base.data;\n \n-\t\twait_for_completion(&tr->completion);\n-\t\treinit_completion(&tr->completion);\n-\t\tret = tr->err;\n-\t}\n-\treturn ret;\n+\treturn crypto_wait_req(ret, wait);\n }\n \n struct test_mb_ahash_data {\n \tstruct scatterlist sg[TVMEMSIZE];\n \tchar result[64];\n \tstruct ahash_request *req;\n-\tstruct tcrypt_result tresult;\n+\tstruct crypto_wait wait;\n \tchar *xbuf[XBUFSIZE];\n };\n \n@@ -440,7 +412,7 @@ static void test_mb_ahash_speed(const char *algo, unsigned int sec,\n \t\tif (testmgr_alloc_buf(data[i].xbuf))\n \t\t\tgoto out;\n \n-\t\tinit_completion(&data[i].tresult.completion);\n+\t\tcrypto_init_wait(&data[i].wait);\n \n \t\tdata[i].req = ahash_request_alloc(tfm, GFP_KERNEL);\n \t\tif (!data[i].req) {\n@@ -449,8 +421,8 @@ static void test_mb_ahash_speed(const char *algo, unsigned int sec,\n \t\t\tgoto out;\n \t\t}\n \n-\t\tahash_request_set_callback(data[i].req, 0,\n-\t\t\t\t\t tcrypt_complete, &data[i].tresult);\n+\t\tahash_request_set_callback(data[i].req, 0, crypto_req_done,\n+\t\t\t\t\t &data[i].wait);\n \t\ttest_hash_sg_init(data[i].sg);\n \t}\n \n@@ -492,16 +464,16 @@ static void test_mb_ahash_speed(const char *algo, unsigned int sec,\n \t\t\tif (ret)\n \t\t\t\tbreak;\n \n-\t\t\tcomplete(&data[k].tresult.completion);\n-\t\t\tdata[k].tresult.err = 0;\n+\t\t\tcrypto_req_done(&data[k].req->base, 0);\n \t\t}\n \n \t\tfor (j = 0; j < k; j++) {\n-\t\t\tstruct tcrypt_result *tr = &data[j].tresult;\n+\t\t\tstruct crypto_wait *wait = &data[j].wait;\n+\t\t\tint wait_ret;\n \n-\t\t\twait_for_completion(&tr->completion);\n-\t\t\tif (tr->err)\n-\t\t\t\tret = tr->err;\n+\t\t\twait_ret = crypto_wait_req(-EINPROGRESS, wait);\n+\t\t\tif (wait_ret)\n+\t\t\t\tret = wait_ret;\n \t\t}\n \n \t\tend = get_cycles();\n@@ -679,7 +651,7 @@ static void test_ahash_speed_common(const char *algo, unsigned int secs,\n \t\t\t\t struct hash_speed *speed, unsigned mask)\n {\n \tstruct scatterlist sg[TVMEMSIZE];\n-\tstruct tcrypt_result tresult;\n+\tstruct crypto_wait wait;\n \tstruct ahash_request *req;\n \tstruct crypto_ahash *tfm;\n \tchar *output;\n@@ -708,9 +680,9 @@ static void test_ahash_speed_common(const char *algo, unsigned int secs,\n \t\tgoto out;\n \t}\n \n-\tinit_completion(&tresult.completion);\n+\tcrypto_init_wait(&wait);\n \tahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,\n-\t\t\t\t tcrypt_complete, &tresult);\n+\t\t\t\t crypto_req_done, &wait);\n \n \toutput = kmalloc(MAX_DIGEST_SIZE, GFP_KERNEL);\n \tif (!output)\n@@ -765,15 +737,9 @@ static void test_hash_speed(const char *algo, unsigned int secs,\n \n static inline int do_one_acipher_op(struct skcipher_request *req, int ret)\n {\n-\tif (ret == -EINPROGRESS || ret == -EBUSY) {\n-\t\tstruct tcrypt_result *tr = req->base.data;\n-\n-\t\twait_for_completion(&tr->completion);\n-\t\treinit_completion(&tr->completion);\n-\t\tret = tr->err;\n-\t}\n+\tstruct crypto_wait *wait = req->base.data;\n \n-\treturn ret;\n+\treturn crypto_wait_req(ret, wait);\n }\n \n static int test_acipher_jiffies(struct skcipher_request *req, int enc,\n@@ -853,7 +819,7 @@ static void test_skcipher_speed(const char *algo, int enc, unsigned int secs,\n \t\t\t\tunsigned int tcount, u8 *keysize, bool async)\n {\n \tunsigned int ret, i, j, k, iv_len;\n-\tstruct tcrypt_result tresult;\n+\tstruct crypto_wait wait;\n \tconst char *key;\n \tchar iv[128];\n \tstruct skcipher_request *req;\n@@ -866,7 +832,7 @@ static void test_skcipher_speed(const char *algo, int enc, unsigned int secs,\n \telse\n \t\te = \"decryption\";\n \n-\tinit_completion(&tresult.completion);\n+\tcrypto_init_wait(&wait);\n \n \ttfm = crypto_alloc_skcipher(algo, 0, async ? 0 : CRYPTO_ALG_ASYNC);\n \n@@ -887,7 +853,7 @@ static void test_skcipher_speed(const char *algo, int enc, unsigned int secs,\n \t}\n \n \tskcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,\n-\t\t\t\t tcrypt_complete, &tresult);\n+\t\t\t\t crypto_req_done, &wait);\n \n \ti = 0;\n \tdo {\n", "prefixes": [ "v8", "16/20" ] }