forked from Minki/linux
IB/mlx5: Consolidate use_umr checks into single function
Introduce helper function to unify various use_umr checks. Signed-off-by: Moni Shoua <monis@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Link: https://lore.kernel.org/r/20190815083834.9245-6-leon@kernel.org Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
60c78668ae
commit
0e6613b41e
@ -1475,4 +1475,18 @@ int bfregn_to_uar_index(struct mlx5_ib_dev *dev,
|
|||||||
bool dyn_bfreg);
|
bool dyn_bfreg);
|
||||||
|
|
||||||
int mlx5_ib_qp_set_counter(struct ib_qp *qp, struct rdma_counter *counter);
|
int mlx5_ib_qp_set_counter(struct ib_qp *qp, struct rdma_counter *counter);
|
||||||
|
|
||||||
|
static inline bool mlx5_ib_can_use_umr(struct mlx5_ib_dev *dev,
|
||||||
|
bool do_modify_atomic)
|
||||||
|
{
|
||||||
|
if (MLX5_CAP_GEN(dev->mdev, umr_modify_entity_size_disabled))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (do_modify_atomic &&
|
||||||
|
MLX5_CAP_GEN(dev->mdev, atomic) &&
|
||||||
|
MLX5_CAP_GEN(dev->mdev, umr_modify_atomic_disabled))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
#endif /* MLX5_IB_H */
|
#endif /* MLX5_IB_H */
|
||||||
|
@ -1293,9 +1293,7 @@ struct ib_mr *mlx5_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
|
|||||||
if (err < 0)
|
if (err < 0)
|
||||||
return ERR_PTR(err);
|
return ERR_PTR(err);
|
||||||
|
|
||||||
use_umr = !MLX5_CAP_GEN(dev->mdev, umr_modify_entity_size_disabled) &&
|
use_umr = mlx5_ib_can_use_umr(dev, true);
|
||||||
(!MLX5_CAP_GEN(dev->mdev, umr_modify_atomic_disabled) ||
|
|
||||||
!MLX5_CAP_GEN(dev->mdev, atomic));
|
|
||||||
|
|
||||||
if (order <= mr_cache_max_order(dev) && use_umr) {
|
if (order <= mr_cache_max_order(dev) && use_umr) {
|
||||||
mr = alloc_mr_from_cache(pd, umem, virt_addr, length, ncont,
|
mr = alloc_mr_from_cache(pd, umem, virt_addr, length, ncont,
|
||||||
|
Loading…
Reference in New Issue
Block a user