[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220126073533.44994-5-xuanzhuo@linux.alibaba.com>
Date: Wed, 26 Jan 2022 15:35:20 +0800
From: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
To: virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org
Cc: "Michael S. Tsirkin" <mst@...hat.com>,
Jason Wang <jasowang@...hat.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Jesper Dangaard Brouer <hawk@...nel.org>,
John Fastabend <john.fastabend@...il.com>, bpf@...r.kernel.org
Subject: [PATCH v3 04/17] virtio: queue_reset: add helper
Add helper for virtio queue reset.
* virtio_reset_vq: reset a queue individually
* virtio_enable_resetq: enable a reset queue
Signed-off-by: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
---
include/linux/virtio_config.h | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 51dd8461d1b6..3c971d9a0a59 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -260,6 +260,38 @@ int virtio_find_vqs_ctx(struct virtio_device *vdev, unsigned nvqs,
desc);
}
+/**
+ * virtio_reset_vq - reset a queue individually
+ * @param: struct virtio_reset_vq
+ *
+ * returns 0 on success or error status
+ *
+ */
+static inline
+int virtio_reset_vq(struct virtio_reset_vq *param)
+{
+ if (!param->vdev->config->reset_vq)
+ return -ENOENT;
+
+ return param->vdev->config->reset_vq(param);
+}
+
+/**
+ * virtio_enable_resetq - enable a reset queue
+ * @param: struct virtio_reset_vq
+ *
+ * returns vq on success or error status
+ *
+ */
+static inline
+struct virtqueue *virtio_enable_resetq(struct virtio_reset_vq *param)
+{
+ if (!param->vdev->config->enable_reset_vq)
+ return ERR_PTR(-ENOENT);
+
+ return param->vdev->config->enable_reset_vq(param);
+}
+
/**
* virtio_device_ready - enable vq use in probe function
* @vdev: the device
--
2.31.0
Powered by blists - more mailing lists