linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH mlx5-next 0/6] mlx5 updates for shared branch 2018-12-12
@ 2018-12-13  3:11 Saeed Mahameed
  2018-12-13  3:11 ` [PATCH mlx5-next 1/6] net/mlx5: Use lowercase 'X' for hex values Saeed Mahameed
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Saeed Mahameed @ 2018-12-13  3:11 UTC (permalink / raw)
  To: Leon Romanovsky, saeedm; +Cc: netdev, linux-rdma, Jason Gunthorpe

Hi,

This series includes updates to mlx5 core driver for the shared
mlx5-next branch.

1) From Mark Bloch, Unify e-switch representors load approach in mlx5_ib
2) From Shahar Klein, Flow counters affinity bits for lag
3) From Roy Dayan, Lag affinity log and cleanup
4) From Saeed Mahameed, A cleanup patch for mlx5_ifc.h

Thanks,
Saeed.

---

Mark Bloch (1):
  IB/mlx5: Unify e-switch representors load approach between uplink and
    VFs

Roi Dayan (2):
  net/mlx5: Split the activate lag function into two routines
  net/mlx5: Add lag affinity info to log

Saeed Mahameed (1):
  net/mlx5: Use lowercase 'X' for hex values

Shahar Klein (2):
  net/mlx5: E-Switch, Introduce flow counter affinity
  net/mlx5: Fold the modify lag code into function

 drivers/infiniband/hw/mlx5/ib_rep.c           | 11 +++-
 drivers/infiniband/hw/mlx5/main.c             | 29 +++------
 drivers/infiniband/hw/mlx5/mlx5_ib.h          |  1 -
 drivers/net/ethernet/mellanox/mlx5/core/lag.c | 59 +++++++++++++------
 include/linux/mlx5/mlx5_ifc.h                 | 24 +++++---
 5 files changed, 74 insertions(+), 50 deletions(-)

-- 
2.19.2

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

* [PATCH mlx5-next 1/6] net/mlx5: Use lowercase 'X' for hex values
  2018-12-13  3:11 [PATCH mlx5-next 0/6] mlx5 updates for shared branch 2018-12-12 Saeed Mahameed
@ 2018-12-13  3:11 ` Saeed Mahameed
  2018-12-13  3:11 ` [PATCH mlx5-next 2/6] IB/mlx5: Unify e-switch representors load approach between uplink and VFs Saeed Mahameed
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2018-12-13  3:11 UTC (permalink / raw)
  To: Leon Romanovsky, saeedm; +Cc: netdev, linux-rdma, Jason Gunthorpe

Apparently gcc is cool with upper case '0X' but it is not commonly used.
Replace '0X' with lowercase '0x' in mlx5_ifc.h file.

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 include/linux/mlx5/mlx5_ifc.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 60c1d49eb40c..a56bd3b1f579 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -3865,16 +3865,16 @@ enum {
 };
 
 enum mlx5_monitor_counter_ppcnt {
-	MLX5_QUERY_MONITOR_PPCNT_IN_RANGE_LENGTH_ERRORS      = 0X0,
-	MLX5_QUERY_MONITOR_PPCNT_OUT_OF_RANGE_LENGTH_FIELD   = 0X1,
-	MLX5_QUERY_MONITOR_PPCNT_FRAME_TOO_LONG_ERRORS       = 0X2,
-	MLX5_QUERY_MONITOR_PPCNT_FRAME_CHECK_SEQUENCE_ERRORS = 0X3,
-	MLX5_QUERY_MONITOR_PPCNT_ALIGNMENT_ERRORS            = 0X4,
-	MLX5_QUERY_MONITOR_PPCNT_IF_OUT_DISCARDS             = 0X5,
+	MLX5_QUERY_MONITOR_PPCNT_IN_RANGE_LENGTH_ERRORS      = 0x0,
+	MLX5_QUERY_MONITOR_PPCNT_OUT_OF_RANGE_LENGTH_FIELD   = 0x1,
+	MLX5_QUERY_MONITOR_PPCNT_FRAME_TOO_LONG_ERRORS       = 0x2,
+	MLX5_QUERY_MONITOR_PPCNT_FRAME_CHECK_SEQUENCE_ERRORS = 0x3,
+	MLX5_QUERY_MONITOR_PPCNT_ALIGNMENT_ERRORS            = 0x4,
+	MLX5_QUERY_MONITOR_PPCNT_IF_OUT_DISCARDS             = 0x5,
 };
 
 enum {
-	MLX5_QUERY_MONITOR_Q_COUNTER_RX_OUT_OF_BUFFER     = 0X4,
+	MLX5_QUERY_MONITOR_Q_COUNTER_RX_OUT_OF_BUFFER     = 0x4,
 };
 
 struct mlx5_ifc_monitor_counter_output_bits {
@@ -4780,7 +4780,7 @@ enum {
 	MLX5_QUERY_FLOW_GROUP_OUT_MATCH_CRITERIA_ENABLE_OUTER_HEADERS    = 0x0,
 	MLX5_QUERY_FLOW_GROUP_OUT_MATCH_CRITERIA_ENABLE_MISC_PARAMETERS  = 0x1,
 	MLX5_QUERY_FLOW_GROUP_OUT_MATCH_CRITERIA_ENABLE_INNER_HEADERS    = 0x2,
-	MLX5_QUERY_FLOW_GROUP_IN_MATCH_CRITERIA_ENABLE_MISC_PARAMETERS_2 = 0X3,
+	MLX5_QUERY_FLOW_GROUP_IN_MATCH_CRITERIA_ENABLE_MISC_PARAMETERS_2 = 0x3,
 };
 
 struct mlx5_ifc_query_flow_group_out_bits {
-- 
2.19.2

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

* [PATCH mlx5-next 2/6] IB/mlx5: Unify e-switch representors load approach between uplink and VFs
  2018-12-13  3:11 [PATCH mlx5-next 0/6] mlx5 updates for shared branch 2018-12-12 Saeed Mahameed
  2018-12-13  3:11 ` [PATCH mlx5-next 1/6] net/mlx5: Use lowercase 'X' for hex values Saeed Mahameed
