From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6685D424A6; Sat, 28 Jan 2023 04:05:23 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9C5A3410DC; Sat, 28 Jan 2023 04:05:18 +0100 (CET) Received: from out28-195.mail.aliyun.com (out28-195.mail.aliyun.com [115.124.28.195]) by mails.dpdk.org (Postfix) with ESMTP id 0E4E540146 for ; Sat, 28 Jan 2023 04:05:14 +0100 (CET) X-Alimail-AntiSpam: AC=CONTINUE; BC=0.1630338|-1; CH=green; DM=|CONTINUE|false|; DS=CONTINUE|ham_system_inform|0.00922433-0.000737289-0.990038; FP=2397808728432252117|1|1|3|0|-1|-1|-1; HT=ay29a033018047209; MF=chenh@yusur.tech; NM=1; PH=DS; RN=5; RT=5; SR=0; TI=SMTPD_---.R2UgStu_1674875112; Received: from localhost.localdomain(mailfrom:chenh@yusur.tech fp:SMTPD_---.R2UgStu_1674875112) by smtp.aliyun-inc.com; Sat, 28 Jan 2023 11:05:13 +0800 From: Hao Chen To: dev@dpdk.org Cc: zy@yusur.tech, huangml@yusur.tech, Maxime Coquelin , Chenbo Xia Subject: [PATCH] vhost: fix vdpa driver multi-queue initialization failure Date: Sat, 28 Jan 2023 11:06:03 +0800 Message-Id: <20230128030603.1168073-2-chenh@yusur.tech> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230128030603.1168073-1-chenh@yusur.tech> References: <20230128030603.1168073-1-chenh@yusur.tech> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org When 'virtio_is_Ready' returns 1, 'vdpa_dev->ops->dev_conf' will be called, and the vdpa driver called 'rte_vhost_get_vhost_vring' to get the vring addr info from 'vhost_devices->virtqueue[]'. virtio_is_ready's nr_vring is VIRTIO_BUILTIN_NUM_VQS_TO_BE_READY(2), multi-queue's nr_vring is greater than 2. Only 'vhost_devices->virtqueue[0]' and 'vhost_devices->virtqueue[1]' are obtained in the for loop. Other queues of multiple queues cannot obtain the corresponding 'vhost_devices->virtqueue[i]', which will cause 'vdpa_dev->ops->dev_conf' to obtain QEMU vring addr information from 'vhost_devices->virtqueue[i]' failed. Here, nr_ving is modified to dev->nr_vring, so that multiple queues can obtain the corresponding 'vhost_devices->virtqueue[i]'. Signed-off-by: Hao Chen --- lib/vhost/vhost_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c index 9902ae9944..9249eafc06 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/vhost/vhost_user.c @@ -1473,7 +1473,7 @@ virtio_is_ready(struct virtio_net *dev) if (dev->nr_vring < nr_vring) return 0; - for (i = 0; i < nr_vring; i++) { + for (i = 0; i < dev->nr_vring; i++) { vq = dev->virtqueue[i]; if (!vq_is_ready(dev, vq)) -- 2.27.0