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