Skip to content

Commit 736dfe4

Browse files
nvmmaxSaeed Mahameed
authored andcommitted
net/mlx5e: Don't treat small ceil values as unlimited in HTB offload
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: 214baf2 ("net/mlx5e: Support HTB offload") Signed-off-by: Maxim Mikityanskiy <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent d8e5883 commit 736dfe4

File tree

1 file changed

+2
-1
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/en

1 file changed

+2
-1
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en/qos.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,8 @@ static int mlx5e_htb_convert_rate(struct mlx5e_priv *priv, u64 rate,
570570

571571
static void mlx5e_htb_convert_ceil(struct mlx5e_priv *priv, u64 ceil, u32 *max_average_bw)
572572
{
573-
*max_average_bw = div_u64(ceil, BYTES_IN_MBIT);
573+
/* Hardware treats 0 as "unlimited", set at least 1. */
574+
*max_average_bw = max_t(u32, div_u64(ceil, BYTES_IN_MBIT), 1);
574575

575576
qos_dbg(priv->mdev, "Convert: ceil %llu -> max_average_bw %u\n",
576577
ceil, *max_average_bw);

0 commit comments

Comments
 (0)