xref: /freebsd/sys/dev/qlnx/qlnxr/qlnxr_verbs.h (revision 8c784bb8cf36911b828652f0bf7e88f443abec50)
1 /*
2  * Copyright (c) 2018-2019 Cavium, Inc.
3  * All rights reserved.
4  *
5  *  Redistribution and use in source and binary forms, with or without
6  *  modification, are permitted provided that the following conditions
7  *  are met:
8  *
9  *  1. Redistributions of source code must retain the above copyright
10  *     notice, this list of conditions and the following disclaimer.
11  *  2. Redistributions in binary form must reproduce the above copyright
12  *     notice, this list of conditions and the following disclaimer in the
13  *     documentation and/or other materials provided with the distribution.
14  *
15  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25  *  POSSIBILITY OF SUCH DAMAGE.
26  *
27  * $FreeBSD$
28  */
29 
30 #ifndef __QLNXR_VERBS_H__
31 #define __QLNXR_VERBS_H__
32 
33 extern int qlnxr_iw_query_gid(struct ib_device *,
34 			uint8_t port,
35 			int index,
36 			union ib_gid *gid);
37 
38 extern int qlnxr_query_gid(struct ib_device *,
39 			u8 port,
40 			int index,
41 			union ib_gid *gid);
42 
43 extern int qlnxr_create_srq(struct ib_srq *ibsrq,
44 			struct ib_srq_init_attr *,
45 			struct ib_udata *);
46 
47 extern void qlnxr_destroy_srq(struct ib_srq *,
48 			struct ib_udata *);
49 
50 extern int qlnxr_modify_srq(struct ib_srq *,
51 			struct ib_srq_attr *,
52 			enum ib_srq_attr_mask,
53 			struct ib_udata *);
54 
55 extern int qlnxr_query_srq(struct ib_srq *,
56 			struct ib_srq_attr *);
57 
58 extern int qlnxr_post_srq_recv(struct ib_srq *,
59 			const struct ib_recv_wr *,
60 			const struct ib_recv_wr **bad_recv_wr);
61 
62 extern int qlnxr_query_device(struct ib_device *, struct ib_device_attr *,
63 		struct ib_udata *);
64 extern int qlnxr_get_port_immutable(struct ib_device *ibdev, u8 port_num,
65 		struct ib_port_immutable *immutable);
66 
67 extern int qlnxr_query_port(struct ib_device *,
68 			u8 port,
69 			struct ib_port_attr *props);
70 
71 extern int qlnxr_modify_port(struct ib_device *,
72 			u8 port,
73 			int mask,
74 			struct ib_port_modify *props);
75 
76 extern enum rdma_link_layer qlnxr_link_layer(struct ib_device *device,
77 			uint8_t port_num);
78 
79 extern int qlnxr_alloc_pd(struct ib_pd *ibpd, struct ib_udata *);
80 
81 extern void qlnxr_dealloc_pd(struct ib_pd *pd, struct ib_udata *udata);
82 
83 extern int qlnxr_create_cq(struct ib_cq *ibcq,
84 		   const struct ib_cq_init_attr *attr,
85 		   struct ib_udata *udata);
86 
87 extern void qlnxr_destroy_cq(struct ib_cq *, struct ib_udata *);
88 
89 extern int qlnxr_resize_cq(struct ib_cq *,
90 			int cqe,
91 			struct ib_udata *);
92 
93 extern int qlnxr_poll_cq(struct ib_cq *,
94 			int num_entries,
95 			struct ib_wc *wc);
96 
97 extern struct ib_qp *qlnxr_create_qp(struct ib_pd *,
98 		       struct ib_qp_init_attr *attrs,
99 		       struct ib_udata *);
100 
101 extern int qlnxr_modify_qp(struct ib_qp *,
102 			struct ib_qp_attr *attr,
103 			int attr_mask,
104 			struct ib_udata *udata);
105 
106 extern int qlnxr_query_qp(struct ib_qp *,
107 			struct ib_qp_attr *qp_attr,
108 			int qp_attr_mask,
109 			struct ib_qp_init_attr *);
110 
111 extern int qlnxr_destroy_qp(struct ib_qp *, struct ib_udata *);
112 
113 extern int qlnxr_query_pkey(struct ib_device *,
114 			u8 port,
115 			u16 index,
116 			u16 *pkey);
117 
118 extern int qlnxr_create_ah(struct ib_ah *ibah,
119 			struct ib_ah_attr *attr, u32 flags,
120 			struct ib_udata *udata);
121 extern void qlnxr_destroy_ah(struct ib_ah *ibah, u32 flags);
122 
123 extern int qlnxr_query_ah(struct ib_ah *ibah,
124 			struct ib_ah_attr *attr);
125 
126 extern int qlnxr_modify_ah(struct ib_ah *ibah,
127 			struct ib_ah_attr *attr);
128 
129 extern int qlnxr_process_mad(struct ib_device *ibdev,
130 			int process_mad_flags,
131 			u8 port_num,
132 			const struct ib_wc *in_wc,
133 			const struct ib_grh *in_grh,
134 			const struct ib_mad_hdr *mad_hdr,
135 			size_t in_mad_size,
136 			struct ib_mad_hdr *out_mad,
137 			size_t *out_mad_size,
138 			u16 *out_mad_pkey_index);
139 
140 extern int qlnxr_post_send(struct ib_qp *,
141 			const struct ib_send_wr *,
142 			const struct ib_send_wr **bad_wr);
143 
144 extern int qlnxr_post_recv(struct ib_qp *,
145 			const struct ib_recv_wr *,
146 			const struct ib_recv_wr **bad_wr);
147 
148 extern int qlnxr_arm_cq(struct ib_cq *,
149 			enum ib_cq_notify_flags flags);
150 
151 extern struct ib_mr *qlnxr_get_dma_mr(struct ib_pd *,
152 			int acc);
153 
154 extern int qlnxr_dereg_mr(struct ib_mr *, struct ib_udata *);
155 
156 extern struct ib_mr *qlnxr_reg_user_mr(struct ib_pd *,
157 			u64 start,
158 			u64 length,
159 			u64 virt,
160 			int acc,
161 			struct ib_udata *);
162 
163 extern struct ib_mr *qlnxr_alloc_mr(struct ib_pd *pd,
164 			enum ib_mr_type mr_type, u32 max_num_sg,
165 			struct ib_udata *udata);
166 
167 extern int qlnxr_map_mr_sg(struct ib_mr *mr, struct scatterlist *sg,
168 			int sg_nents, unsigned int *sg_offset);
169 
170 extern int qlnxr_alloc_ucontext(struct ib_ucontext *uctx,
171 				struct ib_udata *udata);
172 
173 extern void qlnxr_dealloc_ucontext(struct ib_ucontext *ibctx);
174 
175 extern int qlnxr_mmap(struct ib_ucontext *, struct vm_area_struct *vma);
176 
177 extern int qlnxr_iw_connect(struct iw_cm_id *cm_id,
178 		    struct iw_cm_conn_param *conn_param);
179 
180 extern int qlnxr_iw_create_listen(struct iw_cm_id *cm_id, int backlog);
181 
182 void qlnxr_iw_destroy_listen(struct iw_cm_id *cm_id);
183 
184 extern int qlnxr_iw_accept(struct iw_cm_id *cm_id,
185 		      struct iw_cm_conn_param *conn_param);
186 
187 extern int qlnxr_iw_reject(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len);
188 
189 extern void qlnxr_iw_qp_add_ref(struct ib_qp *qp);
190 
191 extern void qlnxr_iw_qp_rem_ref(struct ib_qp *qp);
192 
193 extern struct ib_qp *qlnxr_iw_get_qp(struct ib_device *dev, int qpn);
194 
195 #endif /* #ifndef __QLNXR_VERBS_H__ */
196