From d9f6883bd3a8e5ad543d49563f57efa7b159365c Mon Sep 17 00:00:00 2001 From: Joao Martins Date: Fri, 12 May 2017 09:46:37 +0100 Subject: [PATCH] include/xen: import vendor extension to netif.h 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 Reviewed-by: Shannon Nelson Acked-by: Konrad Rzeszutek Wilk Orabug: 26107942 --- include/xen/interface/io/netif.h | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/include/xen/interface/io/netif.h b/include/xen/interface/io/netif.h index 252ffd4801ef..6bedab7672f9 100644 --- a/include/xen/interface/io/netif.h +++ b/include/xen/interface/io/netif.h @@ -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 = "" + * /local/domain/1/device/vif/0/queue-0/tx-pool-size = "" + * /local/domain/1/device/vif/0/queue-0/rx-pool-ref = "" + * /local/domain/1/device/vif/0/queue-0/rx-pool-size = "" + * + * 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 -- 2.50.1