Commit 26b99066 authored by Jason Gunthorpe's avatar Jason Gunthorpe
Browse files

RDMA: Change all uapi headers to use __aligned_u64 instead of __u64



The new auditing standard for the subsystem will be to only use
__aligned_64 in uapi headers to try and prevent 32/64 compat bugs
from existing in the future.

Changing all existing usage will help ensure new developers copy the
right idea.

The before/after of this patch was tested using pahole on 32 and 64
bit compiles to confirm it has no change in the structure layout, so
this patch is a NOP.

Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent f2e9bfac
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -65,8 +65,8 @@ struct bnxt_re_pd_resp {
} __attribute__((packed, aligned(4)));

struct bnxt_re_cq_req {
	__u64 cq_va;
	__u64 cq_handle;
	__aligned_u64 cq_va;
	__aligned_u64 cq_handle;
};

struct bnxt_re_cq_resp {
@@ -77,9 +77,9 @@ struct bnxt_re_cq_resp {
};

struct bnxt_re_qp_req {
	__u64 qpsva;
	__u64 qprva;
	__u64 qp_handle;
	__aligned_u64 qpsva;
	__aligned_u64 qprva;
	__aligned_u64 qp_handle;
};

struct bnxt_re_qp_resp {
@@ -88,8 +88,8 @@ struct bnxt_re_qp_resp {
};

struct bnxt_re_srq_req {
	__u64 srqva;
	__u64 srq_handle;
	__aligned_u64 srqva;
	__aligned_u64 srq_handle;
};

struct bnxt_re_srq_resp {
+6 −6
Original line number Diff line number Diff line
@@ -41,21 +41,21 @@
 * Make sure that all structs defined in this file remain laid out so
 * that they pack the same way on 32-bit and 64-bit architectures (to
 * avoid incompatibility between 32-bit userspace and 64-bit kernels).
 * In particular do not use pointer types -- pass pointers in __u64
 * In particular do not use pointer types -- pass pointers in __aligned_u64
 * instead.
 */
struct iwch_create_cq_req {
	__u64 user_rptr_addr;
	__aligned_u64 user_rptr_addr;
};

struct iwch_create_cq_resp_v0 {
	__u64 key;
	__aligned_u64 key;
	__u32 cqid;
	__u32 size_log2;
};

struct iwch_create_cq_resp {
	__u64 key;
	__aligned_u64 key;
	__u32 cqid;
	__u32 size_log2;
	__u32 memsize;
@@ -63,8 +63,8 @@ struct iwch_create_cq_resp {
};

struct iwch_create_qp_resp {
	__u64 key;
	__u64 db_key;
	__aligned_u64 key;
	__aligned_u64 db_key;
	__u32 qpid;
	__u32 size_log2;
	__u32 sq_size_log2;
+12 −12
Original line number Diff line number Diff line
@@ -41,13 +41,13 @@
 * Make sure that all structs defined in this file remain laid out so
 * that they pack the same way on 32-bit and 64-bit architectures (to
 * avoid incompatibility between 32-bit userspace and 64-bit kernels).
 * In particular do not use pointer types -- pass pointers in __u64
 * In particular do not use pointer types -- pass pointers in __aligned_u64
 * instead.
 */
struct c4iw_create_cq_resp {
	__u64 key;
	__u64 gts_key;
	__u64 memsize;
	__aligned_u64 key;
	__aligned_u64 gts_key;
	__aligned_u64 memsize;
	__u32 cqid;
	__u32 size;
	__u32 qid_mask;
@@ -59,13 +59,13 @@ enum {
};

struct c4iw_create_qp_resp {
	__u64 ma_sync_key;
	__u64 sq_key;
	__u64 rq_key;
	__u64 sq_db_gts_key;
	__u64 rq_db_gts_key;
	__u64 sq_memsize;
	__u64 rq_memsize;
	__aligned_u64 ma_sync_key;
	__aligned_u64 sq_key;
	__aligned_u64 rq_key;
	__aligned_u64 sq_db_gts_key;
	__aligned_u64 rq_db_gts_key;
	__aligned_u64 sq_memsize;
	__aligned_u64 rq_memsize;
	__u32 sqid;
	__u32 rqid;
	__u32 sq_size;
@@ -75,7 +75,7 @@ struct c4iw_create_qp_resp {
};

struct c4iw_alloc_ucontext_resp {
	__u64 status_page_key;
	__aligned_u64 status_page_key;
	__u32 status_page_size;
	__u32 reserved; /* explicit padding (optional for i386) */
};
+16 −16
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ struct hfi1_user_info {
};

struct hfi1_ctxt_info {
	__u64 runtime_flags;    /* chip/drv runtime flags (HFI1_CAP_*) */
	__aligned_u64 runtime_flags;    /* chip/drv runtime flags (HFI1_CAP_*) */
	__u32 rcvegr_size;      /* size of each eager buffer */
	__u16 num_active;       /* number of active units */
	__u16 unit;             /* unit (chip) assigned to caller */
@@ -98,9 +98,9 @@ struct hfi1_ctxt_info {

struct hfi1_tid_info {
	/* virtual address of first page in transfer */
	__u64 vaddr;
	__aligned_u64 vaddr;
	/* pointer to tid array. this array is big enough */
	__u64 tidlist;
	__aligned_u64 tidlist;
	/* number of tids programmed by this request */
	__u32 tidcnt;
	/* length of transfer buffer programmed by this request */
@@ -131,23 +131,23 @@ struct hfi1_base_info {
	 */
	__u32 bthqp;
	/* PIO credit return address, */
	__u64 sc_credits_addr;
	__aligned_u64 sc_credits_addr;
	/*
	 * Base address of write-only pio buffers for this process.
	 * Each buffer has sendpio_credits*64 bytes.
	 */
	__u64 pio_bufbase_sop;
	__aligned_u64 pio_bufbase_sop;
	/*
	 * Base address of write-only pio buffers for this process.
	 * Each buffer has sendpio_credits*64 bytes.
	 */
	__u64 pio_bufbase;
	__aligned_u64 pio_bufbase;
	/* address where receive buffer queue is mapped into */
	__u64 rcvhdr_bufbase;
	__aligned_u64 rcvhdr_bufbase;
	/* base address of Eager receive buffers. */
	__u64 rcvegr_bufbase;
	__aligned_u64 rcvegr_bufbase;
	/* base address of SDMA completion ring */
	__u64 sdma_comp_bufbase;
	__aligned_u64 sdma_comp_bufbase;
	/*
	 * User register base for init code, not to be used directly by
	 * protocol or applications.  Always maps real chip register space.
@@ -155,20 +155,20 @@ struct hfi1_base_info {
	 * ur_rcvhdrhead, ur_rcvhdrtail, ur_rcvegrhead, ur_rcvegrtail,
	 * ur_rcvtidflow
	 */
	__u64 user_regbase;
	__aligned_u64 user_regbase;
	/* notification events */
	__u64 events_bufbase;
	__aligned_u64 events_bufbase;
	/* status page */
	__u64 status_bufbase;
	__aligned_u64 status_bufbase;
	/* rcvhdrtail update */
	__u64 rcvhdrtail_base;
	__aligned_u64 rcvhdrtail_base;
	/*
	 * shared memory pages for subctxts if ctxt is shared; these cover
	 * all the processes in the group sharing a single context.
	 * all have enough space for the num_subcontexts value on this job.
	 */
	__u64 subctxt_uregbase;
	__u64 subctxt_rcvegrbuf;
	__u64 subctxt_rcvhdrbuf;
	__aligned_u64 subctxt_uregbase;
	__aligned_u64 subctxt_rcvegrbuf;
	__aligned_u64 subctxt_rcvhdrbuf;
};
#endif /* _LINIUX__HFI1_IOCTL_H */
+2 −2
Original line number Diff line number Diff line
@@ -177,8 +177,8 @@ struct hfi1_sdma_comp_entry {
 * Device status and notifications from driver to user-space.
 */
struct hfi1_status {
	__u64 dev;      /* device/hw status bits */
	__u64 port;     /* port state and status bits */
	__aligned_u64 dev;      /* device/hw status bits */
	__aligned_u64 port;     /* port state and status bits */
	char freezemsg[0];
};

Loading