Skip to content

Commit

Permalink
RDMA/mlx5: Remove implicit ODP cache entry
Browse files Browse the repository at this point in the history
Implicit ODP mkey doesn't have unique properties. It shares the same
properties as the order 18 cache entry. There is no need to devote a
special entry for that.

Link: https://lore.kernel.org/r/20230125222807.6921-3-michaelgur@nvidia.com
Signed-off-by: Aharon Landau <aharonl@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
  • Loading branch information
aharonl-nvidia authored and jgunthorpe committed Jan 27, 2023
1 parent a2a88b8 commit 18b1746
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
20 changes: 5 additions & 15 deletions drivers/infiniband/hw/mlx5/odp.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ static void mlx5_ib_page_fault_resume(struct mlx5_ib_dev *dev,
static struct mlx5_ib_mr *implicit_get_child_mr(struct mlx5_ib_mr *imr,
unsigned long idx)
{
int order = order_base_2(MLX5_IMR_MTT_ENTRIES);
struct mlx5_ib_dev *dev = mr_to_mdev(imr);
struct ib_umem_odp *odp;
struct mlx5_ib_mr *mr;
Expand All @@ -417,7 +418,8 @@ static struct mlx5_ib_mr *implicit_get_child_mr(struct mlx5_ib_mr *imr,
if (IS_ERR(odp))
return ERR_CAST(odp);

mr = mlx5_mr_cache_alloc(dev, &dev->cache.ent[MLX5_IMR_MTT_CACHE_ENTRY],
BUILD_BUG_ON(order > MKEY_CACHE_LAST_STD_ENTRY);
mr = mlx5_mr_cache_alloc(dev, &dev->cache.ent[order],
imr->access_flags);
if (IS_ERR(mr)) {
ib_umem_odp_release(odp);
Expand Down Expand Up @@ -1591,20 +1593,8 @@ void mlx5_odp_init_mkey_cache_entry(struct mlx5_cache_ent *ent)
{
if (!(ent->dev->odp_caps.general_caps & IB_ODP_SUPPORT_IMPLICIT))
return;

switch (ent->order - 2) {
case MLX5_IMR_MTT_CACHE_ENTRY:
ent->ndescs = MLX5_IMR_MTT_ENTRIES;
ent->access_mode = MLX5_MKC_ACCESS_MODE_MTT;
ent->limit = 0;
break;

case MLX5_IMR_KSM_CACHE_ENTRY:
ent->ndescs = mlx5_imr_ksm_entries;
ent->access_mode = MLX5_MKC_ACCESS_MODE_KSM;
ent->limit = 0;
break;
}
ent->ndescs = mlx5_imr_ksm_entries;
ent->access_mode = MLX5_MKC_ACCESS_MODE_KSM;
}

static const struct ib_device_ops mlx5_ib_dev_odp_ops = {
Expand Down
1 change: 0 additions & 1 deletion include/linux/mlx5/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,6 @@ enum {

enum {
MKEY_CACHE_LAST_STD_ENTRY = 20,
MLX5_IMR_MTT_CACHE_ENTRY,
MLX5_IMR_KSM_CACHE_ENTRY,
MAX_MKEY_CACHE_ENTRIES
};
Expand Down

0 comments on commit 18b1746

Please sign in to comment.