DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] virtio: fix the vq size issue
@ 2015-07-01  7:48 Ouyang Changchun
  2015-07-01  8:55 ` Xu, Qian Q
                   ` (3 more replies)
  0 siblings, 4 replies; 21+ messages in thread
From: Ouyang Changchun @ 2015-07-01  7:48 UTC (permalink / raw)
  To: dev

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 packet 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.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
 drivers/net/virtio/virtio_ethdev.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

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 = 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 == 0)
-		nb_desc = vq_size;
 	if (vq_size == 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;
 	}
 
-	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 = nb_desc;
-	}
+	if (nb_desc != 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);
 
 	if (queue_type == VTNET_RQ) {
 		snprintf(vq_name, sizeof(vq_name), "port%d_rvq%d",
-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2015-07-21  5:23 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-01  7:48 [dpdk-dev] [PATCH] virtio: fix the vq size issue Ouyang Changchun
2015-07-01  8:55 ` Xu, Qian Q
2015-07-01 15:53 ` Xie, Huawei
2015-07-02  0:29   ` Ouyang, Changchun
2015-07-02  2:01     ` Xie, Huawei
2015-07-02  2:16       ` Ouyang, Changchun
2015-07-02  9:15         ` Xie, Huawei
2015-07-03  1:53           ` Ouyang, Changchun
2015-07-10 14:05   ` Xie, Huawei
2015-07-10 14:11     ` Thomas Monjalon
2015-07-13  1:40       ` Ouyang, Changchun
2015-07-07  2:32 ` Ouyang, Changchun
2015-07-17 10:42   ` Thomas Monjalon
2015-07-17 16:27 ` Stephen Hemminger
2015-07-18 12:11   ` Ouyang, Changchun
2015-07-20 15:47     ` Stephen Hemminger
2015-07-20  3:40   ` Xu, Qian Q
2015-07-20  6:18     ` Ouyang, Changchun
2015-07-20 10:42       ` Thomas Monjalon
2015-07-21  5:23         ` Ouyang, Changchun
2015-07-20 15:30       ` Stephen Hemminger

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).