mlxsw: spectrum: Use guaranteed buffer size as pool size limit
authorPetr Machata <petrm@mellanox.com>
Wed, 23 Oct 2019 06:04:59 +0000 (09:04 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 24 Oct 2019 04:31:31 +0000 (21:31 -0700)
commit914c4fc1b792dd963f9606b2e8b33e3d6606eb84
tree1cd732ec7b75d4cd417ed2e19017437058a688d8
parent06cd9da58fb25526bd1a4b0f36e25e1a8824ea1f
mlxsw: spectrum: Use guaranteed buffer size as pool size limit

There are two resources associated with shared buffer size:
cap_total_buffer_size, and cap_guaranteed_shared_buffer. So far, mlxsw has
been using the former as a limit to determine how large a pool size is
allowed to be. However, the total size also includes headrooms and reserved
space, which really cannot be used for shared buffer pools.

Therefore convert mlxsw to use the latter resource as a limit. Adjust
hard-coded pool sizes to be the guaranteed size minus 256000 bytes for CPU
port pool. On Spectrum-1 that actually leads to an increase. A follow-up
patch will have this size calculated automatically.

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_buffers.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c