1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /*
3  * Copyright (c) 2013-2020, Mellanox Technologies inc. All rights reserved.
4  */
5 
6 #ifndef _MLX5_IB_QP_H
7 #define _MLX5_IB_QP_H
8 
9 struct mlx5_ib_dev;
10 
11 struct mlx5_qp_table {
12 	struct notifier_block nb;
13 	struct xarray dct_xa;
14 
15 	/* protect radix tree
16 	 */
17 	spinlock_t lock;
18 	struct radix_tree_root tree;
19 };
20 
21 int mlx5_init_qp_table(struct mlx5_ib_dev *dev);
22 void mlx5_cleanup_qp_table(struct mlx5_ib_dev *dev);
23 
24 int mlx5_core_create_dct(struct mlx5_ib_dev *dev, struct mlx5_core_dct *qp,
25 			 u32 *in, int inlen, u32 *out, int outlen);
26 int mlx5_qpc_create_qp(struct mlx5_ib_dev *dev, struct mlx5_core_qp *qp,
27 		       u32 *in, int inlen, u32 *out);
28 int mlx5_core_qp_modify(struct mlx5_ib_dev *dev, u16 opcode, u32 opt_param_mask,
29 			void *qpc, struct mlx5_core_qp *qp, u32 *ece);
30 int mlx5_core_destroy_qp(struct mlx5_ib_dev *dev, struct mlx5_core_qp *qp);
31 int mlx5_core_destroy_dct(struct mlx5_ib_dev *dev, struct mlx5_core_dct *dct);
32 int mlx5_core_qp_query(struct mlx5_ib_dev *dev, struct mlx5_core_qp *qp,
33 		       u32 *out, int outlen, bool qpc_ext);
34 int mlx5_core_dct_query(struct mlx5_ib_dev *dev, struct mlx5_core_dct *dct,
35 			u32 *out, int outlen);
36 
37 int mlx5_core_set_delay_drop(struct mlx5_ib_dev *dev, u32 timeout_usec);
38 
39 int mlx5_core_destroy_rq_tracked(struct mlx5_ib_dev *dev,
40 				 struct mlx5_core_qp *rq);
41 int mlx5_core_create_sq_tracked(struct mlx5_ib_dev *dev, u32 *in, int inlen,
42 				struct mlx5_core_qp *sq);
43 void mlx5_core_destroy_sq_tracked(struct mlx5_ib_dev *dev,
44 				  struct mlx5_core_qp *sq);
45 
46 int mlx5_core_create_rq_tracked(struct mlx5_ib_dev *dev, u32 *in, int inlen,
47 				struct mlx5_core_qp *rq);
48 
49 struct mlx5_core_rsc_common *mlx5_core_res_hold(struct mlx5_ib_dev *dev,
50 						int res_num,
51 						enum mlx5_res_type res_type);
52 void mlx5_core_res_put(struct mlx5_core_rsc_common *res);
53 
54 int mlx5_core_xrcd_alloc(struct mlx5_ib_dev *dev, u32 *xrcdn);
55 int mlx5_core_xrcd_dealloc(struct mlx5_ib_dev *dev, u32 xrcdn);
56 int mlx5_ib_qp_set_counter(struct ib_qp *qp, struct rdma_counter *counter);
57 int mlx5_ib_qp_event_init(void);
58 void mlx5_ib_qp_event_cleanup(void);
59 #endif /* _MLX5_IB_QP_H */
60