All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: Juergen Gross <jgross@suse.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	Jan Beulich <jbeulich@suse.com>
Subject: [PATCH RFC 1/2] usbif.h: don't require PAGE_SIZE to be present
Date: Wed, 19 Oct 2016 11:46:43 +0100	[thread overview]
Message-ID: <1476874004-10969-2-git-send-email-wei.liu2@citrix.com> (raw)
In-Reply-To: <1476874004-10969-1-git-send-email-wei.liu2@citrix.com>

If it is present, use it; otherwise use 4096. Also provide two new
macros to let user have control over the page size used to do
calculation.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Tim Deegan <tim@xen.org>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Juergen Gross <jgross@suse.com>
---
 xen/include/public/io/usbif.h | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/xen/include/public/io/usbif.h b/xen/include/public/io/usbif.h
index 4053c24..ac38318 100644
--- a/xen/include/public/io/usbif.h
+++ b/xen/include/public/io/usbif.h
@@ -216,6 +216,16 @@ struct usbif_urb_request {
 };
 typedef struct usbif_urb_request usbif_urb_request_t;
 
+/*
+ * Reference to PAGE_SIZE was overlooked when this header file was
+ * introduced. Respect PAGE_SIZE if defined, otherwise, use 4096.
+ */
+#ifdef PAGE_SIZE
+#define _USB_RING_PAGE_SIZE PAGE_SIZE
+#else
+#define _USB_RING_PAGE_SIZE 4096
+#endif
+
 struct usbif_urb_response {
 	uint16_t id; /* request id */
 	uint16_t start_frame;  /* start frame (ISO) */
@@ -226,7 +236,12 @@ struct usbif_urb_response {
 typedef struct usbif_urb_response usbif_urb_response_t;
 
 DEFINE_RING_TYPES(usbif_urb, struct usbif_urb_request, struct usbif_urb_response);
-#define USB_URB_RING_SIZE __CONST_RING_SIZE(usbif_urb, PAGE_SIZE)
+/*
+ * Please use _SIZE2 variant in new code, _SIZE variant is kept for
+ * backward-compatibility.
+ */
+#define USB_URB_RING_SIZE __CONST_RING_SIZE(usbif_urb, _USB_RING_PAGE_SIZE)
+#define USB_URB_RING_SIZE2(pgsize) __CONST_RING_SIZE(usbif_urb, (pgsize))
 
 /*
  * RING for notifying connect/disconnect events to frontend
@@ -248,6 +263,11 @@ struct usbif_conn_response {
 typedef struct usbif_conn_response usbif_conn_response_t;
 
 DEFINE_RING_TYPES(usbif_conn, struct usbif_conn_request, struct usbif_conn_response);
-#define USB_CONN_RING_SIZE __CONST_RING_SIZE(usbif_conn, PAGE_SIZE)
+/*
+ * Please use _SIZE2 variant in new code, _SIZE variant is kept for
+ * backward-compatibility.
+ */
+#define USB_CONN_RING_SIZE  __CONST_RING_SIZE(usbif_conn, _USB_RING_PAGE_SIZE)
+#define USB_CONN_RING_SIZE2(pgsize) __CONST_RING_SIZE(usbif_conn, (pgsize))
 
 #endif /* __XEN_PUBLIC_IO_USBIF_H__ */
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2016-10-19 10:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-19 10:46 [PATCH RFC 0/2] Fix PAGE_SIZE issues in public headers Wei Liu
2016-10-19 10:46 ` Wei Liu [this message]
2016-10-19 11:45   ` [PATCH RFC 1/2] usbif.h: don't require PAGE_SIZE to be present Andrew Cooper
2016-10-19 12:11     ` Wei Liu
2016-10-19 12:13   ` David Vrabel
2016-10-19 18:08     ` Stefano Stabellini
2016-10-19 10:46 ` [PATCH RFC 2/2] vscsiif.h: " Wei Liu
2016-10-19 11:04 ` [PATCH RFC 0/2] Fix PAGE_SIZE issues in public headers Juergen Gross
2016-10-19 18:09   ` Stefano Stabellini
2016-10-19 19:20     ` Stefano Stabellini
2016-10-20  5:11       ` Juergen Gross
2016-10-24 15:26     ` Ian Jackson
2016-10-24 18:16       ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1476874004-10969-2-git-send-email-wei.liu2@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.