Skip to content

Commit

Permalink
ice: Don't allow more channels than LAN MSI-X available
Browse files Browse the repository at this point in the history
[ Upstream commit 943b881 ]

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: 87324e7 ("ice: Implement ethtool ops for channels")
Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
bcreeley13 authored and gregkh committed Feb 3, 2021
1 parent 55717a1 commit 04cd96d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/net/ethernet/intel/ice/ice_ethtool.c
Expand Up @@ -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)
{
return min_t(int, num_online_cpus(),
pf->hw.func_caps.common_cap.num_txq);
return min3(pf->num_lan_msix, (u16)num_online_cpus(),
(u16)pf->hw.func_caps.common_cap.num_txq);
}

/**
Expand All @@ -3268,8 +3268,8 @@ static int ice_get_max_txq(struct ice_pf *pf)
*/
static int ice_get_max_rxq(struct ice_pf *pf)
{
return min_t(int, num_online_cpus(),
pf->hw.func_caps.common_cap.num_rxq);
return min3(pf->num_lan_msix, (u16)num_online_cpus(),
(u16)pf->hw.func_caps.common_cap.num_rxq);
}

/**
Expand Down

0 comments on commit 04cd96d

Please sign in to comment.