diff mbox

[3/6] RDMA/qedr: Fix uABI structure layouts for 32/64 compat

Message ID 20180320201951.4998-4-jgg@ziepe.ca (mailing list archive)
State Accepted
Delegated to: Jason Gunthorpe
Headers show

Commit Message

Jason Gunthorpe March 20, 2018, 8:19 p.m. UTC
From: Jason Gunthorpe <jgg@mellanox.com>

struct qedr_alloc_ucontext_resp is a different length in 32 and 64
bit compiles due to implicit compiler padding.

The structs alloc_pd_uresp, create_cq_uresp and create_qp_uresp are
not padded by the compiler, but in user space the compiler pads them
due to the way the core and driver structs are concatenated. Make
this padding explicit and consistent for future sanity.

The kernel driver can already handle the user buffer being smaller
than required and copies correctly, so no compat or ABI break happens
from introducing the explicit padding.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
---
 include/uapi/rdma/qedr-abi.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Kalderon, Michal March 22, 2018, 1:53 p.m. UTC | #1
> From: Jason Gunthorpe [mailto:jgg@ziepe.ca]
> Sent: Tuesday, March 20, 2018 10:20 PM
> To: linux-rdma@vger.kernel.org; Kalderon, Michal
> <Michal.Kalderon@cavium.com>
> Cc: Jason Gunthorpe <jgg@mellanox.com>
> Subject: [PATCH 3/6] RDMA/qedr: Fix uABI structure layouts for 32/64
> compat
> 
> From: Jason Gunthorpe <jgg@mellanox.com>
> 
> struct qedr_alloc_ucontext_resp is a different length in 32 and 64 bit
> compiles due to implicit compiler padding.
> 
> The structs alloc_pd_uresp, create_cq_uresp and create_qp_uresp are not
> padded by the compiler, but in user space the compiler pads them due to the
> way the core and driver structs are concatenated. Make this padding explicit
> and consistent for future sanity.
> 
> The kernel driver can already handle the user buffer being smaller than
> required and copies correctly, so no compat or ABI break happens from
> introducing the explicit padding.
> 
> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
> ---
>  include/uapi/rdma/qedr-abi.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/include/uapi/rdma/qedr-abi.h b/include/uapi/rdma/qedr-abi.h
> index 261c6db4623e28..39665606293197 100644
> --- a/include/uapi/rdma/qedr-abi.h
> +++ b/include/uapi/rdma/qedr-abi.h
> @@ -53,6 +53,7 @@ struct qedr_alloc_ucontext_resp {
>  	__u8 dpm_enabled;
>  	__u8 wids_enabled;
>  	__u16 wid_count;
> +	__u32 reserved;
>  };
> 
>  struct qedr_alloc_pd_ureq {
> @@ -61,6 +62,7 @@ struct qedr_alloc_pd_ureq {
> 
>  struct qedr_alloc_pd_uresp {
>  	__u32 pd_id;
> +	__u32 reserved;
>  };
> 
>  struct qedr_create_cq_ureq {
> @@ -71,6 +73,7 @@ struct qedr_create_cq_ureq {  struct
> qedr_create_cq_uresp {
>  	__u32 db_offset;
>  	__u16 icid;
> +	__u16 reserved;
>  };
> 
>  struct qedr_create_qp_ureq {
> @@ -105,6 +108,7 @@ struct qedr_create_qp_uresp {
>  	__u16 rq_icid;
> 
>  	__u32 rq_db2_offset;
> +	__u32 reserved;
>  };
> 
>  #endif /* __QEDR_USER_H__ */
> --
> 2.16.1
thanks Jason
Acked-by: Michal Kalderon <michal.kalderon@cavium.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/uapi/rdma/qedr-abi.h b/include/uapi/rdma/qedr-abi.h
index 261c6db4623e28..39665606293197 100644
--- a/include/uapi/rdma/qedr-abi.h
+++ b/include/uapi/rdma/qedr-abi.h
@@ -53,6 +53,7 @@  struct qedr_alloc_ucontext_resp {
 	__u8 dpm_enabled;
 	__u8 wids_enabled;
 	__u16 wid_count;
+	__u32 reserved;
 };
 
 struct qedr_alloc_pd_ureq {
@@ -61,6 +62,7 @@  struct qedr_alloc_pd_ureq {
 
 struct qedr_alloc_pd_uresp {
 	__u32 pd_id;
+	__u32 reserved;
 };
 
 struct qedr_create_cq_ureq {
@@ -71,6 +73,7 @@  struct qedr_create_cq_ureq {
 struct qedr_create_cq_uresp {
 	__u32 db_offset;
 	__u16 icid;
+	__u16 reserved;
 };
 
 struct qedr_create_qp_ureq {
@@ -105,6 +108,7 @@  struct qedr_create_qp_uresp {
 	__u16 rq_icid;
 
 	__u32 rq_db2_offset;
+	__u32 reserved;
 };
 
 #endif /* __QEDR_USER_H__ */