[openib-general] [PATCH] mthca, ibverbs userspace readability

Bernhard Fischer blist at aon.at
Thu May 26 09:14:55 PDT 2005


Hi,
No object code changes.
 linux-kernel/infiniband/ulp/sdp/sdp_conn.c         |    1
 userspace/libibverbs/include/infiniband/driver.h   |   34 +-
 userspace/libibverbs/include/infiniband/kern-abi.h |    2
 userspace/libibverbs/include/infiniband/verbs.h    |  253 ++++++++++-----------
 userspace/libmthca/src/cq.c                        |    9
 userspace/libmthca/src/mthca.h                     |   87 +++----
 6 files changed, 198 insertions(+), 188 deletions(-)


- improve readability of mthca and ibverbs headers installed to
  userspace.

  Signed-off-by Bernhard Fischer <rep.nop at aon.at>

Those were hard/impossible to read for ts!=8 before.

Please at least consider; I'm aware that those are purely cosmetic,
granted.

TIA for applying nonetheless.
-------------- next part --------------
diff -X excl -rduNp gen2.2491.oorig/trunk/src/linux-kernel/infiniband/ulp/sdp/sdp_conn.c gen2.2491/trunk/src/linux-kernel/infiniband/ulp/sdp/sdp_conn.c
--- gen2.2491.oorig/trunk/src/linux-kernel/infiniband/ulp/sdp/sdp_conn.c	2005-05-16 22:09:24.000000000 +0200
+++ gen2.2491/trunk/src/linux-kernel/infiniband/ulp/sdp/sdp_conn.c	2005-05-26 16:29:31.197039104 +0200
@@ -842,7 +842,6 @@ void sdp_conn_relock(struct sdp_opt *con
 				sdp_dbg_warn(conn, 
 					     "Error <%d> rearming send CQ",
 					     result);
-			
 			rearm = 0;
 		} else
 			break;  /* exit CQ handler routine */
diff -X excl -rduNp gen2.2491.oorig/trunk/src/userspace/libibverbs/include/infiniband/driver.h gen2.2491/trunk/src/userspace/libibverbs/include/infiniband/driver.h
--- gen2.2491.oorig/trunk/src/userspace/libibverbs/include/infiniband/driver.h	2005-05-16 22:09:23.000000000 +0200
+++ gen2.2491/trunk/src/userspace/libibverbs/include/infiniband/driver.h	2005-05-26 16:29:31.200038648 +0200
@@ -60,35 +60,37 @@
  * ops member filled in.  If the driver does not support the device,
  * it should return NULL from openib_driver_init().
  */
- 
+
 typedef struct ibv_device *(*ibv_driver_init_func)(struct sysfs_class_device *);
 
 extern int ibv_cmd_get_context(int num_comp, struct ibv_context *context,
-			       struct ibv_get_context *cmd, size_t cmd_size);
+                               struct ibv_get_context *cmd, size_t cmd_size);
 extern int ibv_cmd_query_port(struct ibv_context *context, uint8_t port_num,
-			      struct ibv_port_attr *port_attr,
-			      struct ibv_query_port *cmd, size_t cmd_size);
+                              struct ibv_port_attr *port_attr,
+                              struct ibv_query_port *cmd, size_t cmd_size);
 extern int ibv_cmd_alloc_pd(struct ibv_context *context, struct ibv_pd *pd,
-			    struct ibv_alloc_pd *cmd, size_t cmd_size);
+                            struct ibv_alloc_pd *cmd, size_t cmd_size);
 extern int ibv_cmd_dealloc_pd(struct ibv_pd *pd);
 extern int ibv_cmd_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
