• Home
  • Raw
  • Download

Lines Matching refs:mr

69 	struct mlx5_ib_mr *mr = context;  in reg_mr_callback()  local
70 struct mlx5_ib_dev *dev = mr->dev; in reg_mr_callback()
72 int c = order2idx(dev, mr->order); in reg_mr_callback()
84 kfree(mr); in reg_mr_callback()
90 if (mr->out.hdr.status) { in reg_mr_callback()
92 mr->out.hdr.status, in reg_mr_callback()
93 be32_to_cpu(mr->out.hdr.syndrome)); in reg_mr_callback()
94 kfree(mr); in reg_mr_callback()
103 mr->mmr.key = mlx5_idx_to_mkey(be32_to_cpu(mr->out.mkey) & 0xffffff) | key; in reg_mr_callback()
108 list_add_tail(&mr->list, &ent->head); in reg_mr_callback()
114 err = radix_tree_insert(&table->tree, mlx5_base_mkey(mr->mmr.key), in reg_mr_callback()
115 &mr->mmr); in reg_mr_callback()
126 struct mlx5_ib_mr *mr; in add_keys() local
141 mr = kzalloc(sizeof(*mr), GFP_KERNEL); in add_keys()
142 if (!mr) { in add_keys()
146 mr->order = ent->order; in add_keys()
147 mr->umred = 1; in add_keys()
148 mr->dev = dev; in add_keys()
158 err = mlx5_core_create_mkey(dev->mdev, &mr->mmr, in, in add_keys()
160 mr, &mr->out); in add_keys()
163 kfree(mr); in add_keys()
176 struct mlx5_ib_mr *mr; in remove_keys() local
186 mr = list_first_entry(&ent->head, struct mlx5_ib_mr, list); in remove_keys()
187 list_del(&mr->list); in remove_keys()
191 err = mlx5_core_destroy_mkey(dev->mdev, &mr->mmr); in remove_keys()
195 kfree(mr); in remove_keys()
398 struct mlx5_ib_mr *mr = NULL; in alloc_cached_mr() local
416 mr = list_first_entry(&ent->head, struct mlx5_ib_mr, in alloc_cached_mr()
418 list_del(&mr->list); in alloc_cached_mr()
429 if (mr) in alloc_cached_mr()
433 if (!mr) in alloc_cached_mr()
436 return mr; in alloc_cached_mr()
439 static void free_cached_mr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr) in free_cached_mr() argument
446 c = order2idx(dev, mr->order); in free_cached_mr()
448 mlx5_ib_warn(dev, "order %d, cache index %d\n", mr->order, c); in free_cached_mr()
453 list_add_tail(&mr->list, &ent->head); in free_cached_mr()
467 struct mlx5_ib_mr *mr; in clean_keys() local
477 mr = list_first_entry(&ent->head, struct mlx5_ib_mr, list); in clean_keys()
478 list_del(&mr->list); in clean_keys()
482 err = mlx5_core_destroy_mkey(dev->mdev, &mr->mmr); in clean_keys()
486 kfree(mr); in clean_keys()
616 struct mlx5_ib_mr *mr; in mlx5_ib_get_dma_mr() local
619 mr = kzalloc(sizeof(*mr), GFP_KERNEL); in mlx5_ib_get_dma_mr()
620 if (!mr) in mlx5_ib_get_dma_mr()
635 err = mlx5_core_create_mkey(mdev, &mr->mmr, in, sizeof(*in), NULL, NULL, in mlx5_ib_get_dma_mr()
641 mr->ibmr.lkey = mr->mmr.key; in mlx5_ib_get_dma_mr()
642 mr->ibmr.rkey = mr->mmr.key; in mlx5_ib_get_dma_mr()
643 mr->umem = NULL; in mlx5_ib_get_dma_mr()
645 return &mr->ibmr; in mlx5_ib_get_dma_mr()
651 kfree(mr); in mlx5_ib_get_dma_mr()
677 struct ib_mr *mr = dev->umrc.mr; in prep_umr_reg_wqe() local
681 sg->lkey = mr->lkey; in prep_umr_reg_wqe()
740 struct mlx5_ib_mr *mr; in reg_umr() local
747 mr = alloc_cached_mr(dev, order); in reg_umr()
748 if (mr) in reg_umr()
758 if (!mr) in reg_umr()
761 mr->pas = kmalloc(size + MLX5_UMR_ALIGN - 1, GFP_KERNEL); in reg_umr()
762 if (!mr->pas) { in reg_umr()
768 mr_align(mr->pas, MLX5_UMR_ALIGN), 1); in reg_umr()
770 mr->dma = dma_map_single(ddev, mr_align(mr->pas, MLX5_UMR_ALIGN), size, in reg_umr()
772 if (dma_mapping_error(ddev, mr->dma)) { in reg_umr()
779 …prep_umr_reg_wqe(pd, &wr, &sg, mr->dma, npages, mr->mmr.key, page_shift, virt_addr, len, access_fl… in reg_umr()
795 mr->mmr.iova = virt_addr; in reg_umr()
796 mr->mmr.size = len; in reg_umr()
797 mr->mmr.pd = to_mpd(pd)->pdn; in reg_umr()
801 dma_unmap_single(ddev, mr->dma, size, DMA_TO_DEVICE); in reg_umr()
804 kfree(mr->pas); in reg_umr()
808 free_cached_mr(dev, mr); in reg_umr()
812 return mr; in reg_umr()
822 struct mlx5_ib_mr *mr; in reg_create() local
826 mr = kzalloc(sizeof(*mr), GFP_KERNEL); in reg_create()
827 if (!mr) in reg_create()
849 err = mlx5_core_create_mkey(dev->mdev, &mr->mmr, in, inlen, NULL, in reg_create()
855 mr->umem = umem; in reg_create()
858 mlx5_ib_dbg(dev, "mkey = 0x%x\n", mr->mmr.key); in reg_create()
860 return mr; in reg_create()
866 kfree(mr); in reg_create()
876 struct mlx5_ib_mr *mr = NULL; in mlx5_ib_reg_user_mr() local
904 mr = reg_umr(pd, umem, virt_addr, length, ncont, page_shift, in mlx5_ib_reg_user_mr()
906 if (PTR_ERR(mr) == -EAGAIN) { in mlx5_ib_reg_user_mr()
908 mr = NULL; in mlx5_ib_reg_user_mr()
912 if (!mr) in mlx5_ib_reg_user_mr()
913 mr = reg_create(pd, virt_addr, length, umem, ncont, page_shift, in mlx5_ib_reg_user_mr()
916 if (IS_ERR(mr)) { in mlx5_ib_reg_user_mr()
917 err = PTR_ERR(mr); in mlx5_ib_reg_user_mr()
921 mlx5_ib_dbg(dev, "mkey 0x%x\n", mr->mmr.key); in mlx5_ib_reg_user_mr()
923 mr->umem = umem; in mlx5_ib_reg_user_mr()
924 mr->npages = npages; in mlx5_ib_reg_user_mr()
928 mr->ibmr.lkey = mr->mmr.key; in mlx5_ib_reg_user_mr()
929 mr->ibmr.rkey = mr->mmr.key; in mlx5_ib_reg_user_mr()
931 return &mr->ibmr; in mlx5_ib_reg_user_mr()
938 static int unreg_umr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr) in unreg_umr() argument
947 prep_umr_unreg_wqe(dev, &wr, mr->mmr.key); in unreg_umr()
974 struct mlx5_ib_mr *mr = to_mmr(ibmr); in mlx5_ib_dereg_mr() local
975 struct ib_umem *umem = mr->umem; in mlx5_ib_dereg_mr()
976 int npages = mr->npages; in mlx5_ib_dereg_mr()
977 int umred = mr->umred; in mlx5_ib_dereg_mr()
981 err = mlx5_core_destroy_mkey(dev->mdev, &mr->mmr); in mlx5_ib_dereg_mr()
984 mr->mmr.key, err); in mlx5_ib_dereg_mr()
988 err = unreg_umr(dev, mr); in mlx5_ib_dereg_mr()
993 free_cached_mr(dev, mr); in mlx5_ib_dereg_mr()
1004 kfree(mr); in mlx5_ib_dereg_mr()
1014 struct mlx5_ib_mr *mr; in mlx5_ib_create_mr() local
1018 mr = kzalloc(sizeof(*mr), GFP_KERNEL); in mlx5_ib_create_mr()
1019 if (!mr) in mlx5_ib_create_mr()
1040 mr->sig = kzalloc(sizeof(*mr->sig), GFP_KERNEL); in mlx5_ib_create_mr()
1041 if (!mr->sig) { in mlx5_ib_create_mr()
1053 mr->sig->psv_memory.psv_idx = psv_index[0]; in mlx5_ib_create_mr()
1054 mr->sig->psv_wire.psv_idx = psv_index[1]; in mlx5_ib_create_mr()
1056 mr->sig->sig_status_checked = true; in mlx5_ib_create_mr()
1057 mr->sig->sig_err_exists = false; in mlx5_ib_create_mr()
1059 ++mr->sig->sigerr_count; in mlx5_ib_create_mr()
1063 err = mlx5_core_create_mkey(dev->mdev, &mr->mmr, in, sizeof(*in), in mlx5_ib_create_mr()
1068 mr->ibmr.lkey = mr->mmr.key; in mlx5_ib_create_mr()
1069 mr->ibmr.rkey = mr->mmr.key; in mlx5_ib_create_mr()
1070 mr->umem = NULL; in mlx5_ib_create_mr()
1073 return &mr->ibmr; in mlx5_ib_create_mr()
1076 if (mr->sig) { in mlx5_ib_create_mr()
1078 mr->sig->psv_memory.psv_idx)) in mlx5_ib_create_mr()
1080 mr->sig->psv_memory.psv_idx); in mlx5_ib_create_mr()
1082 mr->sig->psv_wire.psv_idx)) in mlx5_ib_create_mr()
1084 mr->sig->psv_wire.psv_idx); in mlx5_ib_create_mr()
1087 kfree(mr->sig); in mlx5_ib_create_mr()
1091 kfree(mr); in mlx5_ib_create_mr()
1098 struct mlx5_ib_mr *mr = to_mmr(ibmr); in mlx5_ib_destroy_mr() local
1101 if (mr->sig) { in mlx5_ib_destroy_mr()
1103 mr->sig->psv_memory.psv_idx)) in mlx5_ib_destroy_mr()
1105 mr->sig->psv_memory.psv_idx); in mlx5_ib_destroy_mr()
1107 mr->sig->psv_wire.psv_idx)) in mlx5_ib_destroy_mr()
1109 mr->sig->psv_wire.psv_idx); in mlx5_ib_destroy_mr()
1110 kfree(mr->sig); in mlx5_ib_destroy_mr()
1113 err = mlx5_core_destroy_mkey(dev->mdev, &mr->mmr); in mlx5_ib_destroy_mr()
1116 mr->mmr.key, err); in mlx5_ib_destroy_mr()
1120 kfree(mr); in mlx5_ib_destroy_mr()
1130 struct mlx5_ib_mr *mr; in mlx5_ib_alloc_fast_reg_mr() local
1133 mr = kzalloc(sizeof(*mr), GFP_KERNEL); in mlx5_ib_alloc_fast_reg_mr()
1134 if (!mr) in mlx5_ib_alloc_fast_reg_mr()
1152 err = mlx5_core_create_mkey(dev->mdev, &mr->mmr, in, sizeof(*in), NULL, in mlx5_ib_alloc_fast_reg_mr()
1158 mr->ibmr.lkey = mr->mmr.key; in mlx5_ib_alloc_fast_reg_mr()
1159 mr->ibmr.rkey = mr->mmr.key; in mlx5_ib_alloc_fast_reg_mr()
1160 mr->umem = NULL; in mlx5_ib_alloc_fast_reg_mr()
1162 return &mr->ibmr; in mlx5_ib_alloc_fast_reg_mr()
1165 kfree(mr); in mlx5_ib_alloc_fast_reg_mr()