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
Cc: wexu@redhat.com
Subject: [RFC v3 1/5] virtio: add packed ring definitions
Date: Wed, 25 Apr 2018 13:15:46 +0800 [thread overview]
Message-ID: <20180425051550.24342-2-tiwei.bie@intel.com> (raw)
In-Reply-To: <20180425051550.24342-1-tiwei.bie@intel.com>
Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
---
include/uapi/linux/virtio_config.h | 12 +++++++++++-
include/uapi/linux/virtio_ring.h | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+), 1 deletion(-)
diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h
index 308e2096291f..a6e392325e3a 100644
--- a/include/uapi/linux/virtio_config.h
+++ b/include/uapi/linux/virtio_config.h
@@ -49,7 +49,7 @@
* transport being used (eg. virtio_ring), the rest are per-device feature
* bits. */
#define VIRTIO_TRANSPORT_F_START 28
-#define VIRTIO_TRANSPORT_F_END 34
+#define VIRTIO_TRANSPORT_F_END 36
#ifndef VIRTIO_CONFIG_NO_LEGACY
/* Do we get callbacks when the ring is completely used, even if we've
@@ -71,4 +71,14 @@
* this is for compatibility with legacy systems.
*/
#define VIRTIO_F_IOMMU_PLATFORM 33
+
+/* This feature indicates support for the packed virtqueue layout. */
+#define VIRTIO_F_RING_PACKED 34
+
+/*
+ * This feature indicates that all buffers are used by the device
+ * in the same order in which they have been made available.
+ */
+#define VIRTIO_F_IN_ORDER 35
+
#endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */
diff --git a/include/uapi/linux/virtio_ring.h b/include/uapi/linux/virtio_ring.h
index 6d5d5faa989b..3932cb80c347 100644
--- a/include/uapi/linux/virtio_ring.h
+++ b/include/uapi/linux/virtio_ring.h
@@ -44,6 +44,9 @@
/* This means the buffer contains a list of buffer descriptors. */
#define VRING_DESC_F_INDIRECT 4
+#define VRING_DESC_F_AVAIL(b) ((b) << 7)
+#define VRING_DESC_F_USED(b) ((b) << 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 +56,10 @@
* optimization. */
#define VRING_AVAIL_F_NO_INTERRUPT 1
+#define VRING_EVENT_F_ENABLE 0x0
+#define VRING_EVENT_F_DISABLE 0x1
+#define VRING_EVENT_F_DESC 0x2
+
/* We support indirect buffer descriptors */
#define VIRTIO_RING_F_INDIRECT_DESC 28
@@ -171,4 +178,33 @@ 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 {
+ /* __virtio16 off : 15; // Descriptor Event Offset
+ * __virtio16 wrap : 1; // Descriptor Event Wrap Counter */
+ __virtio16 off_wrap;
+ /* __virtio16 flags : 2; // Descriptor 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.11.0
next parent reply other threads:[~2018-04-25 5:15 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20180425051550.24342-1-tiwei.bie@intel.com>
2018-04-25 5:15 ` Tiwei Bie [this message]
2018-04-25 5:15 ` [RFC v3 2/5] virtio_ring: support creating packed ring Tiwei Bie
2018-04-25 5:15 ` [RFC v3 3/5] virtio_ring: add packed ring support Tiwei Bie
2018-04-25 5:15 ` [RFC v3 4/5] virtio_ring: add event idx support in packed ring Tiwei Bie
2018-04-25 5:15 ` [RFC v3 5/5] virtio_ring: enable " Tiwei Bie
2018-04-27 3:56 ` [RFC v3 0/5] virtio: support " Jason Wang
[not found] ` <5ad1ca01-1e5c-7105-f303-7e8d42f6a068@redhat.com>
2018-04-27 4:18 ` Michael S. Tsirkin
[not found] ` <20180427071725-mutt-send-email-mst@kernel.org>
2018-04-27 6:17 ` Jason Wang
[not found] ` <5c712aa2-f00e-b472-cdfc-48175aea790d@redhat.com>
2018-04-27 9:12 ` Tiwei Bie
[not found] ` <20180427091234.n6vr3wcnbnqxd3so@debian>
2018-04-28 2:45 ` Jason Wang
2018-05-02 3:49 ` Jason Wang
[not found] ` <20180425051550.24342-4-tiwei.bie@intel.com>
2018-05-10 7:32 ` [RFC v3 3/5] virtio_ring: add packed ring support Jason Wang
[not found] ` <927f4478-5a81-31d4-ac69-f9ec26248591@redhat.com>
2018-05-10 7:34 ` Jason Wang
[not found] ` <5885acac-e9e3-3abf-b6a2-7347f4d55be2@redhat.com>
2018-05-10 8:56 ` Tiwei Bie
[not found] ` <20180510085601.6mpxf3yvwxnqnk5q@debian>
2018-05-10 9:49 ` Jason Wang
[not found] ` <2fc35cd5-9dbd-7743-497f-b6637d92f528@redhat.com>
2018-05-10 10:50 ` Tiwei Bie
[not found] ` <20180425051550.24342-5-tiwei.bie@intel.com>
2018-05-02 2:51 ` [RFC v3 4/5] virtio_ring: add event idx support in packed ring Jason Wang
2018-05-02 7:28 ` Tiwei Bie
[not found] ` <20180502072819.mf5l3dypk6dwx2s7@debian>
2018-05-02 13:51 ` Michael S. Tsirkin
[not found] ` <20180502164828-mutt-send-email-mst@kernel.org>
2018-05-02 15:12 ` Tiwei Bie
[not found] ` <20180502151255.h3x6rhszxa3euinl@debian>
2018-05-02 15:42 ` Michael S. Tsirkin
[not found] ` <20180502184015-mutt-send-email-mst@kernel.org>
2018-05-03 1:11 ` Tiwei Bie
[not found] ` <20180503011116.qvoyblcpklinrk26@debian>
2018-05-03 1:44 ` Michael S. Tsirkin
[not found] ` <20180503044218-mutt-send-email-mst@kernel.org>
2018-05-03 2:09 ` Tiwei Bie
2018-05-03 7:25 ` Jason Wang
2018-05-03 13:54 ` Tiwei Bie
[not found] ` <20180503135430.lbtvn4p4lyu3ksqo@debian>
2018-05-08 3:05 ` Jason Wang
[not found] ` <fbe06940-1618-5d34-7321-f4888c5dd1ee@redhat.com>
2018-05-08 5:40 ` Jason Wang
[not found] ` <12ede490-f674-2b89-d639-266b5fe15466@redhat.com>
2018-05-08 6:44 ` Tiwei Bie
[not found] ` <20180508064409.kcn6amhsxu7nkuuc@debian>
2018-05-08 7:16 ` Jason Wang
[not found] ` <34f2c690-7cb2-f9ea-2ce9-40f4ccb594c9@redhat.com>
2018-05-08 9:16 ` Tiwei Bie
2018-05-08 9:34 ` Jason Wang
2018-05-08 9:44 ` Tiwei Bie
[not found] ` <20180508094406.qjlaism3hqy4hvjd@debian>
2018-05-09 3:43 ` Jason Wang
2018-05-16 5:01 ` Jason Wang
[not found] ` <915efeaa-4e47-9004-a722-54b0c40ebcbb@redhat.com>
2018-05-16 5:55 ` Tiwei Bie
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=20180425051550.24342-2-tiwei.bie@intel.com \
--to=tiwei.bie@intel.com \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.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).