From: "Hu, Jiayu" <jiayu.hu@intel.com>
To: "Bie, Tiwei" <tiwei.bie@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
"Yang, Zhiyong" <zhiyong.yang@intel.com>,
"maxime.coquelin@redhat.com" <maxime.coquelin@redhat.com>
Subject: Re: [dpdk-dev] [PATCH] net/virtio-user: fix feature setting with vhost-net backend
Date: Thu, 10 May 2018 08:33:33 +0000 [thread overview]
Message-ID: <ED946F0BEFE0A141B63BABBD629A2A9B388BC57D@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <20180510050443.mzibwgqnp7ixwa3m@debian>
Hi Tiwei,
> -----Original Message-----
> From: Bie, Tiwei
> Sent: Thursday, May 10, 2018 1:05 PM
> To: Hu, Jiayu <jiayu.hu@intel.com>
> Cc: dev@dpdk.org; Yang, Zhiyong <zhiyong.yang@intel.com>;
> maxime.coquelin@redhat.com
> Subject: Re: [dpdk-dev] [PATCH] net/virtio-user: fix feature setting with
> vhost-net backend
>
> On Tue, May 08, 2018 at 03:44:22PM +0800, Jiayu Hu wrote:
> > Hi Tiwei,
> >
> > On Tue, May 08, 2018 at 10:49:50AM +0800, Tiwei Bie wrote:
> > > On Mon, May 07, 2018 at 02:50:06PM +0800, Jiayu Hu wrote:
> > > > Currently, when the backend is vhost-net, which implies
> > > > virtio-user works in client mode, virtio-user is assigned
> > > > to the default feature VIRTIO_USER_SUPPORTED_FEATURES.
> > > > However, virtio-user should request features from the
> > > > backend in this case.
> > > >
> > > > Fixes: bd8f50a45d0f ("net/virtio-user: support server mode")
> > > > Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
> > > > ---
> > > > drivers/net/virtio/virtio_user/virtio_user_dev.c | 15 +++++++--------
> > > > 1 file changed, 7 insertions(+), 8 deletions(-)
> > > >
> > > > diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c
> b/drivers/net/virtio/virtio_user/virtio_user_dev.c
> > > > index 38b8bc9..f745163 100644
> > > > --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
> > > > +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
> > > > @@ -353,20 +353,22 @@ virtio_user_dev_init(struct virtio_user_dev
> *dev, char *path, int queues,
> > > > return -1;
> > > > }
> > > >
> > > > - if (dev->vhostfd >= 0) {
> > > > + if (!dev->is_server) {
> > >
> > > Server mode also needs to run below code when the
> > > connection to the backend is established.
> >
> > For server mode, the below code is called by virtio_user_start_device(),
> > instead of virtio_user_dev_init(). Only client mode virtio-user
> > needs to call it when init.
>
> Okay. So in server mode, virtio-user never get a chance
> to do GET_FEATURES.
In current design, virtio-user server mode always has no way to do GET_FEATURES.
I think it's the design problem of virtio-user server mode. This patch is just for solving
client mode virtio-user feature setting.
>
> >
> > >
> > > > if (dev->ops->send_request(dev,
> VHOST_USER_SET_OWNER,
> > > > - NULL) < 0) {
> > > > + NULL) < 0) {
> > >
> > > There is no need to change the indent.
> >
> > Thanks, change in the next patch.
> >
> > >
> > > > PMD_INIT_LOG(ERR, "set_owner fails: %s",
> > > > - strerror(errno));
> > > > + strerror(errno));
> > >
> > > There is no need to change the indent.
> >
> > ditto.
> >
> > >
> > > > return -1;
> > > > }
> > > >
> > > > if (dev->ops->send_request(dev,
> VHOST_USER_GET_FEATURES,
> > > > - &dev->device_features) < 0) {
> > > > + &dev->device_features) < 0) {
> > >
> > > There is no need to change the indent.
> >
> > ditto.
> >
> > >
> > > > PMD_INIT_LOG(ERR, "get_features failed: %s",
> > > > - strerror(errno));
> > > > + strerror(errno));
> > >
> > > There is no need to change the indent.
> >
> > ditto.
> >
> > >
> > > > return -1;
> > > > }
> > > > + if (dev->mac_specified)
> > > > + dev->device_features |= (1ull <<
> VIRTIO_NET_F_MAC);
> > >
> > > Why move above code?
> >
> > The server mode virtio-user is assigned the default features, which include
> > VIRTIO_NET_F_MAC. So checking if support VIRTIO_NET_F_MAC is only
> necessary
> > for client mode.
>
> I think we should set this bit only when mac is
> specified. And in server mode, we need to clear
> this bit when mac isn't specified. So instead
> of moving it, it should be changed to something
> like this:
>
> if (dev->mac_specified)
> dev->device_features |= (1ull << VIRTIO_NET_F_MAC);
> else
> dev->device_features &= ~(1ull << VIRTIO_NET_F_MAC);
>
Make sense. It shouldn't change in this patch. I will change it. Thanks.
Jiayu
> Thanks
>
> >
> > Thanks,
> > Jiayu
> >
> > >
> > > > } else {
> > > > /* We just pretend vhost-user can support all these
> features.
> > > > * Note that this could be problematic that if some feature
> is
> > > > @@ -376,9 +378,6 @@ virtio_user_dev_init(struct virtio_user_dev
> *dev, char *path, int queues,
> > > > dev->device_features =
> VIRTIO_USER_SUPPORTED_FEATURES;
> > > > }
> > > >
> > > > - if (dev->mac_specified)
> > > > - dev->device_features |= (1ull << VIRTIO_NET_F_MAC);
> > > > -
> > > > if (cq) {
> > > > /* device does not really need to know anything about CQ,
> > > > * so if necessary, we just claim to support CQ
> > > > --
> > > > 2.7.4
> > > >
next prev parent reply other threads:[~2018-05-10 8:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-07 6:50 Jiayu Hu
2018-05-08 2:49 ` Tiwei Bie
2018-05-08 7:44 ` Jiayu Hu
2018-05-10 5:04 ` Tiwei Bie
2018-05-10 8:33 ` Hu, Jiayu [this message]
2018-05-08 8:14 ` [dpdk-dev] [PATCH v2] " Jiayu Hu
2018-05-09 2:58 ` Yao, Lei A
2018-05-11 7:26 ` [dpdk-dev] [PATCH v3] " Jiayu Hu
2018-05-11 7:33 ` Tiwei Bie
2018-05-11 7:45 ` Yang, Zhiyong
2018-05-16 6:05 ` 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=ED946F0BEFE0A141B63BABBD629A2A9B388BC57D@shsmsx102.ccr.corp.intel.com \
--to=jiayu.hu@intel.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.com \
--cc=tiwei.bie@intel.com \
--cc=zhiyong.yang@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).