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
269 mtt->first_seg * dev->limits.mtt_seg_size + in __mthca_write_mtt()
316 struct mthca_mtt *mtt, int start_index, in mthca_tavor_write_mtt_seg() argument
322 mtts = dev->mr_table.tavor_fmr.mtt_base + mtt->first_seg * dev->limits.mtt_seg_size + in mthca_tavor_write_mtt_seg()
330 struct mthca_mtt *mtt, int start_index, in mthca_arbel_write_mtt_seg() argument
343 mtts = mthca_table_find(dev->mr_table.mtt_table, mtt->first_seg + in mthca_arbel_write_mtt_seg()
358 int mthca_write_mtt(struct mthca_dev *dev, struct mthca_mtt *mtt, in mthca_write_mtt() argument
366 return __mthca_write_mtt(dev, mtt, start_index, buffer_list, list_len); in mthca_write_mtt()
371 mthca_arbel_write_mtt_seg(dev, mtt, start_index, in mthca_write_mtt()
374 mthca_tavor_write_mtt_seg(dev, mtt, start_index, in mthca_write_mtt()
463 if (!mr->mtt) in mthca_mr_alloc()
475 if (mr->mtt) in mthca_mr_alloc()
478 mr->mtt->first_seg * dev->limits.mtt_seg_size); in mthca_mr_alloc()
515 mr->mtt = NULL; in mthca_mr_alloc_notrans()
526 mr->mtt = mthca_alloc_mtt(dev, list_len); in mthca_mr_alloc_phys()
527 if (IS_ERR(mr->mtt)) in mthca_mr_alloc_phys()
528 return PTR_ERR(mr->mtt); in mthca_mr_alloc_phys()
530 err = mthca_write_mtt(dev, mr->mtt, 0, buffer_list, list_len); in mthca_mr_alloc_phys()
532 mthca_free_mtt(dev, mr->mtt); in mthca_mr_alloc_phys()
539 mthca_free_mtt(dev, mr->mtt); in mthca_mr_alloc_phys()
564 mthca_free_mtt(dev, mr->mtt); in mthca_free_mr()