]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
include/xen: import vendor extension to netif.h
authorJoao Martins <joao.m.martins@oracle.com>
Fri, 12 May 2017 08:46:37 +0000 (09:46 +0100)
committerJoao Martins <joao.m.martins@oracle.com>
Wed, 31 May 2017 21:51:57 +0000 (22:51 +0100)
Describe in the protocol headers the extension we're making
with respect to staging grants. The extensions here described
are a middle ground with what is being discussed upstream
while keeping similar (yet different naming) structures
to be proposed upstream. The difference with upstream proposal
is that the staging grants occurs through a control ring;
here we do at xenbus features negotiation, which is more
maintainable while we keep this code out of tree.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Reviewed-by: Shannon Nelson <shannon.nelson@oracle.com>
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Orabug: 26107942

include/xen/interface/io/netif.h

index 252ffd4801ef68cbfd8b37c58875e816084149a7..6bedab7672f958cac245b55c5cb6b47c00d29d24 100644 (file)
@@ -265,4 +265,54 @@ DEFINE_RING_TYPES(xen_netif_rx,
 /* No response: used for auxiliary requests (e.g., xen_netif_extra_info). */
 #define XEN_NETIF_RSP_NULL      1
 
+/*
+ * Vendor Extensions
+ * =================
+ *
+ * Grant Allocation (struct xen_ext_gref_alloc)
+ * --------------------------------------------
+ *
+ * "feature-staging-grants" advertises the capability for a frontend to provide
+ * a fixed set of grant references to the backend. This is useful when guests
+ * want to avoid the usage of grants and associated overheads by hinting the
+ * backend to map a limited set of pages. Backend either advertises support for
+ * this feature via xenstore as 0 (disabled) or 1 (enabled). The size of the
+ * table is the number of entries for both Tx and Rx pool (512 + 512).
+ *
+ * Frontend advertises the grants through a couple of xenstore entries in
+ * the form of:
+ *
+ * /local/domain/1/device/vif/0/queue-0 = ""
+ * /local/domain/1/device/vif/0/queue-0/tx-pool-ref  = "<ring-ref-tx0>"
+ * /local/domain/1/device/vif/0/queue-0/tx-pool-size = "<nr-entries-tx0>"
+ * /local/domain/1/device/vif/0/queue-0/rx-pool-ref  = "<ring-ref-rx0>"
+ * /local/domain/1/device/vif/0/queue-0/rx-pool-size = "<nr-entries-rx0>"
+ *
+ * These entries describe a list and size of grants to provide to the frontend
+ * Frontend can use this to pregrant certain pages and reuse them for Rx/Tx
+ * requests. The usage of these grant references abide to the same protocol
+ * describe in this document.
+ *
+ * Each entry in the {rx,tx}-pool-ref table has the following format:
+ *
+ *    0     1     2     3     4     5     6     7  octet
+ * +-----+-----+-----+-----+-----+-----+-----+-----+
+ * | grant ref             |  flags    |  padding  |
+ * +-----+-----+-----+-----+-----+-----+-----+-----+
+ *
+ * grant ref: grant reference
+ * flags: flags for the grant reference (e.g. readonly)
+ *
+ */
+struct xen_ext_gref_alloc {
+       grant_ref_t ref;
+
+#define _XEN_EXTF_GREF_readonly    0
+#define XEN_EXTF_GREF_readonly    (1U<<_XEN_EXTF_GREF_readonly)
+       uint16_t flags;
+       uint8_t pad[2];
+};
+
+#define XEN_EXT_MAX_GREF_ALLOC 512
+
 #endif