Commit 7b08f661 authored by Michael Chan's avatar Michael Chan Committed by David S. Miller

bnxt_en: Improve completion ring allocation for VFs.

All available remaining completion rings not used by the PF should be
made available for the VFs so that there are enough rings in the VF to
support RDMA.  The earlier workaround code of capping the rings by the
statistics context is removed.

When SRIOV is disabled, call a new function bnxt_restore_pf_fw_resources()
to restore FW resources.  Later on we need to add some logic to account
for RDMA resources.
Signed-off-by: default avatarSomnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent aa8ed021
...@@ -4152,7 +4152,7 @@ static int bnxt_hwrm_func_qcfg(struct bnxt *bp) ...@@ -4152,7 +4152,7 @@ static int bnxt_hwrm_func_qcfg(struct bnxt *bp)
return rc; return rc;
} }
int bnxt_hwrm_func_qcaps(struct bnxt *bp) static int bnxt_hwrm_func_qcaps(struct bnxt *bp)
{ {
int rc = 0; int rc = 0;
struct hwrm_func_qcaps_input req = {0}; struct hwrm_func_qcaps_input req = {0};
...@@ -6856,6 +6856,12 @@ static int bnxt_set_dflt_rings(struct bnxt *bp) ...@@ -6856,6 +6856,12 @@ static int bnxt_set_dflt_rings(struct bnxt *bp)
return rc; return rc;
} }
void bnxt_restore_pf_fw_resources(struct bnxt *bp)
{
ASSERT_RTNL();
bnxt_hwrm_func_qcaps(bp);
}
static void bnxt_parse_log_pcie_link(struct bnxt *bp) static void bnxt_parse_log_pcie_link(struct bnxt *bp)
{ {
enum pcie_link_width width = PCIE_LNK_WIDTH_UNKNOWN; enum pcie_link_width width = PCIE_LNK_WIDTH_UNKNOWN;
......
...@@ -1234,7 +1234,6 @@ int _hwrm_send_message(struct bnxt *, void *, u32, int); ...@@ -1234,7 +1234,6 @@ int _hwrm_send_message(struct bnxt *, void *, u32, int);
int hwrm_send_message(struct bnxt *, void *, u32, int); int hwrm_send_message(struct bnxt *, void *, u32, int);
int hwrm_send_message_silent(struct bnxt *, void *, u32, int); int hwrm_send_message_silent(struct bnxt *, void *, u32, int);
int bnxt_hwrm_set_coal(struct bnxt *); int bnxt_hwrm_set_coal(struct bnxt *);
int bnxt_hwrm_func_qcaps(struct bnxt *);
void bnxt_set_max_func_irqs(struct bnxt *bp, unsigned int max); void bnxt_set_max_func_irqs(struct bnxt *bp, unsigned int max);
void bnxt_tx_disable(struct bnxt *bp); void bnxt_tx_disable(struct bnxt *bp);
void bnxt_tx_enable(struct bnxt *bp); void bnxt_tx_enable(struct bnxt *bp);
...@@ -1245,4 +1244,5 @@ int bnxt_open_nic(struct bnxt *, bool, bool); ...@@ -1245,4 +1244,5 @@ int bnxt_open_nic(struct bnxt *, bool, bool);
int bnxt_close_nic(struct bnxt *, bool, bool); int bnxt_close_nic(struct bnxt *, bool, bool);
int bnxt_setup_mq_tc(struct net_device *dev, u8 tc); int bnxt_setup_mq_tc(struct net_device *dev, u8 tc);
int bnxt_get_max_rings(struct bnxt *, int *, int *, bool); int bnxt_get_max_rings(struct bnxt *, int *, int *, bool);
void bnxt_restore_pf_fw_resources(struct bnxt *bp);
#endif #endif
...@@ -420,15 +420,7 @@ static int bnxt_hwrm_func_cfg(struct bnxt *bp, int num_vfs) ...@@ -420,15 +420,7 @@ static int bnxt_hwrm_func_cfg(struct bnxt *bp, int num_vfs)
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_CFG, -1, -1); bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_CFG, -1, -1);
/* Remaining rings are distributed equally amongs VF's for now */ /* Remaining rings are distributed equally amongs VF's for now */
/* TODO: the following workaroud is needed to restrict total number vf_cp_rings = (pf->max_cp_rings - bp->cp_nr_rings) / num_vfs;
* of vf_cp_rings not exceed number of HW ring groups. This WA should
* be removed once new HWRM provides HW ring groups capability in
* hwrm_func_qcap.
*/
vf_cp_rings = min_t(u16, pf->max_cp_rings, pf->max_stat_ctxs);
vf_cp_rings = (vf_cp_rings - bp->cp_nr_rings) / num_vfs;
/* TODO: restore this logic below once the WA above is removed */
/* vf_cp_rings = (pf->max_cp_rings - bp->cp_nr_rings) / num_vfs; */
vf_stat_ctx = (pf->max_stat_ctxs - bp->num_stat_ctxs) / num_vfs; vf_stat_ctx = (pf->max_stat_ctxs - bp->num_stat_ctxs) / num_vfs;
if (bp->flags & BNXT_FLAG_AGG_RINGS) if (bp->flags & BNXT_FLAG_AGG_RINGS)
vf_rx_rings = (pf->max_rx_rings - bp->rx_nr_rings * 2) / vf_rx_rings = (pf->max_rx_rings - bp->rx_nr_rings * 2) /
...@@ -590,7 +582,9 @@ void bnxt_sriov_disable(struct bnxt *bp) ...@@ -590,7 +582,9 @@ void bnxt_sriov_disable(struct bnxt *bp)
bp->pf.active_vfs = 0; bp->pf.active_vfs = 0;
/* Reclaim all resources for the PF. */ /* Reclaim all resources for the PF. */
bnxt_hwrm_func_qcaps(bp); rtnl_lock();
bnxt_restore_pf_fw_resources(bp);
rtnl_unlock();
} }
int bnxt_sriov_configure(struct pci_dev *pdev, int num_vfs) int bnxt_sriov_configure(struct pci_dev *pdev, int num_vfs)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment