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