linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH mlx5-next 0/5] Mellanox, mlx5 roce enable devlink parameter
@ 2019-11-08 23:45 Saeed Mahameed
  2019-11-08 23:45 ` [PATCH mlx5-next 1/5] devlink: Add new "enable_roce" generic device param Saeed Mahameed
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Saeed Mahameed @ 2019-11-08 23:45 UTC (permalink / raw)
  To: Saeed Mahameed, Leon Romanovsky; +Cc: Jiri Pirko, netdev, linux-rdma

Hi All,

Currently RoCE is always enabled by default in mlx5 and there is no option
for the user to disable it.

This change introduces new generic devlink param "enable_roce". 
User should set desired param value and reload the driver to get
desired configuration.

Two options for reload:
1) reload mlx5_ib driver.
2) reload via devlink, once the devlink mlx5 reload support [1]
lands in net-next branch, after this series is applied.

mlx5 devlink reload is not part of this patchset since it depends on
changes from net-next tree.

RoCE will still be enabled by default after this change.

In case of no objection this series will be applied to mlx5-next branch
and sent later as pull request to both rdma-next and net-next branches.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git/commit/?h=net-next-mlx5&id=0915d89b86e379b26457ba50656e9257193eaa60

Thanks,
Saeed.

---

Michael Guralnik (5):
  devlink: Add new "enable_roce" generic device param
  net/mlx5: Document flow_steering_mode devlink param
  net/mlx5: Handle "enable_roce" devlink param
  IB/mlx5: Rename profile and init methods
  IB/mlx5: Load profile according to RoCE enablement state

 .../device_drivers/mellanox/mlx5.rst          | 21 ++++++++++
 .../networking/devlink-params-mlx5.txt        | 17 ++++++++
 Documentation/networking/devlink-params.txt   |  4 ++
 drivers/infiniband/hw/mlx5/ib_rep.c           |  2 +-
 drivers/infiniband/hw/mlx5/ib_rep.h           |  2 +-
 drivers/infiniband/hw/mlx5/main.c             | 39 ++++++++++---------
 .../net/ethernet/mellanox/mlx5/core/devlink.c | 22 +++++++++++
 include/linux/mlx5/driver.h                   | 11 ++++++
 include/net/devlink.h                         |  4 ++
 net/core/devlink.c                            |  5 +++
 10 files changed, 106 insertions(+), 21 deletions(-)
 create mode 100644 Documentation/networking/devlink-params-mlx5.txt

-- 
2.21.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH mlx5-next 1/5] devlink: Add new "enable_roce" generic device param
  2019-11-08 23:45 [PATCH mlx5-next 0/5] Mellanox, mlx5 roce enable devlink parameter Saeed Mahameed
@ 2019-11-08 23:45 ` Saeed Mahameed
  2019-11-08 23:45 ` [PATCH mlx5-next 2/5] net/mlx5: Document flow_steering_mode devlink param Saeed Mahameed
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Saeed Mahameed @ 2019-11-08 23:45 UTC (permalink / raw)
  To: Saeed Mahameed, Leon Romanovsky
  Cc: Jiri Pirko, netdev, linux-rdma, Michael Guralnik, Maor Gottlieb

From: Michael Guralnik <michaelgur@mellanox.com>

New device parameter to enable/disable handling of RoCE traffic in the
device.

Signed-off-by: Michael Guralnik <michaelgur@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 Documentation/networking/devlink-params.txt | 4 ++++
 include/net/devlink.h                       | 4 ++++
 net/core/devlink.c                          | 5 +++++
 3 files changed, 13 insertions(+)

diff --git a/Documentation/networking/devlink-params.txt b/Documentation/networking/devlink-params.txt
index ddba3e9b55b1..04e234e9acc9 100644
--- a/Documentation/networking/devlink-params.txt
+++ b/Documentation/networking/devlink-params.txt
@@ -65,3 +65,7 @@ reset_dev_on_drv_probe	[DEVICE, GENERIC]
 			  Reset only if device firmware can be found in the
 			  filesystem.
 			Type: u8
+
+enable_roce		[DEVICE, GENERIC]
+			Enable handling of RoCE traffic in the device.
+			Type: Boolean
diff --git a/include/net/devlink.h b/include/net/devlink.h
index 23e4b65ec9df..39fb4d957838 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -400,6 +400,7 @@ enum devlink_param_generic_id {
 	DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MIN,
 	DEVLINK_PARAM_GENERIC_ID_FW_LOAD_POLICY,
 	DEVLINK_PARAM_GENERIC_ID_RESET_DEV_ON_DRV_PROBE,
+	DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE,
 
 	/* add new param generic ids above here*/
 	__DEVLINK_PARAM_GENERIC_ID_MAX,
@@ -434,6 +435,9 @@ enum devlink_param_generic_id {
 	"reset_dev_on_drv_probe"
 #define DEVLINK_PARAM_GENERIC_RESET_DEV_ON_DRV_PROBE_TYPE DEVLINK_PARAM_TYPE_U8
 
+#define DEVLINK_PARAM_GENERIC_ENABLE_ROCE_NAME "enable_roce"
+#define DEVLINK_PARAM_GENERIC_ENABLE_ROCE_TYPE DEVLINK_PARAM_TYPE_BOOL
+
 #define DEVLINK_PARAM_GENERIC(_id, _cmodes, _get, _set, _validate)	\
 {									\
 	.id = DEVLINK_PARAM_GENERIC_ID_##_id,				\
diff --git a/net/core/devlink.c b/net/core/devlink.c
index f80151eeaf51..0fbcd44aa64f 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -2884,6 +2884,11 @@ static const struct devlink_param devlink_param_generic[] = {
 		.name = DEVLINK_PARAM_GENERIC_RESET_DEV_ON_DRV_PROBE_NAME,
 		.type = DEVLINK_PARAM_GENERIC_RESET_DEV_ON_DRV_PROBE_TYPE,
 	},
+	{
+		.id = DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE,
+		.name = DEVLINK_PARAM_GENERIC_ENABLE_ROCE_NAME,
+		.type = DEVLINK_PARAM_GENERIC_ENABLE_ROCE_TYPE,
+	},
 };
 
 static int devlink_param_generic_verify(const struct devlink_param *param)
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH mlx5-next 2/5] net/mlx5: Document flow_steering_mode devlink param
  2019-11-08 23:45 [PATCH mlx5-next 0/5] Mellanox, mlx5 roce enable devlink parameter Saeed Mahameed
  2019-11-08 23:45 ` [PATCH mlx5-next 1/5] devlink: Add new "enable_roce" generic device param Saeed Mahameed
