From: Mark Bloch <markb@mellanox.com>
Date: Wed, 6 May 2020 10:16:01 +0300
Subject: RDMA/mlx5: Assign profile before calling stages
Patch-mainline: v5.8-rc1
Git-commit: 8d93efb8c5e07706651a992fc07f37a2fb69baca
References: jsc#SLE-15175
Assign the profile to the IB device before executing stages. This will
allow to check which profile is being used from within a stage.
Link: https://lore.kernel.org/r/20200506071602.7177-2-leon@kernel.org
Signed-off-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
drivers/infiniband/hw/mlx5/ib_rep.h | 2 +-
drivers/infiniband/hw/mlx5/main.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
--- a/drivers/infiniband/hw/mlx5/ib_rep.h
+++ b/drivers/infiniband/hw/mlx5/ib_rep.h
@@ -9,9 +9,9 @@
#include <linux/mlx5/eswitch.h>
#include "mlx5_ib.h"
-#ifdef CONFIG_MLX5_ESWITCH
extern const struct mlx5_ib_profile raw_eth_profile;
+#ifdef CONFIG_MLX5_ESWITCH
u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw);
struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw,
u16 vport_num);
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -7133,6 +7133,8 @@ void *__mlx5_ib_add(struct mlx5_ib_dev *
int err;
int i;
+ dev->profile = profile;
+
for (i = 0; i < MLX5_IB_STAGE_MAX; i++) {
if (profile->stage[i].init) {
err = profile->stage[i].init(dev);
@@ -7141,7 +7143,6 @@ void *__mlx5_ib_add(struct mlx5_ib_dev *
}
}
- dev->profile = profile;
dev->ib_active = true;
return dev;