OSDN Git Service

mlxsw: spectrum_ethtool: Introduce ptys_max_speed callback
authorPetr Machata <petrm@nvidia.com>
Sun, 13 Sep 2020 15:46:06 +0000 (18:46 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 14 Sep 2020 21:37:30 +0000 (14:37 -0700)
commit60fbc52184ee85d0556142d1a97a56f451be5966
treef72339ed1c4a4734bba9fa53f0000ff5f3615406
parentd24ca6c0a76b52de0d675ef107fef721b6b27b0c
mlxsw: spectrum_ethtool: Introduce ptys_max_speed callback

The SBIB register configures the size of an internal buffer that the
Spectrum ASICs use when mirroring traffic on egress. This size should be
taken into account when validating that the port headroom buffers are not
larger than the chip can handle. Up until now this was not done, which is
incidentally not a problem, because the priority group buffers that mlxsw
auto-configures are small enough that the boundary condition could not be
violated.

When dcbnl_setbuffer is implemented, the user gets control over sizes of PG
buffers, and they might overshoot the headroom capacity. However the size
of the SBIB buffer depends on port speed, which cannot be vetoed. There is
obviously no way to retroactively push back on requests for overlarge PG
buffers, or reject an overlarge MTU, or cancel losslessness of a certain
PG.

Therefore, instead of taking into account the current speed when
calculating SBIB buffer size, take into account the maximum speed that a
port with given Ethernet protocol capabilities can have.

To that end, add a new ethtool callback, ptys_max_speed, which determines
this maximum speed.

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