From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxime Coquelin Subject: Re: [PATCH 2/2] vhost: support requests only handled by external backend Date: Wed, 13 Mar 2019 16:42:40 +0100 Message-ID: <8fc721a3-b37d-a5fa-db1f-32e14453ce61@redhat.com> References: <20190312145410.570-1-maxime.coquelin@redhat.com> <20190312145410.570-3-maxime.coquelin@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit To: Ilya Maximets , dev@dpdk.org, changpeng.liu@intel.com, tiwei.bie@intel.com, dariusz.stojaczyk@intel.com Return-path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id BDE1C374E for ; Wed, 13 Mar 2019 16:42:44 +0100 (CET) In-Reply-To: Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 3/12/19 5:14 PM, Ilya Maximets wrote: > On 12.03.2019 17:54, Maxime Coquelin wrote: >> External backends may have specific requests to handle, and so >> we don't want the vhost-user lib to handle these requests as >> errors. >> >> This patch also changes the experimental API by introducing >> RTE_VHOST_MSG_RESULT_NOT_HANDLED so that vhost-user lib >> can report an error if a message is handled neither by >> the vhost-user library nor by the external backend. >> >> The logic changes a bit so that if the callback returns >> with ERR, OK or REPLY, it is considered the message >> is handled by the external backend so it won't be >> handled by the vhost-user library. >> It is still possible for an external backend to listen >> to requests that have to be handled by the vhost-user >> library like SET_MEM_TABLE, but the callback have to >> return NOT_HANDLED in that case. >> >> Vhost-crypto backend is ialso adapted to this API change. >> >> Suggested-by: Ilya Maximets >> Signed-off-by: Maxime Coquelin >> Tested-by: Darek Stojaczyk >> --- >> lib/librte_vhost/rte_vhost.h | 16 +++++-- >> lib/librte_vhost/vhost_crypto.c | 10 +++- >> lib/librte_vhost/vhost_user.c | 82 +++++++++++++++++++++------------ >> 3 files changed, 71 insertions(+), 37 deletions(-) >> >> diff --git a/lib/librte_vhost/rte_vhost.h b/lib/librte_vhost/rte_vhost.h >> index c9c392975..b1c5a0908 100644 >> --- a/lib/librte_vhost/rte_vhost.h >> +++ b/lib/librte_vhost/rte_vhost.h >> @@ -121,6 +121,8 @@ enum rte_vhost_msg_result { >> RTE_VHOST_MSG_RESULT_OK = 0, >> /* Message handling successful and reply prepared */ >> RTE_VHOST_MSG_RESULT_REPLY = 1, >> + /* Message not handled */ >> + RTE_VHOST_MSG_RESULT_NOT_HANDLED, >> }; >> >> /** >> @@ -135,11 +137,13 @@ enum rte_vhost_msg_result { >> * If the handler requires skipping the master message handling, this variable >> * shall be written 1, otherwise 0. > > Above statement should be updated because 'skip_master' removed. Right. > BTW, maybe it's better to squash these two typedef's as they are > equal now? Comment parts that differs could be moved to the definition > of the 'struct rte_vhost_user_extern_ops'. Good idea, doing it now. >> * @return >> - * VH_RESULT_OK on success, VH_RESULT_REPLY on success with reply, >> - * VH_RESULT_ERR on failure >> + * RTE_VHOST_MSG_RESULT_OK on success, >> + * RTE_VHOST_MSG_RESULT_REPLY on success with reply, >> + * RTE_VHOST_MSG_RESULT_ERR on failure, >> + * RTE_VHOST_MSG_RESULT_NOT_HANDLED if message was not handled. >> */ >> typedef enum rte_vhost_msg_result (*rte_vhost_msg_pre_handle)(int vid, >> - void *msg, uint32_t *skip_master); >> + void *msg); >> Thanks, Maxime