-			  uint64_t hca_va, enum ibv_access_flags access,
-			  struct ibv_mr *mr, struct ibv_reg_mr *cmd,
-			  size_t cmd_size);
+                          uint64_t hca_va, enum ibv_access_flags access,
+                          struct ibv_mr *mr, struct ibv_reg_mr *cmd,
+                          size_t cmd_size);
 extern int ibv_cmd_dereg_mr(struct ibv_mr *mr);
 extern int ibv_cmd_create_cq(struct ibv_context *context, int cqe,
-			     struct ibv_cq *cq,
-			     struct ibv_create_cq *cmd, size_t cmd_size);
+                             struct ibv_cq *cq,
+                             struct ibv_create_cq *cmd, size_t cmd_size);
 extern int ibv_cmd_destroy_cq(struct ibv_cq *cq);
 
 extern int ibv_cmd_create_qp(struct ibv_pd *pd,
-			     struct ibv_qp *qp, struct ibv_qp_init_attr *attr,
-			     struct ibv_create_qp *cmd, size_t cmd_size);
+                             struct ibv_qp *qp, struct ibv_qp_init_attr *attr,
+                             struct ibv_create_qp *cmd, size_t cmd_size);
 extern int ibv_cmd_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
-			     enum ibv_qp_attr_mask attr_mask,
-			     struct ibv_modify_qp *cmd, size_t cmd_size);
+                             enum ibv_qp_attr_mask attr_mask,
+                             struct ibv_modify_qp *cmd, size_t cmd_size);
 extern int ibv_cmd_destroy_qp(struct ibv_qp *qp);
-extern int ibv_cmd_attach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid);
-extern int ibv_cmd_detach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid);
+extern int ibv_cmd_attach_mcast(struct ibv_qp *qp, union ibv_gid *gid,
+                                uint16_t lid);
+extern int ibv_cmd_detach_mcast(struct ibv_qp *qp, union ibv_gid *gid,
+                                uint16_t lid);
 
 #endif /* INFINIBAND_DRIVER_H */
