All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/3] mlxsw: Thermal and qdisc fixes
@ 2021-06-06  8:24 Ido Schimmel
  2021-06-06  8:24 ` [PATCH net 1/3] mlxsw: reg: Spectrum-3: Enforce lowest max-shaper burst size of 11 Ido Schimmel
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ido Schimmel @ 2021-06-06  8:24 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, jiri, petrm, mlxsw, Ido Schimmel

From: Ido Schimmel <idosch@nvidia.com>

Patches #1-#2 fix wrong validation of burst size in qdisc code and a
user triggerable WARN_ON().

Patch #3 fixes a regression in thermal monitoring of transceiver modules
and gearboxes.

Mykola Kostenok (1):
  mlxsw: core: Set thermal zone polling delay argument to real value at
    init

Petr Machata (2):
  mlxsw: reg: Spectrum-3: Enforce lowest max-shaper burst size of 11
  mlxsw: spectrum_qdisc: Pass handle, not band number to find_class()

 drivers/net/ethernet/mellanox/mlxsw/core_thermal.c   | 6 ++++--
 drivers/net/ethernet/mellanox/mlxsw/reg.h            | 2 +-
 drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c | 5 ++++-
 3 files changed, 9 insertions(+), 4 deletions(-)

-- 
2.31.1


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

* [PATCH net 1/3] mlxsw: reg: Spectrum-3: Enforce lowest max-shaper burst size of 11
  2021-06-06  8:24 [PATCH net 0/3] mlxsw: Thermal and qdisc fixes Ido Schimmel
@ 2021-06-06  8:24 ` Ido Schimmel
  2021-06-06  8:24 ` [PATCH net 2/3] mlxsw: spectrum_qdisc: Pass handle, not band number to find_class() Ido Schimmel
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Ido Schimmel @ 2021-06-06  8:24 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, jiri, petrm, mlxsw, Ido Schimmel

From: Petr Machata <petrm@nvidia.com>

A max-shaper is the HW component responsible for delaying egress traffic
above a configured transmission rate. Burst size is the amount of traffic
that is allowed to pass without accounting. The burst size value needs to
be such that it can be expressed as 2^BS * 512 bits, where BS lies in a
certain ASIC-dependent range. mlxsw enforces that this holds before
attempting to configure the shaper.

The assumption for Spectrum-3 was that the lower limit of BS would be 5,
like for Spectrum-1. But as of now, the limit is still 11. Therefore fix
the driver accordingly, so that incorrect values are rejected early with a
proper message.

Fixes: 23effa2479ba ("mlxsw: reg: Add max_shaper_bs to QoS ETS Element Configuration")
Reported-by: Maksym Yaremchuk <maksymy@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlxsw/reg.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h
index 900b4bf5bb5b..2bc5a9003c6d 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/reg.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h
@@ -3907,7 +3907,7 @@ MLXSW_ITEM32(reg, qeec, max_shaper_bs, 0x1C, 0, 6);
 #define MLXSW_REG_QEEC_HIGHEST_SHAPER_BS	25
 #define MLXSW_REG_QEEC_LOWEST_SHAPER_BS_SP1	5
 #define MLXSW_REG_QEEC_LOWEST_SHAPER_BS_SP2	11
-#define MLXSW_REG_QEEC_LOWEST_SHAPER_BS_SP3	5
+#define MLXSW_REG_QEEC_LOWEST_SHAPER_BS_SP3	11
 
 static inline void mlxsw_reg_qeec_pack(char *payload, u8 local_port,
 				       enum mlxsw_reg_qeec_hr hr, u8 index,
-- 
2.31.1


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

* [PATCH net 2/3] mlxsw: spectrum_qdisc: Pass handle, not band number to find_class()
  2021-06-06  8:24 [PATCH net 0/3] mlxsw: Thermal and qdisc fixes Ido Schimmel
  2021-06-06  8:24 ` [PATCH net 1/3] mlxsw: reg: Spectrum-3: Enforce lowest max-shaper burst size of 11 Ido Schimmel
