* [PATCH rdma-next] RDMA/mlx5: Set ODP caps only if device profile support ODP
@ 2021-03-18 13:52 Leon Romanovsky
2021-03-26 16:58 ` Jason Gunthorpe
0 siblings, 1 reply; 2+ messages in thread
From: Leon Romanovsky @ 2021-03-18 13:52 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe; +Cc: Shay Drory, linux-rdma, Maor Gottlieb
From: Shay Drory <shayd@nvidia.com>
Currently, ODP caps are set during the init stage of mlx5_ib_dev,
regardless whether the device profile supports ODP or not.
There isn't a point to set ODP caps if the device profile doesn't
supports ODP. Hence, setting the ODP caps in the odp_init stage.
Reviewed-by: Maor Gottlieb <maorg@nvidia.com>
Signed-off-by: Shay Drory <shayd@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
drivers/infiniband/hw/mlx5/main.c | 2 --
drivers/infiniband/hw/mlx5/mlx5_ib.h | 6 ------
drivers/infiniband/hw/mlx5/odp.c | 4 +++-
3 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 6908db28b796..5f1c76b8dcb1 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -3665,8 +3665,6 @@ static int mlx5_ib_stage_init_init(struct mlx5_ib_dev *dev)
dev->port[i].roce.last_port_state = IB_PORT_DOWN;
}
- mlx5_ib_internal_fill_odp_caps(dev);
-
err = mlx5_ib_init_multiport_master(dev);
if (err)
return err;
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
index 78099d95e8e9..69ecd0229322 100644
--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
+++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
@@ -1372,7 +1372,6 @@ struct ib_mr *mlx5_ib_reg_dm_mr(struct ib_pd *pd, struct ib_dm *dm,
struct uverbs_attr_bundle *attrs);
#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING
-void mlx5_ib_internal_fill_odp_caps(struct mlx5_ib_dev *dev);
int mlx5_ib_odp_init_one(struct mlx5_ib_dev *ibdev);
int mlx5r_odp_create_eq(struct mlx5_ib_dev *dev, struct mlx5_ib_pf_eq *eq);
void mlx5_ib_odp_cleanup_one(struct mlx5_ib_dev *ibdev);
@@ -1388,11 +1387,6 @@ int mlx5_ib_advise_mr_prefetch(struct ib_pd *pd,
int mlx5_ib_init_odp_mr(struct mlx5_ib_mr *mr);
int mlx5_ib_init_dmabuf_mr(struct mlx5_ib_mr *mr);
#else /* CONFIG_INFINIBAND_ON_DEMAND_PAGING */
-static inline void mlx5_ib_internal_fill_odp_caps(struct mlx5_ib_dev *dev)
-{
- return;
-}
-
static inline int mlx5_ib_odp_init_one(struct mlx5_ib_dev *ibdev) { return 0; }
static inline int mlx5r_odp_create_eq(struct mlx5_ib_dev *dev,
struct mlx5_ib_pf_eq *eq)
diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c
index a0b9111b508a..782b2af8f211 100644
--- a/drivers/infiniband/hw/mlx5/odp.c
+++ b/drivers/infiniband/hw/mlx5/odp.c
@@ -317,7 +317,7 @@ const struct mmu_interval_notifier_ops mlx5_mn_ops = {
.invalidate = mlx5_ib_invalidate_range,
};
-void mlx5_ib_internal_fill_odp_caps(struct mlx5_ib_dev *dev)
+static void internal_fill_odp_caps(struct mlx5_ib_dev *dev)
{
struct ib_odp_caps *caps = &dev->odp_caps;
@@ -1639,6 +1639,8 @@ int mlx5_ib_odp_init_one(struct mlx5_ib_dev *dev)
{
int ret = 0;
+ internal_fill_odp_caps(dev);
+
if (!(dev->odp_caps.general_caps & IB_ODP_SUPPORT))
return ret;
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH rdma-next] RDMA/mlx5: Set ODP caps only if device profile support ODP
2021-03-18 13:52 [PATCH rdma-next] RDMA/mlx5: Set ODP caps only if device profile support ODP Leon Romanovsky
@ 2021-03-26 16:58 ` Jason Gunthorpe
0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2021-03-26 16:58 UTC (permalink / raw)
To: Leon Romanovsky; +Cc: Doug Ledford, Shay Drory, linux-rdma, Maor Gottlieb
On Thu, Mar 18, 2021 at 03:52:59PM +0200, Leon Romanovsky wrote:
> From: Shay Drory <shayd@nvidia.com>
>
> Currently, ODP caps are set during the init stage of mlx5_ib_dev,
> regardless whether the device profile supports ODP or not.
> There isn't a point to set ODP caps if the device profile doesn't
> supports ODP. Hence, setting the ODP caps in the odp_init stage.
>
> Reviewed-by: Maor Gottlieb <maorg@nvidia.com>
> Signed-off-by: Shay Drory <shayd@nvidia.com>
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> ---
> drivers/infiniband/hw/mlx5/main.c | 2 --
> drivers/infiniband/hw/mlx5/mlx5_ib.h | 6 ------
> drivers/infiniband/hw/mlx5/odp.c | 4 +++-
> 3 files changed, 3 insertions(+), 9 deletions(-)
Applied to for-next, thanks
Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-26 16:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-18 13:52 [PATCH rdma-next] RDMA/mlx5: Set ODP caps only if device profile support ODP Leon Romanovsky
2021-03-26 16:58 ` Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox