]> git.baikalelectronics.ru Git - kernel.git/commit
mlxsw: __mlxsw_sp_port_headroom_set(): Fix a use of local variable
authorPetr Machata <petrm@mellanox.com>
Sun, 17 Feb 2019 07:18:41 +0000 (07:18 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 17 Feb 2019 18:13:46 +0000 (10:13 -0800)
commit032f8cc1839add52b1bada692e4494e3cad69c84
treeb944cbd0701eccb1a365b9b91ae5e5181b1ee288
parenta2717de836035c6ef53e023c8c8045118726be6f
mlxsw: __mlxsw_sp_port_headroom_set(): Fix a use of local variable

The function-local variable "delay" enters the loop interpreted as delay
in bits. However, inside the loop it gets overwritten by the result of
mlxsw_sp_pg_buf_delay_get(), and thus leaves the loop as quantity in
cells. Thus on second and further loop iterations, the headroom for a
given priority is configured with a wrong size.

Fix by introducing a loop-local variable, delay_cells. Rename thres to
thres_cells for consistency.

Fixes: 14b77c42cb04 ("mlxsw: spectrum: Refactor port buffer configuration")
Signed-off-by: Petr Machata <petrm@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum.c