Skip to content

Commit 0081575

Browse files
monis410dledford
authored andcommitted
IB/mlx5: Report and handle ODP support properly
ODP depends on the several device capabilities, among them is the ability to send UMR WQEs with that modify atomic and entity size of the MR. Therefore, only if all conditions to send such a UMR WQE are met then driver can report that ODP is supported. Use this check of conditions in all places where driver needs to know about ODP support. Also, implicit ODP support depends on ability of driver to send UMR WQEs for an indirect mkey. Therefore, verify that all conditions to do so are met when reporting support. Fixes: c8d75a9 ("IB/mlx5: Respect new UMR capabilities") Signed-off-by: Moni Shoua <[email protected]> Reviewed-by: Guy Levi <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Doug Ledford <[email protected]>
1 parent 0e6613b commit 0081575

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

drivers/infiniband/hw/mlx5/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,7 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,
10231023
props->timestamp_mask = 0x7FFFFFFFFFFFFFFFULL;
10241024

10251025
if (IS_ENABLED(CONFIG_INFINIBAND_ON_DEMAND_PAGING)) {
1026-
if (MLX5_CAP_GEN(mdev, pg))
1026+
if (dev->odp_caps.general_caps & IB_ODP_SUPPORT)
10271027
props->device_cap_flags |= IB_DEVICE_ON_DEMAND_PAGING;
10281028
props->odp_caps = dev->odp_caps;
10291029
}
@@ -6139,6 +6139,8 @@ static int mlx5_ib_stage_init_init(struct mlx5_ib_dev *dev)
61396139
dev->port[i].roce.last_port_state = IB_PORT_DOWN;
61406140
}
61416141

6142+
mlx5_ib_internal_fill_odp_caps(dev);
6143+
61426144
err = mlx5_ib_init_multiport_master(dev);
61436145
if (err)
61446146
return err;
@@ -6563,8 +6565,6 @@ static void mlx5_ib_stage_dev_res_cleanup(struct mlx5_ib_dev *dev)
65636565

65646566
static int mlx5_ib_stage_odp_init(struct mlx5_ib_dev *dev)
65656567
{
6566-
mlx5_ib_internal_fill_odp_caps(dev);
6567-
65686568
return mlx5_ib_odp_init_one(dev);
65696569
}
65706570

drivers/infiniband/hw/mlx5/odp.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,8 @@ void mlx5_ib_internal_fill_odp_caps(struct mlx5_ib_dev *dev)
301301

302302
memset(caps, 0, sizeof(*caps));
303303

304-
if (!MLX5_CAP_GEN(dev->mdev, pg))
304+
if (!MLX5_CAP_GEN(dev->mdev, pg) ||
305+
!mlx5_ib_can_use_umr(dev, true))
305306
return;
306307

307308
caps->general_caps = IB_ODP_SUPPORT;
@@ -355,7 +356,8 @@ void mlx5_ib_internal_fill_odp_caps(struct mlx5_ib_dev *dev)
355356

356357
if (MLX5_CAP_GEN(dev->mdev, fixed_buffer_size) &&
357358
MLX5_CAP_GEN(dev->mdev, null_mkey) &&
358-
MLX5_CAP_GEN(dev->mdev, umr_extended_translation_offset))
359+
MLX5_CAP_GEN(dev->mdev, umr_extended_translation_offset) &&
360+
!MLX5_CAP_GEN(dev->mdev, umr_indirect_mkey_disabled))
359361
caps->general_caps |= IB_ODP_SUPPORT_IMPLICIT;
360362

361363
return;
@@ -1622,8 +1624,10 @@ int mlx5_ib_odp_init_one(struct mlx5_ib_dev *dev)
16221624
{
16231625
int ret = 0;
16241626

1625-
if (dev->odp_caps.general_caps & IB_ODP_SUPPORT)
1626-
ib_set_device_ops(&dev->ib_dev, &mlx5_ib_dev_odp_ops);
1627+
if (!(dev->odp_caps.general_caps & IB_ODP_SUPPORT))
1628+
return ret;
1629+
1630+
ib_set_device_ops(&dev->ib_dev, &mlx5_ib_dev_odp_ops);
16271631

16281632
if (dev->odp_caps.general_caps & IB_ODP_SUPPORT_IMPLICIT) {
16291633
ret = mlx5_cmd_null_mkey(dev->mdev, &dev->null_mkey);
@@ -1633,17 +1637,14 @@ int mlx5_ib_odp_init_one(struct mlx5_ib_dev *dev)
16331637
}
16341638
}
16351639

1636-
if (!MLX5_CAP_GEN(dev->mdev, pg))
1637-
return ret;
1638-
16391640
ret = mlx5_ib_create_pf_eq(dev, &dev->odp_pf_eq);
16401641

16411642
return ret;
16421643
}
16431644

16441645
void mlx5_ib_odp_cleanup_one(struct mlx5_ib_dev *dev)
16451646
{
1646-
if (!MLX5_CAP_GEN(dev->mdev, pg))
1647+
if (!(dev->odp_caps.general_caps & IB_ODP_SUPPORT))
16471648
return;
16481649

16491650
mlx5_ib_destroy_pf_eq(dev, &dev->odp_pf_eq);

0 commit comments

Comments
 (0)