@ 2019-11-08 23:45 ` Saeed Mahameed
  2019-11-08 23:45 ` [PATCH mlx5-next 3/5] net/mlx5: Handle "enable_roce" " Saeed Mahameed
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Saeed Mahameed @ 2019-11-08 23:45 UTC (permalink / raw)
  To: Saeed Mahameed, Leon Romanovsky
  Cc: Jiri Pirko, netdev, linux-rdma, Michael Guralnik

From: Michael Guralnik <michaelgur@mellanox.com>

Add documentation for current mlx5 supported devlink param.

Signed-off-by: Michael Guralnik <michaelgur@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 Documentation/networking/devlink-params-mlx5.txt | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 Documentation/networking/devlink-params-mlx5.txt

diff --git a/Documentation/networking/devlink-params-mlx5.txt b/Documentation/networking/devlink-params-mlx5.txt
new file mode 100644
index 000000000000..8c0b82d655dc
--- /dev/null
+++ b/Documentation/networking/devlink-params-mlx5.txt
@@ -0,0 +1,12 @@
+flow_steering_mode	[DEVICE, DRIVER-SPECIFIC]
+			Controls the flow steering mode of the driver.
+			Two modes are supported:
+			1. 'dmfs' - Device managed flow steering.
+			2. 'smfs  - Software/Driver managed flow steering.
+			In DMFS mode, the HW steering entities are created and
+			managed through the Firmware.
+			In SMFS mode, the HW steering entities are created and
+			managed though by the driver directly into Hardware
+			without firmware intervention.
+			Type: String
+			Configuration mode: runtime
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH mlx5-next 3/5] net/mlx5: Handle "enable_roce" devlink param
  2019-11-08 23:45 [PATCH mlx5-next 0/5] Mellanox, mlx5 roce enable devlink parameter Saeed Mahameed
  2019-11-08 23:45 ` [PATCH mlx5-next 1/5] devlink: Add new "enable_roce" generic device param Saeed Mahameed
  2019-11-08 23:45 ` [PATCH mlx5-next 2/5] net/mlx5: Document flow_steering_mode devlink param Saeed Mahameed
