Skip to content

Commit 7b08f66

Browse files
Michael Chandavem330
authored andcommitted
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: Somnath Kotur <somnath.kotur@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent aa8ed02 commit 7b08f66

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4152,7 +4152,7 @@ static int bnxt_hwrm_func_qcfg(struct bnxt *bp)
41524152
return rc;
41534153
}
41544154

4155-
int bnxt_hwrm_func_qcaps(struct bnxt *bp)
4155+
static int bnxt_hwrm_func_qcaps(struct bnxt *bp)
41564156
{
41574157
int rc = 0;
41584158
struct hwrm_func_qcaps_input req = {0};
@@ -6856,6 +6856,12 @@ static int bnxt_set_dflt_rings(struct bnxt *bp)
68566856
return rc;
68576857
}
68586858

6859+
void bnxt_restore_pf_fw_resources(struct bnxt *bp)
6860+
{
6861+
ASSERT_RTNL();
6862+
bnxt_hwrm_func_qcaps(bp);
6863+
}
6864+
68596865
static void bnxt_parse_log_pcie_link(struct bnxt *bp)
68606866
{
68616867
enum pcie_link_width width = PCIE_LNK_WIDTH_UNKNOWN;

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1234,7 +1234,6 @@ int _hwrm_send_message(struct bnxt *, void *, u32, int);
12341234
int hwrm_send_message(struct bnxt *, void *, u32, int);
12351235
int hwrm_send_message_silent(struct bnxt *, void *, u32, int);
12361236
int bnxt_hwrm_set_coal(struct bnxt *);
1237-
int bnxt_hwrm_func_qcaps(struct bnxt *);
12381237
void bnxt_set_max_func_irqs(struct bnxt *bp, unsigned int max);
12391238
void bnxt_tx_disable(struct bnxt *bp);
12401239
void bnxt_tx_enable(struct bnxt *bp);
@@ -1245,4 +1244,5 @@ int bnxt_open_nic(struct bnxt *, bool, bool);
12451244
int bnxt_close_nic(struct bnxt *, bool, bool);
12461245
int bnxt_setup_mq_tc(struct net_device *dev, u8 tc);
12471246
int bnxt_get_max_rings(struct bnxt *, int *, int *, bool);
1247+
void bnxt_restore_pf_fw_resources(struct bnxt *bp);
12481248
#endif

drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -420,15 +420,7 @@ static int bnxt_hwrm_func_cfg(struct bnxt *bp, int num_vfs)
420420
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_CFG, -1, -1);
421421

422422
/* Remaining rings are distributed equally amongs VF's for now */
423-
/* TODO: the following workaroud is needed to restrict total number
424-
* of vf_cp_rings not exceed number of HW ring groups. This WA should
425-
* be removed once new HWRM provides HW ring groups capability in
426-
* hwrm_func_qcap.
427-
*/
428-
vf_cp_rings = min_t(u16, pf->max_cp_rings, pf->max_stat_ctxs);
429-
vf_cp_rings = (vf_cp_rings - bp->cp_nr_rings) / num_vfs;
430-
/* TODO: restore this logic below once the WA above is removed */
431-
/* vf_cp_rings = (pf->max_cp_rings - bp->cp_nr_rings) / num_vfs; */
423+
vf_cp_rings = (pf->max_cp_rings - bp->cp_nr_rings) / num_vfs;
432424
vf_stat_ctx = (pf->max_stat_ctxs - bp->num_stat_ctxs) / num_vfs;
433425
if (bp->flags & BNXT_FLAG_AGG_RINGS)
434426
vf_rx_rings = (pf->max_rx_rings - bp->rx_nr_rings * 2) /
@@ -590,7 +582,9 @@ void bnxt_sriov_disable(struct bnxt *bp)
590582

591583
bp->pf.active_vfs = 0;
592584
/* Reclaim all resources for the PF. */
593-
bnxt_hwrm_func_qcaps(bp);
585+
rtnl_lock();
586+
bnxt_restore_pf_fw_resources(bp);
587+
rtnl_unlock();
594588
}
595589

596590
int bnxt_sriov_configure(struct pci_dev *pdev, int num_vfs)

0 commit comments

Comments
 (0)