From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <nicknickolaev@gmail.com>
Received: from mail-it1-f193.google.com (mail-it1-f193.google.com
 [209.85.166.193]) by dpdk.org (Postfix) with ESMTP id F0E351B179
 for <dev@dpdk.org>; Fri,  5 Oct 2018 23:35:32 +0200 (CEST)
Received: by mail-it1-f193.google.com with SMTP id q70-v6so4502414itb.3
 for <dev@dpdk.org>; Fri, 05 Oct 2018 14:35:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=fIflwO3ppl8OCJBNkNr9Gwq1hKqEkrzqwntcy2bzIwM=;
 b=X1pRNSwfMgmyOSWSAjmN/ocmVtFsaQqzfDviqgxm2sRrR+W3Lppf6ehZ51jiTuUZZZ
 /fsFJV9Wx4F84Pe7RKqs15ClftjVfFHZXr+M4nDMYi8z2wkApPm3kCt1MlGvobtL8vCw
 JwzzGas7cIH3amy7rf5X/duV5o6CxO7pJmdF2LpfqHvmxV9EOUzvwCCTy+CRq/9gH5gH
 y/Jp58nv9ovqw5R6kBsC5/fl6hOKHvCyAVFffKjFr3BrxWmKySSWbGn3vTepE9tddKWP
 EodA9NtM3+uw7aoK1f6ZzSj4H56BVc8zVIgwtLvfSvgAbGK+jfgovJM/mpVooC/7zT3o
 TUtA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=fIflwO3ppl8OCJBNkNr9Gwq1hKqEkrzqwntcy2bzIwM=;
 b=s+rwiunOnzyCdx2pRzwkopS2YpfZSBZ/MaZzUXqv1221uLocWQBVj3my013koYvvkF
 Jje5nY5I5vNSdS7giBNuC6TyGNgzmpsy2nWVNbhfnYJKuvb4BwliYz7BkHXdOnEDs42i
 ie3tUa4042gffxvbS/O6FKxyqq/ZlOjTZS+GGHtVQ2uNCPluuWfIM6y8vojx5NjPkQoX
 a6KhyaHbOrGUGx0IUlbexZdCRsHdxsE+eBfaI62Un3ZC69ASlFlH1rnYpwf402GNbSio
 WE1/maSzooMUDgiTmbcPF2GDImxtMDtcv02CUCv+e/EQYM0qEqk1dvxfLsc7oyHrHuba
 G9ZA==
X-Gm-Message-State: ABuFfohAfujTr1T+NNV6MGgB64LaDBeoO2HWc0naaWO7oOiaoluq3BBs
 lzaKq0tQ0+n+HTvS3nViluJhVBZnZGxgUEbTR74=
X-Google-Smtp-Source: ACcGV62RWAOAhJRz5MyaQ2wKWDWBC8UBjcli//WacwATr28dZVhaXuvXz0KZ9WmgCjUeKl4EhZ4qg0T7r1hUBiq1M0E=
X-Received: by 2002:a24:a343:: with SMTP id
 p64-v6mr10361162ite.10.1538775332201; 
 Fri, 05 Oct 2018 14:35:32 -0700 (PDT)
MIME-Version: 1.0
References: <153782013094.27450.17651924330876922486.stgit@T460>
 <153782024547.27450.17763956133344046123.stgit@T460>
 <c3f4171c-8aee-007f-b1bc-c45f6029aa29@redhat.com>
In-Reply-To: <c3f4171c-8aee-007f-b1bc-c45f6029aa29@redhat.com>
From: Nikolay Nikolaev <nicknickolaev@gmail.com>
Date: Sat, 6 Oct 2018 00:34:52 +0300
Message-ID: <CAL7hd5JuT=F364Qb=qzMyqMphLGnD+TPkwzYuatxoTnHyxyR7A@mail.gmail.com>
To: maxime.coquelin@redhat.com
Cc: anatoly.burakov@intel.com, tiwei.bie@intel.com, zhihong.wang@intel.com, 
 dev@dpdk.org
Content-Type: text/plain; charset="UTF-8"
Subject: Re: [dpdk-dev] [PATCH v6 4/5] vhost: unify message handling
	function signature
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://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 05 Oct 2018 21:35:33 -0000

On Tue, Oct 2, 2018 at 11:59 AM Maxime Coquelin
<maxime.coquelin@redhat.com> wrote:
>
>
>
> 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.

Oh, sorry for that. I obviously underestimated the complexity of the refactoring
and indeed did not test beyond compilation and visual code inspect,
which of course can not be excused.
I guess at least running the vhost sample against qemu would have
shown these issues.

I'm sorry again, I could have done better.

regards,
Nikolay Nikolaev

>
> Thanks,
> Maxime