net/mlx5e: Don't treat small ceil values as unlimited in HTB offload
authorMaxim Mikityanskiy <maximmi@nvidia.com>
Tue, 18 Jan 2022 11:31:54 +0000 (13:31 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 5 Feb 2022 11:38:58 +0000 (12:38 +0100)
commit5d575586c4b320796e9b0bde69065a8a52cd6a7e
tree7a9d8e44bc36d6f610e0c90aae504fc78be6e73e
parentf232acbb786ffa43f3b91a48333447e1ab55c2c9
net/mlx5e: Don't treat small ceil values as unlimited in HTB offload

commit 736dfe4e68b868829a1e89dfef4a44c1580d4478 upstream.

The hardware spec defines max_average_bw == 0 as "unlimited bandwidth".
max_average_bw is calculated as `ceil / BYTES_IN_MBIT`, which can become
0 when ceil is small, leading to an undesired effect of having no
bandwidth limit.

This commit fixes it by rounding up small values of ceil to 1 Mbit/s.

Fixes: 214baf22870c ("net/mlx5e: Support HTB offload")
Signed-off-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/mellanox/mlx5/core/en/qos.c