From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 12CF3A0516; Tue, 9 Jun 2020 13:16:00 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DE1AD2952; Tue, 9 Jun 2020 13:15:59 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 8AEA22862 for ; Tue, 9 Jun 2020 13:15:58 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from matan@mellanox.com) with SMTP; 9 Jun 2020 14:15:52 +0300 Received: from pegasus25.mtr.labs.mlnx. (pegasus25.mtr.labs.mlnx [10.210.16.10]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 059BFq01021185; Tue, 9 Jun 2020 14:15:52 +0300 From: Matan Azrad To: Maxime Coquelin , Xiao Wang Cc: dev@dpdk.org Date: Tue, 9 Jun 2020 11:15:46 +0000 Message-Id: <1591701346-210050-1-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [RFC] vhost: fix vDPA driver configuration timing X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The vhost virtio standard has multi-queue feature. The master side defines the meximum supported queues number and the slave can choose to work with all the queues or only with part of them. The vhost library, which manages the host side, expects to see configuration of all the queues before the device becomes ready even if the guest doesn't enable all the queues. So, if the guest doesn't enable all the queues, the vhost library never notifies the application on the new device and never triggers the vDPA driver configuration. Remove disabled queues ready check. Also no need anymore callfd validation as last command. Signed-off-by: Matan Azrad --- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 4 +++- lib/librte_vhost/vhost_user.c | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c index 86aded2..8cbeef4 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c @@ -179,6 +179,8 @@ ret = rte_vhost_get_vhost_vring(priv->vid, index, &vq); if (ret) return -1; + DRV_LOG(DEBUG, "virtq %d info: size = %d, callfd = %d, kickfd = %d.", + index, (int)vq.size, vq.callfd, vq.kickfd); virtq->index = index; virtq->vq_size = vq.size; attr.tso_ipv4 = !!(priv->features & (1ULL << VIRTIO_NET_F_HOST_TSO4)); @@ -421,7 +423,7 @@ for (i = 0; i < nr_vring; i++) { claim_zero(rte_vhost_enable_guest_notification(priv->vid, i, 1)); - if (mlx5_vdpa_virtq_setup(priv, i)) + if (priv->virtqs[i].enable && mlx5_vdpa_virtq_setup(priv, i)) goto error; } return 0; diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 84bebad..d030d60 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -1298,6 +1298,9 @@ if (!vq) return false; + if (!vq->enabled) + return true; + if (vq_is_packed(dev)) rings_ok = vq->desc_packed && vq->driver_event && vq->device_event; @@ -1315,7 +1318,7 @@ struct vhost_virtqueue *vq; uint32_t i; - if (dev->nr_vring == 0) + if (dev->nr_vring == 0 || !dev->mem) return 0; for (i = 0; i < dev->nr_vring; i++) { -- 1.8.3.1