From patchwork Sat Jan 28 03:06:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Chen X-Patchwork-Id: 122608 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3C37E424A6; Sat, 28 Jan 2023 04:05:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CEB4740223; Sat, 28 Jan 2023 04:05:16 +0100 (CET) Received: from out29-127.mail.aliyun.com (out29-127.mail.aliyun.com [115.124.29.127]) by mails.dpdk.org (Postfix) with ESMTP id 2605640146 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=0|0|0|0|0|-1|-1|-1; HT=ay29a033018047207; MF=chenh@yusur.tech; NM=1; PH=DS; RN=5; RT=5; SR=0; TI=SMTPD_---.R2UgSrQ_1674875111; Received: from localhost.localdomain(mailfrom:chenh@yusur.tech fp:SMTPD_---.R2UgSrQ_1674875111) by smtp.aliyun-inc.com; Sat, 28 Jan 2023 11:05:12 +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:02 +0800 Message-Id: <20230128030603.1168073-1-chenh@yusur.tech> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 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))