@ 2021-06-06  8:24 ` Ido Schimmel
  2021-06-06  8:24 ` [PATCH net 3/3] mlxsw: core: Set thermal zone polling delay argument to real value at init Ido Schimmel
  2021-06-07 20:20 ` [PATCH net 0/3] mlxsw: Thermal and qdisc fixes patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Ido Schimmel @ 2021-06-06  8:24 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, jiri, petrm, mlxsw, Ido Schimmel

From: Petr Machata <petrm@nvidia.com>

In mlxsw Qdisc offload, find_class() is an operation that yields a qdisc
offload descriptor given a parental qdisc descriptor and a class handle. In
__mlxsw_sp_qdisc_ets_graft() however, a band number is passed to that
function instead of a handle. This can lead to a trigger of a WARN_ON
with the following splat:

 WARNING: CPU: 3 PID: 808 at drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c:1356 __mlxsw_sp_qdisc_ets_graft+0x115/0x130 [mlxsw_spectrum]
 [...]
 Call Trace:
  mlxsw_sp_setup_tc_prio+0xe3/0x100 [mlxsw_spectrum]
  qdisc_offload_graft_helper+0x35/0xa0
  prio_graft+0x176/0x290 [sch_prio]
  qdisc_graft+0xb3/0x540
  tc_modify_qdisc+0x56a/0x8a0
  rtnetlink_rcv_msg+0x12c/0x370
  netlink_rcv_skb+0x49/0xf0
  netlink_unicast+0x1f6/0x2b0
  netlink_sendmsg+0x1fb/0x410
  ____sys_sendmsg+0x1f3/0x220
  ___sys_sendmsg+0x70/0xb0
  __sys_sendmsg+0x54/0xa0
  do_syscall_64+0x3a/0x70
  entry_SYSCALL_64_after_hwframe+0x44/0xae

Since the parent handle is not passed with the offload information, compute
it from the band number and qdisc handle.

Fixes: 28052e618b04 ("mlxsw: spectrum_qdisc: Track children per qdisc")
Reported-by: Maksym Yaremchuk <maksymy@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c
index 04672eb5c7f3..9958d503bf0e 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c
@@ -1332,6 +1332,7 @@ __mlxsw_sp_qdisc_ets_graft(struct mlxsw_sp_port *mlxsw_sp_port,
 			   u8 band, u32 child_handle)
 {
 	struct mlxsw_sp_qdisc *old_qdisc;
+	u32 parent;
 
 	if (band < mlxsw_sp_qdisc->num_classes &&
 	    mlxsw_sp_qdisc->qdiscs[band].handle == child_handle)
@@ -1352,7 +1353,9 @@ __mlxsw_sp_qdisc_ets_graft(struct mlxsw_sp_port *mlxsw_sp_port,
 	if (old_qdisc)
 		mlxsw_sp_qdisc_destroy(mlxsw_sp_port, old_qdisc);
 
-	mlxsw_sp_qdisc = mlxsw_sp_qdisc->ops->find_class(mlxsw_sp_qdisc, band);
+	parent = TC_H_MAKE(mlxsw_sp_qdisc->handle, band + 1);
+	mlxsw_sp_qdisc = mlxsw_sp_qdisc->ops->find_class(mlxsw_sp_qdisc,
+							 parent);
 	if (!WARN_ON(!mlxsw_sp_qdisc))
 		mlxsw_sp_qdisc_destroy(mlxsw_sp_port, mlxsw_sp_qdisc);
 
-- 
2.31.1


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

* [PATCH net 3/3] mlxsw: core: Set thermal zone polling delay argument to real value at init
  2021-06-06  8:24 [PATCH net 0/3] mlxsw: Thermal and qdisc fixes Ido Schimmel
  2021-06-06  8:24 ` [PATCH net 1/3] mlxsw: reg: Spectrum-3: Enforce lowest max-shaper burst size of 11 Ido Schimmel
  2021-06-06  8:24 ` [PATCH net 2/3] mlxsw: spectrum_qdisc: Pass handle, not band number to find_class() Ido Schimmel
@ 2021-06-06  8:24 ` Ido Schimmel
  2021-06-07 20:20 ` [PATCH net 0/3] mlxsw: Thermal and qdisc fixes patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Ido Schimmel @ 2021-06-06  8:24 UTC (permalink / raw)
  To: netdev
  Cc: davem, kuba, jiri, petrm, mlxsw, Mykola Kostenok,
	Andrzej Pietrasiewicz, Ido Schimmel

From: Mykola Kostenok <c_mykolak@nvidia.com>

Thermal polling delay argument for modules and gearboxes thermal zones
used to be initialized with zero value, while actual delay was used to
be set by mlxsw_thermal_set_mode() by thermal operation callback
set_mode(). After operations set_mode()/get_mode() have been removed by
cited commits, modules and gearboxes thermal zones always have polling
time set to zero and do not perform temperature monitoring.

Set non-zero "polling_delay" in thermal_zone_device_register() routine,
thus, the relevant thermal zones will perform thermal monitoring.

Cc: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Fixes: 5d7bd8aa7c35 ("thermal: Simplify or eliminate unnecessary set_mode() methods")
Fixes: 1ee14820fd8e ("thermal: remove get_mode() operation of drivers")
Signed-off-by: Mykola Kostenok <c_mykolak@nvidia.com>
Acked-by: Vadim Pasternak <vadimp@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlxsw/core_thermal.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
index dfea14399607..85f0ce285146 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
@@ -693,7 +693,8 @@ mlxsw_thermal_module_tz_init(struct mlxsw_thermal_module *module_tz)
 							MLXSW_THERMAL_TRIP_MASK,
 							module_tz,
 							&mlxsw_thermal_module_ops,
-							NULL, 0, 0);
+							NULL, 0,
+							module_tz->parent->polling_delay);
 	if (IS_ERR(module_tz->tzdev)) {
 		err = PTR_ERR(module_tz->tzdev);
 		return err;
@@ -815,7 +816,8 @@ mlxsw_thermal_gearbox_tz_init(struct mlxsw_thermal_module *gearbox_tz)
 						MLXSW_THERMAL_TRIP_MASK,
 						gearbox_tz,
 						&mlxsw_thermal_gearbox_ops,
-						NULL, 0, 0);
+						NULL, 0,
+						gearbox_tz->parent->polling_delay);
 	if (IS_ERR(gearbox_tz->tzdev))
 		return PTR_ERR(gearbox_tz->tzdev);
 
-- 
2.31.1


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

* Re: [PATCH net 0/3] mlxsw: Thermal and qdisc fixes
  2021-06-06  8:24 [PATCH net 0/3] mlxsw: Thermal and qdisc fixes Ido Schimmel
                   ` (2 preceding siblings ...)
  2021-06-06  8:24 ` [PATCH net 3/3] mlxsw: core: Set thermal zone polling delay argument to real value at init Ido Schimmel
@ 2021-06-07 20:20 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-07 20:20 UTC (permalink / raw)
  To: Ido Schimmel; +Cc: netdev, davem, kuba, jiri, petrm, mlxsw, idosch

Hello:

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

On Sun,  6 Jun 2021 11:24:29 +0300 you wrote:
> From: Ido Schimmel <idosch@nvidia.com>
> 
> Patches #1-#2 fix wrong validation of burst size in qdisc code and a
> user triggerable WARN_ON().
> 
> Patch #3 fixes a regression in thermal monitoring of transceiver modules
> and gearboxes.
> 
> [...]

Here is the summary with links:
  - [net,1/3] mlxsw: reg: Spectrum-3: Enforce lowest max-shaper burst size of 11
    https://git.kernel.org/netdev/net/c/306b9228c097
  - [net,2/3] mlxsw: spectrum_qdisc: Pass handle, not band number to find_class()
    https://git.kernel.org/netdev/net/c/d566ed04e42b
  - [net,3/3] mlxsw: core: Set thermal zone polling delay argument to real value at init
    https://git.kernel.org/netdev/net/c/2fd8d84ce309

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] 5+ messages in thread

end of thread, other threads:[~2021-06-07 20:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-06  8:24 [PATCH net 0/3] mlxsw: Thermal and qdisc fixes Ido Schimmel
2021-06-06  8:24 ` [PATCH net 1/3] mlxsw: reg: Spectrum-3: Enforce lowest max-shaper burst size of 11 Ido Schimmel
2021-06-06  8:24 ` [PATCH net 2/3] mlxsw: spectrum_qdisc: Pass handle, not band number to find_class() Ido Schimmel
2021-06-06  8:24 ` [PATCH net 3/3] mlxsw: core: Set thermal zone polling delay argument to real value at init Ido Schimmel
2021-06-07 20:20 ` [PATCH net 0/3] mlxsw: Thermal and qdisc fixes 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.