[openib-general] [PATCH] RFC: use stdint.h types

Michael S. Tsirkin mst at mellanox.co.il
Wed May 31 01:50:29 PDT 2006


Roland, I think we should get rid of __u32 and friends in userspace: including
linux/types.h there does all kind of kernel-related tricks such as overriding
offsetof from compiler builtin.

This patch removes this dependency from libibverbs, libmthca and libipathverbs
and supercedes the libmthca patch that I posted previously.

What this patch does:
replace all __uXX with uintXX_t and __sXX with intXX_t.

fix include files appropriately:

#include <linux/types.h> -> #include <stdint.h>

add stddef.h to libmthca and ipathverbs for offsetof macro
(linux/stddef.h redefines it and it is pulled in by linux/types.h on some distros).

add sysfs/libsysfs.h to ipathverbs
(not sure how does it currently compile on trunk without)

---

libibverbs and libmthca pull in types from under linux/ directory which are
broken on some distros/compilers. There's no good reason for us to do so:
integer types of specific widths are specified in stdint.h in a portable way.

Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>

Index: libibverbs/include/infiniband/sa-kern-abi.h
===================================================================
--- libibverbs/include/infiniband/sa-kern-abi.h	(revision 7580)
+++ libibverbs/include/infiniband/sa-kern-abi.h	(working copy)
@@ -33,7 +33,7 @@
 #ifndef INFINIBAND_SA_KERN_ABI_H
 #define INFINIBAND_SA_KERN_ABI_H
 
-#include <linux/types.h>
+#include <stdint.h>
 
 /*
  * Obsolete, deprecated names.  Will be removed in libibverbs 1.1.
@@ -41,25 +41,25 @@
 #define ib_kern_path_rec	ibv_kern_path_rec
 
 struct ibv_kern_path_rec {
-	__u8  dgid[16];
-	__u8  sgid[16];
-	__u16 dlid;
-	__u16 slid;
-	__u32 raw_traffic;
-	__u32 flow_label;
-	__u32 reversible;
-	__u32 mtu;
-	__u16 pkey;
-	__u8  hop_limit;
-	__u8  traffic_class;
-	__u8  numb_path;
-	__u8  sl;
-	__u8  mtu_selector;
-	__u8  rate_selector;
-	__u8  rate;
-	__u8  packet_life_time_selector;
-	__u8  packet_life_time;
-	__u8  preference;
+	uint8_t  dgid[16];
+	uint8_t  sgid[16];
+	uint16_t dlid;
+	uint16_t slid;
+	uint32_t raw_traffic;
+	uint32_t flow_label;
+	uint32_t reversible;
+	uint32_t mtu;
+	uint16_t pkey;
+	uint8_t  hop_limit;
+	uint8_t  traffic_class;
+	uint8_t  numb_path;
+	uint8_t  sl;
+	uint8_t  mtu_selector;
+	uint8_t  rate_selector;
+	uint8_t  rate;
+	uint8_t  packet_life_time_selector;
+	uint8_t  packet_life_time;
+	uint8_t  preference;
 };
 
 #endif /* INFINIBAND_SA_KERN_ABI_H */
Index: libibverbs/include/infiniband/kern-abi.h
===================================================================
--- libibverbs/include/infiniband/kern-abi.h	(revision 7580)
+++ libibverbs/include/infiniband/kern-abi.h	(working copy)
@@ -37,7 +37,7 @@
 #ifndef KERN_ABI_H
 #define KERN_ABI_H
 
