1 /*
2  * Broadcom NetXtreme-E RoCE driver.
3  *
4  * Copyright (c) 2016 - 2017, Broadcom. All rights reserved.  The term
5  * Broadcom refers to Broadcom Limited and/or its subsidiaries.
6  *
7  * This software is available to you under a choice of one of two
8  * licenses.  You may choose to be licensed under the terms of the GNU
9  * General Public License (GPL) Version 2, available from the file
10  * COPYING in the main directory of this source tree, or the
11  * BSD license below:
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions
15  * are met:
16  *
17  * 1. Redistributions of source code must retain the above copyright
18  *    notice, this list of conditions and the following disclaimer.
19  * 2. Redistributions in binary form must reproduce the above copyright
20  *    notice, this list of conditions and the following disclaimer in
21  *    the documentation and/or other materials provided with the
22  *    distribution.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
25  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
26  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
28  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
31  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
32  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
33  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
34  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35  *
36  * Description: Fast Path Operators (header)
37  */
38 
39 #ifndef __BNXT_QPLIB_FP_H__
40 #define __BNXT_QPLIB_FP_H__
41 
42 struct bnxt_qplib_srq {
43 	struct bnxt_qplib_pd		*pd;
44 	struct bnxt_qplib_dpi		*dpi;
45 	struct bnxt_qplib_db_info	dbinfo;
46 	u64				srq_handle;
47 	u32				id;
48 	u32				max_wqe;
49 	u32				max_sge;
50 	u32				threshold;
51 	bool				arm_req;
52 	struct bnxt_qplib_cq		*cq;
53 	struct bnxt_qplib_hwq		hwq;
54 	struct bnxt_qplib_swq		*swq;
55 	int				start_idx;
56 	int				last_idx;
57 	struct bnxt_qplib_sg_info	sg_info;
58 	u16				eventq_hw_ring_id;
59 	spinlock_t			lock; /* protect SRQE link list */
60 };
61 
62 struct bnxt_qplib_sge {
63 	u64				addr;
64 	u32				lkey;
65 	u32				size;
66 };
67 
68 #define BNXT_QPLIB_MAX_SQE_ENTRY_SIZE	sizeof(struct sq_send)
69 
70 #define SQE_CNT_PER_PG		(PAGE_SIZE / BNXT_QPLIB_MAX_SQE_ENTRY_SIZE)
71 #define SQE_MAX_IDX_PER_PG	(SQE_CNT_PER_PG - 1)
72 
73 static inline u32 get_sqe_pg(u32 val)
74 {
75 	return ((val & ~SQE_MAX_IDX_PER_PG) / SQE_CNT_PER_PG);
76 }
77 
78 static inline u32 get_sqe_idx(u32 val)
79 {
80 	return (val & SQE_MAX_IDX_PER_PG);
81 }
82 
83 #define BNXT_QPLIB_MAX_PSNE_ENTRY_SIZE	sizeof(struct sq_psn_search)
84 
85 #define PSNE_CNT_PER_PG		(PAGE_SIZE / BNXT_QPLIB_MAX_PSNE_ENTRY_SIZE)
86 #define PSNE_MAX_IDX_PER_PG	(PSNE_CNT_PER_PG - 1)
87 
88 static inline u32 get_psne_pg(u32 val)
89 {
90 	return ((val & ~PSNE_MAX_IDX_PER_PG) / PSNE_CNT_PER_PG);
91 }
92 
93 static inline u32 get_psne_idx(u32 val)
94 {
95 	return (val & PSNE_MAX_IDX_PER_PG);
96 }
97 
98 #define BNXT_QPLIB_QP_MAX_SGL	6
99 
100 struct bnxt_qplib_swq {
101 	u64				wr_id;
102 	int				next_idx;
103 	u8				type;
104 	u8				flags;
105 	u32				start_psn;
106 	u32				next_psn;
107 	struct sq_psn_search		*psn_search;
108 	struct sq_psn_search_ext	*psn_ext;
109 };
110 
111 struct bnxt_qplib_swqe {
112 	/* General */
113 #define	BNXT_QPLIB_FENCE_WRID	0x46454E43	/* "FENC" */
114 	u64				wr_id;
115 	u8				reqs_type;
116 	u8				type;
117 #define BNXT_QPLIB_SWQE_TYPE_SEND			0
118 #define BNXT_QPLIB_SWQE_TYPE_SEND_WITH_IMM		1
119 #define BNXT_QPLIB_SWQE_TYPE_SEND_WITH_INV		2
120 #define BNXT_QPLIB_SWQE_TYPE_RDMA_WRITE			4
121 #define BNXT_QPLIB_SWQE_TYPE_RDMA_WRITE_WITH_IMM	5
122 #define BNXT_QPLIB_SWQE_TYPE_RDMA_READ			6
123 #define BNXT_QPLIB_SWQE_TYPE_ATOMIC_CMP_AND_SWP		8
124 #define BNXT_QPLIB_SWQE_TYPE_ATOMIC_FETCH_AND_ADD	11
125 #define BNXT_QPLIB_SWQE_TYPE_LOCAL_INV			12
126 #define BNXT_QPLIB_SWQE_TYPE_FAST_REG_MR		13
127 #define BNXT_QPLIB_SWQE_TYPE_REG_MR			13
128 #define BNXT_QPLIB_SWQE_TYPE_BIND_MW			14
129 #define BNXT_QPLIB_SWQE_TYPE_RECV			128
130 #define BNXT_QPLIB_SWQE_TYPE_RECV_RDMA_IMM		129
131 	u8				flags;
132 #define BNXT_QPLIB_SWQE_FLAGS_SIGNAL_COMP		BIT(0)
133 #define BNXT_QPLIB_SWQE_FLAGS_RD_ATOMIC_FENCE		BIT(1)
134 #define BNXT_QPLIB_SWQE_FLAGS_UC_FENCE			BIT(2)
135 #define BNXT_QPLIB_SWQE_FLAGS_SOLICIT_EVENT		BIT(3)
136 #define BNXT_QPLIB_SWQE_FLAGS_INLINE			BIT(4)
137 	struct bnxt_qplib_sge		sg_list[BNXT_QPLIB_QP_MAX_SGL];
138 	int				num_sge;
139 	/* Max inline data is 96 bytes */
140 	u32				inline_len;
141 #define BNXT_QPLIB_SWQE_MAX_INLINE_LENGTH		96
142 	u8		inline_data[BNXT_QPLIB_SWQE_MAX_INLINE_LENGTH];
143 
144 	union {
145 		/* Send, with imm, inval key */
146 		struct {
147 			union {
148 				__be32	imm_data;
149 				u32	inv_key;
150 			};
151 			u32		q_key;
152 			u32		dst_qp;
153 			u16		avid;
154 		} send;
155 
156 		/* Send Raw Ethernet and QP1 */
157 		struct {
158 			u16		lflags;
159 			u16		cfa_action;
160 			u32		cfa_meta;
161 		} rawqp1;
162 
163 		/* RDMA write, with imm, read */
164 		struct {
165 			union {
166 				__be32	imm_data;
167 				u32	inv_key;
168 			};
169 			u64		remote_va;
170 			u32		r_key;
171 		} rdma;
172 
173 		/* Atomic cmp/swap, fetch/add */
174 		struct {
175 			u64		remote_va;
176 			u32		r_key;
177 			u64		swap_data;
178 			u64		cmp_data;
179 		} atomic;
180 
181 		/* Local Invalidate */
182 		struct {
183 			u32		inv_l_key;
184 		} local_inv;
185 
186 		/* FR-PMR */
187 		struct {
188 			u8		access_cntl;
189 			u8		pg_sz_log;
190 			bool		zero_based;
191 			u32		l_key;
192 			u32		length;
193 			u8		pbl_pg_sz_log;
194 #define BNXT_QPLIB_SWQE_PAGE_SIZE_4K			0
195 #define BNXT_QPLIB_SWQE_PAGE_SIZE_8K			1
196 #define BNXT_QPLIB_SWQE_PAGE_SIZE_64K			4
197 #define BNXT_QPLIB_SWQE_PAGE_SIZE_256K			6
198 #define BNXT_QPLIB_SWQE_PAGE_SIZE_1M			8
199 #define BNXT_QPLIB_SWQE_PAGE_SIZE_2M			9
200 #define BNXT_QPLIB_SWQE_PAGE_SIZE_4M			10
201 #define BNXT_QPLIB_SWQE_PAGE_SIZE_1G			18
202 			u8		levels;
203 #define PAGE_SHIFT_4K	12
204 			__le64		*pbl_ptr;
205 			dma_addr_t	pbl_dma_ptr;
206 			u64		*page_list;
207 			u16		page_list_len;
208 			u64		va;
209 		} frmr;
210 
211 		/* Bind */
212 		struct {
213 			u8		access_cntl;
214 #define BNXT_QPLIB_BIND_SWQE_ACCESS_LOCAL_WRITE		BIT(0)
215 #define BNXT_QPLIB_BIND_SWQE_ACCESS_REMOTE_READ		BIT(1)
216 #define BNXT_QPLIB_BIND_SWQE_ACCESS_REMOTE_WRITE	BIT(2)
217 #define BNXT_QPLIB_BIND_SWQE_ACCESS_REMOTE_ATOMIC	BIT(3)
218 #define BNXT_QPLIB_BIND_SWQE_ACCESS_WINDOW_BIND		BIT(4)
219 			bool		zero_based;
220 			u8		mw_type;
221 			u32		parent_l_key;
222 			u32		r_key;
223 			u64		va;
224 			u32		length;
225 		} bind;
226 	};
227 };
228 
229 #define BNXT_QPLIB_MAX_RQE_ENTRY_SIZE	sizeof(struct rq_wqe)
230 
231 #define RQE_CNT_PER_PG		(PAGE_SIZE / BNXT_QPLIB_MAX_RQE_ENTRY_SIZE)
232 #define RQE_MAX_IDX_PER_PG	(RQE_CNT_PER_PG - 1)
233 #define RQE_PG(x)		(((x) & ~RQE_MAX_IDX_PER_PG) / RQE_CNT_PER_PG)
234 #define RQE_IDX(x)		((x) & RQE_MAX_IDX_PER_PG)
235 
236 struct bnxt_qplib_q {
237 	struct bnxt_qplib_hwq		hwq;
238 	struct bnxt_qplib_swq		*swq;
239 	struct bnxt_qplib_db_info	dbinfo;
240 	struct bnxt_qplib_sg_info	sg_info;
241 	u32				max_wqe;
242 	u16				q_full_delta;
243 	u16				max_sge;
244 	u32				psn;
245 	bool				condition;
246 	bool				single;
247 	bool				send_phantom;
248 	u32				phantom_wqe_cnt;
249 	u32				phantom_cqe_cnt;
250 	u32				next_cq_cons;
251 	bool				flushed;
252 };
253 
254 struct bnxt_qplib_qp {
255 	struct bnxt_qplib_pd		*pd;
256 	struct bnxt_qplib_dpi		*dpi;
257 	struct bnxt_qplib_chip_ctx	*cctx;
258 	u64				qp_handle;
259 #define        BNXT_QPLIB_QP_ID_INVALID        0xFFFFFFFF
260 	u32				id;
261 	u8				type;
262 	u8				sig_type;
263 	u32				modify_flags;
264 	u8				state;
265 	u8				cur_qp_state;
266 	u32				max_inline_data;
267 	u32				mtu;
268 	u8				path_mtu;
269 	bool				en_sqd_async_notify;
270 	u16				pkey_index;
271 	u32				qkey;
272 	u32				dest_qp_id;
273 	u8				access;
274 	u8				timeout;
275 	u8				retry_cnt;
276 	u8				rnr_retry;
277 	u64				wqe_cnt;
278 	u32				min_rnr_timer;
279 	u32				max_rd_atomic;
280 	u32				max_dest_rd_atomic;
281 	u32				dest_qpn;
282 	u8				smac[6];
283 	u16				vlan_id;
284 	u8				nw_type;
285 	struct bnxt_qplib_ah		ah;
286 
287 #define BTH_PSN_MASK			((1 << 24) - 1)
288 	/* SQ */
289 	struct bnxt_qplib_q		sq;
290 	/* RQ */
291 	struct bnxt_qplib_q		rq;
292 	/* SRQ */
293 	struct bnxt_qplib_srq		*srq;
294 	/* CQ */
295 	struct bnxt_qplib_cq		*scq;
296 	struct bnxt_qplib_cq		*rcq;
297 	/* IRRQ and ORRQ */
298 	struct bnxt_qplib_hwq		irrq;
299 	struct bnxt_qplib_hwq		orrq;
300 	/* Header buffer for QP1 */
301 	int				sq_hdr_buf_size;
302 	int				rq_hdr_buf_size;
303 /*
304  * Buffer space for ETH(14), IP or GRH(40), UDP header(8)
305  * and ib_bth + ib_deth (20).
306  * Max required is 82 when RoCE V2 is enabled
307  */
308 #define BNXT_QPLIB_MAX_QP1_SQ_HDR_SIZE_V2	86
309 	/* Ethernet header	=  14 */
310 	/* ib_grh		=  40 (provided by MAD) */
311 	/* ib_bth + ib_deth	=  20 */
312 	/* MAD			= 256 (provided by MAD) */
313 	/* iCRC			=   4 */
314 #define BNXT_QPLIB_MAX_QP1_RQ_ETH_HDR_SIZE	14
315 #define BNXT_QPLIB_MAX_QP1_RQ_HDR_SIZE_V2	512
316 #define BNXT_QPLIB_MAX_GRH_HDR_SIZE_IPV4	20
317 #define BNXT_QPLIB_MAX_GRH_HDR_SIZE_IPV6	40
318 #define BNXT_QPLIB_MAX_QP1_RQ_BDETH_HDR_SIZE	20
319 	void				*sq_hdr_buf;
320 	dma_addr_t			sq_hdr_buf_map;
321 	void				*rq_hdr_buf;
322 	dma_addr_t			rq_hdr_buf_map;
323 	struct list_head		sq_flush;
324 	struct list_head		rq_flush;
325 };
326 
327 #define BNXT_QPLIB_MAX_CQE_ENTRY_SIZE	sizeof(struct cq_base)
328 
329 #define CQE_CNT_PER_PG		(PAGE_SIZE / BNXT_QPLIB_MAX_CQE_ENTRY_SIZE)
330 #define CQE_MAX_IDX_PER_PG	(CQE_CNT_PER_PG - 1)
331 #define CQE_PG(x)		(((x) & ~CQE_MAX_IDX_PER_PG) / CQE_CNT_PER_PG)
332 #define CQE_IDX(x)		((x) & CQE_MAX_IDX_PER_PG)
333 
334 #define ROCE_CQE_CMP_V			0
335 #define CQE_CMP_VALID(hdr, raw_cons, cp_bit)			\
336 	(!!((hdr)->cqe_type_toggle & CQ_BASE_TOGGLE) ==		\
337 	   !((raw_cons) & (cp_bit)))
338 
339 static inline bool bnxt_qplib_queue_full(struct bnxt_qplib_q *qplib_q)
340 {
341 	return HWQ_CMP((qplib_q->hwq.prod + qplib_q->q_full_delta),
342 		       &qplib_q->hwq) == HWQ_CMP(qplib_q->hwq.cons,
343 						 &qplib_q->hwq);
344 }
345 
346 struct bnxt_qplib_cqe {
347 	u8				status;
348 	u8				type;
349 	u8				opcode;
350 	u32				length;
351 	u16				cfa_meta;
352 	u64				wr_id;
353 	union {
354 		__be32			immdata;
355 		u32			invrkey;
356 	};
357 	u64				qp_handle;
358 	u64				mr_handle;
359 	u16				flags;
360 	u8				smac[6];
361 	u32				src_qp;
362 	u16				raweth_qp1_flags;
363 	u16				raweth_qp1_errors;
364 	u16				raweth_qp1_cfa_code;
365 	u32				raweth_qp1_flags2;
366 	u32				raweth_qp1_metadata;
367 	u8				raweth_qp1_payload_offset;
368 	u16				pkey_index;
369 };
370 
371 #define BNXT_QPLIB_QUEUE_START_PERIOD		0x01
372 struct bnxt_qplib_cq {
373 	struct bnxt_qplib_dpi		*dpi;
374 	struct bnxt_qplib_db_info	dbinfo;
375 	u32				max_wqe;
376 	u32				id;
377 	u16				count;
378 	u16				period;
379 	struct bnxt_qplib_hwq		hwq;
380 	u32				cnq_hw_ring_id;
381 	struct bnxt_qplib_nq		*nq;
382 	bool				resize_in_progress;
383 	struct bnxt_qplib_sg_info	sg_info;
384 	u64				cq_handle;
385 
386 #define CQ_RESIZE_WAIT_TIME_MS		500
387 	unsigned long			flags;
388 #define CQ_FLAGS_RESIZE_IN_PROG		1
389 	wait_queue_head_t		waitq;
390 	struct list_head		sqf_head, rqf_head;
391 	atomic_t			arm_state;
392 	spinlock_t			compl_lock; /* synch CQ handlers */
393 /* Locking Notes:
394  * QP can move to error state from modify_qp, async error event or error
395  * CQE as part of poll_cq. When QP is moved to error state, it gets added
396  * to two flush lists, one each for SQ and RQ.
397  * Each flush list is protected by qplib_cq->flush_lock. Both scq and rcq
398  * flush_locks should be acquired when QP is moved to error. The control path
399  * operations(modify_qp and async error events) are synchronized with poll_cq
400  * using upper level CQ locks (bnxt_re_cq->cq_lock) of both SCQ and RCQ.
401  * The qplib_cq->flush_lock is required to synchronize two instances of poll_cq
402  * of the same QP while manipulating the flush list.
403  */
404 	spinlock_t			flush_lock; /* QP flush management */
405 	u16				cnq_events;
406 };
407 
408 #define BNXT_QPLIB_MAX_IRRQE_ENTRY_SIZE	sizeof(struct xrrq_irrq)
409 #define BNXT_QPLIB_MAX_ORRQE_ENTRY_SIZE	sizeof(struct xrrq_orrq)
410 #define IRD_LIMIT_TO_IRRQ_SLOTS(x)	(2 * (x) + 2)
411 #define IRRQ_SLOTS_TO_IRD_LIMIT(s)	(((s) >> 1) - 1)
412 #define ORD_LIMIT_TO_ORRQ_SLOTS(x)	((x) + 1)
413 #define ORRQ_SLOTS_TO_ORD_LIMIT(s)	((s) - 1)
414 
415 #define BNXT_QPLIB_MAX_NQE_ENTRY_SIZE	sizeof(struct nq_base)
416 
417 #define NQE_CNT_PER_PG		(PAGE_SIZE / BNXT_QPLIB_MAX_NQE_ENTRY_SIZE)
418 #define NQE_MAX_IDX_PER_PG	(NQE_CNT_PER_PG - 1)
419 #define NQE_PG(x)		(((x) & ~NQE_MAX_IDX_PER_PG) / NQE_CNT_PER_PG)
420 #define NQE_IDX(x)		((x) & NQE_MAX_IDX_PER_PG)
421 
422 #define NQE_CMP_VALID(hdr, raw_cons, cp_bit)			\
423 	(!!(le32_to_cpu((hdr)->info63_v[0]) & NQ_BASE_V) ==	\
424 	   !((raw_cons) & (cp_bit)))
425 
426 #define BNXT_QPLIB_NQE_MAX_CNT		(128 * 1024)
427 
428 #define NQ_CONS_PCI_BAR_REGION		2
429 #define NQ_DB_KEY_CP			(0x2 << CMPL_DOORBELL_KEY_SFT)
430 #define NQ_DB_IDX_VALID			CMPL_DOORBELL_IDX_VALID
431 #define NQ_DB_IRQ_DIS			CMPL_DOORBELL_MASK
432 #define NQ_DB_CP_FLAGS_REARM		(NQ_DB_KEY_CP |		\
433 					 NQ_DB_IDX_VALID)
434 #define NQ_DB_CP_FLAGS			(NQ_DB_KEY_CP    |	\
435 					 NQ_DB_IDX_VALID |	\
436 					 NQ_DB_IRQ_DIS)
437 
438 struct bnxt_qplib_nq_db {
439 	struct bnxt_qplib_reg_desc	reg;
440 	struct bnxt_qplib_db_info	dbinfo;
441 };
442 
443 typedef int (*cqn_handler_t)(struct bnxt_qplib_nq *nq,
444 		struct bnxt_qplib_cq *cq);
445 typedef int (*srqn_handler_t)(struct bnxt_qplib_nq *nq,
446 		struct bnxt_qplib_srq *srq, u8 event);
447 
448 struct bnxt_qplib_nq {
449 	struct pci_dev			*pdev;
450 	struct bnxt_qplib_res		*res;
451 	char				name[32];
452 	struct bnxt_qplib_hwq		hwq;
453 	struct bnxt_qplib_nq_db		nq_db;
454 	u16				ring_id;
455 	int				msix_vec;
456 	cpumask_t			mask;
457 	struct tasklet_struct		nq_tasklet;
458 	bool				requested;
459 	int				budget;
460 
461 	cqn_handler_t			cqn_handler;
462 	srqn_handler_t			srqn_handler;
463 	struct workqueue_struct		*cqn_wq;
464 };
465 
466 struct bnxt_qplib_nq_work {
467 	struct work_struct      work;
468 	struct bnxt_qplib_nq    *nq;
469 	struct bnxt_qplib_cq    *cq;
470 };
471 
472 void bnxt_qplib_nq_stop_irq(struct bnxt_qplib_nq *nq, bool kill);
473 void bnxt_qplib_disable_nq(struct bnxt_qplib_nq *nq);
474 int bnxt_qplib_nq_start_irq(struct bnxt_qplib_nq *nq, int nq_indx,
475 			    int msix_vector, bool need_init);
476 int bnxt_qplib_enable_nq(struct pci_dev *pdev, struct bnxt_qplib_nq *nq,
477 			 int nq_idx, int msix_vector, int bar_reg_offset,
478 			 cqn_handler_t cqn_handler,
479 			 srqn_handler_t srq_handler);
480 int bnxt_qplib_create_srq(struct bnxt_qplib_res *res,
481 			  struct bnxt_qplib_srq *srq);
482 int bnxt_qplib_modify_srq(struct bnxt_qplib_res *res,
483 			  struct bnxt_qplib_srq *srq);
484 int bnxt_qplib_query_srq(struct bnxt_qplib_res *res,
485 			 struct bnxt_qplib_srq *srq);
486 void bnxt_qplib_destroy_srq(struct bnxt_qplib_res *res,
487 			    struct bnxt_qplib_srq *srq);
488 int bnxt_qplib_post_srq_recv(struct bnxt_qplib_srq *srq,
489 			     struct bnxt_qplib_swqe *wqe);
490 int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp);
491 int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp);
492 int bnxt_qplib_modify_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp);
493 int bnxt_qplib_query_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp);
494 int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp);
495 void bnxt_qplib_clean_qp(struct bnxt_qplib_qp *qp);
496 void bnxt_qplib_free_qp_res(struct bnxt_qplib_res *res,
497 			    struct bnxt_qplib_qp *qp);
498 void *bnxt_qplib_get_qp1_sq_buf(struct bnxt_qplib_qp *qp,
499 				struct bnxt_qplib_sge *sge);
500 void *bnxt_qplib_get_qp1_rq_buf(struct bnxt_qplib_qp *qp,
501 				struct bnxt_qplib_sge *sge);
502 u32 bnxt_qplib_get_rq_prod_index(struct bnxt_qplib_qp *qp);
503 dma_addr_t bnxt_qplib_get_qp_buf_from_index(struct bnxt_qplib_qp *qp,
504 					    u32 index);
505 void bnxt_qplib_post_send_db(struct bnxt_qplib_qp *qp);
506 int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp,
507 			 struct bnxt_qplib_swqe *wqe);
508 void bnxt_qplib_post_recv_db(struct bnxt_qplib_qp *qp);
509 int bnxt_qplib_post_recv(struct bnxt_qplib_qp *qp,
510 			 struct bnxt_qplib_swqe *wqe);
511 int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq);
512 int bnxt_qplib_destroy_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq);
513 int bnxt_qplib_poll_cq(struct bnxt_qplib_cq *cq, struct bnxt_qplib_cqe *cqe,
514 		       int num, struct bnxt_qplib_qp **qp);
515 bool bnxt_qplib_is_cq_empty(struct bnxt_qplib_cq *cq);
516 void bnxt_qplib_req_notify_cq(struct bnxt_qplib_cq *cq, u32 arm_type);
517 void bnxt_qplib_free_nq(struct bnxt_qplib_nq *nq);
518 int bnxt_qplib_alloc_nq(struct bnxt_qplib_res *res, struct bnxt_qplib_nq *nq);
519 void bnxt_qplib_add_flush_qp(struct bnxt_qplib_qp *qp);
520 void bnxt_qplib_acquire_cq_locks(struct bnxt_qplib_qp *qp,
521 				 unsigned long *flags);
522 void bnxt_qplib_release_cq_locks(struct bnxt_qplib_qp *qp,
523 				 unsigned long *flags);
524 int bnxt_qplib_process_flush_list(struct bnxt_qplib_cq *cq,
525 				  struct bnxt_qplib_cqe *cqe,
526 				  int num_cqes);
527 void bnxt_qplib_flush_cqn_wq(struct bnxt_qplib_qp *qp);
528 #endif /* __BNXT_QPLIB_FP_H__ */
529