DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Nikolay Nikolaev <nicknickolaev@gmail.com>,
	anatoly.burakov@intel.com, tiwei.bie@intel.com,
	zhihong.wang@intel.com
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v6 4/5] vhost: unify message handling function signature
Date: Tue, 2 Oct 2018 10:59:01 +0200	[thread overview]
Message-ID: <c3f4171c-8aee-007f-b1bc-c45f6029aa29@redhat.com> (raw)
In-Reply-To: <153782024547.27450.17763956133344046123.stgit@T460>



On 09/24/2018 10:17 PM, Nikolay Nikolaev wrote:
> Each vhost-user message handling function will return an int result
> which is described in the new enum vh_result: error, OK and reply.
> All functions will now have two arguments, virtio_net double pointer
> and VhostUserMsg pointer.
> 
> Signed-off-by: Nikolay Nikolaev <nicknickolaev@gmail.com>
> ---
>   lib/librte_vhost/vhost_user.c |  211 ++++++++++++++++++++++++-----------------
>   1 file changed, 125 insertions(+), 86 deletions(-)
> 
> diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
> index 77905dda0..e1b705fa7 100644
> --- a/lib/librte_vhost/vhost_user.c
> +++ b/lib/librte_vhost/vhost_user.c
> @@ -71,6 +71,16 @@ static const char *vhost_message_str[VHOST_USER_MAX] = {
>   	[VHOST_USER_CRYPTO_CLOSE_SESS] = "VHOST_USER_CRYPTO_CLOSE_SESS",
>   };
>   
> +/* The possible results of a message handling function */
> +enum vh_result {
> +	/* Message handling failed */
> +	VH_RESULT_ERR   = -1,
> +	/* Message handling successful */
> +	VH_RESULT_OK    =  0,
> +	/* Message handling successful and reply prepared */
> +	VH_RESULT_REPLY =  1,
> +};
> +


> -vhost_user_get_vring_base(struct virtio_net *dev,
> +vhost_user_get_vring_base(struct virtio_net **pdev,
>   			  struct VhostUserMsg *msg)
>   {
> +	struct virtio_net *dev = *pdev;
>   	struct vhost_virtqueue *vq = dev->virtqueue[msg->payload.state.index];
>   
>   	/* We have to stop the queue (virtio) if it is running. */
> @@ -1135,7 +1161,7 @@ vhost_user_get_vring_base(struct virtio_net *dev,
>   
>   	msg->size = sizeof(msg->payload.state);
>   
> -	return 0;
> +	return VH_RESULT_OK;
>   }

VH_RESULT_REPLY here.

> -static void
> -vhost_user_get_protocol_features(struct virtio_net *dev,
> +static int
> +vhost_user_get_protocol_features(struct virtio_net **pdev,
>   				 struct VhostUserMsg *msg)
>   {
> +	struct virtio_net *dev = *pdev;
>   	uint64_t features, protocol_features;
>   
>   	rte_vhost_driver_get_features(dev->ifname, &features);
> @@ -1189,40 +1217,46 @@ vhost_user_get_protocol_features(struct virtio_net *dev,
>   
>   	msg->payload.u64 = protocol_features;
>   	msg->size = sizeof(msg->payload.u64);
> +
> +	return VH_RESULT_OK;
>   }

Ditto.

I have the patches to fix these, it will be posted as preliminary part 
of my postcopy series.

Please, next time, test your series before posting.

Thanks,
Maxime

  reply	other threads:[~2018-10-02  8:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-24 20:16 [dpdk-dev] [PATCH v6 0/5] vhost: vhost_user.c code cleanup Nikolay Nikolaev
2018-09-24 20:17 ` [dpdk-dev] [PATCH v6 1/5] vhost: unify struct VhostUserMsg usage Nikolay Nikolaev
2018-09-25 15:43   ` Burakov, Anatoly
2018-09-24 20:17 ` [dpdk-dev] [PATCH v6 2/5] vhost: make message handling functions prepare the reply Nikolay Nikolaev
2018-09-25 15:44   ` Burakov, Anatoly
2018-09-24 20:17 ` [dpdk-dev] [PATCH v6 3/5] vhost: handle unsupported message types in functions Nikolay Nikolaev
2018-09-25 15:44   ` Burakov, Anatoly
2018-09-24 20:17 ` [dpdk-dev] [PATCH v6 4/5] vhost: unify message handling function signature Nikolay Nikolaev
2018-10-02  8:59   ` Maxime Coquelin [this message]
2018-10-05 21:34     ` Nikolay Nikolaev
2018-09-24 20:17 ` [dpdk-dev] [PATCH v6 5/5] vhost: message handling implemented as a callback array Nikolay Nikolaev
2018-09-26 12:57   ` Maxime Coquelin
2018-10-02  8:31   ` Maxime Coquelin
2018-09-26 13:51 ` [dpdk-dev] [PATCH v6 0/5] vhost: vhost_user.c code cleanup Maxime Coquelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c3f4171c-8aee-007f-b1bc-c45f6029aa29@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=nicknickolaev@gmail.com \
    --cc=tiwei.bie@intel.com \
    --cc=zhihong.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).