ab57183f6f47132d9bd326cac25cc1d5df0e3927
[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_pd.h"\r
38 #include "al_qp.h"\r
39 \r
40 #ifndef CL_KERNEL\r
41 #include "ual_mad.h"\r
42 #include "ual_qp.h"\r
43 #include "ual_mcast.h"\r
44 #endif\r
45 \r
46 #ifdef CL_KERNEL\r
47 \r
48         /* Macros for kernel-mode only */\r
49 #define verbs_create_av(h_pd, p_av_attr, h_av) \\r
50         h_av->obj.p_ci_ca->verbs.create_av( h_pd->h_ci_pd,\\r
51                 p_av_attr, &h_av->h_ci_av, p_umv_buf )\r
52 \r
53 #define verbs_check_av(h_av)    ((h_av)->h_ci_av)\r
54 #define convert_av_handle(h_qp, h_av)   ((h_av)->h_ci_av)\r
55 #define verbs_destroy_av(h_av) \\r
56         h_av->obj.p_ci_ca->verbs.destroy_av( h_av->h_ci_av )\r
57 \r
58 #define verbs_query_av(h_av, p_av_attr, ph_pd) \\r
59         h_av->obj.p_ci_ca->verbs.query_av( h_av->h_ci_av,\\r
60                 p_av_attr, ph_pd, p_umv_buf )\r
61 \r
62 #define verbs_modify_av(h_av, p_av_mod) \\r
63         h_av->obj.p_ci_ca->verbs.modify_av( h_av->h_ci_av, p_av_mod, p_umv_buf )\r
64 \r
65 #define verbs_query_ca(h_ca, p_ca_attr, p_size) \\r
66         h_ca->obj.p_ci_ca->verbs.query_ca( h_ca->obj.p_ci_ca->h_ci_ca,\\r
67                 p_ca_attr, p_size, p_umv_buf )\r
68 \r
69 #define verbs_modify_ca(h_ca, port_num, ca_mod, p_port_attr_mod) \\r
70         h_ca->obj.p_ci_ca->verbs.modify_ca( h_ca->obj.p_ci_ca->h_ci_ca,\\r
71                 port_num, ca_mod, p_port_attr_mod )\r
72 \r
73 #define verbs_create_cq(h_ca, p_cq_create, h_cq) \\r
74         h_ca->obj.p_ci_ca->verbs.create_cq( h_ca->obj.p_ci_ca->h_ci_ca,\\r
75         h_cq, &p_cq_create->size, &h_cq->h_ci_cq, p_umv_buf )\r
76 \r
77 #define verbs_check_cq(h_cq)    ((h_cq)->h_ci_cq)\r
78 #define verbs_destroy_cq(h_cq) \\r
79         h_cq->obj.p_ci_ca->verbs.destroy_cq( h_cq->h_ci_cq )\r
80 \r
81 #define verbs_modify_cq(h_cq, p_size) \\r
82         h_cq->obj.p_ci_ca->verbs.resize_cq( h_cq->h_ci_cq, p_size, p_umv_buf )\r
83 \r
84 #define verbs_query_cq(h_cq, p_size) \\r
85         h_cq->obj.p_ci_ca->verbs.query_cq( h_cq->h_ci_cq, p_size, p_umv_buf )\r
86 \r
87 #define verbs_peek_cq(h_cq, p_n_cqes) \\r
88         ( ( h_cq->obj.p_ci_ca->verbs.peek_cq ) ? \\r
89                 h_cq->obj.p_ci_ca->verbs.peek_cq( h_cq->h_ci_cq, p_n_cqes) : \\r
90                 IB_UNSUPPORTED )\r
91 \r
92 #define verbs_poll_cq(h_cq, pp_free_wclist, pp_done_wclist) \\r
93         h_cq->obj.p_ci_ca->verbs.poll_cq( h_cq->h_ci_cq,\\r
94                 pp_free_wclist, pp_done_wclist )\r
95 \r
96 #define verbs_rearm_cq(h_cq, solicited) \\r
97         h_cq->obj.p_ci_ca->verbs.enable_cq_notify( h_cq->h_ci_cq,\\r
98                 solicited )\r
99 \r
100 #define verbs_rearm_n_cq(h_cq, n_cqes) \\r
101         ( ( h_cq->obj.p_ci_ca->verbs.enable_ncomp_cq_notify ) ? \\r
102                 h_cq->obj.p_ci_ca->verbs.enable_ncomp_cq_notify(h_cq->h_ci_cq,n_cqes): \\r
103                 IB_UNSUPPORTED )\r
104 \r
105 #define verbs_register_mr(h_pd, p_mr_create, p_lkey, p_rkey, h_mr) \\r
106         h_mr->obj.p_ci_ca->verbs.register_mr( h_pd->h_ci_pd,\\r
107                 p_mr_create, p_lkey, p_rkey, &h_mr->h_ci_mr, um_call )\r
108 \r
109 #define verbs_register_pmr(h_pd, p_phys_create, p_vaddr,\\r
110                                 p_lkey, p_rkey, h_mr) \\r
111         h_mr->obj.p_ci_ca->verbs.register_pmr( h_pd->h_ci_pd,\\r
112                 p_phys_create, p_vaddr, p_lkey, p_rkey, &h_mr->h_ci_mr,\\r
113                 um_call )\r
114 \r
115 #define verbs_check_mr(h_mr)    ((h_mr)->h_ci_mr)\r
116 #define verbs_deregister_mr(h_mr) \\r
117         h_mr->obj.p_ci_ca->verbs.deregister_mr( h_mr->h_ci_mr )\r
118 \r
119 /*\r
120  * Remove this registration from the shmid's list to prevent any\r
121  * new registrations from accessing it once it is deregistered.\r
122  */\r
123 #define verbs_release_shmid(h_mr)       \\r
124         if( h_mr->p_shmid )     \\r
125         {       \\r
126                 cl_spinlock_acquire( &h_mr->p_shmid->obj.lock );        \\r
127                 cl_list_remove_object( &h_mr->p_shmid->mr_list, h_mr ); \\r
128                 cl_spinlock_release( &h_mr->p_shmid->obj.lock );        \\r
129                 release_shmid( h_mr->p_shmid ); \\r
130                 h_mr->p_shmid = NULL;   \\r
131         }\r
132 #define verbs_query_mr(h_mr, p_mr_attr) \\r
133         h_mr->obj.p_ci_ca->verbs.query_mr( h_mr->h_ci_mr, p_mr_attr )\r
134 \r
135 #define verbs_modify_mr(h_mr, mr_modify_mask, p_mr_create, \\r
136         p_lkey, p_rkey, h_pd ) \\r
137                 h_mr->obj.p_ci_ca->verbs.modify_mr( h_mr->h_ci_mr, mr_modify_mask, \\r
138                         p_mr_create, p_lkey, p_rkey, h_pd ? h_pd->h_ci_pd : NULL, \\r
139                         um_call )\r
140 \r
141 #define verbs_modify_pmr(h_mr, mr_modify_mask, p_pmr_create, \\r
142         p_vaddr, p_lkey, p_rkey, h_pd ) \\r
143                 h_mr->obj.p_ci_ca->verbs.modify_pmr( h_mr->h_ci_mr, mr_modify_mask, \\r
144                         p_pmr_create, p_vaddr, p_lkey, p_rkey, \\r
145                         h_pd ? h_pd->h_ci_pd : NULL, um_call )\r
146 \r
147 #define verbs_register_smr(h_mr, h_pd, access_ctrl, p_vaddr, p_lkey, \\r
148         p_rkey, ph_mr ) \\r
149                 h_mr->obj.p_ci_ca->verbs.register_smr( h_mr->h_ci_mr, h_pd->h_ci_pd,\\r
150                         access_ctrl, p_vaddr, p_lkey, p_rkey, &(ph_mr->h_ci_mr), \\r
151                         um_call )\r
152 \r
153 #define verbs_create_mw(h_pd, p_rkey, h_mw) \\r
154         h_mw->obj.p_ci_ca->verbs.create_mw( h_pd->h_ci_pd,\\r
155                 p_rkey, &h_mw->h_ci_mw, p_umv_buf )\r
156 \r
157 #define verbs_check_mw(h_mw)    ((h_mw)->h_ci_mw)\r
158 #define verbs_destroy_mw(h_mw) \\r
159         h_mw->obj.p_ci_ca->verbs.destroy_mw( h_mw->h_ci_mw )\r
160 \r
161 #define verbs_query_mw(h_mw, ph_pd, p_rkey) \\r
162         h_mw->obj.p_ci_ca->verbs.query_mw(\\r
163                 h_mw->h_ci_mw, ph_pd, p_rkey, p_umv_buf )\r
164 \r
165 #define convert_mr_handle(h_mr) ((h_mr)->h_ci_mr)\r
166 \r
167 #define verbs_bind_mw(h_mw, h_qp, p_mw_bind, p_rkey) \\r
168         h_qp->obj.p_ci_ca->verbs.bind_mw( h_mw->h_ci_mw,\\r
169                 h_qp->h_ci_qp, p_mw_bind, p_rkey )\r
170 \r
171 #define verbs_allocate_pd(h_ca, h_pd) \\r
172         h_ca->obj.p_ci_ca->verbs.allocate_pd(\\r
173                                 h_ca->obj.p_ci_ca->h_ci_ca, h_pd->type, &h_pd->h_ci_pd, p_umv_buf )\r
174 \r
175 /*\r
176  * Reference the hardware PD.\r
177  */\r
178 static inline ib_api_status_t\r
179 allocate_pd_alias(\r
180         IN              const   ib_ca_handle_t                          h_ca,\r
181         IN              const   ib_pd_handle_t                          h_pd )\r
182 {\r
183         UNUSED_PARAM( h_ca );\r
184         h_pd->h_ci_pd = h_pd->obj.p_ci_ca->h_pd->h_ci_pd;\r
185         ref_al_obj( &h_pd->obj.p_ci_ca->h_pd->obj );\r
186         return IB_SUCCESS;\r
187 }\r
188 \r
189 static inline void\r
190 deallocate_pd_alias(\r
191         IN              const   ib_pd_handle_t                          h_pd )\r
192 {\r
193         deref_al_obj( &h_pd->obj.p_ci_ca->h_pd->obj );\r
194 }\r
195 \r
196 \r
197 \r
198 #define verbs_check_pd(h_pd)    ((h_pd)->h_ci_pd)\r
199 #define verbs_deallocate_pd(h_pd) \\r
200         h_pd->obj.p_ci_ca->verbs.deallocate_pd( h_pd->h_ci_pd )\r
201 \r
202 #define convert_qp_handle( qp_create ) {\\r
203         CL_ASSERT( qp_create.h_rq_cq ); \\r
204         qp_create.h_rq_cq = qp_create.h_rq_cq->h_ci_cq; \\r
205         CL_ASSERT( qp_create.h_sq_cq ); \\r
206         qp_create.h_sq_cq = qp_create.h_sq_cq->h_ci_cq; \\r
207 }\r
208 \r
209 \r
210 static inline ib_api_status_t\r
211 verbs_get_spl_qp(\r
212         IN                              ib_pd_handle_t                          h_pd,\r
213         IN                              uint8_t                                         port_num,\r
214         IN                              ib_qp_handle_t                          h_qp,\r
215         IN                              ib_qp_create_t                          *p_qp_create,\r
216         IN                              ib_qp_attr_t                            *p_qp_attr )\r
217 {\r
218         ib_api_status_t         status;\r
219 \r
220         status = h_qp->obj.p_ci_ca->verbs.create_spl_qp(\r
221                 h_pd->h_ci_pd, port_num, h_qp, p_qp_create,\r
222                 p_qp_attr, &h_qp->h_ci_qp );\r
223 \r
224         h_qp->h_recv_qp = h_qp->h_ci_qp;\r
225         h_qp->h_send_qp = h_qp->h_ci_qp;\r
226 \r
227         h_qp->pfn_post_send = h_qp->obj.p_ci_ca->verbs.post_send;\r
228         h_qp->pfn_post_recv = h_qp->obj.p_ci_ca->verbs.post_recv;\r
229         return status;\r
230 }\r
231 \r
232 \r
233 static inline ib_api_status_t\r
234 verbs_create_qp(\r
235         IN                              ib_pd_handle_t                          h_pd,\r
236         IN                              ib_qp_handle_t                          h_qp,\r
237         IN                              ib_qp_create_t                          *p_qp_create,\r
238         IN                              ib_qp_attr_t                            *p_qp_attr,\r
239         IN      OUT                     ci_umv_buf_t* const                     p_umv_buf )\r
240 {\r
241         ib_api_status_t         status;\r
242 \r
243         status = h_qp->obj.p_ci_ca->verbs.create_qp(\r
244                 h_pd->h_ci_pd, h_qp, p_qp_create, p_qp_attr,\r
245                 &h_qp->h_ci_qp, p_umv_buf );\r
246 \r
247         h_qp->h_recv_qp = h_qp->h_ci_qp;\r
248         h_qp->h_send_qp = h_qp->h_ci_qp;\r
249 \r
250         h_qp->pfn_post_send = h_qp->obj.p_ci_ca->verbs.post_send;\r
251         h_qp->pfn_post_recv = h_qp->obj.p_ci_ca->verbs.post_recv;\r
252         return status;\r
253 }\r
254 \r
255 \r
256 #define verbs_check_qp(h_qp)    ((h_qp)->h_ci_qp)\r
257 #define verbs_destroy_qp(h_qp) \\r
258         h_qp->obj.p_ci_ca->verbs.destroy_qp( h_qp->h_ci_qp, h_qp->timewait )\r
259 \r
260 #define verbs_query_qp(h_qp, p_qp_attr) \\r
261         h_qp->obj.p_ci_ca->verbs.query_qp( h_qp->h_ci_qp,\\r
262                 p_qp_attr, p_umv_buf )\r
263 \r
264 #define verbs_modify_qp(h_qp, p_qp_mod, qp_attr) \\r
265         h_qp->obj.p_ci_ca->verbs.modify_qp( h_qp->h_ci_qp,\\r
266                 p_qp_mod, &qp_attr, p_umv_buf )\r
267 \r
268 #define verbs_post_send(h_qp, p_send_wr, pp_send_failure) \\r
269         h_qp->obj.p_ci_ca->verbs.post_send( h_qp->h_ci_qp,\\r
270                 p_send_wr, pp_send_failure )\r
271 \r
272 #define verbs_post_recv(h_qp, p_recv_wr, pp_recv_failure) \\r
273         h_qp->obj.p_ci_ca->verbs.post_recv( h_qp->h_ci_qp,\\r
274                 p_recv_wr, pp_recv_failure )\r
275 \r
276 #define verbs_local_mad(h_ca, port_num, p_mad_in, p_mad_out) \\r
277         h_ca->obj.p_ci_ca->verbs.local_mad( h_ca->obj.p_ci_ca->h_ci_ca,\\r
278                 port_num, p_mad_in, p_mad_out)\r
279 \r
280 #define check_local_mad(h_qp) \\r
281         (h_qp->obj.p_ci_ca->verbs.local_mad)\r
282 \r
283 #define init_alias_qp( h_qp, h_pd, port_guid, p_qp_create ) \\r
284         init_qp_alias( h_qp, h_pd, port_guid, p_qp_create )\r
285 \r
286 #define spl_qp_mad_send( h_mad_svc, p_mad_element_list, pp_mad_failure ) \\r
287         IB_ERROR\r
288 \r
289 #define spl_qp_cancel_mad( h_mad_svc, h_mad_send ) \\r
290         IB_ERROR\r
291 \r
292 #define create_reg_mad_pool( h_pool, h_pd, p_pool_key ) \\r
293         IB_SUCCESS\r
294 \r
295 #define dereg_destroy_mad_pool( pool_key )\r
296 \r
297 #define verbs_attach_mcast(h_mcast)     \\r
298         h_mcast->obj.p_ci_ca->verbs.attach_mcast(       \\r
299                         ((ib_qp_handle_t)h_mcast->obj.p_parent_obj)->h_ci_qp, &h_mcast->member_rec.mgid,        \\r
300                         h_mcast->member_rec.mlid, &h_mcast->h_ci_mcast, \\r
301                         NULL)\r
302 \r
303 #define verbs_detach_mcast(h_mcast)     \\r
304                 h_mcast->obj.p_ci_ca->verbs.detach_mcast( \\r
305                         h_mcast->h_ci_mcast )\r
306 \r
307 \r
308 \r
309 #else\r
310 \r
311 \r
312 \r
313         /* Macros for user-mode only */\r
314 #define verbs_create_av(h_pd, p_av_attr, h_av) \\r
315         ual_create_av(h_pd, p_av_attr, h_av); \\r
316         UNUSED_PARAM( p_umv_buf )\r
317 \r
318 #define verbs_check_av(h_av)    ((h_av)->h_ci_av || (h_av)->obj.hdl)\r
319 #define convert_av_handle(h_qp, h_av) \\r
320         ((h_qp)->h_ci_qp?(h_av)->h_ci_av:(ib_av_handle_t)(h_av)->obj.hdl)\r
321 #define verbs_destroy_av(h_av) \\r
322         ual_destroy_av(h_av)\r
323 \r
324 #define verbs_query_av(h_av, p_av_attr, ph_pd) \\r
325         ual_query_av(h_av, p_av_attr, ph_pd); \\r
326         UNUSED_PARAM( p_umv_buf )\r
327 \r
328 #define verbs_modify_av(h_av, p_av_mod) \\r
329         ual_modify_av(h_av, p_av_mod); \\r
330         UNUSED_PARAM( p_umv_buf )\r
331 \r
332 #define verbs_query_ca(h_ca, p_ca_attr, p_size) \\r
333         ual_query_ca(h_ca, p_ca_attr, p_size); \\r
334         UNUSED_PARAM( p_umv_buf )\r
335 \r
336 #define verbs_modify_ca(h_ca, port_num, ca_mod, p_port_attr_mod) \\r
337         ual_modify_ca(h_ca, port_num, ca_mod, p_port_attr_mod)\r
338 \r
339 #define verbs_create_cq(h_ca, p_cq_create, h_cq) \\r
340         ual_create_cq(h_ca->obj.p_ci_ca, p_cq_create, h_cq); \\r
341         UNUSED_PARAM( p_umv_buf )\r
342 \r
343 \r
344 #define verbs_check_cq(h_cq)    ((h_cq)->h_ci_cq || (h_cq)->obj.hdl)\r
345 #define verbs_destroy_cq(h_cq) \\r
346         ual_destroy_cq(h_cq)\r
347 \r
348 #define verbs_modify_cq(h_cq, p_size) \\r
349         ual_modify_cq(h_cq, p_size); \\r
350         UNUSED_PARAM( p_umv_buf )\r
351 \r
352 #define verbs_query_cq(h_cq, p_size) \\r
353         ual_query_cq(h_cq, p_size); \\r
354         UNUSED_PARAM( p_umv_buf )\r
355 \r
356 #define verbs_peek_cq(h_cq, p_n_cqes) \\r
357         h_cq->pfn_peek( h_cq->h_peek_cq, p_n_cqes )\r
358 \r
359 #define verbs_poll_cq(h_cq, pp_free_wclist, pp_done_wclist) \\r
360         h_cq->pfn_poll( h_cq->h_poll_cq, pp_free_wclist, pp_done_wclist )\r
361 \r
362 #define verbs_rearm_cq(h_cq, solicited) \\r
363         h_cq->pfn_rearm( h_cq->h_rearm_cq, solicited )\r
364 \r
365 #define verbs_rearm_n_cq(h_cq, n_cqes) \\r
366         h_cq->pfn_rearm_n( h_cq->h_rearm_n_cq, n_cqes )\r
367 \r
368 #define verbs_register_mr(h_pd, p_mr_create, p_lkey, p_rkey, h_mr) \\r
369         ual_reg_mem(h_pd, p_mr_create, p_lkey, p_rkey, h_mr); \\r
370         UNUSED_PARAM( um_call )\r
371 \r
372 #define verbs_register_pmr(h_pd, p_phys_create, p_vaddr, p_lkey, p_rkey, h_mr) \\r
373         IB_UNSUPPORTED; \\r
374         UNUSED_PARAM( h_pd ); \\r
375         UNUSED_PARAM( p_phys_create ); \\r
376         UNUSED_PARAM( p_vaddr ); \\r
377         UNUSED_PARAM( p_lkey ); \\r
378         UNUSED_PARAM( p_rkey ); \\r
379         UNUSED_PARAM( h_mr ); \\r
380         UNUSED_PARAM( um_call )\r
381 \r
382 #define verbs_check_mr(h_mr)    ((h_mr)->h_ci_mr || (h_mr)->obj.hdl)\r
383 #define verbs_deregister_mr(h_mr) \\r
384         ual_dereg_mr(h_mr)\r
385 \r
386 /* For user-mode, this is nop */\r
387 #define verbs_release_shmid(h_mr)\r
388 \r
389 #define verbs_query_mr(h_mr, p_mr_attr) \\r
390         ual_query_mr(h_mr, p_mr_attr)\r
391 \r
392 #define verbs_modify_mr(h_mr, mr_modify_mask, p_mr_create, \\r
393         p_lkey, p_rkey, h_pd ) \\r
394                 ual_modify_mr( h_mr, mr_modify_mask, p_mr_create, \\r
395                         p_lkey, p_rkey, h_pd ); \\r
396                 UNUSED_PARAM( um_call )\r
397 \r
398 #define verbs_modify_pmr( h_mr, mr_mod_mask, p_phys_create, \\r
399         p_vaddr, p_lkey, p_rkey, h_pd ) \\r
400                 IB_UNSUPPORTED; \\r
401                 UNUSED_PARAM( h_mr ); \\r
402                 UNUSED_PARAM( mr_mod_mask ); \\r
403                 UNUSED_PARAM( p_phys_create ); \\r
404                 UNUSED_PARAM( p_vaddr ); \\r
405                 UNUSED_PARAM( p_lkey ); \\r
406                 UNUSED_PARAM( p_rkey ); \\r
407                 UNUSED_PARAM( h_pd ); \\r
408                 UNUSED_PARAM( um_call )\r
409 \r
410 #define verbs_register_smr(h_mr, h_pd, access_ctrl, p_vaddr, p_lkey, \\r
411         p_rkey, ph_mr ) \\r
412                 ual_reg_shared( h_mr, h_pd, access_ctrl, p_vaddr, p_lkey, \\r
413                         p_rkey, ph_mr ); \\r
414                 UNUSED_PARAM( um_call )\r
415 \r
416 #define verbs_create_mw(h_pd, p_rkey, h_mw) \\r
417         ual_create_mw(h_pd, p_rkey, h_mw); \\r
418         UNUSED_PARAM( p_umv_buf )\r
419 \r
420 #define verbs_check_mw(h_mw)    ((h_mw)->h_ci_mw || (h_mw)->obj.hdl)\r
421 #define verbs_destroy_mw(h_mw) \\r
422         ual_destroy_mw(h_mw)\r
423 \r
424 #define verbs_query_mw(h_mw, ph_pd, p_rkey) \\r
425         ual_query_mw(h_mw, ph_pd, p_rkey); \\r
426         UNUSED_PARAM( p_umv_buf )\r
427 \r
428 #define convert_mr_handle(h_mr) (h_mr)\r
429 \r
430 #define verbs_bind_mw(h_mw, h_qp, p_mw_bind, p_rkey) \\r
431         ual_bind_mw(h_mw, h_qp, p_mw_bind, p_rkey)\r
432 \r
433 #define verbs_allocate_pd(h_ca, h_pd) \\r
434         ual_allocate_pd(h_ca, h_pd->type, h_pd); \\r
435         UNUSED_PARAM( p_umv_buf )\r
436 \r
437 /*\r
438  * Get an alias to the kernel's hardware PD.\r
439  */\r
440 static inline ib_api_status_t\r
441 allocate_pd_alias(\r
442         IN              const   ib_ca_handle_t                          h_ca,\r
443         IN              const   ib_pd_handle_t                          h_pd )\r
444 {\r
445         return ual_allocate_pd( h_ca, h_pd->type, h_pd );\r
446 }\r
447 \r
448 #define deallocate_pd_alias( h_pd ) /* no action to take */\r
449 \r
450 #define verbs_check_pd(h_pd)    ((h_pd)->h_ci_pd || (h_pd)->obj.hdl)\r
451 #define verbs_deallocate_pd(h_pd) \\r
452         ual_deallocate_pd(h_pd)\r
453 \r
454 /* For user-mode, handle conversion is done in ual files */\r
455 \r
456 #define convert_qp_handle( qp_create )\r
457 \r
458 /* TBD: Do we need to support this in user-mode? */\r
459 #define verbs_get_spl_qp(h_pd, port_num, h_qp, p_qp_create, p_qp_attr) \\r
460                 IB_UNSUPPORTED\r
461 \r
462 #define verbs_create_qp(h_pd, h_qp, p_qp_create, p_qp_attr, p_umv_buf) \\r
463         ual_create_qp (h_pd, h_qp, p_qp_create, p_qp_attr); \\r
464         UNUSED_PARAM( p_umv_buf )\r
465 \r
466 #define verbs_check_qp(h_qp)    ((h_qp)->h_ci_qp || (h_qp)->obj.hdl)\r
467 #define verbs_destroy_qp(h_qp) \\r
468         ual_destroy_qp(h_qp)\r
469 \r
470 #define verbs_query_qp(h_qp, p_qp_attr) \\r
471         ual_query_qp(h_qp, p_qp_attr); \\r
472         UNUSED_PARAM( p_umv_buf );\r
473 \r
474 #define verbs_modify_qp(h_qp, p_qp_mod, qp_attr) \\r
475         ual_modify_qp(h_qp, p_qp_mod, &qp_attr); \\r
476         UNUSED_PARAM( p_umv_buf );\r
477 \r
478 #define verbs_post_send(h_qp, p_send_wr, pp_send_failure) \\r
479         ual_post_send(h_qp, p_send_wr, pp_send_failure)\r
480 \r
481 #define verbs_post_recv(h_qp, p_recv_wr, pp_recv_failure) \\r
482         ual_post_recv(h_qp, p_recv_wr, pp_recv_failure)\r
483 \r
484 static inline ib_api_status_t\r
485 verbs_local_mad(\r
486         IN              const   ib_ca_handle_t                          h_ca,\r
487         IN              const   uint8_t                                         port_num,\r
488         IN              const   void* const                                     p_mad_in,\r
489         IN                              void*                                           p_mad_out )\r
490 {\r
491         UNUSED_PARAM( h_ca );\r
492         UNUSED_PARAM( port_num );\r
493         UNUSED_PARAM( p_mad_in );\r
494         UNUSED_PARAM( p_mad_out );\r
495         return IB_UNSUPPORTED;\r
496 }\r
497 \r
498 #define check_local_mad(h_qp) \\r
499         (!h_qp)\r
500 \r
501 #define init_alias_qp( h_qp, h_pd, port_guid, p_qp_create ) \\r
502         ual_init_qp_alias( h_qp, h_pd, port_guid, p_qp_create )\r
503 \r
504 #define spl_qp_mad_send( h_mad_svc, p_mad_element_list, pp_mad_failure ) \\r
505         ual_spl_qp_mad_send( h_mad_svc, p_mad_element_list, pp_mad_failure )\r
506 \r
507 #define spl_qp_cancel_mad( h_mad_svc, p_mad_element ) \\r
508         ual_spl_qp_cancel_mad( h_mad_svc, p_mad_element )\r
509 \r
510 #define create_reg_mad_pool( h_pool, h_pd, p_pool_key ) \\r
511         ual_create_reg_mad_pool( h_pool, h_pd, p_pool_key )\r
512 \r
513 #define dereg_destroy_mad_pool( pool_key ) \\r
514         ual_dereg_destroy_mad_pool( pool_key )\r
515 \r
516 #define verbs_attach_mcast(h_mcast)     \\r
517         ual_attach_mcast( h_mcast )\r
518 \r
519 #define verbs_detach_mcast(h_mcast)     \\r
520         ual_detach_mcast( h_mcast )\r
521 \r
522 #endif  /* CL_KERNEL */\r
523 \r
524 \r
525 #endif /* __AL_VERBS_H__ */\r