xref: /linux/drivers/infiniband/hw/mlx5/qp.h (revision cdd5b5a9761fd66d17586e4f4ba6588c70e640ea)
1333fbaa0SLeon Romanovsky /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2333fbaa0SLeon Romanovsky /*
3333fbaa0SLeon Romanovsky  * Copyright (c) 2013-2020, Mellanox Technologies inc. All rights reserved.
4333fbaa0SLeon Romanovsky  */
5333fbaa0SLeon Romanovsky 
6333fbaa0SLeon Romanovsky #ifndef _MLX5_IB_QP_H
7333fbaa0SLeon Romanovsky #define _MLX5_IB_QP_H
8333fbaa0SLeon Romanovsky 
92ecfd946SLeon Romanovsky struct mlx5_ib_dev;
102ecfd946SLeon Romanovsky 
112ecfd946SLeon Romanovsky struct mlx5_qp_table {
122ecfd946SLeon Romanovsky 	struct notifier_block nb;
13*afff2489SPatrisious Haddad 	struct xarray dct_xa;
142ecfd946SLeon Romanovsky 
152ecfd946SLeon Romanovsky 	/* protect radix tree
162ecfd946SLeon Romanovsky 	 */
172ecfd946SLeon Romanovsky 	spinlock_t lock;
182ecfd946SLeon Romanovsky 	struct radix_tree_root tree;
192ecfd946SLeon Romanovsky };
20333fbaa0SLeon Romanovsky 
21333fbaa0SLeon Romanovsky int mlx5_init_qp_table(struct mlx5_ib_dev *dev);
22333fbaa0SLeon Romanovsky void mlx5_cleanup_qp_table(struct mlx5_ib_dev *dev);
23333fbaa0SLeon Romanovsky 
24333fbaa0SLeon Romanovsky int mlx5_core_create_dct(struct mlx5_ib_dev *dev, struct mlx5_core_dct *qp,
25333fbaa0SLeon Romanovsky 			 u32 *in, int inlen, u32 *out, int outlen);
263e09a427SLeon Romanovsky int mlx5_qpc_create_qp(struct mlx5_ib_dev *dev, struct mlx5_core_qp *qp,
273e09a427SLeon Romanovsky 		       u32 *in, int inlen, u32 *out);
28333fbaa0SLeon Romanovsky int mlx5_core_qp_modify(struct mlx5_ib_dev *dev, u16 opcode, u32 opt_param_mask,
295f62a521SLeon Romanovsky 			void *qpc, struct mlx5_core_qp *qp, u32 *ece);
30333fbaa0SLeon Romanovsky int mlx5_core_destroy_qp(struct mlx5_ib_dev *dev, struct mlx5_core_qp *qp);
31333fbaa0SLeon Romanovsky int mlx5_core_destroy_dct(struct mlx5_ib_dev *dev, struct mlx5_core_dct *dct);
32333fbaa0SLeon Romanovsky int mlx5_core_qp_query(struct mlx5_ib_dev *dev, struct mlx5_core_qp *qp,
338067fd8bSPatrisious Haddad 		       u32 *out, int outlen, bool qpc_ext);
34333fbaa0SLeon Romanovsky int mlx5_core_dct_query(struct mlx5_ib_dev *dev, struct mlx5_core_dct *dct,
35333fbaa0SLeon Romanovsky 			u32 *out, int outlen);
36333fbaa0SLeon Romanovsky 
37333fbaa0SLeon Romanovsky int mlx5_core_set_delay_drop(struct mlx5_ib_dev *dev, u32 timeout_usec);
38333fbaa0SLeon Romanovsky 
39add53535SLeon Romanovsky int mlx5_core_destroy_rq_tracked(struct mlx5_ib_dev *dev,
40333fbaa0SLeon Romanovsky 				 struct mlx5_core_qp *rq);
41333fbaa0SLeon Romanovsky int mlx5_core_create_sq_tracked(struct mlx5_ib_dev *dev, u32 *in, int inlen,
42333fbaa0SLeon Romanovsky 				struct mlx5_core_qp *sq);
43333fbaa0SLeon Romanovsky void mlx5_core_destroy_sq_tracked(struct mlx5_ib_dev *dev,
44333fbaa0SLeon Romanovsky 				  struct mlx5_core_qp *sq);
45333fbaa0SLeon Romanovsky 
46333fbaa0SLeon Romanovsky int mlx5_core_create_rq_tracked(struct mlx5_ib_dev *dev, u32 *in, int inlen,
47333fbaa0SLeon Romanovsky 				struct mlx5_core_qp *rq);
48333fbaa0SLeon Romanovsky 
49333fbaa0SLeon Romanovsky struct mlx5_core_rsc_common *mlx5_core_res_hold(struct mlx5_ib_dev *dev,
50333fbaa0SLeon Romanovsky 						int res_num,
51333fbaa0SLeon Romanovsky 						enum mlx5_res_type res_type);
52333fbaa0SLeon Romanovsky void mlx5_core_res_put(struct mlx5_core_rsc_common *res);
53333fbaa0SLeon Romanovsky 
54333fbaa0SLeon Romanovsky int mlx5_core_xrcd_alloc(struct mlx5_ib_dev *dev, u32 *xrcdn);
55333fbaa0SLeon Romanovsky int mlx5_core_xrcd_dealloc(struct mlx5_ib_dev *dev, u32 xrcdn);
5664825827SLeon Romanovsky int mlx5_ib_qp_set_counter(struct ib_qp *qp, struct rdma_counter *counter);
57312b8f79SMark Zhang int mlx5_ib_qp_event_init(void);
58312b8f79SMark Zhang void mlx5_ib_qp_event_cleanup(void);
59333fbaa0SLeon Romanovsky #endif /* _MLX5_IB_QP_H */
60