-#include <linux/types.h>
+#include <stdint.h>
 
 /*
  * This file must be kept in sync with the kernel's version of
@@ -95,663 +95,663 @@
  * that they pack the same way on 32-bit and 64-bit architectures (to
  * avoid incompatibility between 32-bit userspace and 64-bit kernels).
  * Specifically:
- *  - Do not use pointer types -- pass pointers in __u64 instead.
+ *  - Do not use pointer types -- pass pointers in uint64_t instead.
  *  - Make sure that any structure larger than 4 bytes is padded to a
  *    multiple of 8 bytes.  Otherwise the structure size will be
  *    different between 32-bit and 64-bit architectures.
  */
 
 struct ibv_kern_async_event {
-	__u64 element;
-	__u32 event_type;
-	__u32 reserved;
+	uint64_t element;
+	uint32_t event_type;
+	uint32_t reserved;
 };
 
 struct ibv_comp_event {
-	__u64 cq_handle;
+	uint64_t cq_handle;
 };
 
 /*
- * All commands from userspace should start with a __u32 command field
- * followed by __u16 in_words and out_words fields (which give the
+ * All commands from userspace should start with a uint32_t command field
+ * followed by uint16_t in_words and out_words fields (which give the
  * length of the command block and response buffer if any in 32-bit
  * words).  The kernel driver will read these fields first and read
  * the rest of the command struct based on these value.
  */
 
 struct ibv_query_params {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u64 response;
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint64_t response;
 };
 
 struct ibv_query_params_resp {
-	__u32 num_cq_events;
+	uint32_t num_cq_events;
 };
 
 struct ibv_get_context {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u64 response;
-	__u64 driver_data[0];
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint64_t response;
+	uint64_t driver_data[0];
 };
 
 struct ibv_get_context_resp {
-	__u32 async_fd;
-	__u32 num_comp_vectors;
+	uint32_t async_fd;
+	uint32_t num_comp_vectors;
 };
 
 struct ibv_query_device {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u64 response;
-	__u64 driver_data[0];
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint64_t response;
+	uint64_t driver_data[0];
 };
 
 struct ibv_query_device_resp {
-	__u64 fw_ver;
-	__u64 node_guid;
-	__u64 sys_image_guid;
-	__u64 max_mr_size;
-	__u64 page_size_cap;
-	__u32 vendor_id;
-	__u32 vendor_part_id;
-	__u32 hw_ver;
-	__u32 max_qp;
-	__u32 max_qp_wr;
-	__u32 device_cap_flags;
-	__u32 max_sge;
-	__u32 max_sge_rd;
-	__u32 max_cq;
-	__u32 max_cqe;
-	__u32 max_mr;
-	__u32 max_pd;
-	__u32 max_qp_rd_atom;
-	__u32 max_ee_rd_atom;
-	__u32 max_res_rd_atom;
-	__u32 max_qp_init_rd_atom;
-	__u32 max_ee_init_rd_atom;
-	__u32 atomic_cap;
-	__u32 max_ee;
-	__u32 max_rdd;
-	__u32 max_mw;
-	__u32 max_raw_ipv6_qp;
-	__u32 max_raw_ethy_qp;
-	__u32 max_mcast_grp;
-	__u32 max_mcast_qp_attach;
-	__u32 max_total_mcast_qp_attach;
-	__u32 max_ah;
-	__u32 max_fmr;
-	__u32 max_map_per_fmr;
-	__u32 max_srq;
-	__u32 max_srq_wr;
-	__u32 max_srq_sge;
-	__u16 max_pkeys;
-	__u8  local_ca_ack_delay;
-	__u8  phys_port_cnt;
-	__u8  reserved[4];
+	uint64_t fw_ver;
+	uint64_t node_guid;
+	uint64_t sys_image_guid;
+	uint64_t max_mr_size;
+	uint64_t page_size_cap;
+	uint32_t vendor_id;
+	uint32_t vendor_part_id;
+	uint32_t hw_ver;
+	uint32_t max_qp;
+	uint32_t max_qp_wr;
+	uint32_t device_cap_flags;
+	uint32_t max_sge;
+	uint32_t max_sge_rd;
+	uint32_t max_cq;
+	uint32_t max_cqe;
+	uint32_t max_mr;
+	uint32_t max_pd;
+	uint32_t max_qp_rd_atom;
+	uint32_t max_ee_rd_atom;
+	uint32_t max_res_rd_atom;
+	uint32_t max_qp_init_rd_atom;
+	uint32_t max_ee_init_rd_atom;
+	uint32_t atomic_cap;
+	uint32_t max_ee;
+	uint32_t max_rdd;
+	uint32_t max_mw;
+	uint32_t max_raw_ipv6_qp;
+	uint32_t max_raw_ethy_qp;
+	uint32_t max_mcast_grp;
+	uint32_t max_mcast_qp_attach;
+	uint32_t max_total_mcast_qp_attach;
+	uint32_t max_ah;
+	uint32_t max_fmr;
+	uint32_t max_map_per_fmr;
+	uint32_t max_srq;
+	uint32_t max_srq_wr;
+	uint32_t max_srq_sge;
+	uint16_t max_pkeys;
+	uint8_t  local_ca_ack_delay;
+	uint8_t  phys_port_cnt;
+	uint8_t  reserved[4];
 };
 
 struct ibv_query_port {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u64 response;
-	__u8  port_num;
-	__u8  reserved[7];
-	__u64 driver_data[0];
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint64_t response;
+	uint8_t  port_num;
+	uint8_t  reserved[7];
+	uint64_t driver_data[0];
 };
 
 struct ibv_query_port_resp {
-	__u32 port_cap_flags;
-	__u32 max_msg_sz;
-	__u32 bad_pkey_cntr;
-	__u32 qkey_viol_cntr;
-	__u32 gid_tbl_len;
-	__u16 pkey_tbl_len;
-	__u16 lid;
-	__u16 sm_lid;
-	__u8  state;
-	__u8  max_mtu;
-	__u8  active_mtu;
-	__u8  lmc;
-	__u8  max_vl_num;
-	__u8  sm_sl;
-	__u8  subnet_timeout;
-	__u8  init_type_reply;
-	__u8  active_width;
-	__u8  active_speed;
-	__u8  phys_state;
-	__u8  reserved[3];
+	uint32_t port_cap_flags;
+	uint32_t max_msg_sz;
+	uint32_t bad_pkey_cntr;
+	uint32_t qkey_viol_cntr;
+	uint32_t gid_tbl_len;
+	uint16_t pkey_tbl_len;
+	uint16_t lid;
+	uint16_t sm_lid;
+	uint8_t  state;
+	uint8_t  max_mtu;
+	uint8_t  active_mtu;
+	uint8_t  lmc;
+	uint8_t  max_vl_num;
+	uint8_t  sm_sl;
+	uint8_t  subnet_timeout;
+	uint8_t  init_type_reply;
+	uint8_t  active_width;
+	uint8_t  active_speed;
+	uint8_t  phys_state;
+	uint8_t  reserved[3];
 };
 
 struct ibv_alloc_pd {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u64 response;
-	__u64 driver_data[0];
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint64_t response;
+	uint64_t driver_data[0];
 };
 
 struct ibv_alloc_pd_resp {
-	__u32 pd_handle;
+	uint32_t pd_handle;
 };
 
 struct ibv_dealloc_pd {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u32 pd_handle;
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint32_t pd_handle;
 };
 
 struct ibv_reg_mr {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u64 response;
-	__u64 start;
-	__u64 length;
-	__u64 hca_va;
-	__u32 pd_handle;
-	__u32 access_flags;
-	__u64 driver_data[0];
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint64_t response;
+	uint64_t start;
+	uint64_t length;
+	uint64_t hca_va;
+	uint32_t pd_handle;
+	uint32_t access_flags;
+	uint64_t driver_data[0];
 };
 
 struct ibv_reg_mr_resp {
-	__u32 mr_handle;
-	__u32 lkey;
-	__u32 rkey;
+	uint32_t mr_handle;
+	uint32_t lkey;
+	uint32_t rkey;
 };
 
 struct ibv_dereg_mr {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u32 mr_handle;
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint32_t mr_handle;
 };
 
 struct ibv_create_comp_channel {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u64 response;
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint64_t response;
 };
 
 struct ibv_create_comp_channel_resp {
-	__u32 fd;
+	uint32_t fd;
 };
 
 struct ibv_create_cq {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u64 response;
-	__u64 user_handle;
-	__u32 cqe;
-	__u32 comp_vector;
-	__s32 comp_channel;
-	__u32 reserved;
-	__u64 driver_data[0];
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint64_t response;
+	uint64_t user_handle;
+	uint32_t cqe;
+	uint32_t comp_vector;
+	int32_t  comp_channel;
+	uint32_t reserved;
+	uint64_t driver_data[0];
 };
 
 struct ibv_create_cq_resp {
-	__u32 cq_handle;
-	__u32 cqe;
+	uint32_t cq_handle;
+	uint32_t cqe;
 };
 
 struct ibv_kern_wc {
-	__u64  wr_id;
-	__u32  status;
-	__u32  opcode;
-	__u32  vendor_err;
-	__u32  byte_len;
-	__u32  imm_data;
-	__u32  qp_num;
-	__u32  src_qp;
-	__u32  wc_flags;
-	__u16  pkey_index;
-	__u16  slid;
-	__u8   sl;
-	__u8   dlid_path_bits;
-	__u8   port_num;
-	__u8   reserved;
+	uint64_t  wr_id;
+	uint32_t  status;
+	uint32_t  opcode;
+	uint32_t  vendor_err;
+	uint32_t  byte_len;
+	uint32_t  imm_data;
+	uint32_t  qp_num;
+	uint32_t  src_qp;
+	uint32_t  wc_flags;
+	uint16_t  pkey_index;
+	uint16_t  slid;
+	uint8_t   sl;
+	uint8_t   dlid_path_bits;
+	uint8_t   port_num;
+	uint8_t   reserved;
 };
 
 struct ibv_poll_cq {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u64 response;
-	__u32 cq_handle;
-	__u32 ne;
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint64_t response;
+	uint32_t cq_handle;
+	uint32_t ne;
 };
 
 struct ibv_poll_cq_resp {
-	__u32 count;
-	__u32 reserved;
+	uint32_t count;
+	uint32_t reserved;
 	struct ibv_kern_wc wc[0];
 };
 
 struct ibv_req_notify_cq {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u32 cq_handle;
-	__u32 solicited;
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint32_t cq_handle;
+	uint32_t solicited;
 };
 
 struct ibv_resize_cq {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u64 response;
-	__u32 cq_handle;
-	__u32 cqe;
-	__u64 driver_data[0];
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint64_t response;
+	uint32_t cq_handle;
+	uint32_t cqe;
+	uint64_t driver_data[0];
 };
 
 struct ibv_resize_cq_resp {
-	__u32 cqe;
+	uint32_t cqe;
 };
 
 struct ibv_destroy_cq {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u64 response;
-	__u32 cq_handle;
-	__u32 reserved;
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint64_t response;
+	uint32_t cq_handle;
+	uint32_t reserved;
 };
 
 struct ibv_destroy_cq_resp {
-	__u32 comp_events_reported;
-	__u32 async_events_reported;
+	uint32_t comp_events_reported;
+	uint32_t async_events_reported;
 };
 
 struct ibv_kern_global_route {
-	__u8  dgid[16];
-	__u32 flow_label;
-	__u8  sgid_index;
-	__u8  hop_limit;
-	__u8  traffic_class;
-	__u8  reserved;
+	uint8_t  dgid[16];
+	uint32_t flow_label;
+	uint8_t  sgid_index;
+	uint8_t  hop_limit;
+	uint8_t  traffic_class;
+	uint8_t  reserved;
 };
 
 struct ibv_kern_ah_attr {
 	struct ibv_kern_global_route grh;
-	__u16 dlid;
-	__u8  sl;
-	__u8  src_path_bits;
-	__u8  static_rate;
-	__u8  is_global;
-	__u8  port_num;
-	__u8  reserved;
+	uint16_t dlid;
+	uint8_t  sl;
+	uint8_t  src_path_bits;
+	uint8_t  static_rate;
+	uint8_t  is_global;
+	uint8_t  port_num;
+	uint8_t  reserved;
 };
 
 struct ibv_kern_qp_attr {
-	__u32	qp_attr_mask;
-	__u32	qp_state;
-	__u32	cur_qp_state;
-	__u32	path_mtu;
-	__u32	path_mig_state;
-	__u32	qkey;
-	__u32	rq_psn;
-	__u32	sq_psn;
-	__u32	dest_qp_num;
-	__u32	qp_access_flags;
+	uint32_t	qp_attr_mask;
+	uint32_t	qp_state;
+	uint32_t	cur_qp_state;
+	uint32_t	path_mtu;
+	uint32_t	path_mig_state;
+	uint32_t	qkey;
+	uint32_t	rq_psn;
+	uint32_t	sq_psn;
+	uint32_t	dest_qp_num;
+	uint32_t	qp_access_flags;
 
 	struct ibv_kern_ah_attr ah_attr;
 	struct ibv_kern_ah_attr alt_ah_attr;
 
 	/* ib_qp_cap */
-	__u32	max_send_wr;
-	__u32	max_recv_wr;
-	__u32	max_send_sge;
-	__u32	max_recv_sge;
-	__u32	max_inline_data;
+	uint32_t	max_send_wr;
+	uint32_t	max_recv_wr;
+	uint32_t	max_send_sge;
+	uint32_t	max_recv_sge;
+	uint32_t	max_inline_data;
 
-	__u16	pkey_index;
-	__u16	alt_pkey_index;
-	__u8	en_sqd_async_notify;
-	__u8	sq_draining;
-	__u8	max_rd_atomic;
-	__u8	max_dest_rd_atomic;
-	__u8	min_rnr_timer;
-	__u8	port_num;
-	__u8	timeout;
-	__u8	retry_cnt;
-	__u8	rnr_retry;
-	__u8	alt_port_num;
-	__u8	alt_timeout;
-	__u8	reserved[5];
+	uint16_t	pkey_index;
+	uint16_t	alt_pkey_index;
+	uint8_t	en_sqd_async_notify;
+	uint8_t	sq_draining;
+	uint8_t	max_rd_atomic;
+	uint8_t	max_dest_rd_atomic;
+	uint8_t	min_rnr_timer;
+	uint8_t	port_num;
+	uint8_t	timeout;
+	uint8_t	retry_cnt;
+	uint8_t	rnr_retry;
+	uint8_t	alt_port_num;
+	uint8_t	alt_timeout;
+	uint8_t	reserved[5];
 };
 
 struct ibv_create_qp {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u64 response;
-	__u64 user_handle;
-	__u32 pd_handle;
-	__u32 send_cq_handle;
-	__u32 recv_cq_handle;
-	__u32 srq_handle;
-	__u32 max_send_wr;
-	__u32 max_recv_wr;
-	__u32 max_send_sge;
-	__u32 max_recv_sge;
-	__u32 max_inline_data;
-	__u8  sq_sig_all;
-	__u8  qp_type;
-	__u8  is_srq;
-	__u8  reserved;
-	__u64 driver_data[0];
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint64_t response;
+	uint64_t user_handle;
+	uint32_t pd_handle;
+	uint32_t send_cq_handle;
+	uint32_t recv_cq_handle;
+	uint32_t srq_handle;
+	uint32_t max_send_wr;
+	uint32_t max_recv_wr;
+	uint32_t max_send_sge;
+	uint32_t max_recv_sge;
+	uint32_t max_inline_data;
+	uint8_t  sq_sig_all;
+	uint8_t  qp_type;
+	uint8_t  is_srq;
+	uint8_t  reserved;
+	uint64_t driver_data[0];
 };
 
 struct ibv_create_qp_resp {
-	__u32 qp_handle;
-	__u32 qpn;
-	__u32 max_send_wr;
-	__u32 max_recv_wr;
-	__u32 max_send_sge;
-	__u32 max_recv_sge;
-	__u32 max_inline_data;
-	__u32 reserved;
+	uint32_t qp_handle;
+	uint32_t qpn;
+	uint32_t max_send_wr;
+	uint32_t max_recv_wr;
+	uint32_t max_send_sge;
+	uint32_t max_recv_sge;
+	uint32_t max_inline_data;
+	uint32_t reserved;
 };
 
 struct ibv_qp_dest {
-	__u8  dgid[16];
-	__u32 flow_label;
-	__u16 dlid;
-	__u16 reserved;
-	__u8  sgid_index;
-	__u8  hop_limit;
-	__u8  traffic_class;
-	__u8  sl;
-	__u8  src_path_bits;
-	__u8  static_rate;
-	__u8  is_global;
-	__u8  port_num;
+	uint8_t  dgid[16];
+	uint32_t flow_label;
+	uint16_t dlid;
+	uint16_t reserved;
+	uint8_t  sgid_index;
+	uint8_t  hop_limit;
+	uint8_t  traffic_class;
+	uint8_t  sl;
+	uint8_t  src_path_bits;
+	uint8_t  static_rate;
+	uint8_t  is_global;
+	uint8_t  port_num;
 };
 
 struct ibv_query_qp {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u64 response;
-	__u32 qp_handle;
-	__u32 attr_mask;
-	__u64 driver_data[0];
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint64_t response;
+	uint32_t qp_handle;
+	uint32_t attr_mask;
+	uint64_t driver_data[0];
 };
 
 struct ibv_query_qp_resp {
 	struct ibv_qp_dest dest;
 	struct ibv_qp_dest alt_dest;
-	__u32 max_send_wr;
-	__u32 max_recv_wr;
-	__u32 max_send_sge;
-	__u32 max_recv_sge;
-	__u32 max_inline_data;
-	__u32 qkey;
-	__u32 rq_psn;
-	__u32 sq_psn;
-	__u32 dest_qp_num;
-	__u32 qp_access_flags;
-	__u16 pkey_index;
-	__u16 alt_pkey_index;
-	__u8  qp_state;
-	__u8  cur_qp_state;
-	__u8  path_mtu;
-	__u8  path_mig_state;
-	__u8  en_sqd_async_notify;
-	__u8  max_rd_atomic;
-	__u8  max_dest_rd_atomic;
-	__u8  min_rnr_timer;
-	__u8  port_num;
-	__u8  timeout;
-	__u8  retry_cnt;
-	__u8  rnr_retry;
-	__u8  alt_port_num;
-	__u8  alt_timeout;
-	__u8  sq_sig_all;
-	__u8  reserved[5];
-	__u64 driver_data[0];
+	uint32_t max_send_wr;
+	uint32_t max_recv_wr;
+	uint32_t max_send_sge;
+	uint32_t max_recv_sge;
+	uint32_t max_inline_data;
+	uint32_t qkey;
+	uint32_t rq_psn;
+	uint32_t sq_psn;
+	uint32_t dest_qp_num;
+	uint32_t qp_access_flags;
+	uint16_t pkey_index;
+	uint16_t alt_pkey_index;
+	uint8_t  qp_state;
+	uint8_t  cur_qp_state;
+	uint8_t  path_mtu;
+	uint8_t  path_mig_state;
+	uint8_t  en_sqd_async_notify;
+	uint8_t  max_rd_atomic;
+	uint8_t  max_dest_rd_atomic;
+	uint8_t  min_rnr_timer;
+	uint8_t  port_num;
+	uint8_t  timeout;
+	uint8_t  retry_cnt;
+	uint8_t  rnr_retry;
+	uint8_t  alt_port_num;
+	uint8_t  alt_timeout;
+	uint8_t  sq_sig_all;
+	uint8_t  reserved[5];
+	uint64_t driver_data[0];
 };
 
 struct ibv_modify_qp {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
 	struct ibv_qp_dest dest;
 	struct ibv_qp_dest alt_dest;
-	__u32 qp_handle;
-	__u32 attr_mask;
-	__u32 qkey;
-	__u32 rq_psn;
-	__u32 sq_psn;
-	__u32 dest_qp_num;
-	__u32 qp_access_flags;
-	__u16 pkey_index;
-	__u16 alt_pkey_index;
-	__u8  qp_state;
-	__u8  cur_qp_state;
-	__u8  path_mtu;
-	__u8  path_mig_state;
-	__u8  en_sqd_async_notify;
-	__u8  max_rd_atomic;
-	__u8  max_dest_rd_atomic;
-	__u8  min_rnr_timer;
-	__u8  port_num;
-	__u8  timeout;
-	__u8  retry_cnt;
-	__u8  rnr_retry;
-	__u8  alt_port_num;
-	__u8  alt_timeout;
-	__u8  reserved[2];
-	__u64 driver_data[0];
+	uint32_t qp_handle;
+	uint32_t attr_mask;
+	uint32_t qkey;
+	uint32_t rq_psn;
+	uint32_t sq_psn;
+	uint32_t dest_qp_num;
+	uint32_t qp_access_flags;
+	uint16_t pkey_index;
+	uint16_t alt_pkey_index;
+	uint8_t  qp_state;
+	uint8_t  cur_qp_state;
+	uint8_t  path_mtu;
+	uint8_t  path_mig_state;
+	uint8_t  en_sqd_async_notify;
+	uint8_t  max_rd_atomic;
+	uint8_t  max_dest_rd_atomic;
+	uint8_t  min_rnr_timer;
+	uint8_t  port_num;
+	uint8_t  timeout;
+	uint8_t  retry_cnt;
+	uint8_t  rnr_retry;
+	uint8_t  alt_port_num;
+	uint8_t  alt_timeout;
+	uint8_t  reserved[2];
+	uint64_t driver_data[0];
 };
 
 struct ibv_destroy_qp {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u64 response;
-	__u32 qp_handle;
-	__u32 reserved;
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint64_t response;
+	uint32_t qp_handle;
+	uint32_t reserved;
 };
 
 struct ibv_destroy_qp_resp {
-	__u32 events_reported;
+	uint32_t events_reported;
 };
 
 struct ibv_kern_send_wr {
-	__u64 wr_id;
-	__u32 num_sge;
-	__u32 opcode;
-	__u32 send_flags;
-	__u32 imm_data;
+	uint64_t wr_id;
+	uint32_t num_sge;
+	uint32_t opcode;
+	uint32_t send_flags;
+	uint32_t imm_data;
 	union {
 		struct {
-			__u64 remote_addr;
-			__u32 rkey;
-			__u32 reserved;
+			uint64_t remote_addr;
+			uint32_t rkey;
+			uint32_t reserved;
 		} rdma;
 		struct {
-			__u64 remote_addr;
-			__u64 compare_add;
-			__u64 swap;
-			__u32 rkey;
-			__u32 reserved;
+			uint64_t remote_addr;
+			uint64_t compare_add;
+			uint64_t swap;
+			uint32_t rkey;
+			uint32_t reserved;
 		} atomic;
 		struct {
-			__u32 ah;
-			__u32 remote_qpn;
-			__u32 remote_qkey;
-			__u32 reserved;
+			uint32_t ah;
+			uint32_t remote_qpn;
+			uint32_t remote_qkey;
+			uint32_t reserved;
 		} ud;
 	} wr;
 };
 
 struct ibv_post_send {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u64 response;
-	__u32 qp_handle;
-	__u32 wr_count;
-	__u32 sge_count;
-	__u32 wqe_size;
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint64_t response;
+	uint32_t qp_handle;
+	uint32_t wr_count;
+	uint32_t sge_count;
+	uint32_t wqe_size;
 	struct ibv_kern_send_wr send_wr[0];
 };
 
 struct ibv_post_send_resp {
-	__u32 bad_wr;
+	uint32_t bad_wr;
 };
 
 struct ibv_kern_recv_wr {
-	__u64 wr_id;
-	__u32 num_sge;
-	__u32 reserved;
+	uint64_t wr_id;
+	uint32_t num_sge;
+	uint32_t reserved;
 };
 
 struct ibv_post_recv {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u64 response;
-	__u32 qp_handle;
-	__u32 wr_count;
-	__u32 sge_count;
-	__u32 wqe_size;
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint64_t response;
+	uint32_t qp_handle;
+	uint32_t wr_count;
+	uint32_t sge_count;
+	uint32_t wqe_size;
 	struct ibv_kern_recv_wr recv_wr[0];
 };
 
 struct ibv_post_recv_resp {
-	__u32 bad_wr;
+	uint32_t bad_wr;
 };
 
 struct ibv_post_srq_recv {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u64 response;
-	__u32 srq_handle;
-	__u32 wr_count;
-	__u32 sge_count;
-	__u32 wqe_size;
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint64_t response;
+	uint32_t srq_handle;
+	uint32_t wr_count;
+	uint32_t sge_count;
+	uint32_t wqe_size;
 	struct ibv_kern_recv_wr recv_wr[0];
 };
 
 struct ibv_post_srq_recv_resp {
-	__u32 bad_wr;
+	uint32_t bad_wr;
 };
 
 struct ibv_create_ah {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u64 response;
-	__u64 user_handle;
-	__u32 pd_handle;
-	__u32 reserved;
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint64_t response;
+	uint64_t user_handle;
+	uint32_t pd_handle;
+	uint32_t reserved;
 	struct ibv_kern_ah_attr attr;
 };
 
 struct ibv_create_ah_resp {
-	__u32 handle;
+	uint32_t handle;
 };
 
 struct ibv_destroy_ah {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u32 ah_handle;
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint32_t ah_handle;
 };
 
 struct ibv_attach_mcast {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u8  gid[16];
-	__u32 qp_handle;
-	__u16 mlid;
-	__u16 reserved;
-	__u64 driver_data[0];
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint8_t  gid[16];
+	uint32_t qp_handle;
+	uint16_t mlid;
+	uint16_t reserved;
+	uint64_t driver_data[0];
 };
 
 struct ibv_detach_mcast {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u8  gid[16];
-	__u32 qp_handle;
-	__u16 mlid;
-	__u16 reserved;
-	__u64 driver_data[0];
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint8_t  gid[16];
+	uint32_t qp_handle;
+	uint16_t mlid;
+	uint16_t reserved;
+	uint64_t driver_data[0];
 };
 
 struct ibv_create_srq {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u64 response;
-	__u64 user_handle;
-	__u32 pd_handle;
-	__u32 max_wr;
-	__u32 max_sge;
-	__u32 srq_limit;
-	__u64 driver_data[0];
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint64_t response;
+	uint64_t user_handle;
+	uint32_t pd_handle;
+	uint32_t max_wr;
+	uint32_t max_sge;
+	uint32_t srq_limit;
+	uint64_t driver_data[0];
 };
 
 struct ibv_create_srq_resp {
-	__u32 srq_handle;
-	__u32 max_wr;
-	__u32 max_sge;
-	__u32 reserved;
+	uint32_t srq_handle;
+	uint32_t max_wr;
+	uint32_t max_sge;
+	uint32_t reserved;
 };
 
 struct ibv_modify_srq {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u32 srq_handle;
-	__u32 attr_mask;
-	__u32 max_wr;
-	__u32 srq_limit;
-	__u64 driver_data[0];
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint32_t srq_handle;
+	uint32_t attr_mask;
+	uint32_t max_wr;
+	uint32_t srq_limit;
+	uint64_t driver_data[0];
 };
 
 struct ibv_query_srq {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u64 response;
-	__u32 srq_handle;
-	__u32 reserved;
-	__u64 driver_data[0];
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint64_t response;
+	uint32_t srq_handle;
+	uint32_t reserved;
+	uint64_t driver_data[0];
 };
 
 struct ibv_query_srq_resp {
-	__u32 max_wr;
-	__u32 max_sge;
-	__u32 srq_limit;
-	__u32 reserved;
+	uint32_t max_wr;
+	uint32_t max_sge;
+	uint32_t srq_limit;
+	uint32_t reserved;
 };
 
 struct ibv_destroy_srq {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u64 response;
-	__u32 srq_handle;
-	__u32 reserved;
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint64_t response;
+	uint32_t srq_handle;
+	uint32_t reserved;
 };
 
 struct ibv_destroy_srq_resp {
-	__u32 events_reported;
+	uint32_t events_reported;
 };
 
 /*
@@ -806,76 +806,76 @@
 };
 
 struct ibv_destroy_cq_v1 {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u32 cq_handle;
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint32_t cq_handle;
 };
 
 struct ibv_destroy_qp_v1 {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u32 qp_handle;
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint32_t qp_handle;
 };
 
 struct ibv_destroy_srq_v1 {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u32 srq_handle;
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint32_t srq_handle;
 };
 
 struct ibv_get_context_v2 {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u64 response;
-	__u64 cq_fd_tab;
-	__u64 driver_data[0];
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint64_t response;
+	uint64_t cq_fd_tab;
+	uint64_t driver_data[0];
 };
 
 struct ibv_create_cq_v2 {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u64 response;
-	__u64 user_handle;
-	__u32 cqe;
-	__u32 event_handler;
-	__u64 driver_data[0];
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint64_t response;
+	uint64_t user_handle;
+	uint32_t cqe;
+	uint32_t event_handler;
+	uint64_t driver_data[0];
 };
 
 struct ibv_modify_srq_v3 {
-	__u32 command;
-	__u16 in_words;
-	__u16 out_words;
-	__u32 srq_handle;
-	__u32 attr_mask;
-	__u32 max_wr;
-	__u32 max_sge;
-	__u32 srq_limit;
-	__u32 reserved;
-	__u64 driver_data[0];
+	uint32_t command;
+	uint16_t in_words;
+	uint16_t out_words;
+	uint32_t srq_handle;
+	uint32_t attr_mask;
+	uint32_t max_wr;
+	uint32_t max_sge;
+	uint32_t srq_limit;
+	uint32_t reserved;
+	uint64_t driver_data[0];
 };
 
 struct ibv_create_qp_resp_v3 {
-	__u32 qp_handle;
-	__u32 qpn;
+	uint32_t qp_handle;
+	uint32_t qpn;
 };
 
 struct ibv_create_qp_resp_v4 {
-	__u32 qp_handle;
-	__u32 qpn;
-	__u32 max_send_wr;
-	__u32 max_recv_wr;
-	__u32 max_send_sge;
-	__u32 max_recv_sge;
-	__u32 max_inline_data;
+	uint32_t qp_handle;
+	uint32_t qpn;
+	uint32_t max_send_wr;
+	uint32_t max_recv_wr;
+	uint32_t max_send_sge;
+	uint32_t max_recv_sge;
+	uint32_t max_inline_data;
 };
 
 struct ibv_create_srq_resp_v5 {
-	__u32 srq_handle;
+	uint32_t srq_handle;
 };
 
 #endif /* KERN_ABI_H */
