Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/810115/?format=api
{ "id": 810115, "url": "http://patchwork.ozlabs.org/api/patches/810115/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-cifs-client/patch/1504615144-29770-7-git-send-email-gilad@benyossef.com/", "project": { "id": 12, "url": "http://patchwork.ozlabs.org/api/projects/12/?format=api", "name": "Linux CIFS Client", "link_name": "linux-cifs-client", "list_id": "linux-cifs.vger.kernel.org", "list_email": "linux-cifs@vger.kernel.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1504615144-29770-7-git-send-email-gilad@benyossef.com>", "list_archive_url": null, "date": "2017-09-05T12:38:45", "name": "[v8,06/20] crypto: introduce crypto wait for async op", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "06a5952bf3330672bb5395e269df583046791ff0", "submitter": { "id": 11198, "url": "http://patchwork.ozlabs.org/api/people/11198/?format=api", "name": "Gilad Ben-Yossef", "email": "gilad@benyossef.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-cifs-client/patch/1504615144-29770-7-git-send-email-gilad@benyossef.com/mbox/", "series": [ { "id": 1572, "url": "http://patchwork.ozlabs.org/api/series/1572/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-cifs-client/list/?series=1572", "date": "2017-09-05T12:38:39", "name": "simplify crypto wait for async op", "version": 8, "mbox": "http://patchwork.ozlabs.org/series/1572/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/810115/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/810115/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linux-cifs-owner@vger.kernel.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.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=linux-cifs-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 3xmmXn2VtPz9t16\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 5 Sep 2017 22:40:57 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751678AbdIEMky (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tTue, 5 Sep 2017 08:40:54 -0400", "from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:39242 \"EHLO\n\tfoss.arm.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751386AbdIEMks (ORCPT <rfc822;linux-cifs@vger.kernel.org>);\n\tTue, 5 Sep 2017 08:40:48 -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 53A76165D;\n\tTue, 5 Sep 2017 05:40:47 -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\tDF76E3F3E1; Tue, 5 Sep 2017 05:40:37 -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>, Eric Biggers <ebiggers3@gmail.com>,\n\tJonathan Cameron <Jonathan.Cameron@huawei.com>", "Subject": "[PATCH v8 06/20] crypto: introduce crypto wait for async op", "Date": "Tue, 5 Sep 2017 15:38:45 +0300", "Message-Id": "<1504615144-29770-7-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": "linux-cifs-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<linux-cifs.vger.kernel.org>", "X-Mailing-List": "linux-cifs@vger.kernel.org" }, "content": "Invoking a possibly async. crypto op and waiting for completion\nwhile correctly handling backlog processing is a common task\nin the crypto API implementation and outside users of it.\n\nThis patch adds a generic implementation for doing so in\npreparation for using it across the board instead of hand\nrolled versions.\n\nSigned-off-by: Gilad Ben-Yossef <gilad@benyossef.com>\nCC: Eric Biggers <ebiggers3@gmail.com>\nCC: Jonathan Cameron <Jonathan.Cameron@huawei.com>\n---\n crypto/api.c | 13 +++++++++++++\n include/linux/crypto.h | 40 ++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 53 insertions(+)", "diff": "diff --git a/crypto/api.c b/crypto/api.c\nindex 941cd4c..2a2479d 100644\n--- a/crypto/api.c\n+++ b/crypto/api.c\n@@ -24,6 +24,7 @@\n #include <linux/sched/signal.h>\n #include <linux/slab.h>\n #include <linux/string.h>\n+#include <linux/completion.h>\n #include \"internal.h\"\n \n LIST_HEAD(crypto_alg_list);\n@@ -595,5 +596,17 @@ int crypto_has_alg(const char *name, u32 type, u32 mask)\n }\n EXPORT_SYMBOL_GPL(crypto_has_alg);\n \n+void crypto_req_done(struct crypto_async_request *req, int err)\n+{\n+\tstruct crypto_wait *wait = req->data;\n+\n+\tif (err == -EINPROGRESS)\n+\t\treturn;\n+\n+\twait->err = err;\n+\tcomplete(&wait->completion);\n+}\n+EXPORT_SYMBOL_GPL(crypto_req_done);\n+\n MODULE_DESCRIPTION(\"Cryptographic core API\");\n MODULE_LICENSE(\"GPL\");\ndiff --git a/include/linux/crypto.h b/include/linux/crypto.h\nindex 84da997..78508ca 100644\n--- a/include/linux/crypto.h\n+++ b/include/linux/crypto.h\n@@ -24,6 +24,7 @@\n #include <linux/slab.h>\n #include <linux/string.h>\n #include <linux/uaccess.h>\n+#include <linux/completion.h>\n \n /*\n * Autoloaded crypto modules should only use a prefixed name to avoid allowing\n@@ -468,6 +469,45 @@ struct crypto_alg {\n } CRYPTO_MINALIGN_ATTR;\n \n /*\n+ * A helper struct for waiting for completion of async crypto ops\n+ */\n+struct crypto_wait {\n+\tstruct completion completion;\n+\tint err;\n+};\n+\n+/*\n+ * Macro for declaring a crypto op async wait object on stack\n+ */\n+#define DECLARE_CRYPTO_WAIT(_wait) \\\n+\tstruct crypto_wait _wait = { \\\n+\t\tCOMPLETION_INITIALIZER_ONSTACK((_wait).completion), 0 }\n+\n+/*\n+ * Async ops completion helper functioons\n+ */\n+void crypto_req_done(struct crypto_async_request *req, int err);\n+\n+static inline int crypto_wait_req(int err, struct crypto_wait *wait)\n+{\n+\tswitch (err) {\n+\tcase -EINPROGRESS:\n+\tcase -EBUSY:\n+\t\twait_for_completion(&wait->completion);\n+\t\treinit_completion(&wait->completion);\n+\t\terr = wait->err;\n+\t\tbreak;\n+\t};\n+\n+\treturn err;\n+}\n+\n+static inline void crypto_init_wait(struct crypto_wait *wait)\n+{\n+\tinit_completion(&wait->completion);\n+}\n+\n+/*\n * Algorithm registration interface.\n */\n int crypto_register_alg(struct crypto_alg *alg);\n", "prefixes": [ "v8", "06/20" ] }