Lines Matching full:mr

306 		mlx4_warn(dev, "Most likely the MR has MWs bound to it.\n");  in mlx4_mr_hw_get_mpt()
419 int page_shift, struct mlx4_mr *mr) in mlx4_mr_alloc_reserved() argument
421 mr->iova = iova; in mlx4_mr_alloc_reserved()
422 mr->size = size; in mlx4_mr_alloc_reserved()
423 mr->pd = pd; in mlx4_mr_alloc_reserved()
424 mr->access = access; in mlx4_mr_alloc_reserved()
425 mr->enabled = MLX4_MPT_DISABLED; in mlx4_mr_alloc_reserved()
426 mr->key = hw_index_to_key(mridx); in mlx4_mr_alloc_reserved()
428 return mlx4_mtt_init(dev, npages, page_shift, &mr->mtt); in mlx4_mr_alloc_reserved()
476 mlx4_warn(dev, "Failed to release mr index:%d\n", in mlx4_mpt_release()
520 mlx4_warn(dev, "Failed to free icm of mr index:%d\n", in mlx4_mpt_free_icm()
528 int npages, int page_shift, struct mlx4_mr *mr) in mlx4_mr_alloc() argument
538 access, npages, page_shift, mr); in mlx4_mr_alloc()
546 static int mlx4_mr_free_reserved(struct mlx4_dev *dev, struct mlx4_mr *mr) in mlx4_mr_free_reserved() argument
550 if (mr->enabled == MLX4_MPT_EN_HW) { in mlx4_mr_free_reserved()
552 key_to_hw_index(mr->key) & in mlx4_mr_free_reserved()
555 mlx4_warn(dev, "HW2SW_MPT failed (%d), MR has MWs bound to it\n", in mlx4_mr_free_reserved()
560 mr->enabled = MLX4_MPT_EN_SW; in mlx4_mr_free_reserved()
562 mlx4_mtt_cleanup(dev, &mr->mtt); in mlx4_mr_free_reserved()
567 int mlx4_mr_free(struct mlx4_dev *dev, struct mlx4_mr *mr) in mlx4_mr_free() argument
571 ret = mlx4_mr_free_reserved(dev, mr); in mlx4_mr_free()
574 if (mr->enabled) in mlx4_mr_free()
575 mlx4_mpt_free_icm(dev, key_to_hw_index(mr->key)); in mlx4_mr_free()
576 mlx4_mpt_release(dev, key_to_hw_index(mr->key)); in mlx4_mr_free()
582 void mlx4_mr_rereg_mem_cleanup(struct mlx4_dev *dev, struct mlx4_mr *mr) in mlx4_mr_rereg_mem_cleanup() argument
584 mlx4_mtt_cleanup(dev, &mr->mtt); in mlx4_mr_rereg_mem_cleanup()
585 mr->mtt.order = -1; in mlx4_mr_rereg_mem_cleanup()
589 int mlx4_mr_rereg_mem_write(struct mlx4_dev *dev, struct mlx4_mr *mr, in mlx4_mr_rereg_mem_write() argument
595 err = mlx4_mtt_init(dev, npages, page_shift, &mr->mtt); in mlx4_mr_rereg_mem_write()
604 if (mr->mtt.order < 0) { in mlx4_mr_rereg_mem_write()
609 &mr->mtt)); in mlx4_mr_rereg_mem_write()
610 if (mr->mtt.page_shift == 0) in mlx4_mr_rereg_mem_write()
611 mpt_entry->mtt_sz = cpu_to_be32(1 << mr->mtt.order); in mlx4_mr_rereg_mem_write()
613 if (mr->mtt.order >= 0 && mr->mtt.page_shift == 0) { in mlx4_mr_rereg_mem_write()
614 /* fast register MR in free state */ in mlx4_mr_rereg_mem_write()
621 mr->enabled = MLX4_MPT_EN_SW; in mlx4_mr_rereg_mem_write()
627 int mlx4_mr_enable(struct mlx4_dev *dev, struct mlx4_mr *mr) in mlx4_mr_enable() argument
633 err = mlx4_mpt_alloc_icm(dev, key_to_hw_index(mr->key)); in mlx4_mr_enable()
645 mr->access); in mlx4_mr_enable()
647 mpt_entry->key = cpu_to_be32(key_to_hw_index(mr->key)); in mlx4_mr_enable()
648 mpt_entry->pd_flags = cpu_to_be32(mr->pd | MLX4_MPT_PD_FLAG_EN_INV); in mlx4_mr_enable()
649 mpt_entry->start = cpu_to_be64(mr->iova); in mlx4_mr_enable()
650 mpt_entry->length = cpu_to_be64(mr->size); in mlx4_mr_enable()
651 mpt_entry->entity_size = cpu_to_be32(mr->mtt.page_shift); in mlx4_mr_enable()
653 if (mr->mtt.order < 0) { in mlx4_mr_enable()
658 &mr->mtt)); in mlx4_mr_enable()
661 if (mr->mtt.order >= 0 && mr->mtt.page_shift == 0) { in mlx4_mr_enable()
662 /* fast register MR in free state */ in mlx4_mr_enable()
666 mpt_entry->mtt_sz = cpu_to_be32(1 << mr->mtt.order); in mlx4_mr_enable()
672 key_to_hw_index(mr->key) & (dev->caps.num_mpts - 1)); in mlx4_mr_enable()
677 mr->enabled = MLX4_MPT_EN_HW; in mlx4_mr_enable()
687 mlx4_mpt_free_icm(dev, key_to_hw_index(mr->key)); in mlx4_mr_enable()
913 /* Nothing to do for slaves - all MR handling is forwarded in mlx4_init_mr_table()