@ 2018-12-13  3:11 ` Saeed Mahameed
  2018-12-13  3:37   ` Jason Gunthorpe
  2018-12-13  3:11 ` [PATCH mlx5-next 3/6] net/mlx5: E-Switch, Introduce flow counter affinity Saeed Mahameed
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 10+ messages in thread
From: Saeed Mahameed @ 2018-12-13  3:11 UTC (permalink / raw)
  To: Leon Romanovsky, saeedm; +Cc: netdev, linux-rdma, Jason Gunthorpe, Mark Bloch

From: Mark Bloch <markb@mellanox.com>

When in switchdev mode and the add function is called by the core
level driver, make sure we only register the callbacks, but don't
create the mlx5 IB device or initialize anything. With this change
all the IB devices in switchdev mode are created only once the load
callback is invoked by the e-switch core sub-module. This follows
the design paradigm under which the all the Eth representors must
be loaded before any of IB reprs is loaded.

Signed-off-by: Mark Bloch <markb@mellanox.com>
Acked-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/infiniband/hw/mlx5/ib_rep.c  | 11 ++++++++++-
 drivers/infiniband/hw/mlx5/main.c    | 29 +++++++++-------------------
 drivers/infiniband/hw/mlx5/mlx5_ib.h |  1 -
 3 files changed, 19 insertions(+), 22 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/ib_rep.c b/drivers/infiniband/hw/mlx5/ib_rep.c
index 8a682d86d634..46a9ddc8ca56 100644
--- a/drivers/infiniband/hw/mlx5/ib_rep.c
+++ b/drivers/infiniband/hw/mlx5/ib_rep.c
@@ -48,13 +48,21 @@ static const struct mlx5_ib_profile rep_profile = {
 static int
 mlx5_ib_nic_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
 {
+	struct mlx5_ib_dev *ibdev;
+
+	ibdev = mlx5_ib_rep_to_dev(rep);
+	if (!__mlx5_ib_add(ibdev, ibdev->profile))
+		return -EINVAL;
 	return 0;
 }
 
 static void
 mlx5_ib_nic_rep_unload(struct mlx5_eswitch_rep *rep)
 {
-	rep->rep_if[REP_IB].priv = NULL;
+	struct mlx5_ib_dev *ibdev;
+
+	ibdev = mlx5_ib_rep_to_dev(rep);
+	__mlx5_ib_remove(ibdev, ibdev->profile, MLX5_IB_STAGE_MAX);
 }
 
 static int
@@ -89,6 +97,7 @@ mlx5_ib_vport_rep_unload(struct mlx5_eswitch_rep *rep)
 	dev = mlx5_ib_rep_to_dev(rep);
 	__mlx5_ib_remove(dev, dev->profile, MLX5_IB_STAGE_MAX);
 	rep->rep_if[REP_IB].priv = NULL;
+	ib_dealloc_device(&dev->ib_dev);
 }
 
 static void *mlx5_ib_vport_get_proto_dev(struct mlx5_eswitch_rep *rep)
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 2560996fce79..4a4200a88957 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -6214,18 +6214,6 @@ static void mlx5_ib_stage_delay_drop_cleanup(struct mlx5_ib_dev *dev)
 	cancel_delay_drop(dev);
 }
 
-static int mlx5_ib_stage_rep_reg_init(struct mlx5_ib_dev *dev)
-{
-	mlx5_ib_register_vport_reps(dev);
-
-	return 0;
-}
-
-static void mlx5_ib_stage_rep_reg_cleanup(struct mlx5_ib_dev *dev)
-{
-	mlx5_ib_unregister_vport_reps(dev);
-}
-
 static int mlx5_ib_stage_dev_notifier_init(struct mlx5_ib_dev *dev)
 {
 	dev->mdev_events.notifier_call = mlx5_ib_event;
@@ -6264,8 +6252,6 @@ void __mlx5_ib_remove(struct mlx5_ib_dev *dev,
 		if (profile->stage[stage].cleanup)
 			profile->stage[stage].cleanup(dev);
 	}
-
-	ib_dealloc_device((struct ib_device *)dev);
 }
 
 void *__mlx5_ib_add(struct mlx5_ib_dev *dev,
@@ -6399,9 +6385,6 @@ static const struct mlx5_ib_profile nic_rep_profile = {
 	STAGE_CREATE(MLX5_IB_STAGE_POST_IB_REG_UMR,
 		     mlx5_ib_stage_post_ib_reg_umr_init,
 		     NULL),
-	STAGE_CREATE(MLX5_IB_STAGE_REP_REG,
-		     mlx5_ib_stage_rep_reg_init,
-		     mlx5_ib_stage_rep_reg_cleanup),
 };
 
 static void *mlx5_ib_add_slave_port(struct mlx5_core_dev *mdev)
@@ -6469,8 +6452,9 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
 	if (MLX5_ESWITCH_MANAGER(mdev) &&
 	    mlx5_ib_eswitch_mode(mdev->priv.eswitch) == SRIOV_OFFLOADS) {
 		dev->rep = mlx5_ib_vport_rep(mdev->priv.eswitch, 0);
-
-		return __mlx5_ib_add(dev, &nic_rep_profile);
+		dev->profile = &nic_rep_profile;
+		mlx5_ib_register_vport_reps(dev);
+		return dev;
 	}
 
 	return __mlx5_ib_add(dev, &pf_profile);
@@ -6492,7 +6476,12 @@ static void mlx5_ib_remove(struct mlx5_core_dev *mdev, void *context)
 	}
 
 	dev = context;
-	__mlx5_ib_remove(dev, dev->profile, MLX5_IB_STAGE_MAX);
+	if (dev->profile == &nic_rep_profile)
+		mlx5_ib_unregister_vport_reps(dev);
+	else
+		__mlx5_ib_remove(dev, dev->profile, MLX5_IB_STAGE_MAX);
+
+	ib_dealloc_device((struct ib_device *)dev);
 }
 
 static struct mlx5_interface mlx5_ib_interface = {
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
index 861b68f2e330..c89b3b44b22e 100644
--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
+++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
@@ -790,7 +790,6 @@ enum mlx5_ib_stages {
 	MLX5_IB_STAGE_POST_IB_REG_UMR,
 	MLX5_IB_STAGE_DELAY_DROP,
 	MLX5_IB_STAGE_CLASS_ATTR,
-	MLX5_IB_STAGE_REP_REG,
 	MLX5_IB_STAGE_MAX,
 };
 
-- 
2.19.2

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

* [PATCH mlx5-next 3/6] net/mlx5: E-Switch, Introduce flow counter affinity
  2018-12-13  3:11 [PATCH mlx5-next 0/6] mlx5 updates for shared branch 2018-12-12 Saeed Mahameed
  2018-12-13  3:11 ` [PATCH mlx5-next 1/6] net/mlx5: Use lowercase 'X' for hex values Saeed Mahameed
  2018-12-13  3:11 ` [PATCH mlx5-next 2/6] IB/mlx5: Unify e-switch representors load approach between uplink and VFs Saeed Mahameed
@ 2018-12-13  3:11 ` Saeed Mahameed
  2018-12-13  3:11 ` [PATCH mlx5-next 4/6] net/mlx5: Split the activate lag function into two routines Saeed Mahameed
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2018-12-13  3:11 UTC (permalink / raw)
  To: Leon Romanovsky, saeedm
  Cc: netdev, linux-rdma, Jason Gunthorpe, Shahar Klein, Roi Dayan

From: Shahar Klein <shahark@mellanox.com>

This dictates the device affinity for eswitch flow counters, set by the FW
according to the HW device capabilities.

Under "source eswitch" affinity, the counter should be allocated on the
device related to the source vport in the match. This covers both non
merged e-switch mode as well as old FW that does not advertise this cap.

Under "flow eswitch" affinity, the counter should be allocated on the
device where the eswitch rule is set.

Signed-off-by: Shahar Klein <shahark@mellanox.com>
Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 include/linux/mlx5/mlx5_ifc.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index a56bd3b1f579..f48d7ee345ff 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -608,13 +608,19 @@ struct mlx5_ifc_flow_table_eswitch_cap_bits {
 	u8      reserved_at_800[0x7800];
 };
 
+enum {
+	MLX5_COUNTER_SOURCE_ESWITCH = 0x0,
+	MLX5_COUNTER_FLOW_ESWITCH   = 0x1,
+};
+
 struct mlx5_ifc_e_switch_cap_bits {
 	u8         vport_svlan_strip[0x1];
 	u8         vport_cvlan_strip[0x1];
 	u8         vport_svlan_insert[0x1];
 	u8         vport_cvlan_insert_if_not_exist[0x1];
 	u8         vport_cvlan_insert_overwrite[0x1];
-	u8         reserved_at_5[0x18];
+	u8         reserved_at_5[0x17];
+	u8         counter_eswitch_affinity[0x1];
 	u8         merged_eswitch[0x1];
 	u8         nic_vport_node_guid_modify[0x1];
 	u8         nic_vport_port_guid_modify[0x1];
-- 
2.19.2

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

* [PATCH mlx5-next 4/6] net/mlx5: Split the activate lag function into two routines
  2018-12-13  3:11 [PATCH mlx5-next 0/6] mlx5 updates for shared branch 2018-12-12 Saeed Mahameed
                   ` (2 preceding siblings ...)
  2018-12-13  3:11 ` [PATCH mlx5-next 3/6] net/mlx5: E-Switch, Introduce flow counter affinity Saeed Mahameed
@ 2018-12-13  3:11 ` Saeed Mahameed
  2018-12-13  3:11 ` [PATCH mlx5-next 5/6] net/mlx5: Add lag affinity info to log Saeed Mahameed
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2018-12-13  3:11 UTC (permalink / raw)
  To: Leon Romanovsky, saeedm
  Cc: netdev, linux-rdma, Jason Gunthorpe, Roi Dayan, Shahar Klein

From: Roi Dayan <roid@mellanox.com>

Split the activate lag function in order to be symmetric with
the deactivate lag function.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Shahar Klein <shahark@mellanox.com>
Reviewed-by: Aviv Heller <avivh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/lag.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag.c
index 582b2f18010a..75f7c8efaab5 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lag.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lag.c
@@ -186,14 +186,12 @@ static void mlx5_infer_tx_affinity_mapping(struct lag_tracker *tracker,
 		*port2 = 1;
 }
 
-static void mlx5_activate_lag(struct mlx5_lag *ldev,
-			      struct lag_tracker *tracker)
+static int mlx5_create_lag(struct mlx5_lag *ldev,
+			   struct lag_tracker *tracker)
 {
 	struct mlx5_core_dev *dev0 = ldev->pf[0].dev;
 	int err;
 
-	ldev->flags |= MLX5_LAG_FLAG_BONDED;
-
 	mlx5_infer_tx_affinity_mapping(tracker, &ldev->v2p_map[0],
 				       &ldev->v2p_map[1]);
 
@@ -202,6 +200,14 @@ static void mlx5_activate_lag(struct mlx5_lag *ldev,
 		mlx5_core_err(dev0,
 			      "Failed to create LAG (%d)\n",
 			      err);
+	return err;
+}
+
+static void mlx5_activate_lag(struct mlx5_lag *ldev,
+			      struct lag_tracker *tracker)
+{
+	ldev->flags |= MLX5_LAG_FLAG_BONDED;
+	mlx5_create_lag(ldev, tracker);
 }
 
 static void mlx5_deactivate_lag(struct mlx5_lag *ldev)
-- 
2.19.2

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

* [PATCH mlx5-next 5/6] net/mlx5: Add lag affinity info to log
  2018-12-13  3:11 [PATCH mlx5-next 0/6] mlx5 updates for shared branch 2018-12-12 Saeed Mahameed
                   ` (3 preceding siblings ...)
  2018-12-13  3:11 ` [PATCH mlx5-next 4/6] net/mlx5: Split the activate lag function into two routines Saeed Mahameed
@ 2018-12-13  3:11 ` Saeed Mahameed
  2018-12-13  3:11 ` [PATCH mlx5-next 6/6] net/mlx5: Fold the modify lag code into function Saeed Mahameed
  2018-12-14 19:05 ` [PATCH mlx5-next 0/6] mlx5 updates for shared branch 2018-12-12 Saeed Mahameed
  6 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2018-12-13  3:11 UTC (permalink / raw)
  To: Leon Romanovsky, saeedm
  Cc: netdev, linux-rdma, Jason Gunthorpe, Roi Dayan, Shahar Klein

