All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA: Do not used __packed in uapi headers
@ 2018-02-07 23:45 Jason Gunthorpe
       [not found] ` <20180207234551.GA14373-uk2M96/98Pc@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Jason Gunthorpe @ 2018-02-07 23:45 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Mike Marciniszyn,
	Dennis Dalessandro, Selvin Xavier, Devesh Sharma

__packed is not available in linux/types.h, so we cannot use it in
the uapi headers.

The construction struct ABC {} __packed; may still compile even if
__packed is not defined, however it simply creates a variable called
__packed, and doesn't set the alignment.

All these uses of packed are on structs that already have aligned
members.

While use in hfi may indicate the struct itself is unaligned,
the use in ocrdma is on a UHW struct which should never be unaligned,
so just delete it there.

Signed-off-by: Jason Gunthorpe <jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 include/uapi/rdma/hfi/hfi1_user.h | 6 +++---
 include/uapi/rdma/ocrdma-abi.h    | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/uapi/rdma/hfi/hfi1_user.h b/include/uapi/rdma/hfi/hfi1_user.h
index 791bea2f8297b4..43b46bf6f8bb10 100644
--- a/include/uapi/rdma/hfi/hfi1_user.h
+++ b/include/uapi/rdma/hfi/hfi1_user.h
@@ -219,7 +219,7 @@ struct sdma_req_info {
 	 * in charge of managing its own ring.
 	 */
 	__u16 comp_idx;
-} __packed;
+} __attribute__((__packed__));
 
 /*
  * SW KDETH header.
@@ -230,7 +230,7 @@ struct hfi1_kdeth_header {
 	__le16 jkey;
 	__le16 hcrc;
 	__le32 swdata[7];
-} __packed;
+}  __attribute__((__packed__));
 
 /*
  * Structure describing the headers that User space uses. The
@@ -241,7 +241,7 @@ struct hfi1_pkt_header {
 	__be16 lrh[4];
 	__be32 bth[3];
 	struct hfi1_kdeth_header kdeth;
-} __packed;
+}  __attribute__((__packed__));
 
 
 /*
diff --git a/include/uapi/rdma/ocrdma-abi.h b/include/uapi/rdma/ocrdma-abi.h
index ad64a3cea1cdab..07f85c7e313d84 100644
--- a/include/uapi/rdma/ocrdma-abi.h
+++ b/include/uapi/rdma/ocrdma-abi.h
@@ -106,7 +106,7 @@ struct ocrdma_create_qp_ureq {
 	__u32 rsvd1;	/* pad */
 };
 
-struct ocrdma_create_qp_uresp {
+sxtruct ocrdma_create_qp_uresp {
 	__u16 qp_id;
 	__u16 sq_dbid;
 	__u16 rq_dbid;
@@ -127,7 +127,7 @@ struct ocrdma_create_qp_uresp {
 	__u32 db_rq_offset;
 	__u32 db_shift;
 	__u64 rsvd[11];
-} __packed;
+};
 
 struct ocrdma_create_srq_uresp {
 	__u16 rq_dbid;
-- 
2.16.1

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] RDMA: Do not used __packed in uapi headers
       [not found] ` <20180207234551.GA14373-uk2M96/98Pc@public.gmane.org>
@ 2018-02-14 23:53   ` Jason Gunthorpe
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2018-02-14 23:53 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Mike Marciniszyn,
	Dennis Dalessandro, Selvin Xavier, Devesh Sharma

On Wed, Feb 07, 2018 at 04:45:51PM -0700, Jason Gunthorpe wrote:
> __packed is not available in linux/types.h, so we cannot use it in
> the uapi headers.
> 
> The construction struct ABC {} __packed; may still compile even if
> __packed is not defined, however it simply creates a variable called
> __packed, and doesn't set the alignment.
> 
> All these uses of packed are on structs that already have aligned
> members.
> 
> While use in hfi may indicate the struct itself is unaligned,
> the use in ocrdma is on a UHW struct which should never be unaligned,
> so just delete it there.
> 
> Signed-off-by: Jason Gunthorpe <jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>  include/uapi/rdma/hfi/hfi1_user.h | 6 +++---
>  include/uapi/rdma/ocrdma-abi.h    | 4 ++--
>  2 files changed, 5 insertions(+), 5 deletions(-)

applied to -next

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-14 23:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-07 23:45 [PATCH] RDMA: Do not used __packed in uapi headers Jason Gunthorpe
     [not found] ` <20180207234551.GA14373-uk2M96/98Pc@public.gmane.org>
2018-02-14 23:53   ` Jason Gunthorpe

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.