]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net/mlx5e: Fix maxrate wraparound in threshold between units
authorGal Pressman <gal@nvidia.com>
Sun, 9 Nov 2025 09:37:51 +0000 (11:37 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Dec 2025 11:45:17 +0000 (12:45 +0100)
commitad2467e714075bfda68f82ba2c471ff3027aa92a
treeaa7ae8e2d7fa36a8d9aff8644142a13fa6f2e637
parent918e063304f945fb93be9bb70cacea07d0b730ea
net/mlx5e: Fix maxrate wraparound in threshold between units

[ Upstream commit a7bf4d5063c7837096aab2853224eb23628514d9 ]

The previous calculation used roundup() which caused an overflow for
rates between 25.5Gbps and 26Gbps.
For example, a rate of 25.6Gbps would result in using 100Mbps units with
value of 256, which would overflow the 8 bits field.

Simplify the upper_limit_mbps calculation by removing the
unnecessary roundup, and adjust the comparison to use <= to correctly
handle the boundary condition.

Fixes: d8880795dabf ("net/mlx5e: Implement DCBNL IEEE max rate")
Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Nimrod Oren <noren@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/1762681073-1084058-4-git-send-email-tariqt@nvidia.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c