From 8d01b9cd70a67cdafd5b965a70420c3bd7fb3f82 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Thu, 1 Nov 2018 11:59:50 +0000 Subject: New upstream version 18.11-rc1 Change-Id: Iaa71986dd6332e878d8f4bf493101b2bbc6313bb Signed-off-by: Luca Boccassi --- lib/librte_vhost/vhost_crypto.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'lib/librte_vhost/vhost_crypto.c') diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c index 57341ef8..9811a232 100644 --- a/lib/librte_vhost/vhost_crypto.c +++ b/lib/librte_vhost/vhost_crypto.c @@ -425,35 +425,34 @@ vhost_crypto_close_sess(struct vhost_crypto *vcrypto, uint64_t session_id) return 0; } -static int -vhost_crypto_msg_post_handler(int vid, void *msg, uint32_t *require_reply) +static enum vh_result +vhost_crypto_msg_post_handler(int vid, void *msg) { struct virtio_net *dev = get_device(vid); struct vhost_crypto *vcrypto; VhostUserMsg *vmsg = msg; - int ret = 0; + enum vh_result ret = VH_RESULT_OK; - if (dev == NULL || require_reply == NULL) { + if (dev == NULL) { VC_LOG_ERR("Invalid vid %i", vid); - return -EINVAL; + return VH_RESULT_ERR; } vcrypto = dev->extern_data; if (vcrypto == NULL) { VC_LOG_ERR("Cannot find required data, is it initialized?"); - return -ENOENT; + return VH_RESULT_ERR; } - *require_reply = 0; - if (vmsg->request.master == VHOST_USER_CRYPTO_CREATE_SESS) { vhost_crypto_create_sess(vcrypto, &vmsg->payload.crypto_session); - *require_reply = 1; - } else if (vmsg->request.master == VHOST_USER_CRYPTO_CLOSE_SESS) - ret = vhost_crypto_close_sess(vcrypto, vmsg->payload.u64); - else - ret = -EINVAL; + vmsg->fd_num = 0; + ret = VH_RESULT_REPLY; + } else if (vmsg->request.master == VHOST_USER_CRYPTO_CLOSE_SESS) { + if (vhost_crypto_close_sess(vcrypto, vmsg->payload.u64)) + ret = VH_RESULT_ERR; + } return ret; } -- cgit 1.2.3-korg