net/mlx5e: Update shared buffer along with device buffer changes
authorMaher Sanalla <msanalla@nvidia.com>
Mon, 28 Nov 2022 17:03:07 +0000 (19:03 +0200)
committerSaeed Mahameed <saeedm@nvidia.com>
Wed, 11 Jan 2023 05:24:40 +0000 (21:24 -0800)
commita440030d8946bfe3fd44b6da685e33ffe0ecd1ff
tree89487e0d838101f86d750b66af9e2e170a872bef
parent11f0996d5c6023f4889882c8d088ec76a050d704
net/mlx5e: Update shared buffer along with device buffer changes

Currently, the user can modify device's receive buffer size, modify the
mapping between QoS priority groups to buffers and change the buffer
state to become lossy/lossless via pfc command.

However, the shared receive buffer pool alignments, as a result of
such commands, is performed only when the shared buffer is in FW ownership.
When a user changes the mapping of priority groups or buffer size,
the shared buffer is moved to SW ownership.

Therefore, for devices that support shared buffer, handle the shared buffer
alignments in accordance to user's desired configurations.

Meaning, the following will be performed:
1. For every change of buffer's headroom, recalculate the size of shared
   buffer to be equal to "total_buffer_size" - "new_headroom_size".
   The new shared buffer size will be split in ratio of 3:1 between
   lossy and lossless pools, respectively.

2. For each port buffer change, count the number of lossless buffers.
   If there is only one lossless buffer, then set its lossless pool
   usage threshold to be infinite. Otherwise, if there is more than
   one lossless buffer, set a usage threshold for each lossless buffer.

While at it, add more verbosity to debug prints when handling user
commands, to assist in future debug.

Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c
drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.h