Lines Matching refs:mr
59 struct mlx4_ib_mr *mr; in mlx4_ib_get_dma_mr() local
62 mr = kmalloc(sizeof *mr, GFP_KERNEL); in mlx4_ib_get_dma_mr()
63 if (!mr) in mlx4_ib_get_dma_mr()
67 ~0ull, convert_access(acc), 0, 0, &mr->mmr); in mlx4_ib_get_dma_mr()
71 err = mlx4_mr_enable(to_mdev(pd->device)->dev, &mr->mmr); in mlx4_ib_get_dma_mr()
75 mr->ibmr.rkey = mr->ibmr.lkey = mr->mmr.key; in mlx4_ib_get_dma_mr()
76 mr->umem = NULL; in mlx4_ib_get_dma_mr()
78 return &mr->ibmr; in mlx4_ib_get_dma_mr()
81 (void) mlx4_mr_free(to_mdev(pd->device)->dev, &mr->mmr); in mlx4_ib_get_dma_mr()
84 kfree(mr); in mlx4_ib_get_dma_mr()
138 struct mlx4_ib_mr *mr; in mlx4_ib_reg_user_mr() local
143 mr = kmalloc(sizeof *mr, GFP_KERNEL); in mlx4_ib_reg_user_mr()
144 if (!mr) in mlx4_ib_reg_user_mr()
149 mr->umem = ib_umem_get(pd->uobject->context, start, length, in mlx4_ib_reg_user_mr()
151 if (IS_ERR(mr->umem)) { in mlx4_ib_reg_user_mr()
152 err = PTR_ERR(mr->umem); in mlx4_ib_reg_user_mr()
156 n = ib_umem_page_count(mr->umem); in mlx4_ib_reg_user_mr()
157 shift = ilog2(mr->umem->page_size); in mlx4_ib_reg_user_mr()
160 convert_access(access_flags), n, shift, &mr->mmr); in mlx4_ib_reg_user_mr()
164 err = mlx4_ib_umem_write_mtt(dev, &mr->mmr.mtt, mr->umem); in mlx4_ib_reg_user_mr()
168 err = mlx4_mr_enable(dev->dev, &mr->mmr); in mlx4_ib_reg_user_mr()
172 mr->ibmr.rkey = mr->ibmr.lkey = mr->mmr.key; in mlx4_ib_reg_user_mr()
174 return &mr->ibmr; in mlx4_ib_reg_user_mr()
177 (void) mlx4_mr_free(to_mdev(pd->device)->dev, &mr->mmr); in mlx4_ib_reg_user_mr()
180 ib_umem_release(mr->umem); in mlx4_ib_reg_user_mr()
183 kfree(mr); in mlx4_ib_reg_user_mr()
188 int mlx4_ib_rereg_user_mr(struct ib_mr *mr, int flags, in mlx4_ib_rereg_user_mr() argument
193 struct mlx4_ib_dev *dev = to_mdev(mr->device); in mlx4_ib_rereg_user_mr()
194 struct mlx4_ib_mr *mmr = to_mmr(mr); in mlx4_ib_rereg_user_mr()
231 mmr->umem = ib_umem_get(mr->uobject->context, start, length, in mlx4_ib_rereg_user_mr()
277 struct mlx4_ib_mr *mr = to_mmr(ibmr); in mlx4_ib_dereg_mr() local
280 ret = mlx4_mr_free(to_mdev(ibmr->device)->dev, &mr->mmr); in mlx4_ib_dereg_mr()
283 if (mr->umem) in mlx4_ib_dereg_mr()
284 ib_umem_release(mr->umem); in mlx4_ib_dereg_mr()
285 kfree(mr); in mlx4_ib_dereg_mr()
358 struct mlx4_ib_mr *mr; in mlx4_ib_alloc_fast_reg_mr() local
361 mr = kmalloc(sizeof *mr, GFP_KERNEL); in mlx4_ib_alloc_fast_reg_mr()
362 if (!mr) in mlx4_ib_alloc_fast_reg_mr()
366 max_page_list_len, 0, &mr->mmr); in mlx4_ib_alloc_fast_reg_mr()
370 err = mlx4_mr_enable(dev->dev, &mr->mmr); in mlx4_ib_alloc_fast_reg_mr()
374 mr->ibmr.rkey = mr->ibmr.lkey = mr->mmr.key; in mlx4_ib_alloc_fast_reg_mr()
375 mr->umem = NULL; in mlx4_ib_alloc_fast_reg_mr()
377 return &mr->ibmr; in mlx4_ib_alloc_fast_reg_mr()
380 (void) mlx4_mr_free(dev->dev, &mr->mmr); in mlx4_ib_alloc_fast_reg_mr()
383 kfree(mr); in mlx4_ib_alloc_fast_reg_mr()
454 fmr->ibfmr.rkey = fmr->ibfmr.lkey = fmr->mfmr.mr.key; in mlx4_ib_fmr_alloc()
459 (void) mlx4_mr_free(to_mdev(pd->device)->dev, &fmr->mfmr.mr); in mlx4_ib_fmr_alloc()