From: Roi Dayan <roid@mellanox.com>

Report the initial LAG port affinity upon LAG creation.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Shahar Klein <shahark@mellanox.com>
Reviewed-by: Aviv Heller <avivh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/lag.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag.c
index 75f7c8efaab5..448d9d5c689c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lag.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lag.c
@@ -195,6 +195,9 @@ static int mlx5_create_lag(struct mlx5_lag *ldev,
 	mlx5_infer_tx_affinity_mapping(tracker, &ldev->v2p_map[0],
 				       &ldev->v2p_map[1]);
 
+	mlx5_core_info(dev0, "lag map port 1:%d port 2:%d",
+		       ldev->v2p_map[0], ldev->v2p_map[1]);
+
 	err = mlx5_cmd_create_lag(dev0, ldev->v2p_map[0], ldev->v2p_map[1]);
 	if (err)
 		mlx5_core_err(dev0,
-- 
2.19.2

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

* [PATCH mlx5-next 6/6] net/mlx5: Fold the modify lag code into function
  2018-12-13  3:11 [PATCH mlx5-next 0/6] mlx5 updates for shared branch 2018-12-12 Saeed Mahameed
                   ` (4 preceding siblings ...)
  2018-12-13  3:11 ` [PATCH mlx5-next 5/6] net/mlx5: Add lag affinity info to log Saeed Mahameed
@ 2018-12-13  3:11 ` Saeed Mahameed
  2018-12-14 19:05 ` [PATCH mlx5-next 0/6] mlx5 updates for shared branch 2018-12-12 Saeed Mahameed
  6 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2018-12-13  3:11 UTC (permalink / raw)
  To: Leon Romanovsky, saeedm
  Cc: netdev, linux-rdma, Jason Gunthorpe, Shahar Klein, Roi Dayan

From: Shahar Klein <shahark@mellanox.com>

Handle the code of modifying the lag affinity within a separate function.

Signed-off-by: Shahar Klein <shahark@mellanox.com>
Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Aviv Heller <avivh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/lag.c | 44 ++++++++++++-------
 1 file changed, 28 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag.c
index 448d9d5c689c..8c5c5e418d61 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lag.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lag.c
@@ -186,6 +186,32 @@ static void mlx5_infer_tx_affinity_mapping(struct lag_tracker *tracker,
 		*port2 = 1;
 }
 
+static void mlx5_modify_lag(struct mlx5_lag *ldev,
+			    struct lag_tracker *tracker)
+{
+	struct mlx5_core_dev *dev0 = ldev->pf[0].dev;
+	u8 v2p_port1, v2p_port2;
+	int err;
+
+	mlx5_infer_tx_affinity_mapping(tracker, &v2p_port1,
+				       &v2p_port2);
+
+	if (v2p_port1 != ldev->v2p_map[0] ||
+	    v2p_port2 != ldev->v2p_map[1]) {
+		ldev->v2p_map[0] = v2p_port1;
+		ldev->v2p_map[1] = v2p_port2;
+
+		mlx5_core_info(dev0, "modify lag map port 1:%d port 2:%d",
+			       ldev->v2p_map[0], ldev->v2p_map[1]);
+
+		err = mlx5_cmd_modify_lag(dev0, v2p_port1, v2p_port2);
+		if (err)
+			mlx5_core_err(dev0,
+				      "Failed to modify LAG (%d)\n",
+				      err);
+	}
+}
+
 static int mlx5_create_lag(struct mlx5_lag *ldev,
 			   struct lag_tracker *tracker)
 {
@@ -232,8 +258,7 @@ static void mlx5_do_bond(struct mlx5_lag *ldev)
 	struct mlx5_core_dev *dev0 = ldev->pf[0].dev;
 	struct mlx5_core_dev *dev1 = ldev->pf[1].dev;
 	struct lag_tracker tracker;
-	u8 v2p_port1, v2p_port2;
-	int i, err;
+	int i;
 	bool do_bond;
 
 	if (!dev0 || !dev1)
@@ -255,20 +280,7 @@ static void mlx5_do_bond(struct mlx5_lag *ldev)
 		mlx5_add_dev_by_protocol(dev0, MLX5_INTERFACE_PROTOCOL_IB);
 		mlx5_nic_vport_enable_roce(dev1);
 	} else if (do_bond && mlx5_lag_is_bonded(ldev)) {
-		mlx5_infer_tx_affinity_mapping(&tracker, &v2p_port1,
-					       &v2p_port2);
-
-		if ((v2p_port1 != ldev->v2p_map[0]) ||
-		    (v2p_port2 != ldev->v2p_map[1])) {
-			ldev->v2p_map[0] = v2p_port1;
-			ldev->v2p_map[1] = v2p_port2;
-
-			err = mlx5_cmd_modify_lag(dev0, v2p_port1, v2p_port2);
-			if (err)
-				mlx5_core_err(dev0,
-					      "Failed to modify LAG (%d)\n",
-					      err);
-		}
+		mlx5_modify_lag(ldev, &tracker);
 	} else if (!do_bond && mlx5_lag_is_bonded(ldev)) {
 		mlx5_remove_dev_by_protocol(dev0, MLX5_INTERFACE_PROTOCOL_IB);
 		mlx5_nic_vport_disable_roce(dev1);
-- 
2.19.2

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

* Re: [PATCH mlx5-next 2/6] IB/mlx5: Unify e-switch representors load approach between uplink and VFs
  2018-12-13  3:11 ` [PATCH mlx5-next 2/6] IB/mlx5: Unify e-switch representors load approach between uplink and VFs Saeed Mahameed
@ 2018-12-13  3:37   ` Jason Gunthorpe
  2018-12-13  3:41     ` Saeed Mahameed
  0 siblings, 1 reply; 10+ messages in thread
From: Jason Gunthorpe @ 2018-12-13  3:37 UTC (permalink / raw)
  To: Saeed Mahameed; +Cc: Leon Romanovsky, netdev, linux-rdma, Mark Bloch

On Wed, Dec 12, 2018 at 07:11:37PM -0800, Saeed Mahameed wrote:
> From: Mark Bloch <markb@mellanox.com>
> 
> When in switchdev mode and the add function is called by the core
> level driver, make sure we only register the callbacks, but don't
> create the mlx5 IB device or initialize anything. With this change
> all the IB devices in switchdev mode are created only once the load
> callback is invoked by the e-switch core sub-module. This follows
> the design paradigm under which the all the Eth representors must
> be loaded before any of IB reprs is loaded.
> 
> Signed-off-by: Mark Bloch <markb@mellanox.com>
> Acked-by: Or Gerlitz <ogerlitz@mellanox.com>
> Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
> ---
>  drivers/infiniband/hw/mlx5/ib_rep.c  | 11 ++++++++++-
>  drivers/infiniband/hw/mlx5/main.c    | 29 +++++++++-------------------
>  drivers/infiniband/hw/mlx5/mlx5_ib.h |  1 -
>  3 files changed, 19 insertions(+), 22 deletions(-)

Why is this going in the shared branch? This looks like an IB patch??

Jason

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

* Re: [PATCH mlx5-next 2/6] IB/mlx5: Unify e-switch representors load approach between uplink and VFs
  2018-12-13  3:37   ` Jason Gunthorpe
@ 2018-12-13  3:41     ` Saeed Mahameed
  0 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2018-12-13  3:41 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: netdev, Leon Romanovsky, linux-rdma, Mark Bloch

On Thu, 2018-12-13 at 03:37 +0000, Jason Gunthorpe wrote:
> On Wed, Dec 12, 2018 at 07:11:37PM -0800, Saeed Mahameed wrote:
> > From: Mark Bloch <markb@mellanox.com>
> > 
> > When in switchdev mode and the add function is called by the core
> > level driver, make sure we only register the callbacks, but don't
> > create the mlx5 IB device or initialize anything. With this change
> > all the IB devices in switchdev mode are created only once the load
> > callback is invoked by the e-switch core sub-module. This follows
> > the design paradigm under which the all the Eth representors must
> > be loaded before any of IB reprs is loaded.
> > 
> > Signed-off-by: Mark Bloch <markb@mellanox.com>
> > Acked-by: Or Gerlitz <ogerlitz@mellanox.com>
> > Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
> > Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
> > ---
> >  drivers/infiniband/hw/mlx5/ib_rep.c  | 11 ++++++++++-
> >  drivers/infiniband/hw/mlx5/main.c    | 29 +++++++++---------------
> > ----
> >  drivers/infiniband/hw/mlx5/mlx5_ib.h |  1 -
> >  3 files changed, 19 insertions(+), 22 deletions(-)
> 
> Why is this going in the shared branch? This looks like an IB patch??
> 

Some upcoming changes to support uplink representor will demand this
refactoring in the mlx5 IB driver, otherwise we will have a broken rdma
eswitch representors untill the two trees are merged.

> Jason

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

* Re: [PATCH mlx5-next 0/6] mlx5 updates for shared branch 2018-12-12
  2018-12-13  3:11 [PATCH mlx5-next 0/6] mlx5 updates for shared branch 2018-12-12 Saeed Mahameed
                   ` (5 preceding siblings ...)
  2018-12-13  3:11 ` [PATCH mlx5-next 6/6] net/mlx5: Fold the modify lag code into function Saeed Mahameed
@ 2018-12-14 19:05 ` Saeed Mahameed
  6 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2018-12-14 19:05 UTC (permalink / raw)
  To: Saeed Mahameed
  Cc: Leon Romanovsky, Linux Netdev List, RDMA mailing list, Jason Gunthorpe

On Wed, Dec 12, 2018 at 7:12 PM Saeed Mahameed <saeedm@mellanox.com> wrote:
>
> Hi,
>
> This series includes updates to mlx5 core driver for the shared
> mlx5-next branch.
>
> 1) From Mark Bloch, Unify e-switch representors load approach in mlx5_ib
> 2) From Shahar Klein, Flow counters affinity bits for lag
> 3) From Roy Dayan, Lag affinity log and cleanup
> 4) From Saeed Mahameed, A cleanup patch for mlx5_ifc.h
>