Index: libmthca/src/mthca.h
===================================================================
--- libmthca/src/mthca.h	(revision 7574)
+++ libmthca/src/mthca.h	(working copy)
@@ -36,6 +36,7 @@
 #ifndef MTHCA_H
 #define MTHCA_H
 
+#include <stddef.h>
 #include <infiniband/driver.h>
 #include <infiniband/arch.h>
 
Index: libmthca/src/mthca-abi.h
===================================================================
--- libmthca/src/mthca-abi.h	(revision 7574)
+++ libmthca/src/mthca-abi.h	(working copy)
@@ -36,63 +36,64 @@
 #ifndef MTHCA_ABI_H
 #define MTHCA_ABI_H
 
+#include <stdint.h>
 #include <infiniband/kern-abi.h>
 
 struct mthca_alloc_ucontext_resp {
 	struct ibv_get_context_resp	ibv_resp;
-	__u32				qp_tab_size;
-	__u32				uarc_size;
+	uint32_t				qp_tab_size;
+	uint32_t				uarc_size;
 };
 
 struct mthca_alloc_pd_resp {
 	struct ibv_alloc_pd_resp	ibv_resp;
-	__u32				pdn;
-	__u32				reserved;
+	uint32_t				pdn;
+	uint32_t				reserved;
 };
 
 struct mthca_create_cq {
 	struct ibv_create_cq		ibv_cmd;
-	__u32				lkey;
-	__u32				pdn;
-	__u64				arm_db_page;
-	__u64				set_db_page;
-	__u32				arm_db_index;
-	__u32				set_db_index;
+	uint32_t				lkey;
+	uint32_t				pdn;
+	uint64_t				arm_db_page;
+	uint64_t				set_db_page;
+	uint32_t				arm_db_index;
+	uint32_t				set_db_index;
 };
 
 struct mthca_create_cq_resp {
 	struct ibv_create_cq_resp	ibv_resp;
-	__u32				cqn;
-	__u32				reserved;
+	uint32_t				cqn;
+	uint32_t				reserved;
 };
 
 struct mthca_resize_cq {
 	struct ibv_resize_cq		ibv_cmd;
-	__u32				lkey;
-	__u32				reserved;
+	uint32_t				lkey;
+	uint32_t				reserved;
 };
 
 struct mthca_create_srq {
 	struct ibv_create_srq		ibv_cmd;
-	__u32				lkey;
-	__u32				db_index;
-	__u64				db_page;
+	uint32_t				lkey;
+	uint32_t				db_index;
+	uint64_t				db_page;
 };
 
 struct mthca_create_srq_resp {
 	struct ibv_create_srq_resp	ibv_resp;
-	__u32				srqn;
-	__u32				reserved;
+	uint32_t				srqn;
+	uint32_t				reserved;
 };
 
 struct mthca_create_qp {
 	struct ibv_create_qp		ibv_cmd;
-	__u32				lkey;
-	__u32				reserved;
-	__u64				sq_db_page;
-	__u64				rq_db_page;
-	__u32				sq_db_index;
-	__u32				rq_db_index;
+	uint32_t				lkey;
+	uint32_t				reserved;
+	uint64_t				sq_db_page;
+	uint64_t				rq_db_page;
+	uint32_t				sq_db_index;
+	uint32_t				rq_db_index;
 };
 
 #endif /* MTHCA_ABI_H */
Index: libipathverbs/src/ipathverbs.h
===================================================================
--- libipathverbs/src/ipathverbs.h	(revision 7584)
+++ libipathverbs/src/ipathverbs.h	(working copy)
@@ -40,6 +40,8 @@
 #include <endian.h>
 #include <byteswap.h>
 
+#include <stddef.h>
+#include <sysfs/libsysfs.h>
 #include <infiniband/driver.h>
 #include <infiniband/arch.h>
 #include <infiniband/verbs.h>

-- 
MST



More information about the general mailing list