From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <changchun.ouyang@intel.com>
Received: from mga11.intel.com (mga11.intel.com [192.55.52.93])
 by dpdk.org (Postfix) with ESMTP id 4AB381DB1
 for <dev@dpdk.org>; Thu,  2 Jul 2015 02:29:46 +0200 (CEST)
Received: from fmsmga003.fm.intel.com ([10.253.24.29])
 by fmsmga102.fm.intel.com with ESMTP; 01 Jul 2015 17:29:41 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.15,389,1432623600"; d="scan'208";a="517504349"
Received: from pgsmsx108.gar.corp.intel.com ([10.221.44.103])
 by FMSMGA003.fm.intel.com with ESMTP; 01 Jul 2015 17:29:40 -0700
Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by
 PGSMSX108.gar.corp.intel.com (10.221.44.103) with Microsoft SMTP Server (TLS)
 id 14.3.224.2; Thu, 2 Jul 2015 08:29:39 +0800
Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.165]) by
 SHSMSX101.ccr.corp.intel.com ([169.254.1.246]) with mapi id 14.03.0224.002;
 Thu, 2 Jul 2015 08:29:38 +0800
From: "Ouyang, Changchun" <changchun.ouyang@intel.com>
To: "Xie, Huawei" <huawei.xie@intel.com>, "dev@dpdk.org" <dev@dpdk.org>,
 Thomas Monjalon <thomas.monjalon@6wind.com>
Thread-Topic: [dpdk-dev] [PATCH] virtio: fix the vq size issue
Thread-Index: AQHQs9JlQEOaxBUIeEyxKL7zRjwCJJ3HUlRQ
Date: Thu, 2 Jul 2015 00:29:37 +0000
Message-ID: <F52918179C57134FAEC9EA62FA2F962511BDCE1F@shsmsx102.ccr.corp.intel.com>
References: <1435736930-26737-1-git-send-email-changchun.ouyang@intel.com>
 <C37D651A908B024F974696C65296B57B0F5504FB@SHSMSX101.ccr.corp.intel.com>
In-Reply-To: <C37D651A908B024F974696C65296B57B0F5504FB@SHSMSX101.ccr.corp.intel.com>
Accept-Language: zh-CN, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-originating-ip: [10.239.127.40]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH] virtio: fix the vq size issue
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://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: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 02 Jul 2015 00:29:46 -0000

Hi huawei,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Xie, Huawei
> Sent: Wednesday, July 1, 2015 11:53 PM
> To: dev@dpdk.org; Thomas Monjalon
> Subject: Re: [dpdk-dev] [PATCH] virtio: fix the vq size issue
>=20
> On 7/1/2015 3:49 PM, Ouyang Changchun wrote:
> > This commit breaks virtio basic packets rx functionality:
> >   d78deadae4dca240e85054bf2d604a801676becc
> >
> > The QEMU use 256 as default vring size, also use this default value to
> > calculate the virtio avail ring base address and used ring base
> > address, and vhost in the backend use the ring base address to do packe=
t
> IO.
> >
> > Virtio spec also says the queue size in PCI configuration is
> > read-only, so virtio front end can't change it. just need use the
> > read-only value to allocate space for vring and calculate the avail
> > and used ring base address. Otherwise, the avail and used ring base
> address will be different between host and guest, accordingly, packet IO
> can't work normally.
> virtio driver could still use the vq_size to initialize avail ring and us=
e ring so
> that they still have the same base address.
> The other issue is vhost use  index & (vq->size -1) to index the ring.

I am not sure what is your clear message here,
Vhost has no choice but use vq->size -1 to index the ring,=20
It is qemu that always use 256 as the vq size, and set the avail and used r=
ing base address,
It also tells vhost the vq size is 256.

>=20
>=20
> Thomas:
> This fix works but introduces slight change with original code. Could we =
just
> rollback that commit?
What's your major concern for the slight change here?
just removing the unnecessary check for nb_desc itself.
So I think no issue for the slight change. =20

Thanks
Changchun