Lines Matching refs:mtt

211 	struct mthca_mtt *mtt;  in __mthca_alloc_mtt()  local
217 mtt = kmalloc(sizeof *mtt, GFP_KERNEL); in __mthca_alloc_mtt()
218 if (!mtt) in __mthca_alloc_mtt()
221 mtt->buddy = buddy; in __mthca_alloc_mtt()
222 mtt->order = 0; in __mthca_alloc_mtt()
224 ++mtt->order; in __mthca_alloc_mtt()
226 mtt->first_seg = mthca_alloc_mtt_range(dev, mtt->order, buddy); in __mthca_alloc_mtt()
227 if (mtt->first_seg == -1) { in __mthca_alloc_mtt()
228 kfree(mtt); in __mthca_alloc_mtt()
232 return mtt; in __mthca_alloc_mtt()
240 void mthca_free_mtt(struct mthca_dev *dev, struct mthca_mtt *mtt) in mthca_free_mtt() argument
242 if (!mtt) in mthca_free_mtt()
245 mthca_buddy_free(mtt->buddy, mtt->first_seg, mtt->order); in mthca_free_mtt()
248 mtt->first_seg, in mthca_free_mtt()
249 mtt->first_seg + (1 << mtt->order) - 1); in mthca_free_mtt()
251 kfree(mtt); in mthca_free_mtt()
254 static int __mthca_write_mtt(struct mthca_dev *dev, struct mthca_mtt *mtt, in __mthca_write_mtt() argument
270 mtt->first_seg * dev->limits.mtt_seg_size + in __mthca_write_mtt()
323 struct mthca_mtt *mtt, int start_index, in mthca_tavor_write_mtt_seg() argument
329 mtts = dev->mr_table.tavor_fmr.mtt_base + mtt->first_seg * dev->limits.mtt_seg_size + in mthca_tavor_write_mtt_seg()
337 struct mthca_mtt *mtt, int start_index, in mthca_arbel_write_mtt_seg() argument
350 mtts = mthca_table_find(dev->mr_table.mtt_table, mtt->first_seg + in mthca_arbel_write_mtt_seg()
365 int mthca_write_mtt(struct mthca_dev *dev, struct mthca_mtt *mtt, in mthca_write_mtt() argument
373 return __mthca_write_mtt(dev, mtt, start_index, buffer_list, list_len); in mthca_write_mtt()
378 mthca_arbel_write_mtt_seg(dev, mtt, start_index, in mthca_write_mtt()
381 mthca_tavor_write_mtt_seg(dev, mtt, start_index, in mthca_write_mtt()
471 if (!mr->mtt) in mthca_mr_alloc()
483 if (mr->mtt) in mthca_mr_alloc()
486 mr->mtt->first_seg * dev->limits.mtt_seg_size); in mthca_mr_alloc()
529 mr->mtt = NULL; in mthca_mr_alloc_notrans()
540 mr->mtt = mthca_alloc_mtt(dev, list_len); in mthca_mr_alloc_phys()
541 if (IS_ERR(mr->mtt)) in mthca_mr_alloc_phys()
542 return PTR_ERR(mr->mtt); in mthca_mr_alloc_phys()
544 err = mthca_write_mtt(dev, mr->mtt, 0, buffer_list, list_len); in mthca_mr_alloc_phys()
546 mthca_free_mtt(dev, mr->mtt); in mthca_mr_alloc_phys()
553 mthca_free_mtt(dev, mr->mtt); in mthca_mr_alloc_phys()
583 mthca_free_mtt(dev, mr->mtt); in mthca_free_mr()
627 mr->mtt = __mthca_alloc_mtt(dev, list_len, dev->mr_table.fmr_mtt_buddy); in mthca_fmr_alloc()
628 if (IS_ERR(mr->mtt)) { in mthca_fmr_alloc()
629 err = PTR_ERR(mr->mtt); in mthca_fmr_alloc()
633 mtt_seg = mr->mtt->first_seg * dev->limits.mtt_seg_size; in mthca_fmr_alloc()
637 mr->mtt->first_seg, in mthca_fmr_alloc()
695 mthca_free_mtt(dev, mr->mtt); in mthca_fmr_alloc()
711 mthca_free_mtt(dev, fmr->mtt); in mthca_free_fmr()