{"id":812196,"url":"http://patchwork.ozlabs.org/api/1.2/patches/812196/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/1505092240-10864-5-git-send-email-longpeng2@huawei.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.2/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1505092240-10864-5-git-send-email-longpeng2@huawei.com>","list_archive_url":null,"date":"2017-09-11T01:10:36","name":"[RFC,4/8] cryptodev: add stateless mode cipher support","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"e3496c6cacc7467cb136761db88e7aab86747569","submitter":{"id":69776,"url":"http://patchwork.ozlabs.org/api/1.2/people/69776/?format=json","name":"Longpeng (Mike, Cloud Infrastructure Service Product Dept.)","email":"longpeng2@huawei.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/1505092240-10864-5-git-send-email-longpeng2@huawei.com/mbox/","series":[{"id":2425,"url":"http://patchwork.ozlabs.org/api/1.2/series/2425/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=2425","date":"2017-09-11T01:10:36","name":null,"version":1,"mbox":"http://patchwork.ozlabs.org/series/2425/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/812196/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/812196/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xr8zX6WMLz9s0Z\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 11 Sep 2017 11:12:23 +1000 (AEST)","from localhost ([::1]:54823 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1drDGu-0004Hj-Du\n\tfor incoming@patchwork.ozlabs.org; Sun, 10 Sep 2017 21:12:20 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:35247)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <longpeng2@huawei.com>) id 1drDG5-0004HF-L6\n\tfor qemu-devel@nongnu.org; Sun, 10 Sep 2017 21:11:30 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <longpeng2@huawei.com>) id 1drDG0-00045W-Lf\n\tfor qemu-devel@nongnu.org; Sun, 10 Sep 2017 21:11:29 -0400","from szxga04-in.huawei.com ([45.249.212.190]:2311)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71)\n\t(envelope-from <longpeng2@huawei.com>) id 1drDG0-00042A-05\n\tfor qemu-devel@nongnu.org; Sun, 10 Sep 2017 21:11:24 -0400","from 172.30.72.58 (EHLO DGGEMS407-HUB.china.huawei.com)\n\t([172.30.72.58])\n\tby dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued)\n\twith ESMTP id DGZ05861; Mon, 11 Sep 2017 09:10:58 +0800 (CST)","from localhost (10.177.246.209) by DGGEMS407-HUB.china.huawei.com\n\t(10.3.19.207) with Microsoft SMTP Server id 14.3.301.0;\n\tMon, 11 Sep 2017 09:10:50 +0800"],"From":"\"Longpeng(Mike)\" <longpeng2@huawei.com>","To":"<qemu-devel@nongnu.org>, <virtio-dev@lists.oasis-open.org>","Date":"Mon, 11 Sep 2017 09:10:36 +0800","Message-ID":"<1505092240-10864-5-git-send-email-longpeng2@huawei.com>","X-Mailer":"git-send-email 1.8.4.msysgit.0","In-Reply-To":"<1505092240-10864-1-git-send-email-longpeng2@huawei.com>","References":"<1505092240-10864-1-git-send-email-longpeng2@huawei.com>","MIME-Version":"1.0","Content-Type":"text/plain","X-Originating-IP":"[10.177.246.209]","X-CFilter-Loop":"Reflected","X-Mirapoint-Virus-RAPID-Raw":"score=unknown(0),\n\trefid=str=0001.0A0B0208.59B5E2A2.00B3, ss=1, re=0.000, recu=0.000,\n\treip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0,\n\tso=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32","X-Mirapoint-Loop-Id":"9f6fc4f4f0818c6979e99629858e8117","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]\n\t[fuzzy]","X-Received-From":"45.249.212.190","Subject":"[Qemu-devel] [RFC 4/8] cryptodev: add stateless mode cipher support","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"weidong.huang@huawei.com, mst@redhat.com, jasowang@redhat.com,\n\tjohn.griffin@intel.com, Varun.Sethi@freescale.com,\n\tdenglingli@chinamobile.com, arei.gonglei@hotmail.com,\n\tagraf@suse.de, arei.gonglei@huawei.com,\n\t\"Longpeng\\(Mike\\)\" <longpeng2@huawei.com>,\n\tvincent.jardin@6wind.com, Ola.Liljedahl@arm.com,\n\tluonengjun@huawei.com, xin.zeng@intel.com, liang.j.ma@intel.com,\n\tstefanha@redhat.com, Jani.Kokkonen@huawei.com,\n\tpasic@linux.vnet.ibm.com, brian.a.keating@intel.com,\n\twangxinxin.wang@huawei.com, cohuck@redhat.com, mike.caraman@nxp.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"Adds stateless mode cipher support.\n\nSigned-off-by: Longpeng(Mike) <longpeng2@huawei.com>\n---\n backends/cryptodev.c              | 21 +++++++++++++++++++++\n include/hw/virtio/virtio-crypto.h |  1 +\n include/sysemu/cryptodev.h        | 18 ++++++++++++++++++\n 3 files changed, 40 insertions(+)","diff":"diff --git a/backends/cryptodev.c b/backends/cryptodev.c\nindex 1764c17..a76a312 100755\n--- a/backends/cryptodev.c\n+++ b/backends/cryptodev.c\n@@ -120,6 +120,21 @@ static int cryptodev_backend_sym_operation(\n     return -VIRTIO_CRYPTO_ERR;\n }\n \n+static int cryptodev_backend_sym_stateless_operation(\n+                 CryptoDevBackend *backend,\n+                 CryptoDevBackendSymStatelessInfo *op_info,\n+                 uint32_t queue_index, Error **errp)\n+{\n+    CryptoDevBackendClass *bc =\n+                      CRYPTODEV_BACKEND_GET_CLASS(backend);\n+\n+    if (bc->do_sym_stateless_op) {\n+        return bc->do_sym_stateless_op(backend, op_info, queue_index, errp);\n+    }\n+\n+    return -VIRTIO_CRYPTO_ERR;\n+}\n+\n int cryptodev_backend_crypto_operation(\n                  CryptoDevBackend *backend,\n                  void *opaque,\n@@ -133,6 +148,12 @@ int cryptodev_backend_crypto_operation(\n \n         return cryptodev_backend_sym_operation(backend,\n                          op_info, queue_index, errp);\n+    } else if (req->flags == CRYPTODEV_BACKEND_ALG_SYM_STATELESS) {\n+        CryptoDevBackendSymStatelessInfo *op_info;\n+        op_info = req->u.sym_stateless_info;\n+\n+        return cryptodev_backend_sym_stateless_operation(backend,\n+                         op_info, queue_index, errp);\n     } else {\n         error_setg(errp, \"Unsupported cryptodev alg type: %\" PRIu32 \"\",\n                    req->flags);\ndiff --git a/include/hw/virtio/virtio-crypto.h b/include/hw/virtio/virtio-crypto.h\nindex a00a0bf..465ad20 100755\n--- a/include/hw/virtio/virtio-crypto.h\n+++ b/include/hw/virtio/virtio-crypto.h\n@@ -73,6 +73,7 @@ typedef struct VirtIOCryptoReq {\n     struct VirtIOCrypto *vcrypto;\n     union {\n         CryptoDevBackendSymOpInfo *sym_op_info;\n+        CryptoDevBackendSymStatelessInfo *sym_stateless_info;\n     } u;\n } VirtIOCryptoReq;\n \ndiff --git a/include/sysemu/cryptodev.h b/include/sysemu/cryptodev.h\nindex a9d0d1e..aa2fcd8 100755\n--- a/include/sysemu/cryptodev.h\n+++ b/include/sysemu/cryptodev.h\n@@ -58,6 +58,7 @@ typedef struct CryptoDevBackend CryptoDevBackend;\n \n enum CryptoDevBackendAlgType {\n     CRYPTODEV_BACKEND_ALG_SYM,\n+    CRYPTODEV_BACKEND_ALG_SYM_STATELESS,\n     CRYPTODEV_BACKEND_ALG__MAX,\n };\n \n@@ -146,6 +147,20 @@ typedef struct CryptoDevBackendSymOpInfo {\n     uint8_t data[0];\n } CryptoDevBackendSymOpInfo;\n \n+/**\n+ * CryptoDevBackendSymStatelessInfo:\n+ *\n+ * @session_info: session information, see above\n+ *  CryptoDevBackendSymSessionInfo\n+ * @op_info: crypto operation information, see above\n+ *  CryptoDevBackendSymOpInfo, @session_id is ignored\n+ *\n+ **/\n+typedef struct CryptoDevBackendSymStatelessInfo {\n+    CryptoDevBackendSymSessionInfo session_info;\n+    CryptoDevBackendSymOpInfo op_info;\n+} CryptoDevBackendSymStatelessInfo;\n+\n typedef struct CryptoDevBackendClass {\n     ObjectClass parent_class;\n \n@@ -161,6 +176,9 @@ typedef struct CryptoDevBackendClass {\n     int (*do_sym_op)(CryptoDevBackend *backend,\n                      CryptoDevBackendSymOpInfo *op_info,\n                      uint32_t queue_index, Error **errp);\n+    int (*do_sym_stateless_op)(CryptoDevBackend *backend,\n+                     CryptoDevBackendSymStatelessInfo *op_info,\n+                     uint32_t queue_index, Error **errp);\n } CryptoDevBackendClass;\n \n \n","prefixes":["RFC","4/8"]}