summaryrefslogtreecommitdiff
path: root/xen/public/io/ring.h
diff options
context:
space:
mode:
Diffstat (limited to 'xen/public/io/ring.h')
-rw-r--r--xen/public/io/ring.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/xen/public/io/ring.h b/xen/public/io/ring.h
index 6ce1d0d4..8669564b 100644
--- a/xen/public/io/ring.h
+++ b/xen/public/io/ring.h
@@ -50,6 +50,12 @@ typedef unsigned int RING_IDX;
* A ring contains as many entries as will fit, rounded down to the nearest
* power of two (so we can mask with (size-1) to loop around).
*/
+#define __CONST_RING_SIZE(_s, _sz) \
+ (__RD32(((_sz) - offsetof(struct _s##_sring, ring)) / \
+ sizeof(((struct _s##_sring *)0)->ring[0])))
+/*
+ * The same for passing in an actual pointer instead of a name tag.
+ */
#define __RING_SIZE(_s, _sz) \
(__RD32(((_sz) - (long)(_s)->ring + (long)(_s)) / sizeof((_s)->ring[0])))