All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/2] mlxsw: Various fixes
@ 2019-03-12  8:40 Ido Schimmel
  2019-03-12  8:40 ` [PATCH net 1/2] mlxsw: core: Prevent duplication during QSFP module initialization Ido Schimmel
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Ido Schimmel @ 2019-03-12  8:40 UTC (permalink / raw)
  To: netdev; +Cc: davem, Jiri Pirko, mlxsw, Vadim Pasternak, Ido Schimmel

Patch #1 fixes the recently introduced QSFP thermal zones to correctly
work with split ports, where several ports are mapped to the same
module.

Patch #2 initializes the base MAC in the minimal driver. The driver is
using the base MAC as its parent ID and without initializing it, it is
reported as all zeroes to user space.

Jiri Pirko (1):
  mlxsw: minimal: Initialize base_mac

Vadim Pasternak (1):
  mlxsw: core: Prevent duplication during QSFP module initialization

 .../ethernet/mellanox/mlxsw/core_thermal.c    | 21 ++++++++++---------
 drivers/net/ethernet/mellanox/mlxsw/minimal.c | 18 ++++++++++++++++
 2 files changed, 29 insertions(+), 10 deletions(-)

-- 
2.20.1


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

* [PATCH net 1/2] mlxsw: core: Prevent duplication during QSFP module initialization
  2019-03-12  8:40 [PATCH net 0/2] mlxsw: Various fixes Ido Schimmel
@ 2019-03-12  8:40 ` Ido Schimmel
  2019-03-12  8:40 ` [PATCH net 2/2] mlxsw: minimal: Initialize base_mac Ido Schimmel
  2019-03-12 21:55 ` [PATCH net 0/2] mlxsw: Various fixes David Miller
  2 siblings, 0 replies; 10+ messages in thread
From: Ido Schimmel @ 2019-03-12  8:40 UTC (permalink / raw)
  To: netdev; +Cc: davem, Jiri Pirko, mlxsw, Vadim Pasternak, Ido Schimmel

From: Vadim Pasternak <vadimp@mellanox.com>

Verify during thermal initialization if QSFP module's entry is already
configured in order to prevent duplication.
Such scenario could happen in case two switch drivers (PCI and I2C
based) coexist and if after boot, splitting configuration is applied
for some ports and then I2C based driver is re-probed.
In such case after reboot same QSFP module, associated with split will
be discovered by I2C based driver few times, and it will cause a crash.

It could happen for example on system equipped with BMC (Baseboard
Management Controller), running I2C based driver, when the next steps
are performed:
- System boot
- Host side configures port spilt.
- BMC side is rebooted.

Fixes: 6a79507cfe94 ("mlxsw: core: Extend thermal module with per QSFP module thermal zones")
Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
---
 .../ethernet/mellanox/mlxsw/core_thermal.c    | 21 ++++++++++---------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
index 0b85c7252f9e..472f63f9fac5 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
@@ -111,7 +111,6 @@ struct mlxsw_thermal {
 	struct mlxsw_thermal_trip trips[MLXSW_THERMAL_NUM_TRIPS];
 	enum thermal_device_mode mode;
 	struct mlxsw_thermal_module *tz_module_arr;
-	unsigned int tz_module_num;
 };
 
 static inline u8 mlxsw_state_to_duty(int state)
