If it is present, use it; otherwise use 4096. Also provide a new macro 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/vscsiif.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/xen/include/public/io/vscsiif.h b/xen/include/public/io/vscsiif.h index 0a4709f..00e8b74 100644 --- a/xen/include/public/io/vscsiif.h +++ b/xen/include/public/io/vscsiif.h @@ -256,7 +256,23 @@ struct scsiif_request_segment { }; typedef struct scsiif_request_segment vscsiif_segment_t; -#define VSCSIIF_SG_PER_PAGE (PAGE_SIZE / sizeof(struct scsiif_request_segment)) +/* + * Reference to PAGE_SIZE was overlooked when this header file was + * introduced. Respect PAGE_SIZE if defined, otherwise, use 4096. + */ +#ifdef PAGE_SIZE +#define _VSCSIIF_PAGE_SIZE PAGE_SIZE +#else +#define _VSCSIIF_PAGE_SIZE 4096 +#endif +/* + * Please use _PAGE2 variant in new code, _PAGE variant is kept for + * backward-compatibility. + */ +#define VSCSIIF_SG_PER_PAGE (_VSCSI_PAGE_SIZE / \ + sizeof(struct scsiif_request_segment)) +#define VSCSIIF_SG_PER_PAGE2(pgsize) ((pgsize) / \ + sizeof(struct scsiif_request_segment)) /* Size of one request is 252 bytes */ struct vscsiif_request { -- 2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
