From: Tiwei Bie <tiwei.bie@intel.com>
To: mst@redhat.com, jasowang@redhat.com,
virtualization@lists.linux-foundation.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
virtio-dev@lists.oasis-open.org
Cc: wexu@redhat.com, jfreimann@redhat.com, tiwei.bie@intel.com
Subject: [PATCH net-next v2 1/5] virtio: add packed ring definitions
Date: Wed, 11 Jul 2018 10:27:07 +0800 [thread overview]
Message-ID: <20180711022711.7090-2-tiwei.bie@intel.com> (raw)
In-Reply-To: <20180711022711.7090-1-tiwei.bie@intel.com>
Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
---
include/uapi/linux/virtio_config.h | 3 +++
include/uapi/linux/virtio_ring.h | 43 ++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+)
diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h
index 449132c76b1c..1196e1c1d4f6 100644
--- a/include/uapi/linux/virtio_config.h
+++ b/include/uapi/linux/virtio_config.h
@@ -75,6 +75,9 @@
*/
#define VIRTIO_F_IOMMU_PLATFORM 33
+/* This feature indicates support for the packed virtqueue layout. */
+#define VIRTIO_F_RING_PACKED 34
+
/*
* Does the device support Single Root I/O Virtualization?
*/
diff --git a/include/uapi/linux/virtio_ring.h b/include/uapi/linux/virtio_ring.h
index 6d5d5faa989b..0254a2ba29cf 100644
--- a/include/uapi/linux/virtio_ring.h
+++ b/include/uapi/linux/virtio_ring.h
@@ -44,6 +44,10 @@
/* This means the buffer contains a list of buffer descriptors. */
#define VRING_DESC_F_INDIRECT 4
+/* Mark a descriptor as available or used. */
+#define VRING_DESC_F_AVAIL (1ul << 7)
+#define VRING_DESC_F_USED (1ul << 15)
+
/* The Host uses this in used->flags to advise the Guest: don't kick me when
* you add a buffer. It's unreliable, so it's simply an optimization. Guest
* will still kick if it's out of buffers. */
@@ -53,6 +57,17 @@
* optimization. */
#define VRING_AVAIL_F_NO_INTERRUPT 1
+/* Enable events. */
+#define VRING_EVENT_F_ENABLE 0x0
+/* Disable events. */
+#define VRING_EVENT_F_DISABLE 0x1
+/*
+ * Enable events for a specific descriptor
+ * (as specified by Descriptor Ring Change Event Offset/Wrap Counter).
+ * Only valid if VIRTIO_RING_F_EVENT_IDX has been negotiated.
+ */
+#define VRING_EVENT_F_DESC 0x2
+
/* We support indirect buffer descriptors */
#define VIRTIO_RING_F_INDIRECT_DESC 28
@@ -171,4 +186,32 @@ static inline int vring_need_event(__u16 event_idx, __u16 new_idx, __u16 old)
return (__u16)(new_idx - event_idx - 1) < (__u16)(new_idx - old);
}
+struct vring_packed_desc_event {
+ /* Descriptor Ring Change Event Offset/Wrap Counter. */
+ __virtio16 off_wrap;
+ /* Descriptor Ring Change Event Flags. */
+ __virtio16 flags;
+};
+
+struct vring_packed_desc {
+ /* Buffer Address. */
+ __virtio64 addr;
+ /* Buffer Length. */
+ __virtio32 len;
+ /* Buffer ID. */
+ __virtio16 id;
+ /* The flags depending on descriptor type. */
+ __virtio16 flags;
+};
+
+struct vring_packed {
+ unsigned int num;
+
+ struct vring_packed_desc *desc;
+
+ struct vring_packed_desc_event *driver;
+
+ struct vring_packed_desc_event *device;
+};
+
#endif /* _UAPI_LINUX_VIRTIO_RING_H */
--
2.18.0
next prev parent reply other threads:[~2018-07-11 2:27 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-11 2:27 [PATCH net-next v2 0/5] virtio: support packed ring Tiwei Bie
2018-07-11 2:27 ` Tiwei Bie [this message]
2018-09-07 13:51 ` [PATCH net-next v2 1/5] virtio: add packed ring definitions Michael S. Tsirkin
2018-09-10 2:13 ` Tiwei Bie
2018-09-12 12:53 ` Michael S. Tsirkin
2018-07-11 2:27 ` [PATCH net-next v2 2/5] virtio_ring: support creating packed ring Tiwei Bie
2018-09-07 14:03 ` Michael S. Tsirkin
2018-09-10 2:28 ` Tiwei Bie
2018-09-12 7:51 ` Tiwei Bie
2018-09-12 16:12 ` Michael S. Tsirkin
2018-09-12 12:45 ` Michael S. Tsirkin
2018-07-11 2:27 ` [PATCH net-next v2 3/5] virtio_ring: add packed ring support Tiwei Bie
2018-09-07 13:49 ` Michael S. Tsirkin
2018-09-10 2:03 ` Tiwei Bie
2018-09-12 16:22 ` Michael S. Tsirkin
2018-11-07 17:48 ` Michael S. Tsirkin
2018-11-08 1:38 ` Tiwei Bie
2018-11-08 8:18 ` Jason Wang
2018-11-08 11:51 ` Tiwei Bie
2018-11-08 15:56 ` Michael S. Tsirkin
2018-11-09 1:50 ` Tiwei Bie
2018-11-09 2:30 ` Jason Wang
2018-11-09 4:00 ` Michael S. Tsirkin
2018-11-09 10:05 ` Jason Wang
2018-11-08 14:14 ` Michael S. Tsirkin
2018-11-09 2:25 ` Jason Wang
2018-11-09 3:58 ` Michael S. Tsirkin
2018-11-09 10:04 ` Jason Wang
2018-07-11 2:27 ` [PATCH net-next v2 4/5] virtio_ring: add event idx support in packed ring Tiwei Bie
2018-09-07 14:10 ` Michael S. Tsirkin
2018-09-10 2:35 ` [virtio-dev] " Tiwei Bie
2018-07-11 2:27 ` [PATCH net-next v2 5/5] virtio_ring: enable " Tiwei Bie
2018-07-11 2:52 ` [PATCH net-next v2 0/5] virtio: support " Jason Wang
2018-07-12 21:44 ` David Miller
2018-07-13 0:52 ` Jason Wang
2018-07-13 3:26 ` Michael S. Tsirkin
2018-08-27 14:00 ` Michael S. Tsirkin
2018-08-28 5:51 ` [virtio-dev] " Jens Freimann
2018-09-07 1:22 ` Tiwei Bie
2018-09-07 13:00 ` Michael S. Tsirkin
2018-09-10 3:00 ` Tiwei Bie
2018-09-10 3:33 ` Jason Wang
2018-09-11 5:37 ` Tiwei Bie
2018-09-12 16:16 ` Michael S. Tsirkin
2018-09-13 8:59 ` Tiwei Bie
2018-09-13 9:47 ` Jason Wang
2018-10-10 14:36 ` Michael S. Tsirkin
2018-10-11 12:12 ` Tiwei Bie
2018-10-11 13:48 ` Michael S. Tsirkin
2018-10-11 14:13 ` Tiwei Bie
2018-10-11 14:17 ` Michael S. Tsirkin
2018-10-11 14:34 ` Tiwei Bie
2018-09-12 13:06 ` Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180711022711.7090-2-tiwei.bie@intel.com \
--to=tiwei.bie@intel.com \
--cc=jasowang@redhat.com \
--cc=jfreimann@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=virtio-dev@lists.oasis-open.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=wexu@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).