Commit e19a238a authored by Michal Jaron's avatar Michal Jaron Committed by Jialin Zhang
Browse files

i40e: Fix set max_tx_rate when it is lower than 1 Mbps

stable inclusion
from stable-v5.10.146
commit 2dbf487d6b381942665166be528fc06a61457206
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I6D0VX

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=2dbf487d6b381942665166be528fc06a61457206



--------------------------------

[ Upstream commit 198eb7e1 ]

While converting max_tx_rate from bytes to Mbps, this value was set to 0,
if the original value was lower than 125000 bytes (1 Mbps). This would
cause no transmission rate limiting to occur. This happened due to lack of
check of max_tx_rate against the 1 Mbps value for max_tx_rate and the
following division by 125000. Fix this issue by adding a helper
i40e_bw_bytes_to_mbits() which sets max_tx_rate to minimum usable value of
50 Mbps, if its value is less than 1 Mbps, otherwise do the required
conversion by dividing by 125000.

Fixes: 5ecae412 ("i40e: Refactor VF BW rate limiting")
Signed-off-by: default avatarMichal Jaron <michalx.jaron@intel.com>
Signed-off-by: default avatarAndrii Staikov <andrii.staikov@intel.com>
Tested-by: default avatarBharathi Sreenivas <bharathi.sreenivas@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
Reviewed-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent a304ab01
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment