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