Lines Matching refs:mtt

209 	struct mthca_mtt *mtt;  in __mthca_alloc_mtt()  local
215 mtt = kmalloc(sizeof *mtt, GFP_KERNEL); in __mthca_alloc_mtt()
216 if (!mtt) in __mthca_alloc_mtt()
219 mtt->buddy = buddy; in __mthca_alloc_mtt()
220 mtt->order = 0; in __mthca_alloc_mtt()
222 ++mtt->order; in __mthca_alloc_mtt()
224 mtt->first_seg = mthca_alloc_mtt_range(dev, mtt->order, buddy); in __mthca_alloc_mtt()
225 if (mtt->first_seg == -1) { in __mthca_alloc_mtt()
226 kfree(mtt); in __mthca_alloc_mtt()
230 return mtt; in __mthca_alloc_mtt()
238 void mthca_free_mtt(struct mthca_dev *dev, struct mthca_mtt *mtt) in mthca_free_mtt() argument
240 if (!mtt) in mthca_free_mtt()
243 mthca_buddy_free(mtt->buddy, mtt->first_seg, mtt->order); in mthca_free_mtt()
246 mtt->first_seg, in mthca_free_mtt()
247 mtt->first_seg + (1 << mtt->order) - 1); in mthca_free_mtt()
249 kfree(mtt); in mthca_free_mtt()
252 static int __mthca_write_mtt(struct mthca_dev *dev, struct mthca_mtt *mtt, in __mthca_write_mtt() argument
267 mtt->first_seg * dev->limits.mtt_seg_size + in __mthca_write_mtt()
314 struct mthca_mtt *mtt, int start_index, in mthca_tavor_write_mtt_seg() argument
320 mtts = dev->mr_table.tavor_fmr.mtt_base + mtt->first_seg * dev->limits.mtt_seg_size + in mthca_tavor_write_mtt_seg()
328 struct mthca_mtt *mtt, int start_index, in mthca_arbel_write_mtt_seg() argument
341 mtts = mthca_table_find(dev->mr_table.mtt_table, mtt->first_seg + in mthca_arbel_write_mtt_seg()
356 int mthca_write_mtt(struct mthca_dev *dev, struct mthca_mtt *mtt, in mthca_write_mtt() argument
364 return __mthca_write_mtt(dev, mtt, start_index, buffer_list, list_len); in mthca_write_mtt()
369 mthca_arbel_write_mtt_seg(dev, mtt, start_index, in mthca_write_mtt()
372 mthca_tavor_write_mtt_seg(dev, mtt, start_index, in mthca_write_mtt()
461 if (!mr->mtt) in mthca_mr_alloc()
472 if (mr->mtt) in mthca_mr_alloc()
475 mr->mtt->first_seg * dev->limits.mtt_seg_size); in mthca_mr_alloc()
512 mr->mtt = NULL; in mthca_mr_alloc_notrans()
523 mr->mtt = mthca_alloc_mtt(dev, list_len); in mthca_mr_alloc_phys()
524 if (IS_ERR(mr->mtt)) in mthca_mr_alloc_phys()
525 return PTR_ERR(mr->mtt); in mthca_mr_alloc_phys()
527 err = mthca_write_mtt(dev, mr->mtt, 0, buffer_list, list_len); in mthca_mr_alloc_phys()
529 mthca_free_mtt(dev, mr->mtt); in mthca_mr_alloc_phys()
536 mthca_free_mtt(dev, mr->mtt); in mthca_mr_alloc_phys()
561 mthca_free_mtt(dev, mr->mtt); in mthca_free_mr()