f5ce6c0d817bcc8c106378db92ace5a2eb908510
[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         (h_pd->type == IB_PDT_ALIAS) ?\\r
316         ual_pd_alias_create_av(h_pd, p_av_attr, h_av):\\r
317         ual_create_av(h_pd, p_av_attr, h_av); \\r
318         UNUSED_PARAM( p_umv_buf )\r
319 \r
320 #define verbs_check_av(h_av)    ((h_av)->h_ci_av || (h_av)->obj.hdl)\r
321 #define convert_av_handle(h_qp, h_av) \\r
322         ((h_qp)->h_ci_qp?(h_av)->h_ci_av:(ib_av_handle_t)(h_av)->obj.hdl)\r
323 #define verbs_destroy_av(h_av) \\r
324         ual_destroy_av(h_av)\r
325 \r
326 #define verbs_query_av(h_av, p_av_attr, ph_pd) \\r
327         ual_query_av(h_av, p_av_attr, ph_pd); \\r
328         UNUSED_PARAM( p_umv_buf )\r
329 \r
330 #define verbs_modify_av(h_av, p_av_mod) \\r
331         ual_modify_av(h_av, p_av_mod); \\r
332         UNUSED_PARAM( p_umv_buf )\r
333 \r
334 #define verbs_query_ca(h_ca, p_ca_attr, p_size) \\r
335         ual_query_ca(h_ca, p_ca_attr, p_size); \\r
336         UNUSED_PARAM( p_umv_buf )\r
337 \r
338 #define verbs_modify_ca(h_ca, port_num, ca_mod, p_port_attr_mod) \\r
339         ual_modify_ca(h_ca, port_num, ca_mod, p_port_attr_mod)\r
340 \r
341 #define verbs_create_cq(h_ca, p_cq_create, h_cq) \\r
342         ual_create_cq(h_ca->obj.p_ci_ca, p_cq_create, h_cq); \\r
343         UNUSED_PARAM( p_umv_buf )\r
344 \r
345 \r
346 #define verbs_check_cq(h_cq)    ((h_cq)->h_ci_cq || (h_cq)->obj.hdl)\r
347 #define verbs_destroy_cq(h_cq) \\r
348         ual_destroy_cq(h_cq)\r
349 \r
350 #define verbs_modify_cq(h_cq, p_size) \\r
351         ual_modify_cq(h_cq, p_size); \\r
352         UNUSED_PARAM( p_umv_buf )\r
353 \r
354 #define verbs_query_cq(h_cq, p_size) \\r
355         ual_query_cq(h_cq, p_size); \\r
356         UNUSED_PARAM( p_umv_buf )\r
357 \r
358 #define verbs_peek_cq(h_cq, p_n_cqes) \\r
359         h_cq->pfn_peek( h_cq->h_peek_cq, p_n_cqes )\r
360 \r
361 #define verbs_poll_cq(h_cq, pp_free_wclist, pp_done_wclist) \\r
362         h_cq->pfn_poll( h_cq->h_poll_cq, pp_free_wclist, pp_done_wclist )\r
363 \r
364 #define verbs_rearm_cq(h_cq, solicited) \\r
365         h_cq->pfn_rearm( h_cq->h_rearm_cq, solicited )\r
366 \r
367 #define verbs_rearm_n_cq(h_cq, n_cqes) \\r
368         h_cq->pfn_rearm_n( h_cq->h_rearm_n_cq, n_cqes )\r
369 \r
370 #define verbs_register_mr(h_pd, p_mr_create, p_lkey, p_rkey, h_mr) \\r
371         ual_reg_mem(h_pd, p_mr_create, p_lkey, p_rkey, h_mr); \\r
372         UNUSED_PARAM( um_call )\r
373 \r
374 #define verbs_register_pmr(h_pd, p_phys_create, p_vaddr, p_lkey, p_rkey, h_mr) \\r
375         IB_UNSUPPORTED; \\r
376         UNUSED_PARAM( h_pd ); \\r
377         UNUSED_PARAM( p_phys_create ); \\r
378         UNUSED_PARAM( p_vaddr ); \\r
379         UNUSED_PARAM( p_lkey ); \\r
380         UNUSED_PARAM( p_rkey ); \\r
381         UNUSED_PARAM( h_mr ); \\r
382         UNUSED_PARAM( um_call )\r
383 \r
384 #define verbs_check_mr(h_mr)    ((h_mr)->h_ci_mr || (h_mr)->obj.hdl)\r
385 #define verbs_deregister_mr(h_mr) \\r
386         ual_dereg_mr(h_mr)\r
387 \r
388 /* For user-mode, this is nop */\r
389 #define verbs_release_shmid(h_mr)\r
390 \r
391 #define verbs_query_mr(h_mr, p_mr_attr) \\r
392         ual_query_mr(h_mr, p_mr_attr)\r
393 \r
394 #define verbs_modify_mr(h_mr, mr_modify_mask, p_mr_create, \\r
395         p_lkey, p_rkey, h_pd ) \\r
396                 ual_modify_mr( h_mr, mr_modify_mask, p_mr_create, \\r
397                         p_lkey, p_rkey, h_pd ); \\r
398                 UNUSED_PARAM( um_call )\r
399 \r
400 #define verbs_modify_pmr( h_mr, mr_mod_mask, p_phys_create, \\r
401         p_vaddr, p_lkey, p_rkey, h_pd ) \\r
402                 IB_UNSUPPORTED; \\r
403                 UNUSED_PARAM( h_mr ); \\r
404                 UNUSED_PARAM( mr_mod_mask ); \\r
405                 UNUSED_PARAM( p_phys_create ); \\r
406                 UNUSED_PARAM( p_vaddr ); \\r
407                 UNUSED_PARAM( p_lkey ); \\r
408                 UNUSED_PARAM( p_rkey ); \\r
409                 UNUSED_PARAM( h_pd ); \\r
410                 UNUSED_PARAM( um_call )\r
411 \r
412 #define verbs_register_smr(h_mr, h_pd, access_ctrl, p_vaddr, p_lkey, \\r
413         p_rkey, ph_mr ) \\r
414                 ual_reg_shared( h_mr, h_pd, access_ctrl, p_vaddr, p_lkey, \\r
415                         p_rkey, ph_mr ); \\r
416                 UNUSED_PARAM( um_call )\r
417 \r
418 #define verbs_create_mw(h_pd, p_rkey, h_mw) \\r
419         ual_create_mw(h_pd, p_rkey, h_mw); \\r
420         UNUSED_PARAM( p_umv_buf )\r
421 \r
422 #define verbs_check_mw(h_mw)    ((h_mw)->h_ci_mw || (h_mw)->obj.hdl)\r
423 #define verbs_destroy_mw(h_mw) \\r
424         ual_destroy_mw(h_mw)\r
425 \r
426 #define verbs_query_mw(h_mw, ph_pd, p_rkey) \\r
427         ual_query_mw(h_mw, ph_pd, p_rkey); \\r
428         UNUSED_PARAM( p_umv_buf )\r
429 \r
430 #define convert_mr_handle(h_mr) (h_mr)\r
431 \r
432 #define verbs_bind_mw(h_mw, h_qp, p_mw_bind, p_rkey) \\r
433         ual_bind_mw(h_mw, h_qp, p_mw_bind, p_rkey)\r
434 \r
435 #define verbs_allocate_pd(h_ca, h_pd) \\r
436         ual_allocate_pd(h_ca, h_pd->type, h_pd); \\r
437         UNUSED_PARAM( p_umv_buf )\r
438 \r
439 /*\r
440  * Get an alias to the kernel's hardware PD.\r
441  */\r
442 static inline ib_api_status_t\r
443 allocate_pd_alias(\r
444         IN              const   ib_ca_handle_t                          h_ca,\r
445         IN              const   ib_pd_handle_t                          h_pd )\r
446 {\r
447         return ual_allocate_pd( h_ca, h_pd->type, h_pd );\r
448 }\r
449 \r
450 #define deallocate_pd_alias( h_pd ) /* no action to take */\r
451 \r
452 #define verbs_check_pd(h_pd)    ((h_pd)->h_ci_pd || (h_pd)->obj.hdl)\r
453 #define verbs_deallocate_pd(h_pd) \\r
454         ual_deallocate_pd(h_pd)\r
455 \r
456 /* For user-mode, handle conversion is done in ual files */\r
457 \r
458 #define convert_qp_handle( qp_create )\r
459 \r
460 /* TBD: Do we need to support this in user-mode? */\r
461 #define verbs_get_spl_qp(h_pd, port_num, h_qp, p_qp_create, p_qp_attr) \\r
462                 IB_UNSUPPORTED\r
463 \r
464 #define verbs_create_qp(h_pd, h_qp, p_qp_create, p_qp_attr, p_umv_buf) \\r
465         ual_create_qp (h_pd, h_qp, p_qp_create, p_qp_attr); \\r
466         UNUSED_PARAM( p_umv_buf )\r
467 \r
468 #define verbs_check_qp(h_qp)    ((h_qp)->h_ci_qp || (h_qp)->obj.hdl)\r
469 #define verbs_destroy_qp(h_qp) \\r
470         ual_destroy_qp(h_qp)\r
471 \r
472 #define verbs_query_qp(h_qp, p_qp_attr) \\r
473         ual_query_qp(h_qp, p_qp_attr); \\r
474         UNUSED_PARAM( p_umv_buf );\r
475 \r
476 #define verbs_modify_qp(h_qp, p_qp_mod, qp_attr) \\r
477         ual_modify_qp(h_qp, p_qp_mod, &qp_attr); \\r
478         UNUSED_PARAM( p_umv_buf );\r
479 \r
480 #define verbs_post_send(h_qp, p_send_wr, pp_send_failure) \\r
481         ual_post_send(h_qp, p_send_wr, pp_send_failure)\r
482 \r
483 #define verbs_post_recv(h_qp, p_recv_wr, pp_recv_failure) \\r
484         ual_post_recv(h_qp, p_recv_wr, pp_recv_failure)\r
485 \r
486 static inline ib_api_status_t\r
487 verbs_local_mad(\r
488         IN              const   ib_ca_handle_t                          h_ca,\r
489         IN              const   uint8_t                                         port_num,\r
490         IN              const   void* const                                     p_mad_in,\r
491         IN                              void*                                           p_mad_out )\r
492 {\r
493         UNUSED_PARAM( h_ca );\r
494         UNUSED_PARAM( port_num );\r
495         UNUSED_PARAM( p_mad_in );\r
496         UNUSED_PARAM( p_mad_out );\r
497         return IB_UNSUPPORTED;\r
498 }\r
499 \r
500 #define check_local_mad(h_qp) \\r
501         (!h_qp)\r
502 \r
503 #define init_alias_qp( h_qp, h_pd, port_guid, p_qp_create ) \\r
504         ual_init_qp_alias( h_qp, h_pd, port_guid, p_qp_create )\r
505 \r
506 #define spl_qp_mad_send( h_mad_svc, p_mad_element_list, pp_mad_failure ) \\r
507         ual_spl_qp_mad_send( h_mad_svc, p_mad_element_list, pp_mad_failure )\r
508 \r
509 #define spl_qp_cancel_mad( h_mad_svc, p_mad_element ) \\r
510         ual_spl_qp_cancel_mad( h_mad_svc, p_mad_element )\r
511 \r
512 #define create_reg_mad_pool( h_pool, h_pd, p_pool_key ) \\r
513         ual_create_reg_mad_pool( h_pool, h_pd, p_pool_key )\r
514 \r
515 #define dereg_destroy_mad_pool( pool_key ) \\r
516         ual_dereg_destroy_mad_pool( pool_key )\r
517 \r
518 #define verbs_attach_mcast(h_mcast)     \\r
519         ual_attach_mcast( h_mcast )\r
520 \r
521 #define verbs_detach_mcast(h_mcast)     \\r
522         ual_detach_mcast( h_mcast )\r
523 \r
524 #endif  /* CL_KERNEL */\r
525 \r
526 \r
527 #endif /* __AL_VERBS_H__ */\r