@ 2019-11-08 23:45 ` Saeed Mahameed
  2019-11-08 23:45 ` [PATCH mlx5-next 4/5] IB/mlx5: Rename profile and init methods Saeed Mahameed
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Saeed Mahameed @ 2019-11-08 23:45 UTC (permalink / raw)
  To: Saeed Mahameed, Leon Romanovsky
  Cc: Jiri Pirko, netdev, linux-rdma, Michael Guralnik

From: Michael Guralnik <michaelgur@mellanox.com>

Register "enable_roce" param, default value is RoCE enabled.
Current configuration is stored on mlx5_core_dev and exposed to user
through the cmode runtime devlink param.
Changing configuration requires changing the cmode driverinit devlink
param and calling devlink reload.

Signed-off-by: Michael Guralnik <michaelgur@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 .../device_drivers/mellanox/mlx5.rst          | 21 ++++++++++++++++++
 .../networking/devlink-params-mlx5.txt        |  5 +++++
 .../net/ethernet/mellanox/mlx5/core/devlink.c | 22 +++++++++++++++++++
 include/linux/mlx5/driver.h                   | 11 ++++++++++
 4 files changed, 59 insertions(+)

diff --git a/Documentation/networking/device_drivers/mellanox/mlx5.rst b/Documentation/networking/device_drivers/mellanox/mlx5.rst
index d071c6b49e1f..7599dceba9f1 100644
--- a/Documentation/networking/device_drivers/mellanox/mlx5.rst
+++ b/Documentation/networking/device_drivers/mellanox/mlx5.rst
@@ -154,6 +154,27 @@ User command examples:
       values:
          cmode runtime value smfs
 
+enable_roce: RoCE enablement state
+----------------------------------
+RoCE enablement state controls driver support for RoCE traffic.
+When RoCE is disabled, there is no gid table, only raw ethernet QPs are supported and traffic on the well known UDP RoCE port is handled as raw ethernet traffic.
+
+To change RoCE enablement state a user must change the driverinit cmode value and run devlink reload.
+
+User command examples:
+
+- Disable RoCE::
+
+    $ devlink dev param set pci/0000:06:00.0 name enable_roce value false cmode driverinit
+    $ devlink dev reload pci/0000:06:00.0
+
+- Read RoCE enablement state::
+
+    $ devlink dev param show pci/0000:06:00.0 name enable_roce
+      pci/0000:06:00.0:
+      name enable_roce type generic
+      values:
+         cmode driverinit value true
 
 Devlink health reporters
 ========================
diff --git a/Documentation/networking/devlink-params-mlx5.txt b/Documentation/networking/devlink-params-mlx5.txt
index 8c0b82d655dc..5071467118bd 100644
--- a/Documentation/networking/devlink-params-mlx5.txt
+++ b/Documentation/networking/devlink-params-mlx5.txt
@@ -10,3 +10,8 @@ flow_steering_mode	[DEVICE, DRIVER-SPECIFIC]
 			without firmware intervention.
 			Type: String
 			Configuration mode: runtime
