* [Xen-devel] [PATCH] public/io/ring.h: add FRONT/BACK_RING_ATTACH macros
@ 2019-12-13 10:18 Paul Durrant
2019-12-13 10:27 ` Jürgen Groß
0 siblings, 1 reply; 2+ messages in thread
From: Paul Durrant @ 2019-12-13 10:18 UTC (permalink / raw)
To: xen-devel; +Cc: Juergen Gross, Paul Durrant, Konrad Rzeszutek Wilk
The version of this header present in the Linux source tree has contained
such macros for some time. These macros, as the names imply, allow front
or back rings to be set up for existent (rather than freshly created and
zeroed) shared rings.
This patch is to update this, the canonical version of the header, to
match the latest definition of these macros in the Linux source.
NOTE: The way the new macros are defined allows the FRONT/BACK_RING_INIT
macros to be re-defined in terms of them, thereby reducing
duplication.
Signed-off-by: Paul Durrant <pdurrant@amazon.com>
---
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Juergen Gross <jgross@suse.com>
---
xen/include/public/io/ring.h | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/xen/include/public/io/ring.h b/xen/include/public/io/ring.h
index c5d53e3103..d68615ae2f 100644
--- a/xen/include/public/io/ring.h
+++ b/xen/include/public/io/ring.h
@@ -175,20 +175,24 @@ typedef struct __name##_back_ring __name##_back_ring_t
(void)memset((_s)->__pad, 0, sizeof((_s)->__pad)); \
} while(0)
-#define FRONT_RING_INIT(_r, _s, __size) do { \
- (_r)->req_prod_pvt = 0; \
- (_r)->rsp_cons = 0; \
+#define FRONT_RING_ATTACH(_r, _s, _i, __size) do { \
+ (_r)->req_prod_pvt = (_i); \
+ (_r)->rsp_cons = (_i); \
(_r)->nr_ents = __RING_SIZE(_s, __size); \
(_r)->sring = (_s); \
} while (0)
-#define BACK_RING_INIT(_r, _s, __size) do { \
- (_r)->rsp_prod_pvt = 0; \
- (_r)->req_cons = 0; \
+#define FRONT_RING_INIT(_r, _s, __size) FRONT_RING_ATTACH(_r, _s, 0, __size)
+
+#define BACK_RING_ATTACH(_r, _s, _i, __size) do { \
+ (_r)->rsp_prod_pvt = (_i); \
+ (_r)->req_cons = (_i); \
(_r)->nr_ents = __RING_SIZE(_s, __size); \
(_r)->sring = (_s); \
} while (0)
+#define BACK_RING_INIT(_r, _s, __size) BACK_RING_ATTACH(_r, _s, 0, __size)
+
/* How big is this ring? */
#define RING_SIZE(_r) \
((_r)->nr_ents)
--
2.20.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Xen-devel] [PATCH] public/io/ring.h: add FRONT/BACK_RING_ATTACH macros
2019-12-13 10:18 [Xen-devel] [PATCH] public/io/ring.h: add FRONT/BACK_RING_ATTACH macros Paul Durrant
@ 2019-12-13 10:27 ` Jürgen Groß
0 siblings, 0 replies; 2+ messages in thread
From: Jürgen Groß @ 2019-12-13 10:27 UTC (permalink / raw)
To: Paul Durrant, xen-devel; +Cc: Konrad Rzeszutek Wilk
On 13.12.19 11:18, Paul Durrant wrote:
> The version of this header present in the Linux source tree has contained
> such macros for some time. These macros, as the names imply, allow front
> or back rings to be set up for existent (rather than freshly created and
> zeroed) shared rings.
>
> This patch is to update this, the canonical version of the header, to
> match the latest definition of these macros in the Linux source.
>
> NOTE: The way the new macros are defined allows the FRONT/BACK_RING_INIT
> macros to be re-defined in terms of them, thereby reducing
> duplication.
>
> Signed-off-by: Paul Durrant <pdurrant@amazon.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Juergen
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-12-13 10:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-13 10:18 [Xen-devel] [PATCH] public/io/ring.h: add FRONT/BACK_RING_ATTACH macros Paul Durrant
2019-12-13 10:27 ` Jürgen Groß
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.