summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-03-31 03:13:57 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-03-31 03:13:57 +0200
commit2926f6f92dab25ba19c3e758931e6b3e34db1891 (patch)
treeae8bd9136ad1e40c56bd96c5dbe17c48c6bd73fc
parent2e1342cdcd9907076015398fd47943c191633518 (diff)
xen: fix const warning
* xen/public/io/ring.h (__CONST_RING_SIZE): Add macro from upstream * xen/net.c (WINDOW): Use __CONST_RING_SIZE instead of __RING_SIZE.
-rw-r--r--xen/net.c2
-rw-r--r--xen/public/io/ring.h6
2 files changed, 7 insertions, 1 deletions
diff --git a/xen/net.c b/xen/net.c
index 1dc2209e..4507ead3 100644
--- a/xen/net.c
+++ b/xen/net.c
@@ -47,7 +47,7 @@
/* Hypervisor part */
#define ADDRESS_SIZE 6
-#define WINDOW __RING_SIZE((netif_rx_sring_t*)0, PAGE_SIZE)
+#define WINDOW __CONST_RING_SIZE(netif_rx, PAGE_SIZE)
struct net_data {
struct device device;
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])))