+
+enable_roce		[DEVICE, GENERIC]
+			Enable handling of RoCE traffic in the device.
+			Defaultly enabled.
+			Configuration mode: driverinit
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
index 381925c90d94..b2c26388edb1 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
@@ -177,12 +177,29 @@ enum mlx5_devlink_param_id {
 	MLX5_DEVLINK_PARAM_FLOW_STEERING_MODE,
 };
 
+static int mlx5_devlink_enable_roce_validate(struct devlink *devlink, u32 id,
+					     union devlink_param_value val,
+					     struct netlink_ext_ack *extack)
+{
+	struct mlx5_core_dev *dev = devlink_priv(devlink);
+	bool new_state = val.vbool;
+
+	if (new_state && !MLX5_CAP_GEN(dev, roce)) {
+		NL_SET_ERR_MSG_MOD(extack, "Device doesn't support RoCE");
+		return -EOPNOTSUPP;
+	}
+
+	return 0;
+}
+
 static const struct devlink_param mlx5_devlink_params[] = {
 	DEVLINK_PARAM_DRIVER(MLX5_DEVLINK_PARAM_FLOW_STEERING_MODE,
 			     "flow_steering_mode", DEVLINK_PARAM_TYPE_STRING,
 			     BIT(DEVLINK_PARAM_CMODE_RUNTIME),
 			     mlx5_devlink_fs_mode_get, mlx5_devlink_fs_mode_set,
 			     mlx5_devlink_fs_mode_validate),
+	DEVLINK_PARAM_GENERIC(ENABLE_ROCE, BIT(DEVLINK_PARAM_CMODE_DRIVERINIT),
+			      NULL, NULL, mlx5_devlink_enable_roce_validate),
 };
 
 static void mlx5_devlink_set_params_init_values(struct devlink *devlink)
@@ -197,6 +214,11 @@ static void mlx5_devlink_set_params_init_values(struct devlink *devlink)
 	devlink_param_driverinit_value_set(devlink,
 					   MLX5_DEVLINK_PARAM_FLOW_STEERING_MODE,
 					   value);
+
+	value.vbool = MLX5_CAP_GEN(dev, roce);
+	devlink_param_driverinit_value_set(devlink,
+					   DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE,
+					   value);
 }
 
 int mlx5_devlink_register(struct devlink *devlink, struct device *dev)
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 7b4801e96feb..1884513aac90 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -1191,4 +1191,15 @@ enum {
 	MLX5_TRIGGERED_CMD_COMP = (u64)1 << 32,
 };
 
+static inline bool mlx5_is_roce_enabled(struct mlx5_core_dev *dev)
+{
+	struct devlink *devlink = priv_to_devlink(dev);
+	union devlink_param_value val;
+
+	devlink_param_driverinit_value_get(devlink,
+					   DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE,
+					   &val);
+	return val.vbool;
+}
+
 #endif /* MLX5_DRIVER_H */
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH mlx5-next 4/5] IB/mlx5: Rename profile and init methods
  2019-11-08 23:45 [PATCH mlx5-next 0/5] Mellanox, mlx5 roce enable devlink parameter Saeed Mahameed
                   ` (2 preceding siblings ...)
  2019-11-08 23:45 ` [PATCH mlx5-next 3/5] net/mlx5: Handle "enable_roce" " Saeed Mahameed
