提交 f39fa3f4 编写于 作者: B Brett Creeley 提交者: Zheng Zengkai

ice: Don't allow more channels than LAN MSI-X available

stable inclusion
from stable-5.10.13
commit 04cd96db6f888cf8a79c8163c136eb30400ce206
bugzilla: 47995

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

[ Upstream commit 943b881e ]

Currently users could create more channels than LAN MSI-X available.
This is happening because there is no check against pf->num_lan_msix
when checking the max allowed channels and will cause performance issues
if multiple Tx and Rx queues are tied to a single MSI-X. Fix this by not
allowing more channels than LAN MSI-X available in pf->num_lan_msix.

Fixes: 87324e74 ("ice: Implement ethtool ops for channels")
Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 fcbdd770
...@@ -3258,8 +3258,8 @@ ice_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key, ...@@ -3258,8 +3258,8 @@ ice_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key,
*/ */
static int ice_get_max_txq(struct ice_pf *pf) static int ice_get_max_txq(struct ice_pf *pf)
{ {
return min_t(int, num_online_cpus(), return min3(pf->num_lan_msix, (u16)num_online_cpus(),
pf->hw.func_caps.common_cap.num_txq); (u16)pf->hw.func_caps.common_cap.num_txq);
} }
/** /**
...@@ -3268,8 +3268,8 @@ static int ice_get_max_txq(struct ice_pf *pf) ...@@ -3268,8 +3268,8 @@ static int ice_get_max_txq(struct ice_pf *pf)
*/ */
static int ice_get_max_rxq(struct ice_pf *pf) static int ice_get_max_rxq(struct ice_pf *pf)
{ {
return min_t(int, num_online_cpus(), return min3(pf->num_lan_msix, (u16)num_online_cpus(),
pf->hw.func_caps.common_cap.num_rxq); (u16)pf->hw.func_caps.common_cap.num_rxq);
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册