From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 5A99F106B for ; Tue, 7 Jul 2015 04:32:44 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 06 Jul 2015 19:32:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,419,1432623600"; d="scan'208";a="757256229" Received: from pgsmsx105.gar.corp.intel.com ([10.221.44.96]) by fmsmga002.fm.intel.com with ESMTP; 06 Jul 2015 19:32:42 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by PGSMSX105.gar.corp.intel.com (10.221.44.96) with Microsoft SMTP Server (TLS) id 14.3.224.2; Tue, 7 Jul 2015 10:32:38 +0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.165]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.46]) with mapi id 14.03.0224.002; Tue, 7 Jul 2015 10:32:36 +0800 From: "Ouyang, Changchun" To: "dev@dpdk.org" Thread-Topic: [PATCH] virtio: fix the vq size issue Thread-Index: AQHQs9JlQEOaxBUIeEyxKL7zRjwCJJ3PUo4g Date: Tue, 7 Jul 2015 02:32:36 +0000 Message-ID: References: <1435736930-26737-1-git-send-email-changchun.ouyang@intel.com> In-Reply-To: <1435736930-26737-1-git-send-email-changchun.ouyang@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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jul 2015 02:32:44 -0000 > -----Original Message----- > From: Ouyang, Changchun > Sent: Wednesday, July 1, 2015 3:49 PM > To: dev@dpdk.org > Cc: Cao, Waterman; Xu, Qian Q; Ouyang, Changchun > Subject: [PATCH] virtio: fix the vq size issue >=20 > This commit breaks virtio basic packets rx functionality: > d78deadae4dca240e85054bf2d604a801676becc >=20 > 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 packet IO. >=20 > Virtio spec also says the queue size in PCI configuration is read-only, s= o 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. >=20 > Signed-off-by: Changchun Ouyang > --- > drivers/net/virtio/virtio_ethdev.c | 14 +++----------- > 1 file changed, 3 insertions(+), 11 deletions(-) >=20 > diff --git a/drivers/net/virtio/virtio_ethdev.c > b/drivers/net/virtio/virtio_ethdev.c > index fe5f9a1..d84de13 100644 > --- a/drivers/net/virtio/virtio_ethdev.c > +++ b/drivers/net/virtio/virtio_ethdev.c > @@ -263,8 +263,6 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev, > */ > vq_size =3D VIRTIO_READ_REG_2(hw, VIRTIO_PCI_QUEUE_NUM); > PMD_INIT_LOG(DEBUG, "vq_size: %d nb_desc:%d", vq_size, > nb_desc); > - if (nb_desc =3D=3D 0) > - nb_desc =3D vq_size; > if (vq_size =3D=3D 0) { > PMD_INIT_LOG(ERR, "%s: virtqueue does not exist", > __func__); > return -EINVAL; > @@ -275,15 +273,9 @@ int virtio_dev_queue_setup(struct rte_eth_dev > *dev, > return -EINVAL; > } >=20 > - if (nb_desc < vq_size) { > - if (!rte_is_power_of_2(nb_desc)) { > - PMD_INIT_LOG(ERR, > - "nb_desc(%u) size is not powerof 2", > - nb_desc); > - return -EINVAL; > - } > - vq_size =3D nb_desc; > - } > + if (nb_desc !=3D vq_size) > + PMD_INIT_LOG(ERR, "Warning: nb_desc(%d) is not equal to > vq size (%d), fall to vq size", > + nb_desc, vq_size); >=20 > if (queue_type =3D=3D VTNET_RQ) { > snprintf(vq_name, sizeof(vq_name), "port%d_rvq%d", > -- > 1.8.4.2 Any more comments for this patch? Thanks Changchun