@ 2019-11-08 23:45 ` Saeed Mahameed
  2019-11-08 23:45 ` [PATCH mlx5-next 5/5] IB/mlx5: Load profile according to RoCE enablement state Saeed Mahameed
  2019-11-11 20:18 ` [PATCH mlx5-next 0/5] Mellanox, mlx5 roce enable devlink parameter Saeed Mahameed
  5 siblings, 0 replies; 7+ messages in thread
From: Saeed Mahameed @ 2019-11-08 23:45 UTC (permalink / raw)
  To: Saeed Mahameed, Leon Romanovsky
  Cc: Jiri Pirko, netdev, linux-rdma, Michael Guralnik, Maor Gottlieb

From: Michael Guralnik <michaelgur@mellanox.com>

Rename uplink_rep_profile and its unique init and cleanup stages to
suit its upcoming use as the profile when RoCE is disabled.

Signed-off-by: Michael Guralnik <michaelgur@mellanox.com>
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/infiniband/hw/mlx5/ib_rep.c |  2 +-
 drivers/infiniband/hw/mlx5/ib_rep.h |  2 +-
 drivers/infiniband/hw/mlx5/main.c   | 14 +++++++-------
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/ib_rep.c b/drivers/infiniband/hw/mlx5/ib_rep.c
index 74ce9249e75a..5c3d052ac30b 100644
--- a/drivers/infiniband/hw/mlx5/ib_rep.c
+++ b/drivers/infiniband/hw/mlx5/ib_rep.c
@@ -35,7 +35,7 @@ mlx5_ib_vport_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
 	int vport_index;
 
 	if (rep->vport == MLX5_VPORT_UPLINK)
-		profile = &uplink_rep_profile;
+		profile = &raw_eth_profile;
 	else
 		return mlx5_ib_set_vport_rep(dev, rep);
 
diff --git a/drivers/infiniband/hw/mlx5/ib_rep.h b/drivers/infiniband/hw/mlx5/ib_rep.h
index de43b423bafc..3b6750cba796 100644
--- a/drivers/infiniband/hw/mlx5/ib_rep.h
+++ b/drivers/infiniband/hw/mlx5/ib_rep.h
@@ -10,7 +10,7 @@
 #include "mlx5_ib.h"
 
 #ifdef CONFIG_MLX5_ESWITCH
-extern const struct mlx5_ib_profile uplink_rep_profile;
+extern const struct mlx5_ib_profile raw_eth_profile;
 
 u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw);
 struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw,
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 8343a740c91e..d6afe33d56ac 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -6444,7 +6444,7 @@ static const struct ib_device_ops mlx5_ib_dev_port_rep_ops = {
 	.query_port = mlx5_ib_rep_query_port,
 };
 
-static int mlx5_ib_stage_rep_non_default_cb(struct mlx5_ib_dev *dev)
+static int mlx5_ib_stage_raw_eth_non_default_cb(struct mlx5_ib_dev *dev)
 {
 	ib_set_device_ops(&dev->ib_dev, &mlx5_ib_dev_port_rep_ops);
 	return 0;
@@ -6484,7 +6484,7 @@ static void mlx5_ib_stage_common_roce_cleanup(struct mlx5_ib_dev *dev)
 	mlx5_remove_netdev_notifier(dev, port_num);
 }
 
-static int mlx5_ib_stage_rep_roce_init(struct mlx5_ib_dev *dev)
+static int mlx5_ib_stage_raw_eth_roce_init(struct mlx5_ib_dev *dev)
 {
 	struct mlx5_core_dev *mdev = dev->mdev;
 	enum rdma_link_layer ll;
@@ -6500,7 +6500,7 @@ static int mlx5_ib_stage_rep_roce_init(struct mlx5_ib_dev *dev)
 	return err;
 }
 
-static void mlx5_ib_stage_rep_roce_cleanup(struct mlx5_ib_dev *dev)
+static void mlx5_ib_stage_raw_eth_roce_cleanup(struct mlx5_ib_dev *dev)
 {
 	mlx5_ib_stage_common_roce_cleanup(dev);
 }
@@ -6807,7 +6807,7 @@ static const struct mlx5_ib_profile pf_profile = {
 		     mlx5_ib_stage_delay_drop_cleanup),
 };
 
-const struct mlx5_ib_profile uplink_rep_profile = {
+const struct mlx5_ib_profile raw_eth_profile = {
 	STAGE_CREATE(MLX5_IB_STAGE_INIT,
 		     mlx5_ib_stage_init_init,
 		     mlx5_ib_stage_init_cleanup),
@@ -6818,11 +6818,11 @@ const struct mlx5_ib_profile uplink_rep_profile = {
 		     mlx5_ib_stage_caps_init,
 		     NULL),
 	STAGE_CREATE(MLX5_IB_STAGE_NON_DEFAULT_CB,
-		     mlx5_ib_stage_rep_non_default_cb,
+		     mlx5_ib_stage_raw_eth_non_default_cb,
 		     NULL),
 	STAGE_CREATE(MLX5_IB_STAGE_ROCE,
-		     mlx5_ib_stage_rep_roce_init,
-		     mlx5_ib_stage_rep_roce_cleanup),
+		     mlx5_ib_stage_raw_eth_roce_init,
+		     mlx5_ib_stage_raw_eth_roce_cleanup),
 	STAGE_CREATE(MLX5_IB_STAGE_SRQ,
 		     mlx5_init_srq_table,
 		     mlx5_cleanup_srq_table),
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH mlx5-next 5/5] IB/mlx5: Load profile according to RoCE enablement state
  2019-11-08 23:45 [PATCH mlx5-next 0/5] Mellanox, mlx5 roce enable devlink parameter Saeed Mahameed
                   ` (3 preceding siblings ...)
  2019-11-08 23:45 ` [PATCH mlx5-next 4/5] IB/mlx5: Rename profile and init methods Saeed Mahameed
@ 2019-11-08 23:45 ` Saeed Mahameed
  2019-11-11 20:18 ` [PATCH mlx5-next 0/5] Mellanox, mlx5 roce enable devlink parameter Saeed Mahameed
  5 siblings, 0 replies; 7+ messages in thread
From: Saeed Mahameed @ 2019-11-08 23:45 UTC (permalink / raw)
  To: Saeed Mahameed, Leon Romanovsky
  Cc: Jiri Pirko, netdev, linux-rdma, Michael Guralnik, Maor Gottlieb

From: Michael Guralnik <michaelgur@mellanox.com>

When RoCE is disabled load mlx5_ib in raw_eth profile.
Clean pf_profile roce capability checks as it will not be used without
roce capability.

Signed-off-by: Michael Guralnik <michaelgur@mellanox.com>
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/infiniband/hw/mlx5/main.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index d6afe33d56ac..46ea4f0b9b51 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -5145,8 +5145,7 @@ static int mlx5_port_immutable(struct ib_device *ibdev, u8 port_num,
 	immutable->pkey_tbl_len = attr.pkey_tbl_len;
 	immutable->gid_tbl_len = attr.gid_tbl_len;
 	immutable->core_cap_flags = get_core_cap_flags(ibdev, &rep);
-	if ((ll == IB_LINK_LAYER_INFINIBAND) || MLX5_CAP_GEN(dev->mdev, roce))
-		immutable->max_mad_size = IB_MGMT_MAD_SIZE;
+	immutable->max_mad_size = IB_MGMT_MAD_SIZE;
 
 	return 0;
 }
@@ -5249,11 +5248,9 @@ static int mlx5_enable_eth(struct mlx5_ib_dev *dev)
 {
 	int err;
 
-	if (MLX5_CAP_GEN(dev->mdev, roce)) {
-		err = mlx5_nic_vport_enable_roce(dev->mdev);
-		if (err)
-			return err;
-	}
+	err = mlx5_nic_vport_enable_roce(dev->mdev);
+	if (err)
+		return err;
 
 	err = mlx5_eth_lag_init(dev);
 	if (err)
@@ -5262,8 +5259,7 @@ static int mlx5_enable_eth(struct mlx5_ib_dev *dev)
 	return 0;
 
 err_disable_roce:
-	if (MLX5_CAP_GEN(dev->mdev, roce))
-		mlx5_nic_vport_disable_roce(dev->mdev);
+	mlx5_nic_vport_disable_roce(dev->mdev);
 
 	return err;
 }
@@ -5271,8 +5267,7 @@ static int mlx5_enable_eth(struct mlx5_ib_dev *dev)
 static void mlx5_disable_eth(struct mlx5_ib_dev *dev)
 {
 	mlx5_eth_lag_cleanup(dev);
-	if (MLX5_CAP_GEN(dev->mdev, roce))
-		mlx5_nic_vport_disable_roce(dev->mdev);
+	mlx5_nic_vport_disable_roce(dev->mdev);
 }
 
 struct mlx5_ib_counter {
@@ -6898,6 +6893,7 @@ static void *mlx5_ib_add_slave_port(struct mlx5_core_dev *mdev)
 
 static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
 {
+	const struct mlx5_ib_profile *profile;
 	enum rdma_link_layer ll;
 	struct mlx5_ib_dev *dev;
 	int port_type_cap;
@@ -6933,7 +6929,12 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
 	dev->mdev = mdev;
 	dev->num_ports = num_ports;
 
-	return __mlx5_ib_add(dev, &pf_profile);
+	if (ll == IB_LINK_LAYER_ETHERNET && !mlx5_is_roce_enabled(mdev))
+		profile = &raw_eth_profile;
+	else
+		profile = &pf_profile;
+
+	return __mlx5_ib_add(dev, profile);
 }
 
 static void mlx5_ib_remove(struct mlx5_core_dev *mdev, void *context)
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH mlx5-next 0/5] Mellanox, mlx5 roce enable devlink parameter
  2019-11-08 23:45 [PATCH mlx5-next 0/5] Mellanox, mlx5 roce enable devlink parameter Saeed Mahameed
                   ` (4 preceding siblings ...)
  2019-11-08 23:45 ` [PATCH mlx5-next 5/5] IB/mlx5: Load profile according to RoCE enablement state Saeed Mahameed
@ 2019-11-11 20:18 ` Saeed Mahameed
  5 siblings, 0 replies; 7+ messages in thread
