lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200716072327.5359-7-eli@mellanox.com>
Date:   Thu, 16 Jul 2020 10:23:23 +0300
From:   Eli Cohen <eli@...lanox.com>
To:     mst@...hat.com, jasowang@...hat.com,
        virtualization@...ts.linux-foundation.org,
        linux-kernel@...r.kernel.org
Cc:     shahafs@...lanox.com, saeedm@...lanox.com,
        Eli Cohen <eli@...lanox.com>, Parav Pandit <parav@...lanox.com>
Subject: [PATCH vhost next 06/10] vdpa: Add means to communicate vq status on get_vq_state

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 <parav@...lanox.com>
Signed-off-by: Eli Cohen <eli@...lanox.com>
---
 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