summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorParav Pandit <parav@nvidia.com>2021-02-17 07:23:29 +0100
committerSaeed Mahameed <saeedm@nvidia.com>2021-03-10 20:01:57 +0100
commit8b90d897823b28a51811931f3bdc79f8df79407e (patch)
tree914fc4e29e9ed0804ab451221f1fc8bffbee9039
parentRDMA/mlx5: Fix timestamp default mode (diff)
downloadlinux-8b90d897823b28a51811931f3bdc79f8df79407e.tar.xz
linux-8b90d897823b28a51811931f3bdc79f8df79407e.zip
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: 0e22bfb7c046 ("net/mlx5e: E-switch, Fix rate calculation for overflow") Signed-off-by: Parav Pandit <parav@nvidia.com> Signed-off-by: Maor Dickman <maord@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_tc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 0da69b98f38f..0cacf46dc950 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -4445,7 +4445,8 @@ static int apply_police_params(struct mlx5e_priv *priv, u64 rate,
*/
if (rate) {
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);