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