[MTHCA\MT23108\IBAL] change to support TRAP and TRAP_REPRESS
[mirror/winof/.git] / core / al / al_verbs.h
1 /*\r
2  * Copyright (c) 2005 SilverStorm Technologies.  All rights reserved.\r
3  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
4  *\r
5  * This software is available to you under the OpenIB.org BSD license\r
6  * below:\r
7  *\r
8  *     Redistribution and use in source and binary forms, with or\r
9  *     without modification, are permitted provided that the following\r
10  *     conditions are met:\r
11  *\r
12  *      - Redistributions of source code must retain the above\r
13  *        copyright notice, this list of conditions and the following\r
14  *        disclaimer.\r
15  *\r
16  *      - Redistributions in binary form must reproduce the above\r
17  *        copyright notice, this list of conditions and the following\r
18  *        disclaimer in the documentation and/or other materials\r
19  *        provided with the distribution.\r
20  *\r
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
22  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
24  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
25  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
26  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
27  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
28  * SOFTWARE.\r
29  *\r
30  * $Id$\r
31  */\r
32 \r
33 #if !defined(__AL_VERBS_H__)\r
34 #define __AL_VERBS_H__\r
35 \r
36 #include "al_ca.h"\r
37 #include "al_cq.h"\r
38 #include "al_pd.h"\r
39 #include "al_qp.h"\r
40 \r
41 #ifndef CL_KERNEL\r
42 #include "ual_mad.h"\r
43 #include "ual_qp.h"\r
44 #include "ual_mcast.h"\r
45 #endif\r
46 \r
47 #ifdef CL_KERNEL\r
48 \r
49         /* Macros for kernel-mode only */\r
50 #define verbs_create_av(h_pd, p_av_attr, h_av) \\r
51         h_av->obj.p_ci_ca->verbs.create_av( h_pd->h_ci_pd,\\r
52                 p_av_attr, &h_av->h_ci_av, p_umv_buf )\r
53 \r
54 #define verbs_check_av(h_av)    ((h_av)->h_ci_av)\r
55 #define convert_av_handle(h_qp, h_av)   ((h_av)->h_ci_av)\r
56 #define verbs_destroy_av(h_av) \\r
57         h_av->obj.p_ci_ca->verbs.destroy_av( h_av->h_ci_av )\r
58 \r
59 #define verbs_query_av(h_av, p_av_attr, ph_pd) \\r
60         h_av->obj.p_ci_ca->verbs.query_av( h_av->h_ci_av,\\r
61                 p_av_attr, ph_pd, p_umv_buf )\r
62 \r
63 #define verbs_modify_av(h_av, p_av_mod) \\r
64         h_av->obj.p_ci_ca->verbs.modify_av( h_av->h_ci_av, p_av_mod, p_umv_buf )\r
65 \r
66 #define verbs_query_ca(h_ca, p_ca_attr, p_size) \\r
67         h_ca->obj.p_ci_ca->verbs.query_ca( h_ca->obj.p_ci_ca->h_ci_ca,\\r
68                 p_ca_attr, p_size, p_umv_buf )\r
69 \r
70 #define verbs_modify_ca(h_ca, port_num, ca_mod, p_port_attr_mod) \\r
71         h_ca->obj.p_ci_ca->verbs.modify_ca( h_ca->obj.p_ci_ca->h_ci_ca,\\r
72                 port_num, ca_mod, p_port_attr_mod )\r
73 \r
74 static inline ib_api_status_t\r
75 verbs_create_cq(\r
76         IN              const   ib_ca_handle_t                          h_ca,\r
77         IN      OUT                     ib_cq_create_t* const           p_cq_create,\r
78         IN                              ib_cq_handle_t                          h_cq,\r
79         IN      OUT                     ci_umv_buf_t* const                     p_umv_buf )\r
80 {\r
81         return h_ca->obj.p_ci_ca->verbs.create_cq(\r
82                 (p_umv_buf) ? h_ca->h_um_ca : h_ca->obj.p_ci_ca->h_ci_ca,\r
83                 h_cq, &p_cq_create->size, &h_cq->h_ci_cq, p_umv_buf );\r
84 }\r
85 \r
86 #define verbs_check_cq(h_cq)    ((h_cq)->h_ci_cq)\r
87 #define verbs_destroy_cq(h_cq) \\r
88         h_cq->obj.p_ci_ca->verbs.destroy_cq( h_cq->h_ci_cq )\r
89 \r
90 #define verbs_modify_cq(h_cq, p_size) \\r
91         h_cq->obj.p_ci_ca->verbs.resize_cq( h_cq->h_ci_cq, p_size, p_umv_buf )\r
92 \r
93 #define verbs_query_cq(h_cq, p_size) \\r
94         h_cq->obj.p_ci_ca->verbs.query_cq( h_cq->h_ci_cq, p_size, p_umv_buf )\r
95 \r
96 #define verbs_peek_cq(h_cq, p_n_cqes) \\r
97         ( ( h_cq->obj.p_ci_ca->verbs.peek_cq ) ? \\r
98                 h_cq->obj.p_ci_ca->verbs.peek_cq( h_cq->h_ci_cq, p_n_cqes) : \\r
99                 IB_UNSUPPORTED )\r
100 \r
101 #define verbs_poll_cq(h_cq, pp_free_wclist, pp_done_wclist) \\r
102         h_cq->obj.p_ci_ca->verbs.poll_cq( h_cq->h_ci_cq,\\r
103                 pp_free_wclist, pp_done_wclist )\r
104 \r
105 #define verbs_rearm_cq(h_cq, solicited) \\r
106         h_cq->obj.p_ci_ca->verbs.enable_cq_notify( h_cq->h_ci_cq,\\r
107                 solicited )\r
108 \r
109 #define verbs_rearm_n_cq(h_cq, n_cqes) \\r
110         ( ( h_cq->obj.p_ci_ca->verbs.enable_ncomp_cq_notify ) ? \\r
111                 h_cq->obj.p_ci_ca->verbs.enable_ncomp_cq_notify(h_cq->h_ci_cq,n_cqes): \\r
112                 IB_UNSUPPORTED )\r
113 \r
114 #define verbs_register_mr(h_pd, p_mr_create, p_lkey, p_rkey, h_mr) \\r
115         h_mr->obj.p_ci_ca->verbs.register_mr( h_pd->h_ci_pd,\\r
116                 p_mr_create, p_lkey, p_rkey, &h_mr->h_ci_mr, um_call )\r
117 \r
118 #define verbs_register_pmr(h_pd, p_phys_create, p_vaddr,\\r
119                                 p_lkey, p_rkey, h_mr) \\r
120         h_mr->obj.p_ci_ca->verbs.register_pmr( h_pd->h_ci_pd,\\r
121                 p_phys_create, p_vaddr, p_lkey, p_rkey, &h_mr->h_ci_mr, FALSE )\r
122 \r
123 #define verbs_check_mr(h_mr)    ((h_mr)->h_ci_mr)\r
124 #define verbs_check_mlnx_fmr(h_fmr)     ((h_fmr)->h_ci_fmr)\r
125 #define verbs_deregister_mr(h_mr) \\r
126         h_mr->obj.p_ci_ca->verbs.deregister_mr( h_mr->h_ci_mr )\r
127 \r
128 /*\r
129  * Remove this registration from the shmid's list to prevent any\r
130  * new registrations from accessing it once it is deregistered.\r
131  */\r
132 #define verbs_release_shmid(h_mr)       \\r
133         if( h_mr->p_shmid )     \\r
134         {       \\r
135                 cl_spinlock_acquire( &h_mr->p_shmid->obj.lock );        \\r
136                 cl_list_remove_object( &h_mr->p_shmid->mr_list, h_mr ); \\r
137                 cl_spinlock_release( &h_mr->p_shmid->obj.lock );        \\r
138                 release_shmid( h_mr->p_shmid ); \\r
139                 h_mr->p_shmid = NULL;   \\r
140         }\r
141 #define verbs_query_mr(h_mr, p_mr_attr) \\r
142         h_mr->obj.p_ci_ca->verbs.query_mr( h_mr->h_ci_mr, p_mr_attr )\r
143 \r
144 #define verbs_modify_mr(h_mr, mr_modify_mask, p_mr_create, \\r
145         p_lkey, p_rkey, h_pd ) \\r
146                 h_mr->obj.p_ci_ca->verbs.modify_mr( h_mr->h_ci_mr, mr_modify_mask, \\r
147                         p_mr_create, p_lkey, p_rkey, h_pd ? h_pd->h_ci_pd : NULL, \\r
148                         um_call )\r
149 \r
150 #define verbs_modify_pmr(h_mr, mr_modify_mask, p_pmr_create, \\r
151         p_vaddr, p_lkey, p_rkey, h_pd ) \\r
152                 h_mr->obj.p_ci_ca->verbs.modify_pmr( h_mr->h_ci_mr, mr_modify_mask, \\r
153                         p_pmr_create, p_vaddr, p_lkey, p_rkey, \\r
154                         h_pd ? h_pd->h_ci_pd : NULL, FALSE )\r
155 \r
156 #define verbs_register_smr(h_mr, h_pd, access_ctrl, p_vaddr, p_lkey, \\r
157         p_rkey, ph_mr ) \\r
158                 h_mr->obj.p_ci_ca->verbs.register_smr( h_mr->h_ci_mr, h_pd->h_ci_pd,\\r
159                         access_ctrl, p_vaddr, p_lkey, p_rkey, &(ph_mr->h_ci_mr), \\r
160                         um_call )\r
161 \r
162 #define verbs_create_mlnx_fmr(h_pd, p_fmr_create, h_fmr ) \\r
163         h_fmr->obj.p_ci_ca->verbs.alloc_mlnx_fmr( h_pd->h_ci_pd,\\r
164                 p_fmr_create, &h_fmr->h_ci_fmr )\r
165 \r
166 #define verbs_map_phys_mlnx_fmr( h_fmr, plist_addr, list_len, p_vaddr, p_lkey, p_rkey) \\r
167         h_fmr->obj.p_ci_ca->verbs.map_phys_mlnx_fmr( h_fmr->h_ci_fmr,\\r
168                 plist_addr, list_len, p_vaddr, p_lkey, p_rkey )\r
169 \r
170 #define verbs_unmap_mlnx_fmr( h_fmr ) \\r
171         h_fmr->obj.p_ci_ca->verbs.unmap_mlnx_fmr( h_fmr->h_ci_fmr)\r
172 \r
173 #define verbs_destroy_mlnx_fmr( h_fmr ) \\r
174         h_fmr->obj.p_ci_ca->verbs.dealloc_mlnx_fmr( h_fmr->h_ci_fmr )\r
175         \r
176 \r
177 #define verbs_create_mw(h_pd, p_rkey, h_mw) \\r
178         h_mw->obj.p_ci_ca->verbs.create_mw( h_pd->h_ci_pd,\\r
179                 p_rkey, &h_mw->h_ci_mw, p_umv_buf )\r
180 \r
181 #define verbs_check_mw(h_mw)    ((h_mw)->h_ci_mw)\r
182 #define verbs_destroy_mw(h_mw) \\r
183         h_mw->obj.p_ci_ca->verbs.destroy_mw( h_mw->h_ci_mw )\r
184 \r
185 #define verbs_query_mw(h_mw, ph_pd, p_rkey) \\r
186         h_mw->obj.p_ci_ca->verbs.query_mw(\\r
187                 h_mw->h_ci_mw, ph_pd, p_rkey, p_umv_buf )\r
188 \r
189 #define convert_mr_handle(h_mr) ((h_mr)->h_ci_mr)\r
190 \r
191 #define verbs_bind_mw(h_mw, h_qp, p_mw_bind, p_rkey) \\r
192         h_qp->obj.p_ci_ca->verbs.bind_mw( h_mw->h_ci_mw,\\r
193                 h_qp->h_ci_qp, p_mw_bind, p_rkey )\r
194 \r
195 static inline ib_api_status_t\r
196 verbs_allocate_pd(\r
197         IN              const   ib_ca_handle_t                          h_ca,\r
198         IN                              ib_pd_handle_t                          h_pd,\r
199         IN      OUT                     ci_umv_buf_t* const                     p_umv_buf )\r
200 {\r
201         return h_ca->obj.p_ci_ca->verbs.allocate_pd(\r
202                 (p_umv_buf) ? h_ca->h_um_ca : h_ca->obj.p_ci_ca->h_ci_ca,\r
203                 h_pd->type, &h_pd->h_ci_pd, p_umv_buf );\r
204 }\r
205 \r
206 /*\r
207  * Reference the hardware PD.\r
208  */\r
209 static inline ib_api_status_t\r
210 allocate_pd_alias(\r
211         IN              const   ib_ca_handle_t                          h_ca,\r
212         IN              const   ib_pd_handle_t                          h_pd )\r
213 {\r
214         UNUSED_PARAM( h_ca );\r
215         h_pd->h_ci_pd = h_pd->obj.p_ci_ca->h_pd->h_ci_pd;\r
216         ref_al_obj( &h_pd->obj.p_ci_ca->h_pd->obj );\r
217         return IB_SUCCESS;\r
218 }\r
219 \r
220 static inline void\r
221 deallocate_pd_alias(\r
222         IN              const   ib_pd_handle_t                          h_pd )\r
223 {\r
224         deref_al_obj( &h_pd->obj.p_ci_ca->h_pd->obj );\r
225 }\r
226 \r
227 \r
228 \r
229 #define verbs_check_pd(h_pd)    ((h_pd)->h_ci_pd)\r
230 #define verbs_deallocate_pd(h_pd) \\r
231         h_pd->obj.p_ci_ca->verbs.deallocate_pd( h_pd->h_ci_pd )\r
232 \r
233 #define convert_qp_handle( qp_create ) {\\r
234         CL_ASSERT( qp_create.h_rq_cq ); \\r
235         qp_create.h_rq_cq = qp_create.h_rq_cq->h_ci_cq; \\r
236         CL_ASSERT( qp_create.h_sq_cq ); \\r
237         qp_create.h_sq_cq = qp_create.h_sq_cq->h_ci_cq; \\r
238 }\r
239 \r
240 \r
241 static inline ib_api_status_t\r
242 verbs_get_spl_qp(\r
243         IN                              ib_pd_handle_t                          h_pd,\r
244         IN                              uint8_t                                         port_num,\r
245         IN                              ib_qp_handle_t                          h_qp,\r
246         IN                              ib_qp_create_t                          *p_qp_create,\r
247         IN                              ib_qp_attr_t                            *p_qp_attr )\r
248 {\r
249         ib_api_status_t         status;\r
250 \r
251         status = h_qp->obj.p_ci_ca->verbs.create_spl_qp(\r
252                 h_pd->h_ci_pd, port_num, h_qp, p_qp_create,\r
253                 p_qp_attr, &h_qp->h_ci_qp );\r
254 \r
255         h_qp->h_recv_qp = h_qp->h_ci_qp;\r
256         h_qp->h_send_qp = h_qp->h_ci_qp;\r
257 \r
258         h_qp->pfn_post_send = h_qp->obj.p_ci_ca->verbs.post_send;\r
259         h_qp->pfn_post_recv = h_qp->obj.p_ci_ca->verbs.post_recv;\r
260         return status;\r
261 }\r
262 \r
263 \r
264 static inline ib_api_status_t\r
265 verbs_create_qp(\r
266         IN                              ib_pd_handle_t                          h_pd,\r
267         IN                              ib_qp_handle_t                          h_qp,\r
268         IN                              ib_qp_create_t                          *p_qp_create,\r
269         IN                              ib_qp_attr_t                            *p_qp_attr,\r
270         IN      OUT                     ci_umv_buf_t* const                     p_umv_buf )\r
271 {\r
272         ib_api_status_t         status;\r
273 \r
274         status = h_qp->obj.p_ci_ca->verbs.create_qp(\r
275                 h_pd->h_ci_pd, h_qp, p_qp_create, p_qp_attr,\r
276                 &h_qp->h_ci_qp, p_umv_buf );\r
277 \r
278         h_qp->h_recv_qp = h_qp->h_ci_qp;\r
279         h_qp->h_send_qp = h_qp->h_ci_qp;\r
280 \r
281         h_qp->pfn_post_send = h_qp->obj.p_ci_ca->verbs.post_send;\r
282         h_qp->pfn_post_recv = h_qp->obj.p_ci_ca->verbs.post_recv;\r
283         return status;\r
284 }\r
285 \r
286 \r
287 #define verbs_check_qp(h_qp)    ((h_qp)->h_ci_qp)\r
288 #define verbs_destroy_qp(h_qp) \\r
289         h_qp->obj.p_ci_ca->verbs.destroy_qp( h_qp->h_ci_qp, h_qp->timewait )\r
290 \r
291 #define verbs_query_qp(h_qp, p_qp_attr) \\r
292         h_qp->obj.p_ci_ca->verbs.query_qp( h_qp->h_ci_qp,\\r
293                 p_qp_attr, p_umv_buf )\r
294 \r
295 #define verbs_modify_qp(h_qp, p_qp_mod, qp_attr) \\r
296         h_qp->obj.p_ci_ca->verbs.modify_qp( h_qp->h_ci_qp,\\r
297                 p_qp_mod, &qp_attr, p_umv_buf )\r
298 \r
299 #define verbs_post_send(h_qp, p_send_wr, pp_send_failure) \\r
300         h_qp->obj.p_ci_ca->verbs.post_send( h_qp->h_ci_qp,\\r
301                 p_send_wr, pp_send_failure )\r
302 \r
303 #define verbs_post_recv(h_qp, p_recv_wr, pp_recv_failure) \\r
304         h_qp->obj.p_ci_ca->verbs.post_recv( h_qp->h_ci_qp,\\r
305                 p_recv_wr, pp_recv_failure )\r
306 \r
307 #define verbs_local_mad(h_ca, port_num, p_src_av_attr, p_mad_in, p_mad_out) \\r
308         h_ca->obj.p_ci_ca->verbs.local_mad( h_ca->obj.p_ci_ca->h_ci_ca,\\r
309                 port_num, p_src_av_attr, p_mad_in, p_mad_out)\r
310 \r
311 #define check_local_mad(h_qp) \\r
312         (h_qp->obj.p_ci_ca->verbs.local_mad)\r
313 \r
314 #define init_alias_qp( h_qp, h_pd, port_guid, p_qp_create ) \\r
315         init_qp_alias( h_qp, h_pd, port_guid, p_qp_create )\r
316 \r
317 #define spl_qp_mad_send( h_mad_svc, p_mad_element_list, pp_mad_failure ) \\r
318         IB_ERROR\r
319 \r
320 #define spl_qp_cancel_mad( h_mad_svc, h_mad_send ) \\r
321         IB_ERROR\r
322 \r
323 #define create_reg_mad_pool( h_pool, h_pd, p_pool_key ) \\r
324         IB_SUCCESS\r
325 \r
326 #define dereg_destroy_mad_pool( pool_key )\r
327 \r
328 #define verbs_attach_mcast(h_mcast)     \\r
329         h_mcast->obj.p_ci_ca->verbs.attach_mcast(       \\r
330                         ((ib_qp_handle_t)h_mcast->obj.p_parent_obj)->h_ci_qp, &h_mcast->member_rec.mgid,        \\r
331                         h_mcast->member_rec.mlid, &h_mcast->h_ci_mcast, \\r
332                         NULL)\r
333 \r
334 #define verbs_detach_mcast(h_mcast)     \\r
335                 h_mcast->obj.p_ci_ca->verbs.detach_mcast( \\r
336                         h_mcast->h_ci_mcast )\r
337 \r
338 static inline ib_api_status_t\r
339 verbs_ci_call(\r
340         IN                              ib_ca_handle_t                          h_ca,\r
341         IN              const   void* __ptr64 *         const   handle_array    OPTIONAL,\r
342         IN                              uint32_t                                        num_handles,\r
343         IN                              ib_ci_op_t*                     const   p_ci_op,\r
344         IN                              ci_umv_buf_t*           const   p_umv_buf OPTIONAL )\r
345 {\r
346         return h_ca->obj.p_ci_ca->verbs.vendor_call(\r
347                 p_umv_buf ? h_ca->h_um_ca : h_ca->obj.p_ci_ca->h_ci_ca,\r
348                 handle_array, num_handles, p_ci_op, p_umv_buf );\r
349 }\r
350 \r
351 \r
352 #else\r
353 \r
354 \r
355 \r
356         /* Macros for user-mode only */\r
357 #define verbs_create_av(h_pd, p_av_attr, h_av) \\r
358         (h_pd->type == IB_PDT_ALIAS) ?\\r
359         ual_pd_alias_create_av(h_pd, p_av_attr, h_av):\\r
360         ual_create_av(h_pd, p_av_attr, h_av); \\r
361         UNUSED_PARAM( p_umv_buf )\r
362 \r
363 #define verbs_check_av(h_av)    ((h_av)->h_ci_av || (h_av)->obj.hdl)\r
364 #define convert_av_handle(h_qp, h_av) \\r
365         ((h_qp)->h_ci_qp?(h_av)->h_ci_av:(ib_av_handle_t)(h_av)->obj.hdl)\r
366 #define verbs_destroy_av(h_av) \\r
367         ual_destroy_av(h_av)\r
368 \r
369 #define verbs_query_av(h_av, p_av_attr, ph_pd) \\r
370         ual_query_av(h_av, p_av_attr, ph_pd); \\r
371         UNUSED_PARAM( p_umv_buf )\r
372 \r
373 #define verbs_modify_av(h_av, p_av_mod) \\r
374         ual_modify_av(h_av, p_av_mod); \\r
375         UNUSED_PARAM( p_umv_buf )\r
376 \r
377 #define verbs_query_ca(h_ca, p_ca_attr, p_size) \\r
378         ual_query_ca(h_ca, p_ca_attr, p_size); \\r
379         UNUSED_PARAM( p_umv_buf )\r
380 \r
381 #define verbs_modify_ca(h_ca, port_num, ca_mod, p_port_attr_mod) \\r
382         ual_modify_ca(h_ca, port_num, ca_mod, p_port_attr_mod)\r
383 \r
384 static inline ib_api_status_t\r
385 verbs_create_cq(\r
386         IN              const   ib_ca_handle_t                          h_ca,\r
387         IN      OUT                     ib_cq_create_t* const           p_cq_create,\r
388         IN                              ib_cq_handle_t                          h_cq,\r
389         IN      OUT                     ci_umv_buf_t* const                     p_umv_buf )\r
390 {\r
391         UNUSED_PARAM( p_umv_buf );\r
392         return ual_create_cq( h_ca->obj.p_ci_ca, p_cq_create, h_cq );\r
393 }\r
394 \r
395 \r
396 #define verbs_check_cq(h_cq)    ((h_cq)->h_ci_cq || (h_cq)->obj.hdl)\r
397 #define verbs_destroy_cq(h_cq) \\r
398         ual_destroy_cq(h_cq)\r
399 \r
400 #define verbs_modify_cq(h_cq, p_size) \\r
401         ual_modify_cq(h_cq, p_size); \\r
402         UNUSED_PARAM( p_umv_buf )\r
403 \r
404 #define verbs_query_cq(h_cq, p_size) \\r
405         ual_query_cq(h_cq, p_size); \\r
406         UNUSED_PARAM( p_umv_buf )\r
407 \r
408 #define verbs_peek_cq(h_cq, p_n_cqes) \\r
409         h_cq->pfn_peek( h_cq->h_peek_cq, p_n_cqes )\r
410 \r
411 #define verbs_poll_cq(h_cq, pp_free_wclist, pp_done_wclist) \\r
412         h_cq->pfn_poll( h_cq->h_poll_cq, pp_free_wclist, pp_done_wclist )\r
413 \r
414 #define verbs_rearm_cq(h_cq, solicited) \\r
415         h_cq->pfn_rearm( h_cq->h_rearm_cq, solicited )\r
416 \r
417 #define verbs_rearm_n_cq(h_cq, n_cqes) \\r
418         h_cq->pfn_rearm_n( h_cq->h_rearm_n_cq, n_cqes )\r
419 \r
420 #define verbs_register_mr(h_pd, p_mr_create, p_lkey, p_rkey, h_mr) \\r
421         ual_reg_mem(h_pd, p_mr_create, p_lkey, p_rkey, h_mr); \\r
422         UNUSED_PARAM( um_call )\r
423 \r
424 #define verbs_register_pmr(h_pd, p_phys_create, p_vaddr, p_lkey, p_rkey, h_mr) \\r
425         IB_UNSUPPORTED; \\r
426         UNUSED_PARAM( h_pd ); \\r
427         UNUSED_PARAM( p_phys_create ); \\r
428         UNUSED_PARAM( p_vaddr ); \\r
429         UNUSED_PARAM( p_lkey ); \\r
430         UNUSED_PARAM( p_rkey ); \\r
431         UNUSED_PARAM( h_mr )\r
432 \r
433 #define verbs_check_mr(h_mr)    ((h_mr)->h_ci_mr || (h_mr)->obj.hdl)\r
434 #define verbs_deregister_mr(h_mr) \\r
435         ual_dereg_mr(h_mr)\r
436 \r
437 /* For user-mode, this is nop */\r
438 #define verbs_release_shmid(h_mr)\r
439 \r
440 #define verbs_query_mr(h_mr, p_mr_attr) \\r
441         ual_query_mr(h_mr, p_mr_attr)\r
442 \r
443 #define verbs_modify_mr(h_mr, mr_modify_mask, p_mr_create, \\r
444         p_lkey, p_rkey, h_pd ) \\r
445                 ual_modify_mr( h_mr, mr_modify_mask, p_mr_create, \\r
446                         p_lkey, p_rkey, h_pd ); \\r
447                 UNUSED_PARAM( um_call )\r
448 \r
449 #define verbs_modify_pmr( h_mr, mr_mod_mask, p_phys_create, \\r
450         p_vaddr, p_lkey, p_rkey, h_pd ) \\r
451                 IB_UNSUPPORTED; \\r
452                 UNUSED_PARAM( h_mr ); \\r
453                 UNUSED_PARAM( mr_mod_mask ); \\r
454                 UNUSED_PARAM( p_phys_create ); \\r
455                 UNUSED_PARAM( p_vaddr ); \\r
456                 UNUSED_PARAM( p_lkey ); \\r
457                 UNUSED_PARAM( p_rkey ); \\r
458                 UNUSED_PARAM( h_pd )\r
459 \r
460 #define verbs_register_smr(h_mr, h_pd, access_ctrl, p_vaddr, p_lkey, \\r
461         p_rkey, ph_mr ) \\r
462                 ual_reg_shared( h_mr, h_pd, access_ctrl, p_vaddr, p_lkey, \\r
463                         p_rkey, ph_mr ); \\r
464                 UNUSED_PARAM( um_call )\r
465 \r
466 #define verbs_create_mw(h_pd, p_rkey, h_mw) \\r
467         ual_create_mw(h_pd, p_rkey, h_mw); \\r
468         UNUSED_PARAM( p_umv_buf )\r
469 \r
470 #define verbs_check_mw(h_mw)    ((h_mw)->h_ci_mw || (h_mw)->obj.hdl)\r
471 #define verbs_destroy_mw(h_mw) \\r
472         ual_destroy_mw(h_mw)\r
473 \r
474 #define verbs_query_mw(h_mw, ph_pd, p_rkey) \\r
475         ual_query_mw(h_mw, ph_pd, p_rkey); \\r
476         UNUSED_PARAM( p_umv_buf )\r
477 \r
478 #define convert_mr_handle(h_mr) (h_mr)\r
479 \r
480 #define verbs_bind_mw(h_mw, h_qp, p_mw_bind, p_rkey) \\r
481         ual_bind_mw(h_mw, h_qp, p_mw_bind, p_rkey)\r
482 \r
483 static inline ib_api_status_t\r
484 verbs_allocate_pd(\r
485         IN              const   ib_ca_handle_t                          h_ca,\r
486         IN                              ib_pd_handle_t                          h_pd,\r
487         IN      OUT                     ci_umv_buf_t* const                     p_umv_buf )\r
488 {\r
489         UNUSED_PARAM( p_umv_buf );\r
490         return ual_allocate_pd( h_ca, h_pd->type, h_pd );\r
491 }\r
492 \r
493 /*\r
494  * Get an alias to the kernel's hardware PD.\r
495  */\r
496 static inline ib_api_status_t\r
497 allocate_pd_alias(\r
498         IN              const   ib_ca_handle_t                          h_ca,\r
499         IN              const   ib_pd_handle_t                          h_pd )\r
500 {\r
501         return ual_allocate_pd( h_ca, h_pd->type, h_pd );\r
502 }\r
503 \r
504 #define deallocate_pd_alias( h_pd ) /* no action to take */\r
505 \r
506 #define verbs_check_pd(h_pd)    ((h_pd)->h_ci_pd || (h_pd)->obj.hdl)\r
507 #define verbs_deallocate_pd(h_pd) \\r
508         ual_deallocate_pd(h_pd)\r
509 \r
510 /* For user-mode, handle conversion is done in ual files */\r
511 \r
512 #define convert_qp_handle( qp_create )\r
513 \r
514 /* TBD: Do we need to support this in user-mode? */\r
515 #define verbs_get_spl_qp(h_pd, port_num, h_qp, p_qp_create, p_qp_attr) \\r
516                 IB_UNSUPPORTED\r
517 \r
518 #define verbs_create_qp(h_pd, h_qp, p_qp_create, p_qp_attr, p_umv_buf) \\r
519         ual_create_qp (h_pd, h_qp, p_qp_create, p_qp_attr); \\r
520         UNUSED_PARAM( p_umv_buf )\r
521 \r
522 #define verbs_check_qp(h_qp)    ((h_qp)->h_ci_qp || (h_qp)->obj.hdl)\r
523 #define verbs_destroy_qp(h_qp) \\r
524         ual_destroy_qp(h_qp)\r
525 \r
526 #define verbs_query_qp(h_qp, p_qp_attr) \\r
527         ual_query_qp(h_qp, p_qp_attr); \\r
528         UNUSED_PARAM( p_umv_buf );\r
529 \r
530 #define verbs_modify_qp(h_qp, p_qp_mod, qp_attr) \\r
531         ual_modify_qp(h_qp, p_qp_mod, &qp_attr); \\r
532         UNUSED_PARAM( p_umv_buf );\r
533 \r
534 #define verbs_post_send(h_qp, p_send_wr, pp_send_failure) \\r
535         ual_post_send(h_qp, p_send_wr, pp_send_failure)\r
536 \r
537 #define verbs_post_recv(h_qp, p_recv_wr, pp_recv_failure) \\r
538         ual_post_recv(h_qp, p_recv_wr, pp_recv_failure)\r
539 \r
540 static inline ib_api_status_t\r
541 verbs_local_mad(\r
542         IN              const   ib_ca_handle_t                          h_ca,\r
543         IN              const   uint8_t                                         port_num,\r
544         IN              const   ib_av_attr_t*                                   p_src_av_attr,\r
545         IN              const   void* const                                     p_mad_in,\r
546         IN                              void*                                           p_mad_out )\r
547 {\r
548         return ual_local_mad( h_ca, port_num, p_mad_in, p_mad_out );\r
549         UNUSED_PARAM( p_src_av_attr );\r
550 }\r
551 \r
552 #define check_local_mad(h_qp) \\r
553         (!h_qp)\r
554 \r
555 #define init_alias_qp( h_qp, h_pd, port_guid, p_qp_create ) \\r
556         ual_init_qp_alias( h_qp, h_pd, port_guid, p_qp_create )\r
557 \r
558 #define spl_qp_mad_send( h_mad_svc, p_mad_element_list, pp_mad_failure ) \\r
559         ual_spl_qp_mad_send( h_mad_svc, p_mad_element_list, pp_mad_failure )\r
560 \r
561 #define spl_qp_cancel_mad( h_mad_svc, p_mad_element ) \\r
562         ual_spl_qp_cancel_mad( h_mad_svc, p_mad_element )\r
563 \r
564 #define create_reg_mad_pool( h_pool, h_pd, p_pool_key ) \\r
565         ual_create_reg_mad_pool( h_pool, h_pd, p_pool_key )\r
566 \r
567 #define dereg_destroy_mad_pool( pool_key ) \\r
568         ual_dereg_destroy_mad_pool( pool_key )\r
569 \r
570 #define verbs_attach_mcast(h_mcast)     \\r
571         ual_attach_mcast( h_mcast )\r
572 \r
573 #define verbs_detach_mcast(h_mcast)     \\r
574         ual_detach_mcast( h_mcast )\r
575 \r
576 #endif  /* CL_KERNEL */\r
577 \r
578 \r
579 #endif /* __AL_VERBS_H__ */\r