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 <[email protected]> --- Cc: Andrew Cooper <[email protected]> Cc: George Dunlap <[email protected]> Cc: Ian Jackson <[email protected]> Cc: Jan Beulich <[email protected]> Cc: Konrad Rzeszutek Wilk <[email protected]> Cc: Stefano Stabellini <[email protected]> Cc: Tim Deegan <[email protected]> Cc: Wei Liu <[email protected]> Cc: Juergen Gross <[email protected]> --- 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 [email protected] https://lists.xen.org/xen-devel
