1126304Smtm/*
2107143Sgordon * Copyright (c) 2004, 2005 Topspin Communications.  All rights reserved.
3126304Smtm * Copyright (c) 2005, 2006, 2007 Cisco Systems.  All rights reserved.
4107143Sgordon *
5107143Sgordon * This software is available to you under a choice of one of two
6107143Sgordon * licenses.  You may choose to be licensed under the terms of the GNU
7107143Sgordon * General Public License (GPL) Version 2, available from the file
8107143Sgordon * COPYING in the main directory of this source tree, or the
9107143Sgordon * OpenIB.org BSD license below:
10107143Sgordon *
11107143Sgordon *     Redistribution and use in source and binary forms, with or
12107143Sgordon *     without modification, are permitted provided that the following
13107143Sgordon *     conditions are met:
14107143Sgordon *
15107143Sgordon *      - Redistributions of source code must retain the above
16107143Sgordon *        copyright notice, this list of conditions and the following
17107143Sgordon *        disclaimer.
18107143Sgordon *
19107143Sgordon *      - Redistributions in binary form must reproduce the above
20107143Sgordon *        copyright notice, this list of conditions and the following
21107143Sgordon *        disclaimer in the documentation and/or other materials
22107143Sgordon *        provided with the distribution.
23107143Sgordon *
24107143Sgordon * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25107143Sgordon * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26107143Sgordon * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27107143Sgordon * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28107143Sgordon * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29107143Sgordon * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30131866Sru * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31131866Sru * SOFTWARE.
32255809Sdes */
33107143Sgordon
34107143Sgordon#ifndef MLX4_H
35107143Sgordon#define MLX4_H
36107143Sgordon
37107143Sgordon#include <stddef.h>
38107143Sgordon
39131866Sru#include <infiniband/driver.h>
40107143Sgordon#include <infiniband/arch.h>
41131866Sru
42131866Sru#ifdef HAVE_VALGRIND_MEMCHECK_H
43107143Sgordon
44107143Sgordon#  include <valgrind/memcheck.h>
45107143Sgordon
46107143Sgordon#  if !defined(VALGRIND_MAKE_MEM_DEFINED) || !defined(VALGRIND_MAKE_MEM_UNDEFINED)
47107143Sgordon#    warning "Valgrind support requested, but VALGRIND_MAKE_MEM_(UN)DEFINED not available"
48107143Sgordon#  endif
49107143Sgordon
50107143Sgordon#endif /* HAVE_VALGRIND_MEMCHECK_H */
51107143Sgordon
52107143Sgordon#ifndef VALGRIND_MAKE_MEM_DEFINED
53107143Sgordon#  define VALGRIND_MAKE_MEM_DEFINED(addr,len)
54107143Sgordon#endif
55107143Sgordon
56107143Sgordon#ifndef VALGRIND_MAKE_MEM_UNDEFINED
57107143Sgordon#  define VALGRIND_MAKE_MEM_UNDEFINED(addr,len)
58107143Sgordon#endif
59107143Sgordon
60159828Syar#ifndef rmb
61159828Syar#  define rmb() mb()
62159367Sflz#endif
63107143Sgordon
64159367Sflz#ifndef wmb
65157473Sflz#  define wmb() mb()
66107143Sgordon#endif
67107143Sgordon
68131866Sru#ifndef wc_wmb
69107143Sgordon
70131866Sru#if defined(__i386__)
71107143Sgordon#define wc_wmb() asm volatile("lock; addl $0,0(%%esp) " ::: "memory")
72107143Sgordon#elif defined(__x86_64__)
73107143Sgordon#define wc_wmb() asm volatile("sfence" ::: "memory")
74107143Sgordon#elif defined(__ia64__)
75107143Sgordon#define wc_wmb() asm volatile("fwb" ::: "memory")
76131866Sru#else
77107143Sgordon#define wc_wmb() wmb()
78107143Sgordon#endif
79107143Sgordon
80107143Sgordon#endif
81131866Sru
82107143Sgordon#ifndef HAVE_IBV_MORE_OPS
83131866Sru#undef HAVE_IBV_XRC_OPS
84107143Sgordon#undef HAVE_IBV_CREATE_QP_EXP
85107143Sgordon#endif
86107143Sgordon
87107143Sgordon#define HIDDEN		__attribute__((visibility ("hidden")))
88107143Sgordon
89107143Sgordon#define PFX		"mlx4: "
90107143Sgordon
91107143Sgordon#ifndef max
92107143Sgordon#define max(a,b) \
93107143Sgordon	({ typeof (a) _a = (a); \
94107143Sgordon	   typeof (b) _b = (b); \
95203102Semaste	   _a > _b ? _a : _b; })
96107143Sgordon#endif
97203102Semaste
98107143Sgordon#ifndef min
99107143Sgordon#define min(a,b) \
100107143Sgordon	({ typeof (a) _a = (a); \
101107143Sgordon	   typeof (b) _b = (b); \
102107143Sgordon	   _a < _b ? _a : _b; })
103131866Sru#endif
104107143Sgordon
105107143Sgordonenum {
106107143Sgordon	MLX4_CQ_ENTRY_SIZE		= 0x20
107107143Sgordon};
108107143Sgordon
109107143Sgordonenum {
110107143Sgordon	MLX4_STAT_RATE_OFFSET		= 5
111131866Sru};
112107143Sgordon
113131866Sruenum {
114107143Sgordon	MLX4_QP_TABLE_BITS		= 8,
115107143Sgordon	MLX4_QP_TABLE_SIZE		= 1 << MLX4_QP_TABLE_BITS,
116107143Sgordon	MLX4_QP_TABLE_MASK		= MLX4_QP_TABLE_SIZE - 1
117107143Sgordon};
118107143Sgordon
119107143Sgordonenum {
120107143Sgordon	MLX4_XRC_SRQ_TABLE_BITS		= 8,
121107143Sgordon	MLX4_XRC_SRQ_TABLE_SIZE		= 1 << MLX4_XRC_SRQ_TABLE_BITS,
122107143Sgordon	MLX4_XRC_SRQ_TABLE_MASK		= MLX4_XRC_SRQ_TABLE_SIZE - 1
123131866Sru};
124107143Sgordon
125131866Sruenum {
126107143Sgordon	MLX4_XRC_QPN_BIT		= (1 << 23)
127131866Sru};
128131866Sru
129107143Sgordonenum mlx4_db_type {
130107143Sgordon	MLX4_DB_TYPE_CQ,
131107143Sgordon	MLX4_DB_TYPE_RQ,
132107143Sgordon	MLX4_NUM_DB_TYPE
133107143Sgordon};
134107143Sgordon
135131866Sruenum {
136107143Sgordon	MLX4_OPCODE_NOP			= 0x00,
137107143Sgordon	MLX4_OPCODE_SEND_INVAL		= 0x01,
138107143Sgordon	MLX4_OPCODE_RDMA_WRITE		= 0x08,
139107143Sgordon	MLX4_OPCODE_RDMA_WRITE_IMM	= 0x09,
140107143Sgordon	MLX4_OPCODE_SEND		= 0x0a,
141107143Sgordon	MLX4_OPCODE_SEND_IMM		= 0x0b,
142107143Sgordon	MLX4_OPCODE_LSO			= 0x0e,
143107143Sgordon	MLX4_OPCODE_RDMA_READ		= 0x10,
144107143Sgordon	MLX4_OPCODE_ATOMIC_CS		= 0x11,
145107143Sgordon	MLX4_OPCODE_ATOMIC_FA		= 0x12,
146107143Sgordon	MLX4_OPCODE_ATOMIC_MASK_CS	= 0x14,
147107143Sgordon	MLX4_OPCODE_ATOMIC_MASK_FA	= 0x15,
148107143Sgordon	MLX4_OPCODE_BIND_MW		= 0x18,
149131866Sru	MLX4_OPCODE_FMR			= 0x19,
150107143Sgordon	MLX4_OPCODE_LOCAL_INVAL		= 0x1b,
151107143Sgordon	MLX4_OPCODE_CONFIG_CMD		= 0x1f,
152107143Sgordon
153107143Sgordon	MLX4_RECV_OPCODE_RDMA_WRITE_IMM	= 0x00,
154107143Sgordon	MLX4_RECV_OPCODE_SEND		= 0x01,
155107143Sgordon	MLX4_RECV_OPCODE_SEND_IMM	= 0x02,
156107143Sgordon	MLX4_RECV_OPCODE_SEND_INVAL	= 0x03,
157107143Sgordon
158107143Sgordon	MLX4_CQE_OPCODE_ERROR		= 0x1e,
159107143Sgordon	MLX4_CQE_OPCODE_RESIZE		= 0x16,
160107143Sgordon};
161107143Sgordon
162107143Sgordonenum {
163107143Sgordon	MLX4_MAX_WQE_SIZE = 1008
164107143Sgordon};
165107143Sgordon
166131866Srustruct mlx4_device {
167131866Sru	struct ibv_device		ibv_dev;
168131866Sru	int				page_size;
169107143Sgordon};
170131866Sru
171107143Sgordonstruct mlx4_db_page;
172107143Sgordon
173107143Sgordonstruct mlx4_context {
174131866Sru	struct ibv_context		ibv_ctx;
175131866Sru
176131866Sru	void			       *uar;
177107143Sgordon	pthread_spinlock_t		uar_lock;
178131866Sru
179107143Sgordon	void			       *bf_page;
180107143Sgordon	int				bf_buf_size;
181107143Sgordon	int				bf_offset;
182107143Sgordon	pthread_spinlock_t		bf_lock;
183173013Syar
184173013Syar	struct {
185173013Syar		struct mlx4_qp	      **table;
186173013Syar		int			refcnt;
187173013Syar	}				qp_table[MLX4_QP_TABLE_SIZE];
188131866Sru	pthread_mutex_t			qp_table_mutex;
189107143Sgordon	int				num_qps;
190107143Sgordon	int				qp_table_shift;
191107143Sgordon	int				qp_table_mask;
192107143Sgordon	int				max_qp_wr;
193107143Sgordon	int				max_sge;
194126304Smtm	int				max_cqe;
195107143Sgordon
196107143Sgordon	struct {
197107143Sgordon		struct mlx4_srq       **table;
198107143Sgordon		int			refcnt;
199151686Syar	}				xrc_srq_table[MLX4_XRC_SRQ_TABLE_SIZE];
200131866Sru	pthread_mutex_t			xrc_srq_table_mutex;
201131866Sru	int				num_xrc_srqs;
202131866Sru	int				xrc_srq_table_shift;
203107143Sgordon	int				xrc_srq_table_mask;
204107143Sgordon
205107143Sgordon	struct mlx4_db_page	       *db_list[MLX4_NUM_DB_TYPE];
206107143Sgordon	pthread_mutex_t			db_list_mutex;
207107143Sgordon};
208107143Sgordon
209107143Sgordonstruct mlx4_buf {
210107143Sgordon	void			       *buf;
211107143Sgordon	size_t				length;
212107143Sgordon};
213107143Sgordon
214107143Sgordonstruct mlx4_pd {
215107143Sgordon	struct ibv_pd			ibv_pd;
216107143Sgordon	uint32_t			pdn;
217131866Sru};
218107143Sgordon
219107143Sgordonstruct mlx4_cq {
220107143Sgordon	struct ibv_cq			ibv_cq;
221107143Sgordon	struct mlx4_buf			buf;
222108317Sschweikh	struct mlx4_buf			resize_buf;
223107143Sgordon	pthread_spinlock_t		lock;
224131866Sru	uint32_t			cqn;
225107143Sgordon	uint32_t			cons_index;
226131866Sru	uint32_t		       *set_ci_db;
227107143Sgordon	uint32_t		       *arm_db;
228107143Sgordon	int				arm_sn;
229107143Sgordon};
230131530Sru
231131530Srustruct mlx4_srq {
232107143Sgordon	struct ibv_srq			ibv_srq;
233107143Sgordon	struct mlx4_buf			buf;
234107143Sgordon	pthread_spinlock_t		lock;
235131866Sru	uint64_t		       *wrid;
236131866Sru	uint32_t			srqn;
237107143Sgordon	int				max;
238131866Sru	int				max_gs;
239107143Sgordon	int				wqe_shift;
240107143Sgordon	int				head;
241107143Sgordon	int				tail;
242107143Sgordon	uint32_t		       *db;
243131866Sru	uint16_t			counter;
244107143Sgordon};
245107143Sgordon
246107143Sgordonstruct mlx4_wq {
247107143Sgordon	uint64_t		       *wrid;
248131866Sru	pthread_spinlock_t		lock;
249107143Sgordon	int				wqe_cnt;
250131866Sru	int				max_post;
251107143Sgordon	unsigned			head;
252107143Sgordon	unsigned			tail;
253180628Slme	int				max_gs;
254107143Sgordon	int				wqe_shift;
255107143Sgordon	int				offset;
256131530Sru};
257131530Sru
258107143Sgordonstruct mlx4_qp {
259107143Sgordon	struct ibv_qp			ibv_qp;
260131866Sru	struct mlx4_buf			buf;
261107143Sgordon	int				max_inline_data;
262131866Sru	int				buf_size;
263107143Sgordon
264131530Sru	uint32_t			doorbell_qpn;
265131530Sru	uint32_t			sq_signal_bits;
266107143Sgordon	int				sq_spare_wqes;
267107143Sgordon	struct mlx4_wq			sq;
268107143Sgordon
269131866Sru	uint32_t		       *db;
270107143Sgordon	struct mlx4_wq			rq;
271107143Sgordon};
272107143Sgordon
273107143Sgordonstruct mlx4_av {
274131866Sru	uint32_t			port_pd;
275107143Sgordon	uint8_t				reserved1;
276131866Sru	uint8_t				g_slid;
277107143Sgordon	uint16_t			dlid;
278108317Sschweikh	uint8_t				reserved2;
279107143Sgordon	uint8_t				gid_index;
280107143Sgordon	uint8_t				stat_rate;
281107143Sgordon	uint8_t				hop_limit;
282107143Sgordon	uint32_t			sl_tclass_flowlabel;
283131866Sru	uint8_t				dgid[16];
284159828Syar	uint8_t				mac[8];
285159828Syar};
286159828Syar
287159828Syarstruct mlx4_ah {
288159828Syar	struct ibv_ah			ibv_ah;
289159828Syar	struct mlx4_av			av;
290159828Syar	uint16_t			vlan;
291159828Syar	uint8_t				mac[6];
292159828Syar	uint8_t				tagged;
293159828Syar};
294159828Syar
295159828Syarstruct mlx4_xrc_domain {
296159828Syar	struct ibv_xrc_domain		ibv_xrcd;
297159828Syar	uint32_t			xrcdn;
298159367Sflz};
299107143Sgordon
300159367Sflzstatic inline unsigned long align(unsigned long val, unsigned long align)
301107143Sgordon{
302107143Sgordon	return (val + align - 1) & ~(align - 1);
303161530Sflz}
304107143Sgordon
305161530Sflz#define to_mxxx(xxx, type)						\
306161530Sflz	((struct mlx4_##type *)					\
307161530Sflz	 ((void *) ib##xxx - offsetof(struct mlx4_##type, ibv_##xxx)))
308107143Sgordon
309107143Sgordonstatic inline struct mlx4_device *to_mdev(struct ibv_device *ibdev)
310107143Sgordon{
311107143Sgordon	return to_mxxx(dev, device);
312107143Sgordon}
313159367Sflz
314157473Sflzstatic inline struct mlx4_context *to_mctx(struct ibv_context *ibctx)
315157473Sflz{
316157473Sflz	return to_mxxx(ctx, context);
317157473Sflz}
318157473Sflz
319159367Sflzstatic inline struct mlx4_pd *to_mpd(struct ibv_pd *ibpd)
320157473Sflz{
321157473Sflz	return to_mxxx(pd, pd);
322157473Sflz}
323157473Sflz
324107143Sgordonstatic inline struct mlx4_cq *to_mcq(struct ibv_cq *ibcq)
325107143Sgordon{
326107143Sgordon	return to_mxxx(cq, cq);
327107143Sgordon}
328107143Sgordon
329131866Srustatic inline struct mlx4_srq *to_msrq(struct ibv_srq *ibsrq)
330107143Sgordon{
331107143Sgordon	return to_mxxx(srq, srq);
332131866Sru}
333107143Sgordon
334131866Srustatic inline struct mlx4_qp *to_mqp(struct ibv_qp *ibqp)
335107143Sgordon{
336107143Sgordon	return to_mxxx(qp, qp);
337107143Sgordon}
338107143Sgordon
339131866Srustatic inline struct mlx4_ah *to_mah(struct ibv_ah *ibah)
340230007Srea{
341131866Sru	return to_mxxx(ah, ah);
342131866Sru}
343107143Sgordon
344107143Sgordon#ifdef HAVE_IBV_XRC_OPS
345107143Sgordonstatic inline struct mlx4_xrc_domain *to_mxrcd(struct ibv_xrc_domain *ibxrcd)
346107143Sgordon{
347107143Sgordon	return to_mxxx(xrcd, xrc_domain);
348107143Sgordon}
349107143Sgordon#endif
350107143Sgordon
351107143Sgordonint mlx4_alloc_buf(struct mlx4_buf *buf, size_t size, int page_size);
352107143Sgordonvoid mlx4_free_buf(struct mlx4_buf *buf);
353107143Sgordon
354107143Sgordonuint32_t *mlx4_alloc_db(struct mlx4_context *context, enum mlx4_db_type type);
355107143Sgordonvoid mlx4_free_db(struct mlx4_context *context, enum mlx4_db_type type, uint32_t *db);
356107143Sgordon
357107143Sgordonint mlx4_query_device(struct ibv_context *context,
358107143Sgordon		       struct ibv_device_attr *attr);
359107143Sgordonint mlx4_query_port(struct ibv_context *context, uint8_t port,
360131866Sru		     struct ibv_port_attr *attr);
361131866Sru
362126304Smtmstruct ibv_pd *mlx4_alloc_pd(struct ibv_context *context);
363126304Smtmint mlx4_free_pd(struct ibv_pd *pd);
364126304Smtm
365126304Smtmstruct ibv_mr *mlx4_reg_mr(struct ibv_pd *pd, void *addr,
366126304Smtm			    size_t length, enum ibv_access_flags access);
367126304Smtmint mlx4_dereg_mr(struct ibv_mr *mr);
368126304Smtm
369126304Smtmstruct ibv_cq *mlx4_create_cq(struct ibv_context *context, int cqe,
370126304Smtm			       struct ibv_comp_channel *channel,
371131866Sru			       int comp_vector);
372126304Smtmint mlx4_alloc_cq_buf(struct mlx4_device *dev, struct mlx4_buf *buf, int nent);
373126304Smtmint mlx4_resize_cq(struct ibv_cq *cq, int cqe);
374126304Smtmint mlx4_destroy_cq(struct ibv_cq *cq);
375131866Sruint mlx4_poll_cq(struct ibv_cq *cq, int ne, struct ibv_wc *wc);
376131866Sruint mlx4_arm_cq(struct ibv_cq *cq, int solicited);
377126304Smtmvoid mlx4_cq_event(struct ibv_cq *cq);
378131866Sruvoid __mlx4_cq_clean(struct mlx4_cq *cq, uint32_t qpn, struct mlx4_srq *srq);
379126304Smtmvoid mlx4_cq_clean(struct mlx4_cq *cq, uint32_t qpn, struct mlx4_srq *srq);
380131866Sruint mlx4_get_outstanding_cqes(struct mlx4_cq *cq);
381126304Smtmvoid mlx4_cq_resize_copy_cqes(struct mlx4_cq *cq, void *buf, int new_cqe);
382255809Sdes
383255809Sdesstruct ibv_srq *mlx4_create_srq(struct ibv_pd *pd,
384255809Sdes				 struct ibv_srq_init_attr *attr);
385131866Sruint mlx4_modify_srq(struct ibv_srq *srq,
386126304Smtm		     struct ibv_srq_attr *attr,
387126304Smtm		     enum ibv_srq_attr_mask mask);
388126304Smtmint mlx4_query_srq(struct ibv_srq *srq,
389126304Smtm			   struct ibv_srq_attr *attr);
390126304Smtmint mlx4_destroy_srq(struct ibv_srq *srq);
391107143Sgordonint mlx4_alloc_srq_buf(struct ibv_pd *pd, struct ibv_srq_attr *attr,
392131866Sru			struct mlx4_srq *srq);
393107143Sgordonvoid mlx4_free_srq_wqe(struct mlx4_srq *srq, int ind);
394131866Sruint mlx4_post_srq_recv(struct ibv_srq *ibsrq,
395126304Smtm		       struct ibv_recv_wr *wr,
396131866Sru		       struct ibv_recv_wr **bad_wr);
397131866Srustruct mlx4_srq *mlx4_find_xrc_srq(struct mlx4_context *ctx, uint32_t xrc_srqn);
398126304Smtmint mlx4_store_xrc_srq(struct mlx4_context *ctx, uint32_t xrc_srqn,
399131866Sru		       struct mlx4_srq *srq);
400126304Smtmvoid mlx4_clear_xrc_srq(struct mlx4_context *ctx, uint32_t xrc_srqn);
401126304Smtm
402107143Sgordonstruct ibv_qp *mlx4_create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *attr);
403126304Smtmint mlx4_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
404131866Sru		   enum ibv_qp_attr_mask attr_mask,
405126304Smtm		   struct ibv_qp_init_attr *init_attr);
406107143Sgordonint mlx4_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
407107143Sgordon		    enum ibv_qp_attr_mask attr_mask);
408131866Sruint mlx4_destroy_qp(struct ibv_qp *qp);
409131866Sruvoid mlx4_init_qp_indices(struct mlx4_qp *qp);
410107143Sgordonvoid mlx4_qp_init_sq_ownership(struct mlx4_qp *qp);
411107143Sgordonint mlx4_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr,
412131866Sru			  struct ibv_send_wr **bad_wr);
413131866Sruint mlx4_post_recv(struct ibv_qp *ibqp, struct ibv_recv_wr *wr,
414107143Sgordon			  struct ibv_recv_wr **bad_wr);
415131866Sruvoid mlx4_calc_sq_wqe_size(struct ibv_qp_cap *cap, enum ibv_qp_type type,
416131866Sru			   struct mlx4_qp *qp);
417131866Sruint num_inline_segs(int data, enum ibv_qp_type type);
418107143Sgordonint mlx4_alloc_qp_buf(struct ibv_pd *pd, struct ibv_qp_cap *cap,
419131866Sru		       enum ibv_qp_type type, struct mlx4_qp *qp);
420107143Sgordonvoid mlx4_set_sq_sizes(struct mlx4_qp *qp, struct ibv_qp_cap *cap,
421131866Sru		       enum ibv_qp_type type);
422107143Sgordonstruct mlx4_qp *mlx4_find_qp(struct mlx4_context *ctx, uint32_t qpn);
423131866Sruint mlx4_store_qp(struct mlx4_context *ctx, uint32_t qpn, struct mlx4_qp *qp);
424126304Smtmvoid mlx4_clear_qp(struct mlx4_context *ctx, uint32_t qpn);
425131866Srustruct ibv_ah *mlx4_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr);
426126304Smtmint mlx4_destroy_ah(struct ibv_ah *ah);
427131866Sruint mlx4_alloc_av(struct mlx4_pd *pd, struct ibv_ah_attr *attr,
428131866Sru		   struct mlx4_ah *ah);
429131866Sruvoid mlx4_free_av(struct mlx4_ah *ah);
430131866Sru#ifdef HAVE_IBV_XRC_OPS
431230007Sreastruct ibv_srq *mlx4_create_xrc_srq(struct ibv_pd *pd,
432230007Srea				    struct ibv_xrc_domain *xrc_domain,
433230007Srea				    struct ibv_cq *xrc_cq,
434230007Srea				    struct ibv_srq_init_attr *attr);
435230007Sreastruct ibv_xrc_domain *mlx4_open_xrc_domain(struct ibv_context *context,
436230007Srea					    int fd, int oflag);
437230007Srea
438230007Sreaint mlx4_close_xrc_domain(struct ibv_xrc_domain *d);
439230007Sreaint mlx4_create_xrc_rcv_qp(struct ibv_qp_init_attr *init_attr,
440230007Srea			   uint32_t *xrc_qp_num);
441230007Sreaint mlx4_modify_xrc_rcv_qp(struct ibv_xrc_domain *xrc_domain,
442230007Srea			   uint32_t xrc_qp_num,
443230007Srea			   struct ibv_qp_attr *attr,
444230007Srea			   int attr_mask);
445230007Sreaint mlx4_query_xrc_rcv_qp(struct ibv_xrc_domain *xrc_domain,
446230007Srea			  uint32_t xrc_qp_num,
447107143Sgordon			  struct ibv_qp_attr *attr,
448107143Sgordon			  int attr_mask,
449107143Sgordon			  struct ibv_qp_init_attr *init_attr);
450107143Sgordonint mlx4_reg_xrc_rcv_qp(struct ibv_xrc_domain *xrc_domain,
451107143Sgordon			uint32_t xrc_qp_num);
452131866Sruint mlx4_unreg_xrc_rcv_qp(struct ibv_xrc_domain *xrc_domain,
453131866Sru			uint32_t xrc_qp_num);
454107143Sgordon#endif
455107143Sgordon
456131866Sru
457107143Sgordon#endif /* MLX4_H */
458131866Sru