get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/37087/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 37087,
    "url": "https://patches.dpdk.org/api/patches/37087/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20180404100902.27637-4-roy.fan.zhang@intel.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20180404100902.27637-4-roy.fan.zhang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180404100902.27637-4-roy.fan.zhang@intel.com",
    "date": "2018-04-04T10:08:57",
    "name": "[dpdk-dev,v5,3/8] lib/librte_vhost: add session message handler",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "084538f56f77fbe706526a590b57deb398be09fe",
    "submitter": {
        "id": 304,
        "url": "https://patches.dpdk.org/api/people/304/?format=api",
        "name": "Fan Zhang",
        "email": "roy.fan.zhang@intel.com"
    },
    "delegate": {
        "id": 2642,
        "url": "https://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20180404100902.27637-4-roy.fan.zhang@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/37087/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/37087/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 5BFC21C099;\n\tWed,  4 Apr 2018 12:16:36 +0200 (CEST)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id 8431D1C083\n\tfor <dev@dpdk.org>; Wed,  4 Apr 2018 12:16:32 +0200 (CEST)",
            "from orsmga005.jf.intel.com ([10.7.209.41])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t04 Apr 2018 03:16:32 -0700",
            "from silpixa00398673.ir.intel.com (HELO\n\tsilpixa00398673.ger.corp.intel.com) ([10.237.223.54])\n\tby orsmga005.jf.intel.com with ESMTP; 04 Apr 2018 03:16:30 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.48,405,1517904000\"; d=\"scan'208\";a=\"213819354\"",
        "From": "Fan Zhang <roy.fan.zhang@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "jianjay.zhou@huawei.com, roy.fan.zhang@intel.com,\n\tmaxime.coquelin@redhat.com, jianfeng.tan@intel.com,\n\tpawelx.wodkowski@intel.com",
        "Date": "Wed,  4 Apr 2018 11:08:57 +0100",
        "Message-Id": "<20180404100902.27637-4-roy.fan.zhang@intel.com>",
        "X-Mailer": "git-send-email 2.13.6",
        "In-Reply-To": "<20180404100902.27637-1-roy.fan.zhang@intel.com>",
        "References": "<1522327975-28769-1-git-send-email-roy.fan.zhang@intel.com>\n\t<20180404100902.27637-1-roy.fan.zhang@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v5 3/8] lib/librte_vhost: add session message\n\thandler",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This patch adds session message handler to vhost crypto.\n\nSigned-off-by: Fan Zhang <roy.fan.zhang@intel.com>\n---\n lib/librte_vhost/vhost_crypto.c | 435 ++++++++++++++++++++++++++++++++++++++++\n lib/librte_vhost/vhost_user.c   |   2 +\n 2 files changed, 437 insertions(+)\n create mode 100644 lib/librte_vhost/vhost_crypto.c",
    "diff": "diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c\nnew file mode 100644\nindex 000000000..34587c27e\n--- /dev/null\n+++ b/lib/librte_vhost/vhost_crypto.c\n@@ -0,0 +1,435 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2017-2018 Intel Corporation\n+ */\n+#include <linux/virtio_crypto.h>\n+\n+#include <rte_malloc.h>\n+#include <rte_hash.h>\n+#include <rte_mbuf.h>\n+#include <rte_cryptodev.h>\n+\n+#include \"vhost.h\"\n+#include \"vhost_user.h\"\n+\n+#define IV_OFFSET\t\t(sizeof(struct rte_crypto_op) + \\\n+\t\t\t\tsizeof(struct rte_crypto_sym_op))\n+\n+#ifdef RTE_LIBRTE_VHOST_DEBUG\n+#define VC_LOG_ERR(fmt, args...)\t\t\t\t\\\n+\tRTE_LOG(ERR, USER1, \"[%s] %s() line %u: \" fmt \"\\n\",\t\\\n+\t\t\"Vhost-Crypto\",\t__func__, __LINE__, ## args)\n+#define VC_LOG_INFO(fmt, args...)\t\t\t\t\\\n+\tRTE_LOG(INFO, USER1, \"[%s] %s() line %u: \" fmt \"\\n\",\t\\\n+\t\t\"Vhost-Crypto\",\t__func__, __LINE__, ## args)\n+\n+#define VC_LOG_DBG(fmt, args...)\t\t\t\t\\\n+\tRTE_LOG(DEBUG, USER1, \"[%s] %s() line %u: \" fmt \"\\n\",\t\\\n+\t\t\"Vhost-Crypto\",\t__func__, __LINE__, ## args)\n+#else\n+#define VC_LOG_ERR(fmt, args...)\t\t\t\t\\\n+\tRTE_LOG(ERR, USER1, \"[VHOST-Crypto]: \" fmt \"\\n\", ## args)\n+#define VC_LOG_INFO(fmt, args...)\t\t\t\t\\\n+\tRTE_LOG(INFO, USER1, \"[VHOST-Crypto]: \" fmt \"\\n\", ## args)\n+#define VC_LOG_DBG(fmt, args...)\n+#endif\n+\n+static int\n+cipher_algo_transform(uint32_t virtio_cipher_algo)\n+{\n+\tint ret;\n+\n+\tswitch (virtio_cipher_algo) {\n+\tcase VIRTIO_CRYPTO_CIPHER_AES_CBC:\n+\t\tret = RTE_CRYPTO_CIPHER_AES_CBC;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_CIPHER_AES_CTR:\n+\t\tret = RTE_CRYPTO_CIPHER_AES_CTR;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_CIPHER_DES_ECB:\n+\t\tret = -VIRTIO_CRYPTO_NOTSUPP;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_CIPHER_DES_CBC:\n+\t\tret = RTE_CRYPTO_CIPHER_DES_CBC;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_CIPHER_3DES_ECB:\n+\t\tret = RTE_CRYPTO_CIPHER_3DES_ECB;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_CIPHER_3DES_CBC:\n+\t\tret = RTE_CRYPTO_CIPHER_3DES_CBC;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_CIPHER_3DES_CTR:\n+\t\tret = RTE_CRYPTO_CIPHER_3DES_CTR;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_CIPHER_KASUMI_F8:\n+\t\tret = RTE_CRYPTO_CIPHER_KASUMI_F8;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_CIPHER_SNOW3G_UEA2:\n+\t\tret = RTE_CRYPTO_CIPHER_SNOW3G_UEA2;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_CIPHER_AES_F8:\n+\t\tret = RTE_CRYPTO_CIPHER_AES_F8;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_CIPHER_AES_XTS:\n+\t\tret = RTE_CRYPTO_CIPHER_AES_XTS;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_CIPHER_ZUC_EEA3:\n+\t\tret = RTE_CRYPTO_CIPHER_ZUC_EEA3;\n+\t\tbreak;\n+\tdefault:\n+\t\tret = -VIRTIO_CRYPTO_BADMSG;\n+\t\tbreak;\n+\t}\n+\n+\treturn ret;\n+}\n+\n+static int\n+auth_algo_transform(uint32_t virtio_auth_algo)\n+{\n+\tint ret;\n+\n+\tswitch (virtio_auth_algo) {\n+\n+\tcase VIRTIO_CRYPTO_NO_MAC:\n+\t\tret = RTE_CRYPTO_AUTH_NULL;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_MAC_HMAC_MD5:\n+\t\tret = RTE_CRYPTO_AUTH_MD5_HMAC;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_MAC_HMAC_SHA1:\n+\t\tret = RTE_CRYPTO_AUTH_SHA1_HMAC;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_MAC_HMAC_SHA_224:\n+\t\tret = RTE_CRYPTO_AUTH_SHA224_HMAC;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_MAC_HMAC_SHA_256:\n+\t\tret = RTE_CRYPTO_AUTH_SHA256_HMAC;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_MAC_HMAC_SHA_384:\n+\t\tret = RTE_CRYPTO_AUTH_SHA384_HMAC;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_MAC_HMAC_SHA_512:\n+\t\tret = RTE_CRYPTO_AUTH_SHA512_HMAC;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_MAC_CMAC_3DES:\n+\t\tret = -VIRTIO_CRYPTO_NOTSUPP;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_MAC_CMAC_AES:\n+\t\tret = RTE_CRYPTO_AUTH_AES_CMAC;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_MAC_KASUMI_F9:\n+\t\tret = RTE_CRYPTO_AUTH_KASUMI_F9;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_MAC_SNOW3G_UIA2:\n+\t\tret = RTE_CRYPTO_AUTH_SNOW3G_UIA2;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_MAC_GMAC_AES:\n+\t\tret = RTE_CRYPTO_AUTH_AES_GMAC;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_MAC_GMAC_TWOFISH:\n+\t\tret = -VIRTIO_CRYPTO_NOTSUPP;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_MAC_CBCMAC_AES:\n+\t\tret = RTE_CRYPTO_AUTH_AES_CBC_MAC;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_MAC_CBCMAC_KASUMI_F9:\n+\t\tret = -VIRTIO_CRYPTO_NOTSUPP;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_MAC_XCBC_AES:\n+\t\tret = RTE_CRYPTO_AUTH_AES_XCBC_MAC;\n+\t\tbreak;\n+\tdefault:\n+\t\tret = -VIRTIO_CRYPTO_BADMSG;\n+\t\tbreak;\n+\t}\n+\n+\treturn ret;\n+}\n+\n+static int get_iv_len(enum rte_crypto_cipher_algorithm algo)\n+{\n+\tint len;\n+\n+\tswitch (algo) {\n+\tcase RTE_CRYPTO_CIPHER_3DES_CBC:\n+\t\tlen = 8;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_CIPHER_3DES_CTR:\n+\t\tlen = 8;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_CIPHER_3DES_ECB:\n+\t\tlen = 8;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_CIPHER_AES_CBC:\n+\t\tlen = 16;\n+\t\tbreak;\n+\n+\t/* TODO: add common algos */\n+\n+\tdefault:\n+\t\tlen = -1;\n+\t\tbreak;\n+\t}\n+\n+\treturn len;\n+}\n+\n+/**\n+ * vhost_crypto struct is used to maintain a number of virtio_cryptos and\n+ * one DPDK crypto device that deals with all crypto workloads. It is declared\n+ * here and defined in vhost_crypto.c\n+ */\n+struct vhost_crypto {\n+\t/** Used to lookup DPDK Cryptodev Session based on VIRTIO crypto\n+\t *  session ID.\n+\t */\n+\tstruct rte_hash *session_map;\n+\tstruct rte_mempool *mbuf_pool;\n+\tstruct rte_mempool *sess_pool;\n+\n+\t/** DPDK cryptodev ID */\n+\tuint8_t cid;\n+\tuint16_t nb_qps;\n+\n+\tuint64_t last_session_id;\n+\n+\tuint64_t cache_session_id;\n+\tstruct rte_cryptodev_sym_session *cache_session;\n+\t/** socket id for the device */\n+\tint socket_id;\n+\n+\tstruct virtio_net *dev;\n+\n+\tuint8_t option;\n+} __rte_cache_aligned;\n+\n+static int\n+transform_cipher_param(struct rte_crypto_sym_xform *xform,\n+\t\tVhostUserCryptoSessionParam *param)\n+{\n+\tint ret;\n+\n+\tret = cipher_algo_transform(param->cipher_algo);\n+\tif (unlikely(ret < 0))\n+\t\treturn ret;\n+\n+\txform->type = RTE_CRYPTO_SYM_XFORM_CIPHER;\n+\txform->cipher.algo = (uint32_t)ret;\n+\txform->cipher.key.length = param->cipher_key_len;\n+\tif (xform->cipher.key.length > 0)\n+\t\txform->cipher.key.data = param->cipher_key_buf;\n+\tif (param->dir == VIRTIO_CRYPTO_OP_ENCRYPT)\n+\t\txform->cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;\n+\telse if (param->dir == VIRTIO_CRYPTO_OP_DECRYPT)\n+\t\txform->cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT;\n+\telse {\n+\t\tVC_LOG_DBG(\"Bad operation type\");\n+\t\treturn -VIRTIO_CRYPTO_BADMSG;\n+\t}\n+\n+\tret = get_iv_len(xform->cipher.algo);\n+\tif (unlikely(ret < 0))\n+\t\treturn ret;\n+\txform->cipher.iv.length = (uint16_t)ret;\n+\txform->cipher.iv.offset = IV_OFFSET;\n+\treturn 0;\n+}\n+\n+static int\n+transform_chain_param(struct rte_crypto_sym_xform *xforms,\n+\t\tVhostUserCryptoSessionParam *param)\n+{\n+\tstruct rte_crypto_sym_xform *xform_cipher, *xform_auth;\n+\tint ret;\n+\n+\tswitch (param->chaining_dir) {\n+\tcase VIRTIO_CRYPTO_SYM_ALG_CHAIN_ORDER_HASH_THEN_CIPHER:\n+\t\txform_auth = xforms;\n+\t\txform_cipher = xforms->next;\n+\t\txform_cipher->cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT;\n+\t\txform_auth->auth.op = RTE_CRYPTO_AUTH_OP_VERIFY;\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_SYM_ALG_CHAIN_ORDER_CIPHER_THEN_HASH:\n+\t\txform_cipher = xforms;\n+\t\txform_auth = xforms->next;\n+\t\txform_cipher->cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;\n+\t\txform_auth->auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;\n+\t\tbreak;\n+\tdefault:\n+\t\treturn -VIRTIO_CRYPTO_BADMSG;\n+\t}\n+\n+\t/* cipher */\n+\tret = cipher_algo_transform(param->cipher_algo);\n+\tif (unlikely(ret < 0))\n+\t\treturn ret;\n+\txform_cipher->type = RTE_CRYPTO_SYM_XFORM_CIPHER;\n+\txform_cipher->cipher.algo = (uint32_t)ret;\n+\txform_cipher->cipher.key.length = param->cipher_key_len;\n+\txform_cipher->cipher.key.data = param->cipher_key_buf;\n+\tret = get_iv_len(xform_cipher->cipher.algo);\n+\tif (unlikely(ret < 0))\n+\t\treturn ret;\n+\txform_cipher->cipher.iv.length = (uint16_t)ret;\n+\txform_cipher->cipher.iv.offset = IV_OFFSET;\n+\n+\t/* auth */\n+\txform_auth->type = RTE_CRYPTO_SYM_XFORM_AUTH;\n+\tret = auth_algo_transform(param->hash_algo);\n+\tif (unlikely(ret < 0))\n+\t\treturn ret;\n+\txform_auth->auth.algo = (uint32_t)ret;\n+\txform_auth->auth.digest_length = param->digest_len;\n+\txform_auth->auth.key.length = param->auth_key_len;\n+\txform_auth->auth.key.data = param->auth_key_buf;\n+\n+\treturn 0;\n+}\n+\n+static void\n+vhost_crypto_create_sess(struct vhost_crypto *vcrypto,\n+\t\tVhostUserCryptoSessionParam *sess_param)\n+{\n+\tstruct rte_crypto_sym_xform xform1 = {0}, xform2 = {0};\n+\tstruct rte_cryptodev_sym_session *session;\n+\tint ret;\n+\n+\tswitch (sess_param->op_type) {\n+\tcase VIRTIO_CRYPTO_SYM_OP_NONE:\n+\tcase VIRTIO_CRYPTO_SYM_OP_CIPHER:\n+\t\tret = transform_cipher_param(&xform1, sess_param);\n+\t\tif (unlikely(ret)) {\n+\t\t\tVC_LOG_ERR(\"Error transform session msg (%i)\", ret);\n+\t\t\tsess_param->session_id = ret;\n+\t\t\treturn;\n+\t\t}\n+\t\tbreak;\n+\tcase VIRTIO_CRYPTO_SYM_OP_ALGORITHM_CHAINING:\n+\t\tif (unlikely(sess_param->hash_mode !=\n+\t\t\t\tVIRTIO_CRYPTO_SYM_HASH_MODE_AUTH)) {\n+\t\t\tsess_param->session_id = -VIRTIO_CRYPTO_NOTSUPP;\n+\t\t\tVC_LOG_ERR(\"Error transform session message (%i)\",\n+\t\t\t\t\t-VIRTIO_CRYPTO_NOTSUPP);\n+\t\t\treturn;\n+\t\t}\n+\n+\t\txform1.next = &xform2;\n+\n+\t\tret = transform_chain_param(&xform1, sess_param);\n+\t\tif (unlikely(ret)) {\n+\t\t\tVC_LOG_ERR(\"Error transform session message (%i)\", ret);\n+\t\t\tsess_param->session_id = ret;\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tbreak;\n+\tdefault:\n+\t\tVC_LOG_ERR(\"Algorithm not yet supported\");\n+\t\tsess_param->session_id = -VIRTIO_CRYPTO_NOTSUPP;\n+\t\treturn;\n+\t}\n+\n+\tsession = rte_cryptodev_sym_session_create(vcrypto->sess_pool);\n+\tif (!session) {\n+\t\tVC_LOG_ERR(\"Failed to create session\");\n+\t\tsess_param->session_id = -VIRTIO_CRYPTO_ERR;\n+\t\treturn;\n+\t}\n+\n+\tif (rte_cryptodev_sym_session_init(vcrypto->cid, session, &xform1,\n+\t\t\tvcrypto->sess_pool) < 0) {\n+\t\tVC_LOG_ERR(\"Failed to initialize session\");\n+\t\tsess_param->session_id = -VIRTIO_CRYPTO_ERR;\n+\t\treturn;\n+\t}\n+\n+\t/* insert hash to map */\n+\tif (rte_hash_add_key_data(vcrypto->session_map,\n+\t\t\t&vcrypto->last_session_id, session) < 0) {\n+\t\tVC_LOG_ERR(\"Failed to insert session to hash table\");\n+\n+\t\tif (rte_cryptodev_sym_session_clear(vcrypto->cid, session) < 0)\n+\t\t\tVC_LOG_ERR(\"Failed to clear session\");\n+\t\telse {\n+\t\t\tif (rte_cryptodev_sym_session_free(session) < 0)\n+\t\t\t\tVC_LOG_ERR(\"Failed to free session\");\n+\t\t}\n+\t\tsess_param->session_id = -VIRTIO_CRYPTO_ERR;\n+\t\treturn;\n+\t}\n+\n+\tVC_LOG_DBG(\"Session (key %lu, session %p) created.\",\n+\t\t\tvcrypto->last_session_id, session);\n+\n+\tsess_param->session_id = vcrypto->last_session_id;\n+\tvcrypto->last_session_id++;\n+}\n+\n+static int\n+vhost_crypto_close_sess(struct vhost_crypto *vcrypto, uint64_t session_id)\n+{\n+\tstruct rte_cryptodev_sym_session *session;\n+\tuint64_t sess_id = session_id;\n+\tint ret;\n+\n+\tret = rte_hash_lookup_data(vcrypto->session_map, &sess_id,\n+\t\t\t(void **)&session);\n+\n+\tif (unlikely(ret < 0)) {\n+\t\tVC_LOG_ERR(\"Failed to delete session (key %lu).\", session_id);\n+\t\treturn -VIRTIO_CRYPTO_INVSESS;\n+\t}\n+\n+\tif (rte_cryptodev_sym_session_clear(vcrypto->cid, session) < 0) {\n+\t\tVC_LOG_DBG(\"Failed to delete session\");\n+\t\treturn -VIRTIO_CRYPTO_ERR;\n+\t}\n+\n+\tif (rte_cryptodev_sym_session_free(session) < 0) {\n+\t\tVC_LOG_DBG(\"Failed to delete session\");\n+\t\treturn -VIRTIO_CRYPTO_ERR;\n+\t}\n+\n+\tif (rte_hash_del_key(vcrypto->session_map, &sess_id) < 0) {\n+\t\tVC_LOG_DBG(\"Failed to delete session from hash table.\");\n+\t\treturn -VIRTIO_CRYPTO_ERR;\n+\t}\n+\n+\tVC_LOG_DBG(\"Session (key %lu, session %p) deleted.\", sess_id,\n+\t\t\tsession);\n+\n+\treturn 0;\n+}\n+\n+static int\n+vhost_crypto_msg_post_handler(int vid, void *msg, uint32_t *require_reply)\n+{\n+\tstruct virtio_net *dev = get_device(vid);\n+\tstruct vhost_crypto *vcrypto;\n+\tVhostUserMsg *vmsg = msg;\n+\tint ret = 0;\n+\n+\tif (dev == NULL || require_reply == NULL) {\n+\t\tVC_LOG_ERR(\"Invalid vid %i\", vid);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tvcrypto = dev->extern_data;\n+\tif (vcrypto == NULL) {\n+\t\tVC_LOG_ERR(\"Cannot find required data, is it initialized?\");\n+\t\treturn -ENOENT;\n+\t}\n+\n+\t*require_reply = 0;\n+\n+\tif (vmsg->request.master == VHOST_USER_CRYPTO_CREATE_SESS) {\n+\t\tvhost_crypto_create_sess(vcrypto,\n+\t\t\t\t&vmsg->payload.crypto_session);\n+\t\t*require_reply = 1;\n+\t} else if (vmsg->request.master == VHOST_USER_CRYPTO_CLOSE_SESS)\n+\t\tret = vhost_crypto_close_sess(vcrypto, vmsg->payload.u64);\n+\telse\n+\t\tret = -EINVAL;\n+\n+\treturn ret;\n+}\ndiff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c\nindex a435cce17..3117c6330 100644\n--- a/lib/librte_vhost/vhost_user.c\n+++ b/lib/librte_vhost/vhost_user.c\n@@ -67,6 +67,8 @@ static const char *vhost_message_str[VHOST_USER_MAX] = {\n \t[VHOST_USER_NET_SET_MTU]  = \"VHOST_USER_NET_SET_MTU\",\n \t[VHOST_USER_SET_SLAVE_REQ_FD]  = \"VHOST_USER_SET_SLAVE_REQ_FD\",\n \t[VHOST_USER_IOTLB_MSG]  = \"VHOST_USER_IOTLB_MSG\",\n+\t[VHOST_USER_CRYPTO_CREATE_SESS] = \"VHOST_USER_CRYPTO_CREATE_SESS\",\n+\t[VHOST_USER_CRYPTO_CLOSE_SESS] = \"VHOST_USER_CRYPTO_CLOSE_SESS\",\n };\n \n static uint64_t\n",
    "prefixes": [
        "dpdk-dev",
        "v5",
        "3/8"
    ]
}