From 2926f6f92dab25ba19c3e758931e6b3e34db1891 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Tue, 31 Mar 2020 03:13:57 +0200 Subject: 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. --- xen/net.c | 2 +- xen/public/io/ring.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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]))) -- cgit v1.2.3