xref: /freebsd/sys/dev/irdma/irdma_main.h (revision cdcd52d41e246ba1c0fcfad0769bd691487355ef)
1*cdcd52d4SBartosz Sobczak /*-
2*cdcd52d4SBartosz Sobczak  * SPDX-License-Identifier: GPL-2.0 or Linux-OpenIB
3*cdcd52d4SBartosz Sobczak  *
4*cdcd52d4SBartosz Sobczak  * Copyright (c) 2015 - 2022 Intel Corporation
5*cdcd52d4SBartosz Sobczak  *
6*cdcd52d4SBartosz Sobczak  * This software is available to you under a choice of one of two
7*cdcd52d4SBartosz Sobczak  * licenses.  You may choose to be licensed under the terms of the GNU
8*cdcd52d4SBartosz Sobczak  * General Public License (GPL) Version 2, available from the file
9*cdcd52d4SBartosz Sobczak  * COPYING in the main directory of this source tree, or the
10*cdcd52d4SBartosz Sobczak  * OpenFabrics.org BSD license below:
11*cdcd52d4SBartosz Sobczak  *
12*cdcd52d4SBartosz Sobczak  *   Redistribution and use in source and binary forms, with or
13*cdcd52d4SBartosz Sobczak  *   without modification, are permitted provided that the following
14*cdcd52d4SBartosz Sobczak  *   conditions are met:
15*cdcd52d4SBartosz Sobczak  *
16*cdcd52d4SBartosz Sobczak  *    - Redistributions of source code must retain the above
17*cdcd52d4SBartosz Sobczak  *	copyright notice, this list of conditions and the following
18*cdcd52d4SBartosz Sobczak  *	disclaimer.
19*cdcd52d4SBartosz Sobczak  *
20*cdcd52d4SBartosz Sobczak  *    - Redistributions in binary form must reproduce the above
21*cdcd52d4SBartosz Sobczak  *	copyright notice, this list of conditions and the following
22*cdcd52d4SBartosz Sobczak  *	disclaimer in the documentation and/or other materials
23*cdcd52d4SBartosz Sobczak  *	provided with the distribution.
24*cdcd52d4SBartosz Sobczak  *
25*cdcd52d4SBartosz Sobczak  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26*cdcd52d4SBartosz Sobczak  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27*cdcd52d4SBartosz Sobczak  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28*cdcd52d4SBartosz Sobczak  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29*cdcd52d4SBartosz Sobczak  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30*cdcd52d4SBartosz Sobczak  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31*cdcd52d4SBartosz Sobczak  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32*cdcd52d4SBartosz Sobczak  * SOFTWARE.
33*cdcd52d4SBartosz Sobczak  */
34*cdcd52d4SBartosz Sobczak /*$FreeBSD$*/
35*cdcd52d4SBartosz Sobczak 
36*cdcd52d4SBartosz Sobczak #ifndef IRDMA_MAIN_H
37*cdcd52d4SBartosz Sobczak #define IRDMA_MAIN_H
38*cdcd52d4SBartosz Sobczak 
39*cdcd52d4SBartosz Sobczak #include <linux/in.h>
40*cdcd52d4SBartosz Sobczak #include <netinet/ip6.h>
41*cdcd52d4SBartosz Sobczak #include <netinet/udp.h>
42*cdcd52d4SBartosz Sobczak #include <netinet/tcp.h>
43*cdcd52d4SBartosz Sobczak #include <sys/socket.h>
44*cdcd52d4SBartosz Sobczak #include <netinet/if_ether.h>
45*cdcd52d4SBartosz Sobczak #include <linux/slab.h>
46*cdcd52d4SBartosz Sobczak #include <linux/rculist.h>
47*cdcd52d4SBartosz Sobczak #include <rdma/ib_smi.h>
48*cdcd52d4SBartosz Sobczak #include <rdma/ib_verbs.h>
49*cdcd52d4SBartosz Sobczak #include <rdma/ib_pack.h>
50*cdcd52d4SBartosz Sobczak #include <rdma/rdma_cm.h>
51*cdcd52d4SBartosz Sobczak #include <rdma/iw_cm.h>
52*cdcd52d4SBartosz Sobczak #include <rdma/ib_user_verbs.h>
53*cdcd52d4SBartosz Sobczak #include <rdma/ib_umem.h>
54*cdcd52d4SBartosz Sobczak #include <rdma/ib_cache.h>
55*cdcd52d4SBartosz Sobczak #include <rdma/uverbs_ioctl.h>
56*cdcd52d4SBartosz Sobczak #include "osdep.h"
57*cdcd52d4SBartosz Sobczak #include "irdma_defs.h"
58*cdcd52d4SBartosz Sobczak #include "irdma_hmc.h"
59*cdcd52d4SBartosz Sobczak #include "irdma_type.h"
60*cdcd52d4SBartosz Sobczak #include "irdma_ws.h"
61*cdcd52d4SBartosz Sobczak #include "irdma_protos.h"
62*cdcd52d4SBartosz Sobczak #include "irdma_pble.h"
63*cdcd52d4SBartosz Sobczak #include "irdma_cm.h"
64*cdcd52d4SBartosz Sobczak #include "fbsd_kcompat.h"
65*cdcd52d4SBartosz Sobczak #include "irdma-abi.h"
66*cdcd52d4SBartosz Sobczak #include "irdma_verbs.h"
67*cdcd52d4SBartosz Sobczak #include "irdma_user.h"
68*cdcd52d4SBartosz Sobczak #include "irdma_puda.h"
69*cdcd52d4SBartosz Sobczak 
70*cdcd52d4SBartosz Sobczak extern struct list_head irdma_handlers;
71*cdcd52d4SBartosz Sobczak extern spinlock_t irdma_handler_lock;
72*cdcd52d4SBartosz Sobczak extern bool irdma_upload_context;
73*cdcd52d4SBartosz Sobczak 
74*cdcd52d4SBartosz Sobczak #define IRDMA_FW_VER_DEFAULT	2
75*cdcd52d4SBartosz Sobczak #define IRDMA_HW_VER	        2
76*cdcd52d4SBartosz Sobczak 
77*cdcd52d4SBartosz Sobczak #define IRDMA_ARP_ADD		1
78*cdcd52d4SBartosz Sobczak #define IRDMA_ARP_DELETE	2
79*cdcd52d4SBartosz Sobczak #define IRDMA_ARP_RESOLVE	3
80*cdcd52d4SBartosz Sobczak 
81*cdcd52d4SBartosz Sobczak #define IRDMA_MACIP_ADD		1
82*cdcd52d4SBartosz Sobczak #define IRDMA_MACIP_DELETE	2
83*cdcd52d4SBartosz Sobczak 
84*cdcd52d4SBartosz Sobczak #define IW_CCQ_SIZE	(IRDMA_CQP_SW_SQSIZE_2048 + 1)
85*cdcd52d4SBartosz Sobczak #define IW_CEQ_SIZE	2048
86*cdcd52d4SBartosz Sobczak #define IW_AEQ_SIZE	2048
87*cdcd52d4SBartosz Sobczak 
88*cdcd52d4SBartosz Sobczak #define RX_BUF_SIZE	(1536 + 8)
89*cdcd52d4SBartosz Sobczak #define IW_REG0_SIZE	(4 * 1024)
90*cdcd52d4SBartosz Sobczak #define IW_TX_TIMEOUT	(6 * HZ)
91*cdcd52d4SBartosz Sobczak #define IW_FIRST_QPN	1
92*cdcd52d4SBartosz Sobczak 
93*cdcd52d4SBartosz Sobczak #define IW_SW_CONTEXT_ALIGN	1024
94*cdcd52d4SBartosz Sobczak 
95*cdcd52d4SBartosz Sobczak #define MAX_DPC_ITERATIONS	128
96*cdcd52d4SBartosz Sobczak 
97*cdcd52d4SBartosz Sobczak #define IRDMA_EVENT_TIMEOUT_MS		5000
98*cdcd52d4SBartosz Sobczak #define IRDMA_VCHNL_EVENT_TIMEOUT_MS	10000
99*cdcd52d4SBartosz Sobczak #define IRDMA_RST_TIMEOUT_HZ		4
100*cdcd52d4SBartosz Sobczak 
101*cdcd52d4SBartosz Sobczak #define	IRDMA_NO_QSET	0xffff
102*cdcd52d4SBartosz Sobczak 
103*cdcd52d4SBartosz Sobczak #define IW_CFG_FPM_QP_COUNT		32768
104*cdcd52d4SBartosz Sobczak #define IRDMA_MAX_PAGES_PER_FMR		512
105*cdcd52d4SBartosz Sobczak #define IRDMA_MIN_PAGES_PER_FMR		1
106*cdcd52d4SBartosz Sobczak #define IRDMA_CQP_COMPL_RQ_WQE_FLUSHED	2
107*cdcd52d4SBartosz Sobczak #define IRDMA_CQP_COMPL_SQ_WQE_FLUSHED	3
108*cdcd52d4SBartosz Sobczak 
109*cdcd52d4SBartosz Sobczak #define IRDMA_Q_TYPE_PE_AEQ	0x80
110*cdcd52d4SBartosz Sobczak #define IRDMA_Q_INVALID_IDX	0xffff
111*cdcd52d4SBartosz Sobczak #define IRDMA_REM_ENDPOINT_TRK_QPID	3
112*cdcd52d4SBartosz Sobczak 
113*cdcd52d4SBartosz Sobczak #define IRDMA_DRV_OPT_ENA_MPA_VER_0		0x00000001
114*cdcd52d4SBartosz Sobczak #define IRDMA_DRV_OPT_DISABLE_MPA_CRC		0x00000002
115*cdcd52d4SBartosz Sobczak #define IRDMA_DRV_OPT_DISABLE_FIRST_WRITE	0x00000004
116*cdcd52d4SBartosz Sobczak #define IRDMA_DRV_OPT_DISABLE_INTF		0x00000008
117*cdcd52d4SBartosz Sobczak #define IRDMA_DRV_OPT_ENA_MSI			0x00000010
118*cdcd52d4SBartosz Sobczak #define IRDMA_DRV_OPT_DUAL_LOGICAL_PORT		0x00000020
119*cdcd52d4SBartosz Sobczak #define IRDMA_DRV_OPT_NO_INLINE_DATA		0x00000080
120*cdcd52d4SBartosz Sobczak #define IRDMA_DRV_OPT_DISABLE_INT_MOD		0x00000100
121*cdcd52d4SBartosz Sobczak #define IRDMA_DRV_OPT_DISABLE_VIRT_WQ		0x00000200
122*cdcd52d4SBartosz Sobczak #define IRDMA_DRV_OPT_ENA_PAU			0x00000400
123*cdcd52d4SBartosz Sobczak #define IRDMA_DRV_OPT_MCAST_LOGPORT_MAP		0x00000800
124*cdcd52d4SBartosz Sobczak 
125*cdcd52d4SBartosz Sobczak #define IW_HMC_OBJ_TYPE_NUM	ARRAY_SIZE(iw_hmc_obj_types)
126*cdcd52d4SBartosz Sobczak #define VSI_RXSWCTRL(_VSI)			(0x00205000 + ((_VSI) * 4))
127*cdcd52d4SBartosz Sobczak #define VSI_RXSWCTRL_MACVSIPRUNEENABLE_M	BIT(8)
128*cdcd52d4SBartosz Sobczak #define VSI_RXSWCTRL_SRCPRUNEENABLE_M		BIT(13)
129*cdcd52d4SBartosz Sobczak #define IRDMA_ROCE_CWND_DEFAULT			0x400
130*cdcd52d4SBartosz Sobczak #define IRDMA_ROCE_ACKCREDS_DEFAULT		0x1E
131*cdcd52d4SBartosz Sobczak 
132*cdcd52d4SBartosz Sobczak #define IRDMA_FLUSH_SQ		BIT(0)
133*cdcd52d4SBartosz Sobczak #define IRDMA_FLUSH_RQ		BIT(1)
134*cdcd52d4SBartosz Sobczak #define IRDMA_REFLUSH		BIT(2)
135*cdcd52d4SBartosz Sobczak #define IRDMA_FLUSH_WAIT	BIT(3)
136*cdcd52d4SBartosz Sobczak 
137*cdcd52d4SBartosz Sobczak enum init_completion_state {
138*cdcd52d4SBartosz Sobczak 	INVALID_STATE = 0,
139*cdcd52d4SBartosz Sobczak 	INITIAL_STATE,
140*cdcd52d4SBartosz Sobczak 	CQP_CREATED,
141*cdcd52d4SBartosz Sobczak 	HMC_OBJS_CREATED,
142*cdcd52d4SBartosz Sobczak 	HW_RSRC_INITIALIZED,
143*cdcd52d4SBartosz Sobczak 	CCQ_CREATED,
144*cdcd52d4SBartosz Sobczak 	CEQ0_CREATED, /* Last state of probe */
145*cdcd52d4SBartosz Sobczak 	ILQ_CREATED,
146*cdcd52d4SBartosz Sobczak 	IEQ_CREATED,
147*cdcd52d4SBartosz Sobczak 	REM_ENDPOINT_TRK_CREATED,
148*cdcd52d4SBartosz Sobczak 	CEQS_CREATED,
149*cdcd52d4SBartosz Sobczak 	PBLE_CHUNK_MEM,
150*cdcd52d4SBartosz Sobczak 	AEQ_CREATED,
151*cdcd52d4SBartosz Sobczak 	IP_ADDR_REGISTERED,  /* Last state of open */
152*cdcd52d4SBartosz Sobczak };
153*cdcd52d4SBartosz Sobczak 
154*cdcd52d4SBartosz Sobczak struct irdma_rsrc_limits {
155*cdcd52d4SBartosz Sobczak 	u32 qplimit;
156*cdcd52d4SBartosz Sobczak 	u32 mrlimit;
157*cdcd52d4SBartosz Sobczak 	u32 cqlimit;
158*cdcd52d4SBartosz Sobczak };
159*cdcd52d4SBartosz Sobczak 
160*cdcd52d4SBartosz Sobczak struct irdma_cqp_err_info {
161*cdcd52d4SBartosz Sobczak 	u16 maj;
162*cdcd52d4SBartosz Sobczak 	u16 min;
163*cdcd52d4SBartosz Sobczak 	const char *desc;
164*cdcd52d4SBartosz Sobczak };
165*cdcd52d4SBartosz Sobczak 
166*cdcd52d4SBartosz Sobczak struct irdma_cqp_compl_info {
167*cdcd52d4SBartosz Sobczak 	u32 op_ret_val;
168*cdcd52d4SBartosz Sobczak 	u16 maj_err_code;
169*cdcd52d4SBartosz Sobczak 	u16 min_err_code;
170*cdcd52d4SBartosz Sobczak 	bool error;
171*cdcd52d4SBartosz Sobczak 	u8 op_code;
172*cdcd52d4SBartosz Sobczak };
173*cdcd52d4SBartosz Sobczak 
174*cdcd52d4SBartosz Sobczak struct irdma_cqp_request {
175*cdcd52d4SBartosz Sobczak 	struct cqp_cmds_info info;
176*cdcd52d4SBartosz Sobczak 	wait_queue_head_t waitq;
177*cdcd52d4SBartosz Sobczak 	struct list_head list;
178*cdcd52d4SBartosz Sobczak 	atomic_t refcnt;
179*cdcd52d4SBartosz Sobczak 	void (*callback_fcn)(struct irdma_cqp_request *cqp_request);
180*cdcd52d4SBartosz Sobczak 	void *param;
181*cdcd52d4SBartosz Sobczak 	struct irdma_cqp_compl_info compl_info;
182*cdcd52d4SBartosz Sobczak 	bool waiting:1;
183*cdcd52d4SBartosz Sobczak 	bool request_done:1;
184*cdcd52d4SBartosz Sobczak 	bool dynamic:1;
185*cdcd52d4SBartosz Sobczak };
186*cdcd52d4SBartosz Sobczak 
187*cdcd52d4SBartosz Sobczak struct irdma_cqp {
188*cdcd52d4SBartosz Sobczak 	struct irdma_sc_cqp sc_cqp;
189*cdcd52d4SBartosz Sobczak 	spinlock_t req_lock; /* protect CQP request list */
190*cdcd52d4SBartosz Sobczak 	spinlock_t compl_lock; /* protect CQP completion processing */
191*cdcd52d4SBartosz Sobczak 	wait_queue_head_t waitq;
192*cdcd52d4SBartosz Sobczak 	wait_queue_head_t remove_wq;
193*cdcd52d4SBartosz Sobczak 	struct irdma_dma_mem sq;
194*cdcd52d4SBartosz Sobczak 	struct irdma_dma_mem host_ctx;
195*cdcd52d4SBartosz Sobczak 	u64 *scratch_array;
196*cdcd52d4SBartosz Sobczak 	struct irdma_cqp_request *cqp_requests;
197*cdcd52d4SBartosz Sobczak 	struct list_head cqp_avail_reqs;
198*cdcd52d4SBartosz Sobczak 	struct list_head cqp_pending_reqs;
199*cdcd52d4SBartosz Sobczak };
200*cdcd52d4SBartosz Sobczak 
201*cdcd52d4SBartosz Sobczak struct irdma_ccq {
202*cdcd52d4SBartosz Sobczak 	struct irdma_sc_cq sc_cq;
203*cdcd52d4SBartosz Sobczak 	struct irdma_dma_mem mem_cq;
204*cdcd52d4SBartosz Sobczak 	struct irdma_dma_mem shadow_area;
205*cdcd52d4SBartosz Sobczak };
206*cdcd52d4SBartosz Sobczak 
207*cdcd52d4SBartosz Sobczak struct irdma_ceq {
208*cdcd52d4SBartosz Sobczak 	struct irdma_sc_ceq sc_ceq;
209*cdcd52d4SBartosz Sobczak 	struct irdma_dma_mem mem;
210*cdcd52d4SBartosz Sobczak 	u32 irq;
211*cdcd52d4SBartosz Sobczak 	u32 msix_idx;
212*cdcd52d4SBartosz Sobczak 	struct irdma_pci_f *rf;
213*cdcd52d4SBartosz Sobczak 	struct tasklet_struct dpc_tasklet;
214*cdcd52d4SBartosz Sobczak 	spinlock_t ce_lock; /* sync cq destroy with cq completion event notification */
215*cdcd52d4SBartosz Sobczak };
216*cdcd52d4SBartosz Sobczak 
217*cdcd52d4SBartosz Sobczak struct irdma_aeq {
218*cdcd52d4SBartosz Sobczak 	struct irdma_sc_aeq sc_aeq;
219*cdcd52d4SBartosz Sobczak 	struct irdma_dma_mem mem;
220*cdcd52d4SBartosz Sobczak 	struct irdma_pble_alloc palloc;
221*cdcd52d4SBartosz Sobczak 	bool virtual_map;
222*cdcd52d4SBartosz Sobczak };
223*cdcd52d4SBartosz Sobczak 
224*cdcd52d4SBartosz Sobczak struct irdma_arp_entry {
225*cdcd52d4SBartosz Sobczak 	u32 ip_addr[4];
226*cdcd52d4SBartosz Sobczak 	u8 mac_addr[ETH_ALEN];
227*cdcd52d4SBartosz Sobczak };
228*cdcd52d4SBartosz Sobczak 
229*cdcd52d4SBartosz Sobczak struct irdma_msix_vector {
230*cdcd52d4SBartosz Sobczak 	u32 idx;
231*cdcd52d4SBartosz Sobczak 	u32 irq;
232*cdcd52d4SBartosz Sobczak 	u32 cpu_affinity;
233*cdcd52d4SBartosz Sobczak 	u32 ceq_id;
234*cdcd52d4SBartosz Sobczak 	struct resource *res;
235*cdcd52d4SBartosz Sobczak 	void  *tag;
236*cdcd52d4SBartosz Sobczak };
237*cdcd52d4SBartosz Sobczak 
238*cdcd52d4SBartosz Sobczak struct irdma_mc_table_info {
239*cdcd52d4SBartosz Sobczak 	u32 mgn;
240*cdcd52d4SBartosz Sobczak 	u32 dest_ip[4];
241*cdcd52d4SBartosz Sobczak 	bool lan_fwd:1;
242*cdcd52d4SBartosz Sobczak 	bool ipv4_valid:1;
243*cdcd52d4SBartosz Sobczak };
244*cdcd52d4SBartosz Sobczak 
245*cdcd52d4SBartosz Sobczak struct mc_table_list {
246*cdcd52d4SBartosz Sobczak 	struct list_head list;
247*cdcd52d4SBartosz Sobczak 	struct irdma_mc_table_info mc_info;
248*cdcd52d4SBartosz Sobczak 	struct irdma_mcast_grp_info mc_grp_ctx;
249*cdcd52d4SBartosz Sobczak };
250*cdcd52d4SBartosz Sobczak 
251*cdcd52d4SBartosz Sobczak struct irdma_qv_info {
252*cdcd52d4SBartosz Sobczak 	u32 v_idx; /* msix_vector */
253*cdcd52d4SBartosz Sobczak 	u16 ceq_idx;
254*cdcd52d4SBartosz Sobczak 	u16 aeq_idx;
255*cdcd52d4SBartosz Sobczak 	u8 itr_idx;
256*cdcd52d4SBartosz Sobczak };
257*cdcd52d4SBartosz Sobczak 
258*cdcd52d4SBartosz Sobczak struct irdma_qvlist_info {
259*cdcd52d4SBartosz Sobczak 	u32 num_vectors;
260*cdcd52d4SBartosz Sobczak 	struct irdma_qv_info qv_info[1];
261*cdcd52d4SBartosz Sobczak };
262*cdcd52d4SBartosz Sobczak 
263*cdcd52d4SBartosz Sobczak struct irdma_gen_ops {
264*cdcd52d4SBartosz Sobczak 	void (*request_reset)(struct irdma_pci_f *rf);
265*cdcd52d4SBartosz Sobczak 	int (*register_qset)(struct irdma_sc_vsi *vsi,
266*cdcd52d4SBartosz Sobczak 			     struct irdma_ws_node *tc_node);
267*cdcd52d4SBartosz Sobczak 	void (*unregister_qset)(struct irdma_sc_vsi *vsi,
268*cdcd52d4SBartosz Sobczak 				struct irdma_ws_node *tc_node);
269*cdcd52d4SBartosz Sobczak };
270*cdcd52d4SBartosz Sobczak 
271*cdcd52d4SBartosz Sobczak struct irdma_pci_f {
272*cdcd52d4SBartosz Sobczak 	bool reset:1;
273*cdcd52d4SBartosz Sobczak 	bool rsrc_created:1;
274*cdcd52d4SBartosz Sobczak 	bool msix_shared:1;
275*cdcd52d4SBartosz Sobczak 	bool ftype:1;
276*cdcd52d4SBartosz Sobczak 	u8 rsrc_profile;
277*cdcd52d4SBartosz Sobczak 	u8 *hmc_info_mem;
278*cdcd52d4SBartosz Sobczak 	u8 *mem_rsrc;
279*cdcd52d4SBartosz Sobczak 	u8 rdma_ver;
280*cdcd52d4SBartosz Sobczak 	u8 rst_to;
281*cdcd52d4SBartosz Sobczak 	enum irdma_protocol_used protocol_used;
282*cdcd52d4SBartosz Sobczak 	bool en_rem_endpoint_trk:1;
283*cdcd52d4SBartosz Sobczak 	bool dcqcn_ena:1;
284*cdcd52d4SBartosz Sobczak 	u32 sd_type;
285*cdcd52d4SBartosz Sobczak 	u32 msix_count;
286*cdcd52d4SBartosz Sobczak 	u32 max_mr;
287*cdcd52d4SBartosz Sobczak 	u32 max_qp;
288*cdcd52d4SBartosz Sobczak 	u32 max_cq;
289*cdcd52d4SBartosz Sobczak 	u32 max_ah;
290*cdcd52d4SBartosz Sobczak 	u32 next_ah;
291*cdcd52d4SBartosz Sobczak 	u32 max_mcg;
292*cdcd52d4SBartosz Sobczak 	u32 next_mcg;
293*cdcd52d4SBartosz Sobczak 	u32 max_pd;
294*cdcd52d4SBartosz Sobczak 	u32 next_qp;
295*cdcd52d4SBartosz Sobczak 	u32 next_cq;
296*cdcd52d4SBartosz Sobczak 	u32 next_pd;
297*cdcd52d4SBartosz Sobczak 	u32 max_mr_size;
298*cdcd52d4SBartosz Sobczak 	u32 max_cqe;
299*cdcd52d4SBartosz Sobczak 	u32 mr_stagmask;
300*cdcd52d4SBartosz Sobczak 	u32 used_pds;
301*cdcd52d4SBartosz Sobczak 	u32 used_cqs;
302*cdcd52d4SBartosz Sobczak 	u32 used_mrs;
303*cdcd52d4SBartosz Sobczak 	u32 used_qps;
304*cdcd52d4SBartosz Sobczak 	u32 arp_table_size;
305*cdcd52d4SBartosz Sobczak 	u32 next_arp_index;
306*cdcd52d4SBartosz Sobczak 	u32 ceqs_count;
307*cdcd52d4SBartosz Sobczak 	u32 next_ws_node_id;
308*cdcd52d4SBartosz Sobczak 	u32 max_ws_node_id;
309*cdcd52d4SBartosz Sobczak 	u32 limits_sel;
310*cdcd52d4SBartosz Sobczak 	unsigned long *allocated_ws_nodes;
311*cdcd52d4SBartosz Sobczak 	unsigned long *allocated_qps;
312*cdcd52d4SBartosz Sobczak 	unsigned long *allocated_cqs;
313*cdcd52d4SBartosz Sobczak 	unsigned long *allocated_mrs;
314*cdcd52d4SBartosz Sobczak 	unsigned long *allocated_pds;
315*cdcd52d4SBartosz Sobczak 	unsigned long *allocated_mcgs;
316*cdcd52d4SBartosz Sobczak 	unsigned long *allocated_ahs;
317*cdcd52d4SBartosz Sobczak 	unsigned long *allocated_arps;
318*cdcd52d4SBartosz Sobczak 	enum init_completion_state init_state;
319*cdcd52d4SBartosz Sobczak 	struct irdma_sc_dev sc_dev;
320*cdcd52d4SBartosz Sobczak 	struct irdma_dev_ctx dev_ctx;
321*cdcd52d4SBartosz Sobczak 	struct irdma_tunable_info tun_info;
322*cdcd52d4SBartosz Sobczak 	eventhandler_tag irdma_ifaddr_event;
323*cdcd52d4SBartosz Sobczak 	struct irdma_handler *hdl;
324*cdcd52d4SBartosz Sobczak 	struct pci_dev *pcidev;
325*cdcd52d4SBartosz Sobczak 	struct ice_rdma_peer *peer_info;
326*cdcd52d4SBartosz Sobczak 	struct irdma_hw hw;
327*cdcd52d4SBartosz Sobczak 	struct irdma_cqp cqp;
328*cdcd52d4SBartosz Sobczak 	struct irdma_ccq ccq;
329*cdcd52d4SBartosz Sobczak 	struct irdma_aeq aeq;
330*cdcd52d4SBartosz Sobczak 	struct irdma_ceq *ceqlist;
331*cdcd52d4SBartosz Sobczak 	struct irdma_hmc_pble_rsrc *pble_rsrc;
332*cdcd52d4SBartosz Sobczak 	struct irdma_arp_entry *arp_table;
333*cdcd52d4SBartosz Sobczak 	spinlock_t arp_lock; /*protect ARP table access*/
334*cdcd52d4SBartosz Sobczak 	spinlock_t rsrc_lock; /* protect HW resource array access */
335*cdcd52d4SBartosz Sobczak 	spinlock_t qptable_lock; /*protect QP table access*/
336*cdcd52d4SBartosz Sobczak 	spinlock_t cqtable_lock; /*protect CQ table access*/
337*cdcd52d4SBartosz Sobczak 	struct irdma_qp **qp_table;
338*cdcd52d4SBartosz Sobczak 	struct irdma_cq **cq_table;
339*cdcd52d4SBartosz Sobczak 	spinlock_t qh_list_lock; /* protect mc_qht_list */
340*cdcd52d4SBartosz Sobczak 	struct mc_table_list mc_qht_list;
341*cdcd52d4SBartosz Sobczak 	struct irdma_msix_vector *iw_msixtbl;
342*cdcd52d4SBartosz Sobczak 	struct irdma_qvlist_info *iw_qvlist;
343*cdcd52d4SBartosz Sobczak 	struct tasklet_struct dpc_tasklet;
344*cdcd52d4SBartosz Sobczak 	struct msix_entry msix_info;
345*cdcd52d4SBartosz Sobczak 	struct irdma_dma_mem obj_mem;
346*cdcd52d4SBartosz Sobczak 	struct irdma_dma_mem obj_next;
347*cdcd52d4SBartosz Sobczak 	atomic_t vchnl_msgs;
348*cdcd52d4SBartosz Sobczak 	wait_queue_head_t vchnl_waitq;
349*cdcd52d4SBartosz Sobczak 	struct workqueue_struct *cqp_cmpl_wq;
350*cdcd52d4SBartosz Sobczak 	struct work_struct cqp_cmpl_work;
351*cdcd52d4SBartosz Sobczak 	struct irdma_sc_vsi default_vsi;
352*cdcd52d4SBartosz Sobczak 	void *back_fcn;
353*cdcd52d4SBartosz Sobczak 	struct irdma_gen_ops gen_ops;
354*cdcd52d4SBartosz Sobczak 	void (*check_fc)(struct irdma_sc_vsi *vsi, struct irdma_sc_qp *sc_qp);
355*cdcd52d4SBartosz Sobczak 	struct irdma_dcqcn_cc_params dcqcn_params;
356*cdcd52d4SBartosz Sobczak 	struct irdma_device *iwdev;
357*cdcd52d4SBartosz Sobczak };
358*cdcd52d4SBartosz Sobczak 
359*cdcd52d4SBartosz Sobczak struct irdma_device {
360*cdcd52d4SBartosz Sobczak 	struct ib_device ibdev;
361*cdcd52d4SBartosz Sobczak 	struct irdma_pci_f *rf;
362*cdcd52d4SBartosz Sobczak 	struct ifnet *netdev;
363*cdcd52d4SBartosz Sobczak 	struct irdma_handler *hdl;
364*cdcd52d4SBartosz Sobczak 	struct workqueue_struct *cleanup_wq;
365*cdcd52d4SBartosz Sobczak 	struct irdma_sc_vsi vsi;
366*cdcd52d4SBartosz Sobczak 	struct irdma_cm_core cm_core;
367*cdcd52d4SBartosz Sobczak 	u32 roce_cwnd;
368*cdcd52d4SBartosz Sobczak 	u32 roce_ackcreds;
369*cdcd52d4SBartosz Sobczak 	u32 vendor_id;
370*cdcd52d4SBartosz Sobczak 	u32 vendor_part_id;
371*cdcd52d4SBartosz Sobczak 	u32 device_cap_flags;
372*cdcd52d4SBartosz Sobczak 	u32 push_mode;
373*cdcd52d4SBartosz Sobczak 	u32 rcv_wnd;
374*cdcd52d4SBartosz Sobczak 	u16 mac_ip_table_idx;
375*cdcd52d4SBartosz Sobczak 	u16 vsi_num;
376*cdcd52d4SBartosz Sobczak 	u8 rcv_wscale;
377*cdcd52d4SBartosz Sobczak 	u8 iw_status;
378*cdcd52d4SBartosz Sobczak 	u8 rd_fence_rate;
379*cdcd52d4SBartosz Sobczak 	bool roce_mode:1;
380*cdcd52d4SBartosz Sobczak 	bool roce_dcqcn_en:1;
381*cdcd52d4SBartosz Sobczak 	bool dcb_vlan_mode:1;
382*cdcd52d4SBartosz Sobczak 	bool iw_ooo:1;
383*cdcd52d4SBartosz Sobczak 	enum init_completion_state init_state;
384*cdcd52d4SBartosz Sobczak 
385*cdcd52d4SBartosz Sobczak 	wait_queue_head_t suspend_wq;
386*cdcd52d4SBartosz Sobczak };
387*cdcd52d4SBartosz Sobczak 
388*cdcd52d4SBartosz Sobczak struct irdma_handler {
389*cdcd52d4SBartosz Sobczak 	struct list_head list;
390*cdcd52d4SBartosz Sobczak 	struct irdma_device *iwdev;
391*cdcd52d4SBartosz Sobczak 	struct task deferred_task;
392*cdcd52d4SBartosz Sobczak 	struct taskqueue *deferred_tq;
393*cdcd52d4SBartosz Sobczak 	bool shared_res_created;
394*cdcd52d4SBartosz Sobczak };
395*cdcd52d4SBartosz Sobczak 
396*cdcd52d4SBartosz Sobczak static inline struct irdma_device *to_iwdev(struct ib_device *ibdev)
397*cdcd52d4SBartosz Sobczak {
398*cdcd52d4SBartosz Sobczak 	return container_of(ibdev, struct irdma_device, ibdev);
399*cdcd52d4SBartosz Sobczak }
400*cdcd52d4SBartosz Sobczak 
401*cdcd52d4SBartosz Sobczak static inline struct irdma_ucontext *to_ucontext(struct ib_ucontext *ibucontext)
402*cdcd52d4SBartosz Sobczak {
403*cdcd52d4SBartosz Sobczak 	return container_of(ibucontext, struct irdma_ucontext, ibucontext);
404*cdcd52d4SBartosz Sobczak }
405*cdcd52d4SBartosz Sobczak 
406*cdcd52d4SBartosz Sobczak static inline struct irdma_user_mmap_entry *
407*cdcd52d4SBartosz Sobczak to_irdma_mmap_entry(struct rdma_user_mmap_entry *rdma_entry)
408*cdcd52d4SBartosz Sobczak {
409*cdcd52d4SBartosz Sobczak 	return container_of(rdma_entry, struct irdma_user_mmap_entry,
410*cdcd52d4SBartosz Sobczak 			    rdma_entry);
411*cdcd52d4SBartosz Sobczak }
412*cdcd52d4SBartosz Sobczak 
413*cdcd52d4SBartosz Sobczak static inline struct irdma_pd *to_iwpd(struct ib_pd *ibpd)
414*cdcd52d4SBartosz Sobczak {
415*cdcd52d4SBartosz Sobczak 	return container_of(ibpd, struct irdma_pd, ibpd);
416*cdcd52d4SBartosz Sobczak }
417*cdcd52d4SBartosz Sobczak 
418*cdcd52d4SBartosz Sobczak static inline struct irdma_ah *to_iwah(struct ib_ah *ibah)
419*cdcd52d4SBartosz Sobczak {
420*cdcd52d4SBartosz Sobczak 	return container_of(ibah, struct irdma_ah, ibah);
421*cdcd52d4SBartosz Sobczak }
422*cdcd52d4SBartosz Sobczak 
423*cdcd52d4SBartosz Sobczak static inline struct irdma_mr *to_iwmr(struct ib_mr *ibmr)
424*cdcd52d4SBartosz Sobczak {
425*cdcd52d4SBartosz Sobczak 	return container_of(ibmr, struct irdma_mr, ibmr);
426*cdcd52d4SBartosz Sobczak }
427*cdcd52d4SBartosz Sobczak 
428*cdcd52d4SBartosz Sobczak static inline struct irdma_mr *to_iwmw(struct ib_mw *ibmw)
429*cdcd52d4SBartosz Sobczak {
430*cdcd52d4SBartosz Sobczak 	return container_of(ibmw, struct irdma_mr, ibmw);
431*cdcd52d4SBartosz Sobczak }
432*cdcd52d4SBartosz Sobczak 
433*cdcd52d4SBartosz Sobczak static inline struct irdma_cq *to_iwcq(struct ib_cq *ibcq)
434*cdcd52d4SBartosz Sobczak {
435*cdcd52d4SBartosz Sobczak 	return container_of(ibcq, struct irdma_cq, ibcq);
436*cdcd52d4SBartosz Sobczak }
437*cdcd52d4SBartosz Sobczak 
438*cdcd52d4SBartosz Sobczak static inline struct irdma_qp *to_iwqp(struct ib_qp *ibqp)
439*cdcd52d4SBartosz Sobczak {
440*cdcd52d4SBartosz Sobczak 	return container_of(ibqp, struct irdma_qp, ibqp);
441*cdcd52d4SBartosz Sobczak }
442*cdcd52d4SBartosz Sobczak 
443*cdcd52d4SBartosz Sobczak static inline struct irdma_pci_f *dev_to_rf(struct irdma_sc_dev *dev)
444*cdcd52d4SBartosz Sobczak {
445*cdcd52d4SBartosz Sobczak 	return container_of(dev, struct irdma_pci_f, sc_dev);
446*cdcd52d4SBartosz Sobczak }
447*cdcd52d4SBartosz Sobczak 
448*cdcd52d4SBartosz Sobczak /**
449*cdcd52d4SBartosz Sobczak  * irdma_alloc_resource - allocate a resource
450*cdcd52d4SBartosz Sobczak  * @iwdev: device pointer
451*cdcd52d4SBartosz Sobczak  * @resource_array: resource bit array:
452*cdcd52d4SBartosz Sobczak  * @max_resources: maximum resource number
453*cdcd52d4SBartosz Sobczak  * @req_resources_num: Allocated resource number
454*cdcd52d4SBartosz Sobczak  * @next: next free id
455*cdcd52d4SBartosz Sobczak  **/
456*cdcd52d4SBartosz Sobczak static inline int irdma_alloc_rsrc(struct irdma_pci_f *rf,
457*cdcd52d4SBartosz Sobczak 				   unsigned long *rsrc_array, u32 max_rsrc,
458*cdcd52d4SBartosz Sobczak 				   u32 *req_rsrc_num, u32 *next)
459*cdcd52d4SBartosz Sobczak {
460*cdcd52d4SBartosz Sobczak 	u32 rsrc_num;
461*cdcd52d4SBartosz Sobczak 	unsigned long flags;
462*cdcd52d4SBartosz Sobczak 
463*cdcd52d4SBartosz Sobczak 	spin_lock_irqsave(&rf->rsrc_lock, flags);
464*cdcd52d4SBartosz Sobczak 	rsrc_num = find_next_zero_bit(rsrc_array, max_rsrc, *next);
465*cdcd52d4SBartosz Sobczak 	if (rsrc_num >= max_rsrc) {
466*cdcd52d4SBartosz Sobczak 		rsrc_num = find_first_zero_bit(rsrc_array, max_rsrc);
467*cdcd52d4SBartosz Sobczak 		if (rsrc_num >= max_rsrc) {
468*cdcd52d4SBartosz Sobczak 			spin_unlock_irqrestore(&rf->rsrc_lock, flags);
469*cdcd52d4SBartosz Sobczak 			irdma_debug(&rf->sc_dev, IRDMA_DEBUG_ERR,
470*cdcd52d4SBartosz Sobczak 				    "resource [%d] allocation failed\n",
471*cdcd52d4SBartosz Sobczak 				    rsrc_num);
472*cdcd52d4SBartosz Sobczak 			return -EOVERFLOW;
473*cdcd52d4SBartosz Sobczak 		}
474*cdcd52d4SBartosz Sobczak 	}
475*cdcd52d4SBartosz Sobczak 	__set_bit(rsrc_num, rsrc_array);
476*cdcd52d4SBartosz Sobczak 	*next = rsrc_num + 1;
477*cdcd52d4SBartosz Sobczak 	if (*next == max_rsrc)
478*cdcd52d4SBartosz Sobczak 		*next = 0;
479*cdcd52d4SBartosz Sobczak 	*req_rsrc_num = rsrc_num;
480*cdcd52d4SBartosz Sobczak 	spin_unlock_irqrestore(&rf->rsrc_lock, flags);
481*cdcd52d4SBartosz Sobczak 
482*cdcd52d4SBartosz Sobczak 	return 0;
483*cdcd52d4SBartosz Sobczak }
484*cdcd52d4SBartosz Sobczak 
485*cdcd52d4SBartosz Sobczak /**
486*cdcd52d4SBartosz Sobczak  * irdma_free_resource - free a resource
487*cdcd52d4SBartosz Sobczak  * @iwdev: device pointer
488*cdcd52d4SBartosz Sobczak  * @resource_array: resource array for the resource_num
489*cdcd52d4SBartosz Sobczak  * @resource_num: resource number to free
490*cdcd52d4SBartosz Sobczak  **/
491*cdcd52d4SBartosz Sobczak static inline void irdma_free_rsrc(struct irdma_pci_f *rf,
492*cdcd52d4SBartosz Sobczak 				   unsigned long *rsrc_array, u32 rsrc_num)
493*cdcd52d4SBartosz Sobczak {
494*cdcd52d4SBartosz Sobczak 	unsigned long flags;
495*cdcd52d4SBartosz Sobczak 
496*cdcd52d4SBartosz Sobczak 	spin_lock_irqsave(&rf->rsrc_lock, flags);
497*cdcd52d4SBartosz Sobczak 	__clear_bit(rsrc_num, rsrc_array);
498*cdcd52d4SBartosz Sobczak 	spin_unlock_irqrestore(&rf->rsrc_lock, flags);
499*cdcd52d4SBartosz Sobczak }
500*cdcd52d4SBartosz Sobczak 
501*cdcd52d4SBartosz Sobczak int irdma_ctrl_init_hw(struct irdma_pci_f *rf);
502*cdcd52d4SBartosz Sobczak void irdma_ctrl_deinit_hw(struct irdma_pci_f *rf);
503*cdcd52d4SBartosz Sobczak int irdma_rt_init_hw(struct irdma_device *iwdev,
504*cdcd52d4SBartosz Sobczak 		     struct irdma_l2params *l2params);
505*cdcd52d4SBartosz Sobczak void irdma_rt_deinit_hw(struct irdma_device *iwdev);
506*cdcd52d4SBartosz Sobczak void irdma_qp_add_ref(struct ib_qp *ibqp);
507*cdcd52d4SBartosz Sobczak void irdma_qp_rem_ref(struct ib_qp *ibqp);
508*cdcd52d4SBartosz Sobczak void irdma_free_lsmm_rsrc(struct irdma_qp *iwqp);
509*cdcd52d4SBartosz Sobczak struct ib_qp *irdma_get_qp(struct ib_device *ibdev, int qpn);
510*cdcd52d4SBartosz Sobczak void irdma_flush_wqes(struct irdma_qp *iwqp, u32 flush_mask);
511*cdcd52d4SBartosz Sobczak void irdma_manage_arp_cache(struct irdma_pci_f *rf, unsigned char *mac_addr,
512*cdcd52d4SBartosz Sobczak 			    u32 *ip_addr, u32 action);
513*cdcd52d4SBartosz Sobczak struct irdma_apbvt_entry *irdma_add_apbvt(struct irdma_device *iwdev, u16 port);
514*cdcd52d4SBartosz Sobczak void irdma_del_apbvt(struct irdma_device *iwdev,
515*cdcd52d4SBartosz Sobczak 		     struct irdma_apbvt_entry *entry);
516*cdcd52d4SBartosz Sobczak struct irdma_cqp_request *irdma_alloc_and_get_cqp_request(struct irdma_cqp *cqp,
517*cdcd52d4SBartosz Sobczak 							  bool wait);
518*cdcd52d4SBartosz Sobczak void irdma_free_cqp_request(struct irdma_cqp *cqp,
519*cdcd52d4SBartosz Sobczak 			    struct irdma_cqp_request *cqp_request);
520*cdcd52d4SBartosz Sobczak void irdma_put_cqp_request(struct irdma_cqp *cqp,
521*cdcd52d4SBartosz Sobczak 			   struct irdma_cqp_request *cqp_request);
522*cdcd52d4SBartosz Sobczak int irdma_alloc_local_mac_entry(struct irdma_pci_f *rf, u16 *mac_tbl_idx);
523*cdcd52d4SBartosz Sobczak int irdma_add_local_mac_entry(struct irdma_pci_f *rf, u8 *mac_addr, u16 idx);
524*cdcd52d4SBartosz Sobczak void irdma_del_local_mac_entry(struct irdma_pci_f *rf, u16 idx);
525*cdcd52d4SBartosz Sobczak 
526*cdcd52d4SBartosz Sobczak u32 irdma_initialize_hw_rsrc(struct irdma_pci_f *rf);
527*cdcd52d4SBartosz Sobczak void irdma_port_ibevent(struct irdma_device *iwdev);
528*cdcd52d4SBartosz Sobczak void irdma_cm_disconn(struct irdma_qp *qp);
529*cdcd52d4SBartosz Sobczak 
530*cdcd52d4SBartosz Sobczak bool irdma_cqp_crit_err(struct irdma_sc_dev *dev, u8 cqp_cmd,
531*cdcd52d4SBartosz Sobczak 			u16 maj_err_code, u16 min_err_code);
532*cdcd52d4SBartosz Sobczak int irdma_handle_cqp_op(struct irdma_pci_f *rf,
533*cdcd52d4SBartosz Sobczak 			struct irdma_cqp_request *cqp_request);
534*cdcd52d4SBartosz Sobczak 
535*cdcd52d4SBartosz Sobczak int irdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask,
536*cdcd52d4SBartosz Sobczak 		    struct ib_udata *udata);
537*cdcd52d4SBartosz Sobczak int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr,
538*cdcd52d4SBartosz Sobczak 			 int attr_mask, struct ib_udata *udata);
539*cdcd52d4SBartosz Sobczak void irdma_cq_add_ref(struct ib_cq *ibcq);
540*cdcd52d4SBartosz Sobczak void irdma_cq_rem_ref(struct ib_cq *ibcq);
541*cdcd52d4SBartosz Sobczak void irdma_cq_wq_destroy(struct irdma_pci_f *rf, struct irdma_sc_cq *cq);
542*cdcd52d4SBartosz Sobczak 
543*cdcd52d4SBartosz Sobczak void irdma_cleanup_pending_cqp_op(struct irdma_pci_f *rf);
544*cdcd52d4SBartosz Sobczak int irdma_hw_modify_qp(struct irdma_device *iwdev, struct irdma_qp *iwqp,
545*cdcd52d4SBartosz Sobczak 		       struct irdma_modify_qp_info *info, bool wait);
546*cdcd52d4SBartosz Sobczak int irdma_qp_suspend_resume(struct irdma_sc_qp *qp, bool suspend);
547*cdcd52d4SBartosz Sobczak int irdma_manage_qhash(struct irdma_device *iwdev, struct irdma_cm_info *cminfo,
548*cdcd52d4SBartosz Sobczak 		       enum irdma_quad_entry_type etype,
549*cdcd52d4SBartosz Sobczak 		       enum irdma_quad_hash_manage_type mtype, void *cmnode,
550*cdcd52d4SBartosz Sobczak 		       bool wait);
551*cdcd52d4SBartosz Sobczak void irdma_receive_ilq(struct irdma_sc_vsi *vsi, struct irdma_puda_buf *rbuf);
552*cdcd52d4SBartosz Sobczak void irdma_free_sqbuf(struct irdma_sc_vsi *vsi, void *bufp);
553*cdcd52d4SBartosz Sobczak void irdma_free_qp_rsrc(struct irdma_qp *iwqp);
554*cdcd52d4SBartosz Sobczak int irdma_setup_cm_core(struct irdma_device *iwdev, u8 ver);
555*cdcd52d4SBartosz Sobczak void irdma_cleanup_cm_core(struct irdma_cm_core *cm_core);
556*cdcd52d4SBartosz Sobczak void irdma_next_iw_state(struct irdma_qp *iwqp, u8 state, u8 del_hash, u8 term,
557*cdcd52d4SBartosz Sobczak 			 u8 term_len);
558*cdcd52d4SBartosz Sobczak int irdma_send_syn(struct irdma_cm_node *cm_node, u32 sendack);
559*cdcd52d4SBartosz Sobczak int irdma_send_reset(struct irdma_cm_node *cm_node);
560*cdcd52d4SBartosz Sobczak struct irdma_cm_node *irdma_find_node(struct irdma_cm_core *cm_core,
561*cdcd52d4SBartosz Sobczak 				      u16 rem_port, u32 *rem_addr, u16 loc_port,
562*cdcd52d4SBartosz Sobczak 				      u32 *loc_addr, u16 vlan_id);
563*cdcd52d4SBartosz Sobczak int irdma_hw_flush_wqes(struct irdma_pci_f *rf, struct irdma_sc_qp *qp,
564*cdcd52d4SBartosz Sobczak 			struct irdma_qp_flush_info *info, bool wait);
565*cdcd52d4SBartosz Sobczak void irdma_gen_ae(struct irdma_pci_f *rf, struct irdma_sc_qp *qp,
566*cdcd52d4SBartosz Sobczak 		  struct irdma_gen_ae_info *info, bool wait);
567*cdcd52d4SBartosz Sobczak void irdma_copy_ip_ntohl(u32 *dst, __be32 *src);
568*cdcd52d4SBartosz Sobczak void irdma_copy_ip_htonl(__be32 *dst, u32 *src);
569*cdcd52d4SBartosz Sobczak u16 irdma_get_vlan_ipv4(u32 *addr);
570*cdcd52d4SBartosz Sobczak struct ifnet *irdma_netdev_vlan_ipv6(u32 *addr, u16 *vlan_id, u8 *mac);
571*cdcd52d4SBartosz Sobczak struct ib_mr *irdma_reg_phys_mr(struct ib_pd *ib_pd, u64 addr, u64 size,
572*cdcd52d4SBartosz Sobczak 				int acc, u64 *iova_start);
573*cdcd52d4SBartosz Sobczak int irdma_upload_qp_context(struct irdma_qp *iwqp, bool freeze, bool raw);
574*cdcd52d4SBartosz Sobczak void irdma_del_hmc_objects(struct irdma_sc_dev *dev,
575*cdcd52d4SBartosz Sobczak 			   struct irdma_hmc_info *hmc_info, bool privileged,
576*cdcd52d4SBartosz Sobczak 			   bool reset, enum irdma_vers vers);
577*cdcd52d4SBartosz Sobczak void irdma_cqp_ce_handler(struct irdma_pci_f *rf, struct irdma_sc_cq *cq);
578*cdcd52d4SBartosz Sobczak int irdma_ah_cqp_op(struct irdma_pci_f *rf, struct irdma_sc_ah *sc_ah, u8 cmd,
579*cdcd52d4SBartosz Sobczak 		    bool wait,
580*cdcd52d4SBartosz Sobczak 		    void (*callback_fcn)(struct irdma_cqp_request *cqp_request),
581*cdcd52d4SBartosz Sobczak 		    void *cb_param);
582*cdcd52d4SBartosz Sobczak void irdma_gsi_ud_qp_ah_cb(struct irdma_cqp_request *cqp_request);
583*cdcd52d4SBartosz Sobczak bool irdma_cq_empty(struct irdma_cq *iwcq);
584*cdcd52d4SBartosz Sobczak void irdma_set_rf_user_cfg_params(struct irdma_pci_f *rf);
585*cdcd52d4SBartosz Sobczak void irdma_add_ip(struct irdma_device *iwdev);
586*cdcd52d4SBartosz Sobczak void irdma_add_handler(struct irdma_handler *hdl);
587*cdcd52d4SBartosz Sobczak void irdma_del_handler(struct irdma_handler *hdl);
588*cdcd52d4SBartosz Sobczak void cqp_compl_worker(struct work_struct *work);
589*cdcd52d4SBartosz Sobczak #endif /* IRDMA_MAIN_H */
590