[IBAL, HW] Remove pointers from ci_umv_buf_t.
[mirror/winof/.git] / hw / mlx4 / kernel / hca / mr.c
1 /*\r
2  * Copyright (c) 2005 SilverStorm Technologies.  All rights reserved.\r
3  * Copyright (c) 2004-2005 Mellanox Technologies, Inc. All rights reserved. \r
4  * Portions Copyright (c) 2008 Microsoft Corporation.  All rights reserved.\r
5  *\r
6  * This software is available to you under the OpenIB.org BSD license\r
7  * below:\r
8  *\r
9  *     Redistribution and use in source and binary forms, with or\r
10  *     without modification, are permitted provided that the following\r
11  *     conditions are met:\r
12  *\r
13  *      - Redistributions of source code must retain the above\r
14  *        copyright notice, this list of conditions and the following\r
15  *        disclaimer.\r
16  *\r
17  *      - Redistributions in binary form must reproduce the above\r
18  *        copyright notice, this list of conditions and the following\r
19  *        disclaimer in the documentation and/or other materials\r
20  *        provided with the distribution.\r
21  *\r
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
23  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
24  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
25  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
26  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
27  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
28  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
29  * SOFTWARE.\r
30  *\r
31  * $Id: hca_memory.c 2028 2007-07-12 16:00:03Z leonid $\r
32  */\r
33 \r
34 #include "precomp.h"\r
35 #if defined(EVENT_TRACING)\r
36 #ifdef offsetof\r
37 #undef offsetof\r
38 #endif\r
39 #include "mr.tmh"\r
40 #endif\r
41 \r
42 /*\r
43  *      Memory Management Verbs.\r
44  */\r
45 \r
46 ib_api_status_t\r
47 mlnx_register_mr (\r
48         IN              const   ib_pd_handle_t                          h_pd,\r
49         IN              const   ib_mr_create_t                          *p_mr_create,\r
50         OUT                     net32_t* const                                  p_lkey,\r
51         OUT                     net32_t* const                                  p_rkey,\r
52         OUT                     ib_mr_handle_t                                  *ph_mr,\r
53         IN                              boolean_t                                       um_call )\r
54 {\r
55         ib_api_status_t         status;\r
56         int err;\r
57         struct ib_mr *p_ib_mr;\r
58         struct ib_pd *p_ib_pd = (struct ib_pd *)h_pd;\r
59         ci_umv_buf_t umv_buf = { 0, 0, 0, 0, 0 };\r
60 \r
61         HCA_ENTER(HCA_DBG_MEMORY);\r
62 \r
63         // sanity checks\r
64         if( !cl_is_blockable() ) {\r
65                 status = IB_UNSUPPORTED;\r
66                 goto err_unsupported;\r
67         } \r
68         if (!p_mr_create || 0 == p_mr_create->length) {\r
69                 HCA_PRINT(TRACE_LEVEL_WARNING ,HCA_DBG_MEMORY,\r
70                         ("invalid attributes\n"));\r
71                 status = IB_INVALID_PARAMETER;\r
72                 goto err_invalid_parm; \r
73         }\r
74         /*\r
75          * Local write permission is required if remote write or\r
76          * remote atomic permission is also requested.\r
77          */\r
78         if (p_mr_create->access_ctrl & (IB_AC_RDMA_WRITE | IB_AC_ATOMIC) &&\r
79                 !(p_mr_create->access_ctrl & IB_AC_LOCAL_WRITE)) {\r
80                 HCA_PRINT(TRACE_LEVEL_WARNING ,HCA_DBG_MEMORY,\r
81                         ("invalid access rights\n"));\r
82                 status = IB_INVALID_PERMISSION;\r
83                 goto err_invalid_access; \r
84         }\r
85 \r
86         // register mr \r
87         p_ib_mr = ibv_reg_mr(p_ib_pd, (u64)(ULONG_PTR)(void*)p_mr_create->vaddr, \r
88                 p_mr_create->length, (uint64_t)p_mr_create->vaddr, \r
89                 to_qp_acl(p_mr_create->access_ctrl), um_call ? &umv_buf : NULL );\r
90         if (IS_ERR(p_ib_mr)) {\r
91                 err = PTR_ERR(p_ib_mr);\r
92                 HCA_PRINT(TRACE_LEVEL_ERROR, HCA_DBG_MEMORY,\r
93                         ("ibv_reg_mr failed (%d)\n", err));\r
94                 status = errno_to_iberr(err);\r
95                 goto err_reg_mr;\r
96         }\r
97 \r
98         // results\r
99         *p_lkey = p_ib_mr->lkey;\r
100         *p_rkey = cl_hton32( p_ib_mr->rkey );\r
101         if (ph_mr)      *ph_mr = (ib_mr_handle_t)p_ib_mr;\r
102         status = IB_SUCCESS;\r
103 \r
104 err_reg_mr:\r
105 err_invalid_access:     \r
106 err_invalid_parm:\r
107 err_unsupported:\r
108         if (status != IB_SUCCESS) \r
109                 HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_MEMORY,\r
110                         ("completes with ERROR status %x\n", status));\r
111         HCA_EXIT(HCA_DBG_MEMORY);\r
112         return status;\r
113 }\r
114 \r
115 ib_api_status_t\r
116 mlnx_register_pmr (\r
117         IN              const   ib_pd_handle_t                          h_pd,\r
118         IN              const   ib_phys_create_t* const         p_pmr_create,\r
119         IN      OUT                     uint64_t* const                         p_vaddr,\r
120                 OUT                     net32_t* const                          p_lkey,\r
121                 OUT                     net32_t* const                          p_rkey,\r
122                 OUT                     ib_mr_handle_t* const           ph_mr,\r
123         IN                              boolean_t                                       um_call )\r
124 {\r
125         ib_api_status_t         status;\r
126         int err;\r
127         struct ib_mr *p_ib_mr;\r
128         struct ib_phys_buf *buffer_list;\r
129         struct ib_pd *p_ib_pd = (struct ib_pd *)h_pd;\r
130 \r
131         UNUSED_PARAM( um_call );\r
132 \r
133         HCA_ENTER(HCA_DBG_MEMORY);\r
134 \r
135         if (hca_is_livefish(p_ib_pd->device->x.p_fdo)) {\r
136                 p_ib_mr = kzalloc(sizeof *p_ib_mr, GFP_KERNEL);\r
137                 if (!p_ib_mr) {\r
138                         status = IB_INSUFFICIENT_MEMORY;\r
139                         goto err_mem;\r
140                 }\r
141                 p_ib_mr->device = p_ib_pd->device;\r
142                 p_ib_mr->pd = p_ib_pd;\r
143                 goto done;\r
144         }\r
145 \r
146         // sanity checks\r
147         if( !cl_is_blockable() ) {\r
148                 status = IB_UNSUPPORTED;\r
149                 goto err_unsupported;\r
150         }       \r
151         if (!p_vaddr || !p_pmr_create ||\r
152                 0 == p_pmr_create->length ) {\r
153                 status = IB_INVALID_PARAMETER;\r
154                 goto err_invalid_parm; \r
155         }\r
156 \r
157         // prepare parameters\r
158         buffer_list = (void*)p_pmr_create->range_array;\r
159         //NB: p_pmr_create->buf_offset is not used, i.e. supposed that region is page-aligned\r
160         //NB: p_pmr_create->hca_page_size is not used, i.e. supposed it is always the same\r
161         \r
162         // register pmr \r
163         if (p_pmr_create->length == (uint64_t)-1i64)\r
164         {\r
165                 p_ib_mr = ib_get_dma_mr( p_ib_pd,\r
166                         to_qp_acl(p_pmr_create->access_ctrl) );\r
167         }\r
168         else\r
169                 p_ib_mr = ib_reg_phys_mr(p_ib_pd, buffer_list, p_pmr_create->num_ranges, \r
170                         to_qp_acl(p_pmr_create->access_ctrl), p_vaddr );\r
171         if (IS_ERR(p_ib_mr)) {\r
172                 err = PTR_ERR(p_ib_mr);\r
173                 HCA_PRINT(TRACE_LEVEL_ERROR, HCA_DBG_MEMORY,\r
174                         ("ib_reg_phys_mr failed (%d)\n", err));\r
175                 status = errno_to_iberr(err);\r
176                 goto err_reg_phys_mr;\r
177         }\r
178 \r
179         // results\r
180 done:\r
181         if (ph_mr)      *ph_mr = (ib_mr_handle_t)p_ib_mr;\r
182         *p_lkey = p_ib_mr->lkey;\r
183         *p_rkey = cl_hton32( p_ib_mr->rkey );\r
184         //NB:  p_vaddr was not changed\r
185         status = IB_SUCCESS;\r
186 \r
187 err_reg_phys_mr:\r
188 err_invalid_parm:\r
189 err_unsupported:\r
190 err_mem:\r
191         if (status != IB_SUCCESS) \r
192                 HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_MEMORY,\r
193                         ("completes with ERROR status %x\n", status));\r
194 \r
195         HCA_EXIT(HCA_DBG_MEMORY);\r
196         return status;\r
197         \r
198 }\r
199 \r
200 ib_api_status_t\r
201 mlnx_query_mr (\r
202         IN              const   ib_mr_handle_t                          h_mr,\r
203                 OUT                     ib_mr_attr_t                            *p_mr_query )\r
204 {\r
205         int err;\r
206         ib_api_status_t status = IB_SUCCESS;\r
207         struct ib_mr *p_ib_mr = (struct ib_mr *)h_mr;\r
208         struct ib_mr_attr mr_attr;\r
209         UNREFERENCED_PARAMETER(p_mr_query);\r
210 \r
211         HCA_ENTER(HCA_DBG_MEMORY);\r
212 \r
213         err = p_ib_mr->device->query_mr ?\r
214                 p_ib_mr->device->query_mr(p_ib_mr, &mr_attr) : -ENOSYS;\r
215         status = errno_to_iberr(err);\r
216 \r
217         if (err) {\r
218                 // TODO: convert struct ib_mr_attr to ib_mr_attr_t\r
219         }\r
220 \r
221         if (status != IB_SUCCESS)\r
222                 HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_CQ,\r
223                         ("ib_query_mr failed with status %x\n", status));\r
224 \r
225         HCA_EXIT(HCA_DBG_MEMORY);\r
226         return status;\r
227 }\r
228 \r
229 \r
230 ib_api_status_t\r
231 mlnx_modify_mr (\r
232         IN              const   ib_mr_handle_t                          h_mr,\r
233         IN              const   ib_mr_mod_t                                     mem_modify_req,\r
234         IN              const   ib_mr_create_t                          *p_mr_create,\r
235                 OUT                     uint32_t                                        *p_lkey,\r
236                 OUT                     uint32_t                                        *p_rkey,\r
237         IN              const   ib_pd_handle_t                          h_pd OPTIONAL,\r
238         IN                              boolean_t                                       um_call )\r
239 {\r
240         UNREFERENCED_PARAMETER(h_mr);\r
241         UNREFERENCED_PARAMETER(mem_modify_req);\r
242         UNREFERENCED_PARAMETER(p_mr_create);\r
243         UNREFERENCED_PARAMETER(p_lkey);\r
244         UNREFERENCED_PARAMETER(p_rkey);\r
245         UNREFERENCED_PARAMETER(h_pd);\r
246         UNREFERENCED_PARAMETER(um_call);\r
247         HCA_PRINT(TRACE_LEVEL_ERROR  , HCA_DBG_MEMORY  ,("mlnx_modify_mr not implemented\n"));\r
248         return IB_UNSUPPORTED;\r
249 }\r
250 \r
251 \r
252 ib_api_status_t\r
253 mlnx_modify_pmr (\r
254         IN              const   ib_mr_handle_t                          h_mr,\r
255         IN              const   ib_mr_mod_t                                     mem_modify_req,\r
256         IN              const   ib_phys_create_t* const         p_pmr_create,\r
257         IN      OUT                     uint64_t* const                         p_vaddr,\r
258                 OUT                     uint32_t* const                         p_lkey,\r
259                 OUT                     uint32_t* const                         p_rkey,\r
260         IN              const   ib_pd_handle_t                          h_pd OPTIONAL,\r
261         IN                              boolean_t                                       um_call )\r
262 {\r
263         UNREFERENCED_PARAMETER(h_mr);\r
264         UNREFERENCED_PARAMETER(mem_modify_req);\r
265         UNREFERENCED_PARAMETER(p_pmr_create);\r
266         UNREFERENCED_PARAMETER(p_vaddr);\r
267         UNREFERENCED_PARAMETER(p_lkey);\r
268         UNREFERENCED_PARAMETER(p_rkey);\r
269         UNREFERENCED_PARAMETER(h_pd);\r
270         UNREFERENCED_PARAMETER(um_call);\r
271         HCA_PRINT(TRACE_LEVEL_ERROR  , HCA_DBG_MEMORY  ,("mlnx_modify_pmr not implemented\n"));\r
272         return IB_UNSUPPORTED;\r
273 }\r
274 \r
275 ib_api_status_t\r
276 mlnx_register_smr (\r
277         IN              const   ib_mr_handle_t                          h_mr,\r
278         IN              const   ib_pd_handle_t                          h_pd,\r
279         IN              const   ib_access_t                                     access_ctrl,\r
280         IN      OUT                     uint64_t* const                         p_vaddr,\r
281                 OUT                     net32_t* const                          p_lkey,\r
282                 OUT                     net32_t* const                          p_rkey,\r
283                 OUT                     ib_mr_handle_t* const           ph_mr,\r
284         IN                              boolean_t                                       um_call )\r
285 {\r
286         UNREFERENCED_PARAMETER(h_mr);\r
287         UNREFERENCED_PARAMETER(h_pd);\r
288         UNREFERENCED_PARAMETER(access_ctrl);\r
289         UNREFERENCED_PARAMETER(p_vaddr);\r
290         UNREFERENCED_PARAMETER(p_lkey);\r
291         UNREFERENCED_PARAMETER(p_rkey);\r
292         UNREFERENCED_PARAMETER(ph_mr);\r
293         UNREFERENCED_PARAMETER(um_call);\r
294         HCA_PRINT(TRACE_LEVEL_ERROR  , HCA_DBG_MEMORY  ,("mlnx_register_smr not implemented\n"));\r
295         return IB_UNSUPPORTED;\r
296 }\r
297 \r
298 ib_api_status_t\r
299 mlnx_deregister_mr (\r
300         IN              const   ib_mr_handle_t                          h_mr)\r
301 {\r
302         int err;\r
303         ib_api_status_t status = IB_SUCCESS;\r
304         struct ib_mr *p_ib_mr = (struct ib_mr *)h_mr;\r
305 \r
306         HCA_ENTER(HCA_DBG_SHIM);\r
307 \r
308         if (hca_is_livefish(p_ib_mr->device->x.p_fdo)) {\r
309                 kfree(p_ib_mr);\r
310                 goto done;\r
311         }\r
312 \r
313         // sanity checks\r
314         if( !cl_is_blockable() ) {\r
315                         status = IB_UNSUPPORTED;\r
316                         goto err_unsupported;\r
317         }\r
318 \r
319         // deregister   \r
320         err = ib_dereg_mr(p_ib_mr);\r
321         status = errno_to_iberr(err);\r
322 \r
323 err_unsupported:\r
324         if (status != IB_SUCCESS) \r
325                 HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_MEMORY,\r
326                         ("ib_dereg_mr failed with status %x\n", status));\r
327 \r
328 done:\r
329         HCA_EXIT(HCA_DBG_MEMORY);\r
330         return status;\r
331 }\r
332 \r
333 ib_api_status_t\r
334 mlnx_alloc_fmr(\r
335         IN              const   ib_pd_handle_t                          h_pd,\r
336         IN              const   mlnx_fmr_create_t* const        p_fmr_create,\r
337                 OUT                     mlnx_fmr_handle_t*      const   ph_fmr\r
338         )\r
339 {\r
340         int err;\r
341         ib_api_status_t status = IB_SUCCESS;\r
342         struct ib_fmr * p_ib_fmr;\r
343         struct ib_pd *p_ib_pd = (struct ib_pd *)h_pd;\r
344         struct ib_fmr_attr fmr_attr;\r
345 \r
346         HCA_ENTER(HCA_DBG_MEMORY);\r
347 \r
348         // sanity checks\r
349         if( !cl_is_blockable() ) {\r
350                 status = IB_UNSUPPORTED;\r
351                 goto err_unsupported;\r
352         }\r
353         if (!p_fmr_create ) {\r
354                 status = IB_INVALID_PARAMETER;\r
355                 goto err_invalid_parm; \r
356         }\r
357         // TODO: check Max remap in AL\r
358 \r
359         // prepare parameters\r
360         RtlZeroMemory(&fmr_attr, sizeof(struct ib_fmr_attr));\r
361         fmr_attr.max_maps = p_fmr_create->max_maps;\r
362         fmr_attr.max_pages = p_fmr_create->max_pages;\r
363         fmr_attr.page_shift = p_fmr_create->page_size;\r
364 \r
365         // register mr \r
366         p_ib_fmr = p_ib_pd->device->alloc_fmr(p_ib_pd, \r
367                 to_qp_acl(p_fmr_create->access_ctrl), &fmr_attr);\r
368         if (IS_ERR(p_ib_fmr)) {\r
369                 err = PTR_ERR(p_ib_fmr);\r
370                 HCA_PRINT(TRACE_LEVEL_ERROR  , HCA_DBG_MEMORY  ,\r
371                         ("ib_alloc_fmr failed (%d)\n", err));\r
372                 status = errno_to_iberr(err);\r
373                 goto err_alloc_fmr;\r
374         }\r
375         else {\r
376                 p_ib_fmr->device = p_ib_pd->device;\r
377                 p_ib_fmr->pd     = p_ib_pd;\r
378                 atomic_inc(&p_ib_pd->usecnt);\r
379                 HCA_PRINT(TRACE_LEVEL_INFORMATION ,HCA_DBG_MEMORY ,("PD%d use cnt %d \n", \r
380                         ((struct mlx4_ib_pd*)p_ib_pd)->pdn, p_ib_pd->usecnt));\r
381         }\r
382 \r
383         // results\r
384         if (ph_fmr)\r
385                 *ph_fmr = (mlnx_fmr_handle_t)p_ib_fmr;\r
386 \r
387 err_alloc_fmr:\r
388 err_invalid_parm:\r
389 err_unsupported:\r
390         if (status != IB_SUCCESS) \r
391                 HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_MEMORY,\r
392                         ("completes with ERROR status %x\n", status));\r
393 \r
394         HCA_EXIT(HCA_DBG_MEMORY);\r
395         return status;\r
396 \r
397 }\r
398 \r
399 ib_api_status_t\r
400 mlnx_map_phys_fmr (\r
401         IN              const   mlnx_fmr_handle_t                       h_fmr,\r
402         IN              const   uint64_t* const                         page_list,\r
403         IN              const   int                                                     list_len,\r
404         IN      OUT                     uint64_t* const                         p_vaddr,\r
405                 OUT                     net32_t* const                          p_lkey,\r
406                 OUT                     net32_t* const                          p_rkey\r
407         )\r
408 {\r
409         int err;\r
410         ib_api_status_t status = IB_SUCCESS;\r
411         struct ib_fmr *p_ib_fmr = (struct ib_fmr *)h_fmr;\r
412         uint64_t vaddr = (*p_vaddr) & ~(PAGE_SIZE - 1);\r
413 \r
414         HCA_ENTER(HCA_DBG_MEMORY);\r
415 \r
416         // mapping      \r
417         err = ib_map_phys_fmr(p_ib_fmr, (u64*)page_list, list_len, (uint64_t)(ULONG_PTR)vaddr);\r
418         status = errno_to_iberr(err);\r
419 \r
420         // return the results\r
421         *p_vaddr = vaddr;\r
422         *p_lkey = p_ib_fmr->lkey;\r
423         *p_rkey = cl_hton32( p_ib_fmr->rkey );\r
424         \r
425         if (status != IB_SUCCESS) \r
426                 HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_MEMORY,\r
427                         ("ibv_map_phys_fmr failed with status %x\n", status));\r
428 \r
429         HCA_EXIT(HCA_DBG_MEMORY);\r
430         return status;\r
431 }\r
432 \r
433 \r
434 \r
435 ib_api_status_t\r
436 mlnx_unmap_fmr (\r
437         IN              const   mlnx_fmr_handle_t                       *ph_fmr)\r
438 {\r
439         int err;\r
440         struct list_head fmr_list;\r
441         ib_api_status_t status = IB_SUCCESS;\r
442         struct ib_fmr *p_ib_fmr = (struct ib_fmr *)*ph_fmr;\r
443 \r
444         HCA_ENTER(HCA_DBG_MEMORY);\r
445 \r
446         // sanity checks\r
447         if( !cl_is_blockable() ) {\r
448                         status = IB_UNSUPPORTED;\r
449                         goto err_unsupported;\r
450         }\r
451 \r
452         INIT_LIST_HEAD(&fmr_list);\r
453         while(*ph_fmr) {\r
454                 list_add_tail(&p_ib_fmr->list, &fmr_list);\r
455                 p_ib_fmr = (struct ib_fmr *)*++ph_fmr;\r
456         }\r
457 \r
458         if (list_empty(&fmr_list))\r
459                 goto done;\r
460 \r
461         p_ib_fmr = list_entry(fmr_list.Flink, struct ib_fmr, list);\r
462         err = p_ib_fmr->device->unmap_fmr(&fmr_list);\r
463         status = errno_to_iberr(err);\r
464 \r
465 err_unsupported:\r
466         if (status != IB_SUCCESS) \r
467                 HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_MEMORY,\r
468                         ("ibv_unmap_fmr failed with status %x\n", status));\r
469 \r
470 done:\r
471         HCA_EXIT(HCA_DBG_MEMORY);\r
472         return status;\r
473         \r
474         \r
475 }\r
476 \r
477 \r
478 ib_api_status_t\r
479 mlnx_dealloc_fmr (\r
480         IN              const   mlnx_fmr_handle_t                       h_fmr\r
481         )\r
482 {\r
483         int err;\r
484         ib_api_status_t status = IB_SUCCESS;\r
485         struct ib_fmr *p_ib_fmr = (struct ib_fmr *)h_fmr;\r
486         struct ib_pd *pd = p_ib_fmr->pd;\r
487 \r
488         HCA_ENTER(HCA_DBG_MEMORY);\r
489 \r
490         // sanity checks\r
491         if( !cl_is_blockable() ) {\r
492                         status = IB_UNSUPPORTED;\r
493                         goto err_unsupported;\r
494         }\r
495 \r
496         // deregister   \r
497         err = p_ib_fmr->device->dealloc_fmr(p_ib_fmr);\r
498         if (!err)\r
499                 atomic_dec(&pd->usecnt);\r
500         status = errno_to_iberr(err);\r
501 \r
502 err_unsupported:\r
503         if (status != IB_SUCCESS) \r
504                 HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_MEMORY,\r
505                         ("ibv_dealloc_fmr failed with status %x\n", status));\r
506 \r
507         HCA_EXIT(HCA_DBG_MEMORY);\r
508         return status;\r
509                 \r
510 }\r
511 \r
512 \r
513 \r
514 /*\r
515 *       Memory Window Verbs.\r
516 */\r
517 \r
518 ib_api_status_t\r
519 mlnx_create_mw (\r
520         IN              const   ib_pd_handle_t                          h_pd,\r
521                 OUT                     net32_t* const                          p_rkey,\r
522                 OUT                     ib_mw_handle_t                          *ph_mw,\r
523         IN      OUT                     ci_umv_buf_t                            *p_umv_buf )\r
524 {\r
525         UNREFERENCED_PARAMETER(h_pd);\r
526         UNREFERENCED_PARAMETER(p_rkey);\r
527         UNREFERENCED_PARAMETER(ph_mw);\r
528         UNREFERENCED_PARAMETER(p_umv_buf);\r
529         HCA_PRINT(TRACE_LEVEL_ERROR  , HCA_DBG_MEMORY  ,("mlnx_create_mw not implemented\n"));\r
530         return IB_UNSUPPORTED;\r
531 }\r
532 \r
533 ib_api_status_t\r
534 mlnx_query_mw (\r
535         IN              const   ib_mw_handle_t                          h_mw,\r
536                 OUT                     ib_pd_handle_t                          *ph_pd,\r
537                 OUT                     net32_t* const                          p_rkey,\r
538         IN      OUT                     ci_umv_buf_t                            *p_umv_buf )\r
539 {\r
540         UNREFERENCED_PARAMETER(h_mw);\r
541         UNREFERENCED_PARAMETER(ph_pd);\r
542         UNREFERENCED_PARAMETER(p_rkey);\r
543         UNREFERENCED_PARAMETER(p_umv_buf);\r
544         HCA_PRINT(TRACE_LEVEL_ERROR  , HCA_DBG_MEMORY  ,("mlnx_query_mw not implemented\n"));\r
545         return IB_UNSUPPORTED;\r
546 }\r
547 \r
548 ib_api_status_t\r
549 mlnx_destroy_mw (\r
550         IN              const   ib_mw_handle_t                          h_mw)\r
551 {\r
552         UNREFERENCED_PARAMETER(h_mw);\r
553         HCA_PRINT(TRACE_LEVEL_ERROR  , HCA_DBG_MEMORY  ,("mlnx_destroy_mw not implemented\n"));\r
554         return IB_UNSUPPORTED;\r
555 }\r
556 \r
557 \r
558 void\r
559 mlnx_mr_if(\r
560         IN      OUT                     ci_interface_t                          *p_interface )\r
561 {\r
562         p_interface->register_mr = mlnx_register_mr;\r
563         p_interface->register_pmr = mlnx_register_pmr;\r
564         p_interface->query_mr = mlnx_query_mr;\r
565         p_interface->modify_mr = mlnx_modify_mr;\r
566         p_interface->modify_pmr = mlnx_modify_pmr;\r
567         p_interface->register_smr = mlnx_register_smr;\r
568         p_interface->deregister_mr = mlnx_deregister_mr;\r
569 \r
570         p_interface->alloc_mlnx_fmr = mlnx_alloc_fmr;\r
571         p_interface->map_phys_mlnx_fmr = mlnx_map_phys_fmr;\r
572         p_interface->unmap_mlnx_fmr = mlnx_unmap_fmr;\r
573         p_interface->dealloc_mlnx_fmr = mlnx_dealloc_fmr;\r
574 \r
575         p_interface->create_mw = mlnx_create_mw;\r
576         p_interface->query_mw = mlnx_query_mw;\r
577         p_interface->destroy_mw = mlnx_destroy_mw;\r
578 }\r
579 \r
580 void\r
581 mlnx_mr_if_livefish(\r
582         IN      OUT                     ci_interface_t                          *p_interface )\r
583 {\r
584         p_interface->register_pmr = mlnx_register_pmr;\r
585         p_interface->deregister_mr = mlnx_deregister_mr;\r
586 }\r
587 \r
588 \r