diff -X excl -rduNp gen2.2491.oorig/trunk/src/userspace/libibverbs/include/infiniband/kern-abi.h gen2.2491/trunk/src/userspace/libibverbs/include/infiniband/kern-abi.h
--- gen2.2491.oorig/trunk/src/userspace/libibverbs/include/infiniband/kern-abi.h	2005-04-26 20:58:02.000000000 +0200
+++ gen2.2491/trunk/src/userspace/libibverbs/include/infiniband/kern-abi.h	2005-05-26 17:05:42.530946176 +0200
@@ -165,7 +165,7 @@ struct ibv_query_port_resp {
 	__u8  active_width;
 	__u8  active_speed;
 	__u8  phys_state;
-	__u8  reserved[3];
+	__u8  reserved[3]; /* as always, pad to next __u64 */
 };
 
 struct ibv_query_gid {
diff -X excl -rduNp gen2.2491.oorig/trunk/src/userspace/libibverbs/include/infiniband/verbs.h gen2.2491/trunk/src/userspace/libibverbs/include/infiniband/verbs.h
--- gen2.2491.oorig/trunk/src/userspace/libibverbs/include/infiniband/verbs.h	2005-05-16 22:09:23.000000000 +0200
+++ gen2.2491/trunk/src/userspace/libibverbs/include/infiniband/verbs.h	2005-05-26 16:29:31.203038192 +0200
@@ -51,10 +51,10 @@
 BEGIN_C_DECLS
 
 union ibv_gid {
-	uint8_t			raw[16];
+	uint8_t                 raw[16];
 	struct {
-		uint64_t	subnet_prefix;
-		uint64_t	interface_id;
+		uint64_t        subnet_prefix;
+		uint64_t        interface_id;
 	} global;
 };
 
@@ -67,34 +67,34 @@ enum ibv_mtu {
 };
 
 enum ibv_port_state {
-	IBV_PORT_NOP		= 0,
-	IBV_PORT_DOWN		= 1,
-	IBV_PORT_INIT		= 2,
-	IBV_PORT_ARMED		= 3,
-	IBV_PORT_ACTIVE		= 4,
-	IBV_PORT_ACTIVE_DEFER	= 5
+	IBV_PORT_NOP            = 0,
+	IBV_PORT_DOWN           = 1,
+	IBV_PORT_INIT           = 2,
+	IBV_PORT_ARMED          = 3,
+	IBV_PORT_ACTIVE         = 4,
+	IBV_PORT_ACTIVE_DEFER   = 5
 };
 
 struct ibv_port_attr {
-	enum ibv_port_state	state;
-	enum ibv_mtu		max_mtu;
-	enum ibv_mtu		active_mtu;
-	int			gid_tbl_len;
-	uint32_t		port_cap_flags;
-	uint32_t		max_msg_sz;
-	uint32_t		bad_pkey_cntr;
-	uint32_t		qkey_viol_cntr;
-	uint16_t		pkey_tbl_len;
-	uint16_t		lid;
-	uint16_t		sm_lid;
-	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;
+	enum ibv_port_state     state;
+	enum ibv_mtu            max_mtu;
+	enum ibv_mtu            active_mtu;
+	int                     gid_tbl_len;
+	uint32_t                port_cap_flags;
+	uint32_t                max_msg_sz;
+	uint32_t                bad_pkey_cntr;
+	uint32_t                qkey_viol_cntr;
+	uint16_t                pkey_tbl_len;
+	uint16_t                lid;
+	uint16_t                sm_lid;
+	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;
 };
 
 enum ibv_event_type {
@@ -159,68 +159,68 @@ enum ibv_wc_opcode {
  * Set value of IBV_WC_RECV so consumers can test if a completion is a
  * receive by testing (opcode & IBV_WC_RECV).
  */
-	IBV_WC_RECV			= 1 << 7,
+	IBV_WC_RECV                     = 1 << 7,
 	IBV_WC_RECV_RDMA_WITH_IMM
 };
 
 enum ibv_wc_flags {
-	IBV_WC_GRH		= 1 << 0,
-	IBV_WC_WITH_IMM		= 1 << 1
+	IBV_WC_GRH              = 1 << 0,
+	IBV_WC_WITH_IMM         = 1 << 1
 };
 
 struct ibv_wc {
-	uint64_t		wr_id;
-	enum ibv_wc_status	status;
-	enum ibv_wc_opcode	opcode;
-	uint32_t		vendor_err;
-	uint32_t		byte_len;
-	uint32_t		imm_data;	/* in network byte order */
-	uint32_t		qp_num;
-	uint32_t		src_qp;
-	enum ibv_wc_flags	wc_flags;
-	uint16_t		pkey_index;
-	uint16_t		slid;
-	uint8_t			sl;
-	uint8_t			dlid_path_bits;
+	uint64_t                wr_id;
+	enum ibv_wc_status      status;
+	enum ibv_wc_opcode      opcode;
+	uint32_t                vendor_err;
+	uint32_t                byte_len;
+	uint32_t                imm_data;	/* in network byte order */
+	uint32_t                qp_num;
+	uint32_t                src_qp;
+	enum ibv_wc_flags       wc_flags;
+	uint16_t                pkey_index;
+	uint16_t                slid;
+	uint8_t                 sl;
+	uint8_t                 dlid_path_bits;
 };
 
 enum ibv_access_flags {
-	IBV_ACCESS_LOCAL_WRITE		= 1,
-	IBV_ACCESS_REMOTE_WRITE		= (1<<1),
-	IBV_ACCESS_REMOTE_READ		= (1<<2),
-	IBV_ACCESS_REMOTE_ATOMIC	= (1<<3),
-	IBV_ACCESS_MW_BIND		= (1<<4)
+	IBV_ACCESS_LOCAL_WRITE          = 1,
+	IBV_ACCESS_REMOTE_WRITE         = (1<<1),
+	IBV_ACCESS_REMOTE_READ          = (1<<2),
+	IBV_ACCESS_REMOTE_ATOMIC        = (1<<3),
+	IBV_ACCESS_MW_BIND              = (1<<4)
 };
 
 struct ibv_pd {
 	struct ibv_context     *context;
-	uint32_t		handle;
+	uint32_t                handle;
 };
 
 struct ibv_mr {
 	struct ibv_context     *context;
-	struct ibv_pd	       *pd;
-	uint32_t		handle;
-	uint32_t		lkey;
-	uint32_t		rkey;
+	struct ibv_pd          *pd;
+	uint32_t                handle;
+	uint32_t                lkey;
+	uint32_t                rkey;
 };
 
 struct ibv_global_route {
-	union ibv_gid		dgid;
-	uint32_t		flow_label;
-	uint8_t			sgid_index;
-	uint8_t			hop_limit;
-	uint8_t			traffic_class;
+	union ibv_gid           dgid;
+	uint32_t                flow_label;
+	uint8_t                 sgid_index;
+	uint8_t                 hop_limit;
+	uint8_t                 traffic_class;
 };
 
 struct ibv_ah_attr {
-	struct ibv_global_route	grh;
-	uint16_t		dlid;
-	uint8_t			sl;
-	uint8_t			src_path_bits;
-	uint8_t			static_rate;
-	uint8_t			is_global;
-	uint8_t			port_num;
+	struct ibv_global_route grh;
+	uint16_t                dlid;
+	uint8_t                 sl;
+	uint8_t                 src_path_bits;
+	uint8_t                 static_rate;
+	uint8_t                 is_global;
+	uint8_t                 port_num;
 };
 
 enum ibv_qp_type {
@@ -230,45 +230,45 @@ enum ibv_qp_type {
 };
 
 struct ibv_qp_cap {
-	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                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_qp_init_attr {
-	void		       *qp_context;
-	struct ibv_cq	       *send_cq;
-	struct ibv_cq	       *recv_cq;
-	struct ibv_srq	       *srq;
-	struct ibv_qp_cap	cap;
-	enum ibv_qp_type	qp_type;
-	int			sq_sig_all;
+	void                   *qp_context;
+	struct ibv_cq          *send_cq;
+	struct ibv_cq          *recv_cq;
+	struct ibv_srq         *srq;
+	struct ibv_qp_cap       cap;
+	enum ibv_qp_type        qp_type;
+	int                     sq_sig_all;
 };
 
 enum ibv_qp_attr_mask {
-	IBV_QP_STATE			= 1 << 	0,
-	IBV_QP_CUR_STATE		= 1 << 	1,
-	IBV_QP_EN_SQD_ASYNC_NOTIFY	= 1 << 	2,
-	IBV_QP_ACCESS_FLAGS		= 1 << 	3,
-	IBV_QP_PKEY_INDEX		= 1 << 	4,
-	IBV_QP_PORT			= 1 << 	5,
-	IBV_QP_QKEY			= 1 << 	6,
-	IBV_QP_AV			= 1 << 	7,
-	IBV_QP_PATH_MTU			= 1 << 	8,
-	IBV_QP_TIMEOUT			= 1 << 	9,
-	IBV_QP_RETRY_CNT		= 1 << 10,
-	IBV_QP_RNR_RETRY		= 1 << 11,
-	IBV_QP_RQ_PSN			= 1 << 12,
-	IBV_QP_MAX_QP_RD_ATOMIC		= 1 << 13,
-	IBV_QP_ALT_PATH			= 1 << 14,
-	IBV_QP_MIN_RNR_TIMER		= 1 << 15,
-	IBV_QP_SQ_PSN			= 1 << 16,
-	IBV_QP_MAX_DEST_RD_ATOMIC	= 1 << 17,
-	IBV_QP_PATH_MIG_STATE		= 1 << 18,
-	IBV_QP_CAP			= 1 << 19,
-	IBV_QP_DEST_QPN			= 1 << 20
+	IBV_QP_STATE                    = 1 <<  0,
+	IBV_QP_CUR_STATE                = 1 <<  1,
+	IBV_QP_EN_SQD_ASYNC_NOTIFY      = 1 <<  2,
+	IBV_QP_ACCESS_FLAGS             = 1 <<  3,
+	IBV_QP_PKEY_INDEX               = 1 <<  4,
+	IBV_QP_PORT                     = 1 <<  5,
+	IBV_QP_QKEY                     = 1 <<  6,
+	IBV_QP_AV                       = 1 <<  7,
+	IBV_QP_PATH_MTU                 = 1 <<  8,
+	IBV_QP_TIMEOUT                  = 1 <<  9,
+	IBV_QP_RETRY_CNT                = 1 << 10,
+	IBV_QP_RNR_RETRY                = 1 << 11,
+	IBV_QP_RQ_PSN                   = 1 << 12,
+	IBV_QP_MAX_QP_RD_ATOMIC         = 1 << 13,
+	IBV_QP_ALT_PATH                 = 1 << 14,
+	IBV_QP_MIN_RNR_TIMER            = 1 << 15,
+	IBV_QP_SQ_PSN                   = 1 << 16,
+	IBV_QP_MAX_DEST_RD_ATOMIC       = 1 << 17,
+	IBV_QP_PATH_MIG_STATE           = 1 << 18,
+	IBV_QP_CAP                      = 1 << 19,
+	IBV_QP_DEST_QPN                 = 1 << 20
 };
 
 enum ibv_qp_state {
@@ -288,31 +288,31 @@ enum ibv_mig_state {
 };
 
 struct ibv_qp_attr {
-	enum ibv_qp_state	qp_state;
-	enum ibv_qp_state	cur_qp_state;
-	enum ibv_mtu		path_mtu;
-	enum ibv_mig_state	path_mig_state;
-	uint32_t		qkey;
-	uint32_t		rq_psn;
-	uint32_t		sq_psn;
-	uint32_t		dest_qp_num;
-	int			qp_access_flags;
-	struct ibv_qp_cap	cap;
-	struct ibv_ah_attr	ah_attr;
-	struct ibv_ah_attr	alt_ah_attr;
-	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;
+	enum ibv_qp_state       qp_state;
+	enum ibv_qp_state       cur_qp_state;
+	enum ibv_mtu            path_mtu;
+	enum ibv_mig_state      path_mig_state;
+	uint32_t                qkey;
+	uint32_t                rq_psn;
+	uint32_t                sq_psn;
+	uint32_t                dest_qp_num;
+	int                     qp_access_flags;
+	struct ibv_qp_cap       cap;
+	struct ibv_ah_attr      ah_attr;
+	struct ibv_ah_attr      alt_ah_attr;
+	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;
 };
 
 enum ibv_wr_opcode {
@@ -375,7 +375,7 @@ struct ibv_recv_wr {
 struct ibv_qp {
 	struct ibv_context     *context;
 	void		       *qp_context;
-	struct ibv_pd	       *pd; 
+	struct ibv_pd	       *pd;
 	struct ibv_cq	       *send_cq;
 	struct ibv_cq	       *recv_cq;
 	uint32_t		handle;
@@ -442,7 +442,7 @@ struct ibv_context_ops {
 
 struct ibv_context {
 	struct ibv_device         *device;
-	struct ibv_context_ops	   ops;
+	struct ibv_context_ops     ops;
 	int                        cmd_fd;
 	int                        async_fd;
 	int                        num_comp;
@@ -523,7 +523,6 @@ extern int ibv_destroy_cq(struct ibv_cq 
  */
 extern int ibv_get_cq_event(struct ibv_context *context, int comp_num,
 			    struct ibv_cq **cq, void **cq_context);
- 
 
 /**
  * ibv_poll_cq - Poll a CQ for work completions
diff -X excl -rduNp gen2.2491.oorig/trunk/src/userspace/libmthca/src/cq.c gen2.2491/trunk/src/userspace/libmthca/src/cq.c
--- gen2.2491.oorig/trunk/src/userspace/libmthca/src/cq.c	2005-04-26 20:58:01.000000000 +0200
+++ gen2.2491/trunk/src/userspace/libmthca/src/cq.c	2005-05-26 16:43:34.374856592 +0200
@@ -157,7 +157,8 @@ static inline void update_cons_index(str
 		doorbell[0] = htonl(MTHCA_TAVOR_CQ_DB_INC_CI | cq->cqn);
 		doorbell[1] = htonl(incr - 1);
 
-		mthca_write64(doorbell, to_mctx(cq->ibv_cq.context), MTHCA_CQ_DOORBELL);
+		mthca_write64(doorbell, to_mctx(cq->ibv_cq.context),
+				MTHCA_CQ_DOORBELL);
 	}
 }
 
@@ -302,7 +303,8 @@ static inline int mthca_poll_one(struct 
 		 * because CQs will be locked while QPs are removed
 		 * from the table.
 		 */
-		*cur_qp = mthca_find_qp(to_mctx(cq->ibv_cq.context), ntohl(cqe->my_qpn));
+		*cur_qp = mthca_find_qp(to_mctx(cq->ibv_cq.context),
+					ntohl(cqe->my_qpn));
 		if (!*cur_qp) {
 			err = CQ_POLL_ERR;
 			goto out;
@@ -313,7 +315,8 @@ static inline int mthca_poll_one(struct 
 
 	if (is_send) {
 		wq = &(*cur_qp)->sq;
-		wqe_index = ((ntohl(cqe->wqe) - (*cur_qp)->send_wqe_offset) >> wq->wqe_shift);
+		wqe_index = ((ntohl(cqe->wqe) -
+				(*cur_qp)->send_wqe_offset) >> wq->wqe_shift);
 		wc->wr_id = (*cur_qp)->wrid[wqe_index + (*cur_qp)->rq.max];
 	} else {
 		wq = &(*cur_qp)->rq;
diff -X excl -rduNp gen2.2491.oorig/trunk/src/userspace/libmthca/src/mthca.h gen2.2491/trunk/src/userspace/libmthca/src/mthca.h
--- gen2.2491.oorig/trunk/src/userspace/libmthca/src/mthca.h	2005-05-26 11:47:53.961348000 +0200
+++ gen2.2491/trunk/src/userspace/libmthca/src/mthca.h	2005-05-26 16:35:22.191679808 +0200
@@ -104,13 +104,13 @@ struct mthca_context {
 	struct mthca_db_table *db_tab;
 	struct ibv_pd         *pd;
 	struct {
-		struct mthca_qp	**table;
-		int		  refcnt;
-	}		       qp_table[MTHCA_QP_TABLE_SIZE];
+		struct mthca_qp **table;
+		int               refcnt;
+	}                      qp_table[MTHCA_QP_TABLE_SIZE];
 	pthread_mutex_t        qp_table_mutex;
 	int                    num_qps;
-	int		       qp_table_shift;
-	int		       qp_table_mask;
+	int                    qp_table_shift;
+	int                    qp_table_mask;
 	/*
 	 * ibv_ctx must be last because we size it dynamically
 	 * depending on the number of CQ events available.
@@ -126,12 +126,12 @@ struct mthca_pd {
 };
 
 struct mthca_cq {
-	struct ibv_cq  	   ibv_cq;
-	void           	  *buf;
-	pthread_spinlock_t lock;
-	struct ibv_mr  	  *mr;
-	uint32_t       	   cqn;
-	uint32_t       	   cons_index;
+	struct ibv_cq       ibv_cq;
+	void               *buf;
+	pthread_spinlock_t  lock;
+	struct ibv_mr      *mr;
+	uint32_t            cqn;
+	uint32_t            cons_index;
 
 	/* Next fields are mem-free only */
 	int                set_ci_db_index;
@@ -143,14 +143,14 @@ struct mthca_cq {
 
 struct mthca_wq {
 	pthread_spinlock_t lock;
-	int            	   max;
-	unsigned       	   next_ind;
-	unsigned       	   last_comp;
-	unsigned       	   head;
-	unsigned       	   tail;
-	void           	  *last;
-	int            	   max_gs;
-	int            	   wqe_shift;
+	int                max;
+	unsigned           next_ind;
+	unsigned           last_comp;
+	unsigned           head;
+	unsigned           tail;
+	void              *last;
+	int                max_gs;
+	int                wqe_shift;
 
 	/* Next fields are mem-free only */
 	int                db_index;
@@ -247,25 +247,27 @@ static inline int mthca_is_memfree(struc
 	return to_mdev(ibctx->device)->hca_type == MTHCA_ARBEL;
 }
 
-extern int mthca_alloc_db(struct mthca_db_table *db_tab, enum mthca_db_type type,
-			  uint32_t **db);
+extern int mthca_alloc_db(struct mthca_db_table *db_tab,
+                          enum mthca_db_type type,
+                          uint32_t **db);
 extern void mthca_set_db_qn(uint32_t *db, enum mthca_db_type type, uint32_t qn);
-extern void mthca_free_db(struct mthca_db_table *db_tab, enum mthca_db_type type, int db_index);
+extern void mthca_free_db(struct mthca_db_table *db_tab,
+                          enum mthca_db_type type, int db_index);
 extern struct mthca_db_table *mthca_alloc_db_tab(int uarc_size);
 extern void mthca_free_db_tab(struct mthca_db_table *db_tab);
 
 extern int mthca_query_port(struct ibv_context *context, uint8_t port,
-			    struct ibv_port_attr *attr);
+                            struct ibv_port_attr *attr);
 extern int mthca_query_gid(struct ibv_context *context, uint8_t port_num,
-			   int index, union ibv_gid *gid);
+                           int index, union ibv_gid *gid);
 extern int mthca_query_pkey(struct ibv_context *context, uint8_t port_num,
-			    int index, uint16_t *pkey);
+                            int index, uint16_t *pkey);
 
 extern struct ibv_pd *mthca_alloc_pd(struct ibv_context *context);
 extern int mthca_free_pd(struct ibv_pd *pd);
 
 extern struct ibv_mr *mthca_reg_mr(struct ibv_pd *pd, void *addr,
-				   size_t length, enum ibv_access_flags access);
+                                   size_t length, enum ibv_access_flags access);
 extern int mthca_dereg_mr(struct ibv_mr *mr);
 
 struct ibv_cq *mthca_create_cq(struct ibv_context *context, int cqe);
@@ -276,33 +278,38 @@ extern int mthca_arbel_arm_cq(struct ibv
 extern void mthca_arbel_cq_event(struct ibv_cq *cq);
 extern void mthca_init_cq_buf(struct mthca_cq *cq, int nent);
 
-extern struct ibv_qp *mthca_create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *attr);
+extern struct ibv_qp *mthca_create_qp(struct ibv_pd *pd,
+                                      struct ibv_qp_init_attr *attr);
 extern int mthca_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
-			   enum ibv_qp_attr_mask attr_mask);
+                           enum ibv_qp_attr_mask attr_mask);
 extern int mthca_destroy_qp(struct ibv_qp *qp);
 extern int mthca_tavor_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr,
-				 struct ibv_send_wr **bad_wr);
+                                 struct ibv_send_wr **bad_wr);
 extern int mthca_tavor_post_recv(struct ibv_qp *ibqp, struct ibv_recv_wr *wr,
-				 struct ibv_recv_wr **bad_wr);
+                                 struct ibv_recv_wr **bad_wr);
 extern int mthca_arbel_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr,
-				 struct ibv_send_wr **bad_wr);
+                                 struct ibv_send_wr **bad_wr);
 extern int mthca_arbel_post_recv(struct ibv_qp *ibqp, struct ibv_recv_wr *wr,
-				 struct ibv_recv_wr **bad_wr);
+                                 struct ibv_recv_wr **bad_wr);
 extern int mthca_alloc_qp_buf(struct ibv_pd *pd, struct ibv_qp_cap *cap,
-			      struct mthca_qp *qp);
+                              struct mthca_qp *qp);
 extern void mthca_return_cap(struct ibv_pd *pd, struct mthca_qp *qp,
-			     struct ibv_qp_cap *cap);
+                             struct ibv_qp_cap *cap);
 extern struct mthca_qp *mthca_find_qp(struct mthca_context *ctx, uint32_t qpn);
-extern int mthca_store_qp(struct mthca_context *ctx, uint32_t qpn, struct mthca_qp *qp);
+extern int mthca_store_qp(struct mthca_context *ctx, uint32_t qpn,
+                          struct mthca_qp *qp);
 extern void mthca_clear_qp(struct mthca_context *ctx, uint32_t qpn);
 extern int mthca_free_err_wqe(struct mthca_qp *qp, int is_send,
-			      int index, int *dbd, uint32_t *new_wqe);
-extern struct ibv_ah *mthca_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr);
+                              int index, int *dbd, uint32_t *new_wqe);
+extern struct ibv_ah *mthca_create_ah(struct ibv_pd *pd,
+                                      struct ibv_ah_attr *attr);
 extern int mthca_destroy_ah(struct ibv_ah *ah);
 extern int mthca_alloc_av(struct mthca_pd *pd, struct ibv_ah_attr *attr,
-			  struct mthca_ah *ah);
+                          struct mthca_ah *ah);
 extern void mthca_free_av(struct mthca_ah *ah);
-extern int mthca_attach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid);
-extern int mthca_detach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid);
+extern int mthca_attach_mcast(struct ibv_qp *qp, union ibv_gid *gid,
+                              uint16_t lid);
+extern int mthca_detach_mcast(struct ibv_qp *qp, union ibv_gid *gid,
+                              uint16_t lid);
 
 #endif /* MTHCA_H */



More information about the general mailing list