@@ -711,6 +710,9 @@ mlxsw_thermal_module_init(struct device *dev, struct mlxsw_core *core,
 
 	module = mlxsw_reg_pmlp_module_get(pmlp_pl, 0);
 	module_tz = &thermal->tz_module_arr[module];
+	/* Skip if parent is already set (case of port split). */
+	if (module_tz->parent)
+		return 0;
 	module_tz->module = module;
 	module_tz->parent = thermal;
 	memcpy(module_tz->trips, default_thermal_trips,
@@ -718,13 +720,7 @@ mlxsw_thermal_module_init(struct device *dev, struct mlxsw_core *core,
 	/* Initialize all trip point. */
 	mlxsw_thermal_module_trips_reset(module_tz);
 	/* Update trip point according to the module data. */
-	err = mlxsw_thermal_module_trips_update(dev, core, module_tz);
-	if (err)
-		return err;
-
-	thermal->tz_module_num++;
-
-	return 0;
+	return mlxsw_thermal_module_trips_update(dev, core, module_tz);
 }
 
 static void mlxsw_thermal_module_fini(struct mlxsw_thermal_module *module_tz)
@@ -732,6 +728,7 @@ static void mlxsw_thermal_module_fini(struct mlxsw_thermal_module *module_tz)
 	if (module_tz && module_tz->tzdev) {
 		mlxsw_thermal_module_tz_fini(module_tz->tzdev);
 		module_tz->tzdev = NULL;
+		module_tz->parent = NULL;
 	}
 }
 
@@ -740,6 +737,7 @@ mlxsw_thermal_modules_init(struct device *dev, struct mlxsw_core *core,
 			   struct mlxsw_thermal *thermal)
 {
 	unsigned int module_count = mlxsw_core_max_ports(core);
+	struct mlxsw_thermal_module *module_tz;
 	int i, err;
 
 	thermal->tz_module_arr = kcalloc(module_count,
@@ -754,8 +752,11 @@ mlxsw_thermal_modules_init(struct device *dev, struct mlxsw_core *core,
 			goto err_unreg_tz_module_arr;
 	}
 
-	for (i = 0; i < thermal->tz_module_num; i++) {
-		err = mlxsw_thermal_module_tz_init(&thermal->tz_module_arr[i]);
+	for (i = 0; i < module_count - 1; i++) {
+		module_tz = &thermal->tz_module_arr[i];
+		if (!module_tz->parent)
+			continue;
+		err = mlxsw_thermal_module_tz_init(module_tz);
 		if (err)
 			goto err_unreg_tz_module_arr;
 	}
-- 
2.20.1


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

* [PATCH net 2/2] mlxsw: minimal: Initialize base_mac
  2019-03-12  8:40 [PATCH net 0/2] mlxsw: Various fixes Ido Schimmel
  2019-03-12  8:40 ` [PATCH net 1/2] mlxsw: core: Prevent duplication during QSFP module initialization Ido Schimmel
@ 2019-03-12  8:40 ` Ido Schimmel
  2019-03-12 21:55 ` [PATCH net 0/2] mlxsw: Various fixes David Miller
  2 siblings, 0 replies; 10+ messages in thread
From: Ido Schimmel @ 2019-03-12  8:40 UTC (permalink / raw)
  To: netdev; +Cc: davem, Jiri Pirko, mlxsw, Vadim Pasternak, Ido Schimmel

From: Jiri Pirko <jiri@mellanox.com>

Currently base_mac is not initialized which causes wrong reporting of
zeroed parent_id to userspace. Fix this by initializing base_mac
properly.

Fixes: c100e47caa8e ("mlxsw: minimal: Add ethtool support")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlxsw/minimal.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/minimal.c b/drivers/net/ethernet/mellanox/mlxsw/minimal.c
index 68bee9572a1b..00c390024350 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/minimal.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/minimal.c
@@ -34,6 +34,18 @@ struct mlxsw_m_port {
 	u8 module;
 };
 
+static int mlxsw_m_base_mac_get(struct mlxsw_m *mlxsw_m)
+{
+	char spad_pl[MLXSW_REG_SPAD_LEN] = {0};
+	int err;
+
+	err = mlxsw_reg_query(mlxsw_m->core, MLXSW_REG(spad), spad_pl);
+	if (err)
+		return err;
+	mlxsw_reg_spad_base_mac_memcpy_from(spad_pl, mlxsw_m->base_mac);
+	return 0;
+}
+
 static int mlxsw_m_port_dummy_open_stop(struct net_device *dev)
 {
 	return 0;
@@ -314,6 +326,12 @@ static int mlxsw_m_init(struct mlxsw_core *mlxsw_core,
 	mlxsw_m->core = mlxsw_core;
 	mlxsw_m->bus_info = mlxsw_bus_info;
 
+	err = mlxsw_m_base_mac_get(mlxsw_m);
+	if (err) {
+		dev_err(mlxsw_m->bus_info->dev, "Failed to get base mac\n");
+		return err;
+	}
+
 	err = mlxsw_m_ports_create(mlxsw_m);
 	if (err) {
 		dev_err(mlxsw_m->bus_info->dev, "Failed to create ports\n");
-- 
2.20.1


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

* Re: [PATCH net 0/2] mlxsw: Various fixes
  2019-03-12  8:40 [PATCH net 0/2] mlxsw: Various fixes Ido Schimmel
  2019-03-12  8:40 ` [PATCH net 1/2] mlxsw: core: Prevent duplication during QSFP module initialization Ido Schimmel
  2019-03-12  8:40 ` [PATCH net 2/2] mlxsw: minimal: Initialize base_mac Ido Schimmel
@ 2019-03-12 21:55 ` David Miller
  2 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2019-03-12 21:55 UTC (permalink / raw)
  To: idosch; +Cc: netdev, jiri, mlxsw, vadimp

From: Ido Schimmel <idosch@mellanox.com>
Date: Tue, 12 Mar 2019 08:40:40 +0000

> Patch #1 fixes the recently introduced QSFP thermal zones to correctly
> work with split ports, where several ports are mapped to the same
> module.
> 
> Patch #2 initializes the base MAC in the minimal driver. The driver is
> using the base MAC as its parent ID and without initializing it, it is
> reported as all zeroes to user space.

Applied, thanks.

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

* Re: [PATCH net 0/2] mlxsw: Various fixes
  2021-01-28 14:48 Ido Schimmel
@ 2021-01-28 21:20 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 10+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-01-28 21:20 UTC (permalink / raw)
  To: Ido Schimmel; +Cc: netdev, davem, kuba, jiri, danieller, mlxsw, idosch

Hello:

This series was applied to netdev/net.git (refs/heads/master):

On Thu, 28 Jan 2021 16:48:18 +0200 you wrote:
> From: Ido Schimmel <idosch@nvidia.com>
> 
> Patch #1 fixes wrong invocation of mausezahn in a couple of selftests.
> The tests started failing after Fedora updated their libnet package from
> version 1.1.6 to 1.2.1. With the fix the tests pass regardless of libnet
> version.
> 
> [...]

Here is the summary with links:
  - [net,1/2] selftests: forwarding: Specify interface when invoking mausezahn
    https://git.kernel.org/netdev/net/c/11df27f7fdf0
  - [net,2/2] mlxsw: spectrum_span: Do not overwrite policer configuration
    https://git.kernel.org/netdev/net/c/b6f6881aaf23

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* [PATCH net 0/2] mlxsw: Various fixes
@ 2021-01-28 14:48 Ido Schimmel
  2021-01-28 21:20 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 10+ messages in thread
From: Ido Schimmel @ 2021-01-28 14:48 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, jiri, danieller, mlxsw, Ido Schimmel

From: Ido Schimmel <idosch@nvidia.com>

Patch #1 fixes wrong invocation of mausezahn in a couple of selftests.
The tests started failing after Fedora updated their libnet package from
version 1.1.6 to 1.2.1. With the fix the tests pass regardless of libnet
version.

Patch #2 fixes an issue in the mirroring to CPU code that results in
policer configuration being overwritten.

Danielle Ratson (1):
  selftests: forwarding: Specify interface when invoking mausezahn

Ido Schimmel (1):
  mlxsw: spectrum_span: Do not overwrite policer configuration

 drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c        | 6 ++++++
 drivers/net/ethernet/mellanox/mlxsw/spectrum_span.h        | 1 +
 tools/testing/selftests/net/forwarding/router_mpath_nh.sh  | 2 +-
 tools/testing/selftests/net/forwarding/router_multipath.sh | 2 +-
 4 files changed, 9 insertions(+), 2 deletions(-)

-- 
2.29.2


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

* Re: [PATCH net 0/2] mlxsw: Various fixes
  2020-07-10 13:41 Ido Schimmel
@ 2020-07-10 21:34 ` David Miller
  0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2020-07-10 21:34 UTC (permalink / raw)
  To: idosch; +Cc: netdev, kuba, jiri, mlxsw, idosch

From: Ido Schimmel <idosch@idosch.org>
Date: Fri, 10 Jul 2020 16:41:37 +0300

> From: Ido Schimmel <idosch@mellanox.com>
> 
> Fix two issues found by syzkaller.
> 
> Patch #1 removes inappropriate usage of WARN_ON() following memory
> allocation failure. Constantly triggered when syzkaller injects faults.
> 
> Patch #2 fixes a use-after-free that can be triggered by 'devlink dev
> info' following a failed devlink reload.

Series applied and queued up for -stable, thanks.

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

* [PATCH net 0/2] mlxsw: Various fixes
@ 2020-07-10 13:41 Ido Schimmel
  2020-07-10 21:34 ` David Miller
  0 siblings, 1 reply; 10+ messages in thread
From: Ido Schimmel @ 2020-07-10 13:41 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, jiri, mlxsw, Ido Schimmel

From: Ido Schimmel <idosch@mellanox.com>

Fix two issues found by syzkaller.

Patch #1 removes inappropriate usage of WARN_ON() following memory
allocation failure. Constantly triggered when syzkaller injects faults.

Patch #2 fixes a use-after-free that can be triggered by 'devlink dev
info' following a failed devlink reload.

Ido Schimmel (2):
  mlxsw: spectrum_router: Remove inappropriate usage of WARN_ON()
  mlxsw: pci: Fix use-after-free in case of failed devlink reload

 drivers/net/ethernet/mellanox/mlxsw/pci.c     | 54 +++++++++++++------
 .../ethernet/mellanox/mlxsw/spectrum_router.c |  2 +-
 2 files changed, 39 insertions(+), 17 deletions(-)

-- 
2.26.2


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

* Re: [PATCH net 0/2] mlxsw: Various fixes
  2020-05-21 12:11 Ido Schimmel
@ 2020-05-22 23:08 ` David Miller
  0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2020-05-22 23:08 UTC (permalink / raw)
  To: idosch; +Cc: netdev, kuba, jiri, mlxsw, idosch

From: Ido Schimmel <idosch@idosch.org>
Date: Thu, 21 May 2020 15:11:43 +0300

> From: Ido Schimmel <idosch@mellanox.com>
> 
> Patch #1 from Jiri fixes a use-after-free discovered while fuzzing mlxsw
> / devlink with syzkaller.
> 
> Patch #2 from Amit works around a limitation in new versions of arping,
> which is used in several selftests.

Series applied, thanks.

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

* [PATCH net 0/2] mlxsw: Various fixes
@ 2020-05-21 12:11 Ido Schimmel
  2020-05-22 23:08 ` David Miller
  0 siblings, 1 reply; 10+ messages in thread
From: Ido Schimmel @ 2020-05-21 12:11 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, jiri, mlxsw, Ido Schimmel

From: Ido Schimmel <idosch@mellanox.com>

Patch #1 from Jiri fixes a use-after-free discovered while fuzzing mlxsw
/ devlink with syzkaller.

Patch #2 from Amit works around a limitation in new versions of arping,
which is used in several selftests.

Amit Cohen (1):
  selftests: mlxsw: qos_mc_aware: Specify arping timeout as an integer

Jiri Pirko (1):
  mlxsw: spectrum: Fix use-after-free of split/unsplit/type_set in case
    reload fails

 drivers/net/ethernet/mellanox/mlxsw/spectrum.c     | 14 ++++++++++++--
 drivers/net/ethernet/mellanox/mlxsw/switchx2.c     |  8 ++++++++
 .../selftests/drivers/net/mlxsw/qos_mc_aware.sh    |  2 +-
 3 files changed, 21 insertions(+), 3 deletions(-)

-- 
2.26.2


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

end of thread, other threads:[~2021-01-28 21:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-12  8:40 [PATCH net 0/2] mlxsw: Various fixes Ido Schimmel
2019-03-12  8:40 ` [PATCH net 1/2] mlxsw: core: Prevent duplication during QSFP module initialization Ido Schimmel
2019-03-12  8:40 ` [PATCH net 2/2] mlxsw: minimal: Initialize base_mac Ido Schimmel
2019-03-12 21:55 ` [PATCH net 0/2] mlxsw: Various fixes David Miller
2020-05-21 12:11 Ido Schimmel
2020-05-22 23:08 ` David Miller
2020-07-10 13:41 Ido Schimmel
2020-07-10 21:34 ` David Miller
2021-01-28 14:48 Ido Schimmel
2021-01-28 21:20 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.