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