mlxsw: spectrum_buffers: Reject overlarge headroom size requests
authorPetr Machata <petrm@mellanox.com>
Wed, 20 Feb 2019 19:32:29 +0000 (19:32 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 21 Feb 2019 23:57:46 +0000 (15:57 -0800)
commitbb6c346cef6fb0414865aaa6e2f3a11ceeeae14a
treea5c798c59afc7badb31061b7eaf3b6f5a036488f
parentedf777f55aee61d1021fc496f16ef121380cfa67
mlxsw: spectrum_buffers: Reject overlarge headroom size requests

cap_max_headroom_size holds maximum headroom size supported.
Overstepping that limit might under certain conditions lead to ASIC
freeze.

Query and store the value, and add mlxsw_sp_sb_max_headroom_cells() for
obtaining the stored value. In __mlxsw_sp_port_headroom_set(), reject
requests where the total port buffer is larger than the advertised
maximum.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/resources.h
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
drivers/net/ethernet/mellanox/mlxsw/spectrum.h
drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c