From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <tiwei.bie@intel.com>
Received: from mga03.intel.com (mga03.intel.com [134.134.136.65])
 by dpdk.org (Postfix) with ESMTP id C78A9CFFE;
 Thu, 10 May 2018 16:19:01 +0200 (CEST)
X-Amp-Result: UNSCANNABLE
X-Amp-File-Uploaded: False
Received: from orsmga003.jf.intel.com ([10.7.209.27])
 by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 10 May 2018 07:19:00 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.49,385,1520924400"; d="scan'208";a="49790982"
Received: from debian.sh.intel.com (HELO debian) ([10.67.104.164])
 by orsmga003.jf.intel.com with ESMTP; 10 May 2018 07:18:59 -0700
Date: Thu, 10 May 2018 22:19:32 +0800
From: Tiwei Bie <tiwei.bie@intel.com>
To: "Yang, Zhiyong" <zhiyong.yang@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>
Message-ID: <20180510141932.pjaidtsm7ufbls4t@debian>
References: <20180509094936.62796-1-zhiyong.yang@intel.com>
 <20180510093623.82588-1-zhiyong.yang@intel.com>
 <20180510102322.ps6n7s4rer5hvnxp@debian>
 <E182254E98A5DA4EB1E657AC7CB9BD2A8B0BDD03@BGSMSX101.gar.corp.intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <E182254E98A5DA4EB1E657AC7CB9BD2A8B0BDD03@BGSMSX101.gar.corp.intel.com>
User-Agent: NeoMutt/20170113 (1.7.2)
Subject: Re: [dpdk-dev] [PATCH v2] net/virtio-user: fix multiple queues fail
 in server mode
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://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 10 May 2018 14:19:04 -0000

On Thu, May 10, 2018 at 10:01:55PM +0800, Yang, Zhiyong wrote:
> 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 ?

Sound good.

Thanks