Applied to mlx5-next,
Thanks.

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

end of thread, other threads:[~2018-12-14 19:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-13  3:11 [PATCH mlx5-next 0/6] mlx5 updates for shared branch 2018-12-12 Saeed Mahameed
2018-12-13  3:11 ` [PATCH mlx5-next 1/6] net/mlx5: Use lowercase 'X' for hex values Saeed Mahameed
2018-12-13  3:11 ` [PATCH mlx5-next 2/6] IB/mlx5: Unify e-switch representors load approach between uplink and VFs Saeed Mahameed
2018-12-13  3:37   ` Jason Gunthorpe
2018-12-13  3:41     ` Saeed Mahameed
2018-12-13  3:11 ` [PATCH mlx5-next 3/6] net/mlx5: E-Switch, Introduce flow counter affinity Saeed Mahameed
2018-12-13  3:11 ` [PATCH mlx5-next 4/6] net/mlx5: Split the activate lag function into two routines Saeed Mahameed
2018-12-13  3:11 ` [PATCH mlx5-next 5/6] net/mlx5: Add lag affinity info to log Saeed Mahameed
2018-12-13  3:11 ` [PATCH mlx5-next 6/6] net/mlx5: Fold the modify lag code into function Saeed Mahameed
2018-12-14 19:05 ` [PATCH mlx5-next 0/6] mlx5 updates for shared branch 2018-12-12 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).