Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1019736ybh; Thu, 16 Jul 2020 00:26:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfESkRSmuP8IjvxVPu2We7udSpyXnd31JttQW4xMZ04qsKUnVWVDKBwvpVZY32vE/91L+5 X-Received: by 2002:a50:ab53:: with SMTP id t19mr3261528edc.179.1594884363745; Thu, 16 Jul 2020 00:26:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594884363; cv=none; d=google.com; s=arc-20160816; b=wiHDCeOlE2wtb9umZGfHMjc2fdzlpdF8HGztYRTCWZBvBSJdyLY9sBJFvJk5mAN5cs 8Hn8rabhLDAByNsucgs3u+dRdLsdaxjvXcGd2k3fPqhMYZm38X/muMp+JxYXqtxglxeb iuCkjfblVcsN9XylFsF5LRapWd1Dy4hb5BDxh3FOEQWt0MgR65QcTLTVYIB75+uYNzPA JrNSxF+sCTzjhIaE78Hig7GJOKwHP2ja/AyRutXSzAIaFAN9NfeZ4zlD29HYUqcs0SgI XzypApCvtuZ5hWbbnabAYalOFk067UNpdVC8u9c7DJ9UzyLlUUoWRkUc44DMYlRY6g7G ti9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=p9aASD80uBO2zwakE2LGKEwM6JqpAQlhY8G5PCzPosw=; b=b/VD4nnjLM5IjvPfrm05lvxzAaR7da3AINxrz2hOIOHq3uqosjoWy7B28boRvoyKpF q++JSMBe0rJ+Oln1PmeQaqDtj6/c2b3GAMhc+/9ygm4o2mAPMMnpfl0rz4wNqEJpMUFd EDjumd/JS38mXTXqU1ZqHc6+3f3ibfrCAVnpIOnVm4z8/fQwmiWhW5hL+GdwQqw5l45+ EK0qkXPHneGd1d5R2uNioV8ewwuVt3dIBjA/pOblHssD1cwTXWRZiZZDh2spyxEmiHic nUpB1IZCCvFMaXhW2ojgDbI/e5r8l2v5s49cA0YOYCfSjb6FrbTYMZJUROMc+WKtOhRD UTqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lg17si2683015ejb.440.2020.07.16.00.25.41; Thu, 16 Jul 2020 00:26:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728347AbgGPHXl (ORCPT + 99 others); Thu, 16 Jul 2020 03:23:41 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:60002 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728326AbgGPHXl (ORCPT ); Thu, 16 Jul 2020 03:23:41 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from eli@mellanox.com) with SMTP; 16 Jul 2020 10:23:36 +0300 Received: from nps-server-21.mtl.labs.mlnx (nps-server-21.mtl.labs.mlnx [10.237.240.120]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 06G7Na3n006472; Thu, 16 Jul 2020 10:23:36 +0300 Received: from nps-server-21.mtl.labs.mlnx (localhost [127.0.0.1]) by nps-server-21.mtl.labs.mlnx (8.14.7/8.14.7) with ESMTP id 06G7Na65005422; Thu, 16 Jul 2020 10:23:36 +0300 Received: (from eli@localhost) by nps-server-21.mtl.labs.mlnx (8.14.7/8.14.7/Submit) id 06G7Naxj005421; Thu, 16 Jul 2020 10:23:36 +0300 From: Eli Cohen To: mst@redhat.com, jasowang@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Cc: shahafs@mellanox.com, saeedm@mellanox.com, Eli Cohen , Parav Pandit Subject: [PATCH vhost next 06/10] vdpa: Add means to communicate vq status on get_vq_state Date: Thu, 16 Jul 2020 10:23:23 +0300 Message-Id: <20200716072327.5359-7-eli@mellanox.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200716072327.5359-1-eli@mellanox.com> References: <20200716072327.5359-1-eli@mellanox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, get_vq_state() is used only to pass the available index value of a vq. Extend the struct to return status on the VQ to the caller. For now, define VQ_STATE_NOT_READY. In the future it will be extended to include other infomration. Modify current vdpa driver to update this field. Reviewed-by: Parav Pandit Signed-off-by: Eli Cohen --- drivers/vdpa/ifcvf/ifcvf_main.c | 1 + drivers/vdpa/vdpa_sim/vdpa_sim.c | 1 + include/linux/vdpa.h | 9 +++++++++ 3 files changed, 11 insertions(+) diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c index 69032ee97824..77e3b3d91167 100644 --- a/drivers/vdpa/ifcvf/ifcvf_main.c +++ b/drivers/vdpa/ifcvf/ifcvf_main.c @@ -240,6 +240,7 @@ static void ifcvf_vdpa_get_vq_state(struct vdpa_device *vdpa_dev, u16 qid, { struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev); + state->state = vf->vring[qid].ready ? 0 : BIT(VQ_STATE_NOT_READY); state->avail_index = ifcvf_get_vq_state(vf, qid); } diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c index 599519039f8d..06d974b4bd7b 100644 --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c @@ -434,6 +434,7 @@ static void vdpasim_get_vq_state(struct vdpa_device *vdpa, u16 idx, struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx]; struct vringh *vrh = &vq->vring; + state->state = vq->ready ? 0 : BIT(VQ_STATE_NOT_READY); state->avail_index = vrh->last_avail_idx; } diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h index 7b088bebffe8..bcefa30a3b2f 100644 --- a/include/linux/vdpa.h +++ b/include/linux/vdpa.h @@ -27,12 +27,21 @@ struct vdpa_notification_area { resource_size_t size; }; +/** + * Bitmask describing the status of the vq + */ +enum { + VQ_STATE_NOT_READY = 0, +}; + /** * vDPA vq_state definition * @avail_index: available index + * @state: returned status from get_vq_state */ struct vdpa_vq_state { u16 avail_index; + u32 state; }; /** -- 2.27.0