From: Saeed Mahameed @ 2019-11-11 20:18 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: Jiri Pirko, netdev, linux-rdma

On Fri, 2019-11-08 at 23:45 +0000, Saeed Mahameed wrote:
> Hi All,
> 
> Currently RoCE is always enabled by default in mlx5 and there is no
> option
> for the user to disable it.
> 
> This change introduces new generic devlink param "enable_roce". 
> User should set desired param value and reload the driver to get
> desired configuration.
> 
> Two options for reload:
> 1) reload mlx5_ib driver.
> 2) reload via devlink, once the devlink mlx5 reload support [1]
> lands in net-next branch, after this series is applied.
> 
> mlx5 devlink reload is not part of this patchset since it depends on
> changes from net-next tree.
> 
> RoCE will still be enabled by default after this change.
> 
> In case of no objection this series will be applied to mlx5-next
> branch
> and sent later as pull request to both rdma-next and net-next
> branches.
> 

Series applied to mlx5-next.

Thanks.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-11-11 20:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-08 23:45 [PATCH mlx5-next 0/5] Mellanox, mlx5 roce enable devlink parameter Saeed Mahameed
2019-11-08 23:45 ` [PATCH mlx5-next 1/5] devlink: Add new "enable_roce" generic device param Saeed Mahameed
2019-11-08 23:45 ` [PATCH mlx5-next 2/5] net/mlx5: Document flow_steering_mode devlink param Saeed Mahameed
2019-11-08 23:45 ` [PATCH mlx5-next 3/5] net/mlx5: Handle "enable_roce" " Saeed Mahameed
2019-11-08 23:45 ` [PATCH mlx5-next 4/5] IB/mlx5: Rename profile and init methods Saeed Mahameed
2019-11-08 23:45 ` [PATCH mlx5-next 5/5] IB/mlx5: Load profile according to RoCE enablement state Saeed Mahameed
2019-11-11 20:18 ` [PATCH mlx5-next 0/5] Mellanox, mlx5 roce enable devlink parameter Saeed Mahameed

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).