Commit 8b90d897 authored by Parav Pandit's avatar Parav Pandit Committed by Saeed Mahameed

net/mlx5e: E-switch, Fix rate calculation division

do_div() returns reminder, while cited patch wanted to use
quotient.
Fix it by using quotient.

Fixes: 0e22bfb7 ("net/mlx5e: E-switch, Fix rate calculation for overflow")
Signed-off-by: default avatarParav Pandit <parav@nvidia.com>
Signed-off-by: default avatarMaor Dickman <maord@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 8256c69b
...@@ -4445,7 +4445,8 @@ static int apply_police_params(struct mlx5e_priv *priv, u64 rate, ...@@ -4445,7 +4445,8 @@ static int apply_police_params(struct mlx5e_priv *priv, u64 rate,
*/ */
if (rate) { if (rate) {
rate = (rate * BITS_PER_BYTE) + 500000; rate = (rate * BITS_PER_BYTE) + 500000;
rate_mbps = max_t(u64, do_div(rate, 1000000), 1); do_div(rate, 1000000);
rate_mbps = max_t(u32, rate, 1);
} }
err = mlx5_esw_modify_vport_rate(esw, vport_num, rate_mbps); err = mlx5_esw_modify_vport_rate(esw, vport_num, rate_mbps);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment