RDMA/mlx5: Introduce and reuse helper to identify ODP MR

Consolidate various checks if MR is ODP backed to one simple helper and
update call sites to use it.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
Leon Romanovsky
2019-01-08 16:07:25 +02:00
committed by Jason Gunthorpe
parent e502b8b011
commit 8b4d5bc5cf
3 changed files with 16 additions and 13 deletions

View File

@@ -103,7 +103,7 @@ static int check_parent(struct ib_umem_odp *odp,
struct ib_ucontext_per_mm *mr_to_per_mm(struct mlx5_ib_mr *mr)
{
if (WARN_ON(!mr || !mr->umem || !mr->umem->is_odp))
if (WARN_ON(!mr || !is_odp_mr(mr)))
return NULL;
return to_ib_umem_odp(mr->umem)->per_mm;
@@ -739,12 +739,12 @@ next_mr:
goto srcu_unlock;
}
if (prefetch && !mr->umem->is_odp) {
if (prefetch && !is_odp_mr(mr)) {
ret = -EINVAL;
goto srcu_unlock;
}
if (!mr->umem->is_odp) {
if (!is_odp_mr(mr)) {
mlx5_ib_dbg(dev, "skipping non ODP MR (lkey=0x%06x) in page fault handler.\n",
key);
if (bytes_mapped)