Lines Matching refs:mtt
201 struct mlx4_mtt *mtt) in mlx4_mtt_init() argument
206 mtt->order = -1; in mlx4_mtt_init()
207 mtt->page_shift = MLX4_ICM_PAGE_SHIFT; in mlx4_mtt_init()
210 mtt->page_shift = page_shift; in mlx4_mtt_init()
212 for (mtt->order = 0, i = dev->caps.mtts_per_seg; i < npages; i <<= 1) in mlx4_mtt_init()
213 ++mtt->order; in mlx4_mtt_init()
215 mtt->first_seg = mlx4_alloc_mtt_range(dev, mtt->order); in mlx4_mtt_init()
216 if (mtt->first_seg == -1) in mlx4_mtt_init()
223 void mlx4_mtt_cleanup(struct mlx4_dev *dev, struct mlx4_mtt *mtt) in mlx4_mtt_cleanup() argument
227 if (mtt->order < 0) in mlx4_mtt_cleanup()
230 mlx4_buddy_free(&mr_table->mtt_buddy, mtt->first_seg, mtt->order); in mlx4_mtt_cleanup()
231 mlx4_table_put_range(dev, &mr_table->mtt_table, mtt->first_seg, in mlx4_mtt_cleanup()
232 mtt->first_seg + (1 << mtt->order) - 1); in mlx4_mtt_cleanup()
236 u64 mlx4_mtt_addr(struct mlx4_dev *dev, struct mlx4_mtt *mtt) in mlx4_mtt_addr() argument
238 return (u64) mtt->first_seg * dev->caps.mtt_entry_sz; in mlx4_mtt_addr()
284 err = mlx4_mtt_init(dev, npages, page_shift, &mr->mtt); in mlx4_mr_alloc()
305 mlx4_mtt_cleanup(dev, &mr->mtt); in mlx4_mr_free()
338 mpt_entry->entity_size = cpu_to_be32(mr->mtt.page_shift); in mlx4_mr_enable()
340 if (mr->mtt.order < 0) { in mlx4_mr_enable()
344 mpt_entry->mtt_seg = cpu_to_be64(mlx4_mtt_addr(dev, &mr->mtt)); in mlx4_mr_enable()
347 if (mr->mtt.order >= 0 && mr->mtt.page_shift == 0) { in mlx4_mr_enable()
352 mpt_entry->mtt_sz = cpu_to_be32((1 << mr->mtt.order) * in mlx4_mr_enable()
380 static int mlx4_write_mtt_chunk(struct mlx4_dev *dev, struct mlx4_mtt *mtt, in mlx4_write_mtt_chunk() argument
397 mtts = mlx4_table_find(&priv->mr_table.mtt_table, mtt->first_seg + in mlx4_write_mtt_chunk()
414 int mlx4_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, in mlx4_write_mtt() argument
420 if (mtt->order < 0) in mlx4_write_mtt()
425 err = mlx4_write_mtt_chunk(dev, mtt, start_index, chunk, page_list); in mlx4_write_mtt()
438 int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, in mlx4_buf_write_mtt() argument
455 err = mlx4_write_mtt(dev, mtt, 0, buf->npages, page_list); in mlx4_buf_write_mtt()
603 mtt_seg = fmr->mr.mtt.first_seg * dev->caps.mtt_entry_sz; in mlx4_fmr_alloc()
606 fmr->mr.mtt.first_seg, in mlx4_fmr_alloc()