mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-04 13:56:51 +07:00
bnxt_en: Fix VF resource checking.
In bnxt_sriov_enable(), we calculate to see if we have enough hardware resources to enable the requested number of VFs. The logic to check for minimum completion rings and statistics contexts is missing. Add the required checks so that VF configuration won't fail. Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
7ab0760f51
commit
021570793d
@ -502,6 +502,7 @@ static int bnxt_sriov_enable(struct bnxt *bp, int *num_vfs)
|
||||
int rc = 0, vfs_supported;
|
||||
int min_rx_rings, min_tx_rings, min_rss_ctxs;
|
||||
int tx_ok = 0, rx_ok = 0, rss_ok = 0;
|
||||
int avail_cp, avail_stat;
|
||||
|
||||
/* Check if we can enable requested num of vf's. At a mininum
|
||||
* we require 1 RX 1 TX rings for each VF. In this minimum conf
|
||||
@ -509,6 +510,10 @@ static int bnxt_sriov_enable(struct bnxt *bp, int *num_vfs)
|
||||
*/
|
||||
vfs_supported = *num_vfs;
|
||||
|
||||
avail_cp = bp->pf.max_cp_rings - bp->cp_nr_rings;
|
||||
avail_stat = bp->pf.max_stat_ctxs - bp->num_stat_ctxs;
|
||||
avail_cp = min_t(int, avail_cp, avail_stat);
|
||||
|
||||
while (vfs_supported) {
|
||||
min_rx_rings = vfs_supported;
|
||||
min_tx_rings = vfs_supported;
|
||||
@ -523,10 +528,12 @@ static int bnxt_sriov_enable(struct bnxt *bp, int *num_vfs)
|
||||
min_rx_rings)
|
||||
rx_ok = 1;
|
||||
}
|
||||
if (bp->pf.max_vnics - bp->nr_vnics < min_rx_rings)
|
||||
if (bp->pf.max_vnics - bp->nr_vnics < min_rx_rings ||
|
||||
avail_cp < min_rx_rings)
|
||||
rx_ok = 0;
|
||||
|
||||
if (bp->pf.max_tx_rings - bp->tx_nr_rings >= min_tx_rings)
|
||||
if (bp->pf.max_tx_rings - bp->tx_nr_rings >= min_tx_rings &&
|
||||
avail_cp >= min_tx_rings)
|
||||
tx_ok = 1;
|
||||
|
||||
if (bp->pf.max_rsscos_ctxs - bp->rsscos_nr_ctxs >= min_rss_ctxs)
|
||||
|
Loading…
Reference in New Issue
Block a user