net/mlx5e: E-switch, Fix rate calculation for overflow
authorParav Pandit <parav@nvidia.com>
Tue, 12 Jan 2021 14:13:22 +0000 (16:13 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Feb 2021 22:28:49 +0000 (23:28 +0100)
commit2778913fb080dec00a244faacd2be3f5e7a1e83c
tree2e0532759815470d9c4eabb098dea8b8ca465eb4
parentd62665cac6038ffcde794afeed4c1992c690afd6
net/mlx5e: E-switch, Fix rate calculation for overflow

[ Upstream commit 1fe3e3166b35240615ab7f8276af2bbf2e51f559 ]

rate_bytes_ps is a 64-bit field. It passed as 32-bit field to
apply_police_params(). Due to this when police rate is higher
than 4Gbps, 32-bit calculation ignores the carry. This results
in incorrect rate configurationn the device.

Fix it by performing 64-bit calculation.

Fixes: fcb64c0f5640 ("net/mlx5: E-Switch, add ingress rate support")
Signed-off-by: Parav Pandit <parav@nvidia.com>
Reviewed-by: Eli Cohen <elic@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c