DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Yang, Zhiyong" <zhiyong.yang@intel.com>
To: "Bie, Tiwei" <tiwei.bie@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"stable@dpdk.org" <stable@dpdk.org>,
	"maxime.coquelin@redhat.com" <maxime.coquelin@redhat.com>,
	"Yigit, Ferruh" <ferruh.yigit@intel.com>
Subject: Re: [dpdk-dev] [PATCH v2] net/virtio-user: fix multiple queues fail in server mode
Date: Thu, 10 May 2018 14:01:55 +0000	[thread overview]
Message-ID: <E182254E98A5DA4EB1E657AC7CB9BD2A8B0BDD03@BGSMSX101.gar.corp.intel.com> (raw)
In-Reply-To: <20180510102322.ps6n7s4rer5hvnxp@debian>

Hi tiwei,

Thanks for your review firstly.  Reply inline.

> -----Original Message-----
> From: Bie, Tiwei
> Sent: Thursday, May 10, 2018 6:23 PM
> To: Yang, Zhiyong <zhiyong.yang@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org; maxime.coquelin@redhat.com; Yigit,
> Ferruh <ferruh.yigit@intel.com>
> Subject: Re: [PATCH v2] net/virtio-user: fix multiple queues fail in server
> mode
> 
> On Thu, May 10, 2018 at 05:36:23PM +0800, zhiyong.yang@intel.com wrote:
> > This patch fixes multiple queues failure when virtio-user works in
> > server mode.
> >
> > This patch adds feature negotiation in the processing of virtio-user
> > reccnnection.
> 
> typo: reccnnection
> 

Fix it.

> >
> > Fixes: bd8f50a45d0f ("net/virtio-user: support server mode")
> >
> > Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
> > ---
> >
> > Changes in V2:
> > 1. fix a comment typo.
> > 2. add feature negotiation in the processing of reconnection.
> >
> >  drivers/net/virtio/virtio_user/vhost_user.c      |  3 +++
> >  drivers/net/virtio/virtio_user/virtio_user_dev.c | 14 ++++++++++----
> >  drivers/net/virtio/virtio_user_ethdev.c          | 20
> ++++++++++++++++++++
> >  3 files changed, 33 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/virtio/virtio_user/vhost_user.c
> > b/drivers/net/virtio/virtio_user/vhost_user.c
> > index a6df97a..93e4d92 100644
> > --- a/drivers/net/virtio/virtio_user/vhost_user.c
> > +++ b/drivers/net/virtio/virtio_user/vhost_user.c
> > @@ -263,6 +263,9 @@ struct hugepage_file_info {
> >
> >  	PMD_DRV_LOG(INFO, "%s", vhost_msg_strings[req]);
> >
> > +	if (dev->is_server && vhostfd < 0)
> > +		return -1;
> > +
> >  	msg.request = req;
> >  	msg.flags = VHOST_USER_VERSION;
> >  	msg.size = 0;
> > diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c
> > b/drivers/net/virtio/virtio_user/virtio_user_dev.c
> > index 38b8bc9..b7e1915 100644
> > --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
> > +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
> > @@ -447,10 +447,16 @@ int virtio_user_stop_device(struct
> virtio_user_dev *dev)
> >  		return -1;
> >  	}
> >
> > -	for (i = 0; i < q_pairs; ++i)
> > -		ret |= dev->ops->enable_qp(dev, i, 1);
> > -	for (i = q_pairs; i < dev->max_queue_pairs; ++i)
> > -		ret |= dev->ops->enable_qp(dev, i, 0);
> > +	/* Server mode can't enable queue pairs if vhostfd is invalid,
> > +	 * always return 0 in this case.
> > +	 */
> > +	if (dev->vhostfd >= 0)  {
> > +		for (i = 0; i < q_pairs; ++i)
> > +			ret |= dev->ops->enable_qp(dev, i, 1);
> > +		for (i = q_pairs; i < dev->max_queue_pairs; ++i)
> > +			ret |= dev->ops->enable_qp(dev, i, 0);
> > +	} else if (!dev->is_server)
> > +		ret = ~0;
> 
> You need to find a chance to enable these queue pairs when the connection
> is established.
> 
Enable only one queue pairs in virtio_user_start_device.
 I want to call virtio_user_handle_mq after virtio_user_start_device in virtio_user_server_reconnect. How about ?

> >
> >  	dev->queue_pairs = q_pairs;
> >
> > diff --git a/drivers/net/virtio/virtio_user_ethdev.c
> > b/drivers/net/virtio/virtio_user_ethdev.c
> > index 4e7b3c3..91a0c44 100644
> > --- a/drivers/net/virtio/virtio_user_ethdev.c
> > +++ b/drivers/net/virtio/virtio_user_ethdev.c
> > @@ -30,6 +30,7 @@
> >  	int ret;
> >  	int flag;
> >  	int connectfd;
> > +	uint64_t features = dev->device_features, status;
> >  	struct rte_eth_dev *eth_dev = &rte_eth_devices[dev->port_id];
> >
> >  	connectfd = accept(dev->listenfd, NULL, NULL); @@ -37,6 +38,25
> @@
> >  		return -1;
> >
> >  	dev->vhostfd = connectfd;
> > +	if (dev->ops->send_request(dev, VHOST_USER_GET_FEATURES,
> > +				   &dev->device_features) < 0) {
> > +		PMD_INIT_LOG(ERR, "get_features failed: %s",
> > +			     strerror(errno));
> > +		return -1;
> > +	}
> > +
> > +	status = features & ~dev->device_features;
> 
> There is no need to introduce `status`.
> 
Ok, remove it.

> > +	/* For following bits, vhost-user doesn't really need to know */
> > +	status &= ~(1ull << VIRTIO_NET_F_MAC);
> > +	status &= ~(1ull << VIRTIO_NET_F_CTRL_VLAN);
> > +	status &= ~(1ull << VIRTIO_NET_F_CTRL_MAC_ADDR);
> > +	status &= ~(1ull << VIRTIO_NET_F_STATUS);
> > +	if (status)
> > +		PMD_INIT_LOG(ERR, "WARNING: Some features (0x%lx) are
> not supported
> > +by vhost-user!",
> 
> You will want to use PRIx64 here.
> 
Ok.

Thanks
Zhiyong

  reply	other threads:[~2018-05-10 14:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-09  9:49 [dpdk-dev] [PATCH] " zhiyong.yang
2018-05-09 14:48 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2018-05-10  0:48   ` Tiwei Bie
2018-05-10  1:28   ` Yang, Zhiyong
2018-05-10  1:38     ` Yang, Zhiyong
2018-05-10  2:47 ` [dpdk-dev] " Tiwei Bie
2018-05-10  3:04   ` Yang, Zhiyong
2018-05-10  4:42     ` Tiwei Bie
2018-05-10  9:36 ` [dpdk-dev] [PATCH v2] " zhiyong.yang
2018-05-10 10:23   ` Tiwei Bie
2018-05-10 14:01     ` Yang, Zhiyong [this message]
2018-05-10 14:19       ` Tiwei Bie
2018-05-11  2:12   ` [dpdk-dev] [PATCH v3] " zhiyong.yang
2018-05-11  2:49     ` Tiwei Bie
2018-05-11  3:01       ` Yang, Zhiyong
2018-05-11  3:31     ` [dpdk-dev] [PATCH v4] " zhiyong.yang
2018-05-11 11:33       ` Ferruh Yigit

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=E182254E98A5DA4EB1E657AC7CB9BD2A8B0BDD03@BGSMSX101.gar.corp.intel.com \
    --to=zhiyong.yang@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    --cc=tiwei.bie@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).