Skip to content

Commit bf82736

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Add new VF resource allocation strategy mode.
The new mode is "minimal-static" to be used when resources are more limited to support a large number of VFs, for example The PF driver will provision guaranteed minimum resources of 0. Each VF has no guranteed resources until it tries to reserve resources during device open. Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a1ef4a7 commit bf82736

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5162,7 +5162,7 @@ int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp, bool all)
51625162

51635163
pf->vf_resv_strategy =
51645164
le16_to_cpu(resp->vf_reservation_strategy);
5165-
if (pf->vf_resv_strategy > BNXT_VF_RESV_STRATEGY_MINIMAL)
5165+
if (pf->vf_resv_strategy > BNXT_VF_RESV_STRATEGY_MINIMAL_STATIC)
51665166
pf->vf_resv_strategy = BNXT_VF_RESV_STRATEGY_MAXIMAL;
51675167
}
51685168
hwrm_func_resc_qcaps_exit:

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,7 @@ struct bnxt_pf_info {
862862
u8 vf_resv_strategy;
863863
#define BNXT_VF_RESV_STRATEGY_MAXIMAL 0
864864
#define BNXT_VF_RESV_STRATEGY_MINIMAL 1
865+
#define BNXT_VF_RESV_STRATEGY_MINIMAL_STATIC 2
865866
void *hwrm_cmd_req_addr[4];
866867
dma_addr_t hwrm_cmd_req_dma_addr[4];
867868
struct bnxt_vf_info *vf;

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

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ static int bnxt_hwrm_func_vf_resc_cfg(struct bnxt *bp, int num_vfs)
447447
u16 vf_tx_rings, vf_rx_rings, vf_cp_rings;
448448
u16 vf_stat_ctx, vf_vnics, vf_ring_grps;
449449
struct bnxt_pf_info *pf = &bp->pf;
450-
int i, rc = 0;
450+
int i, rc = 0, min = 1;
451451

452452
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_VF_RESOURCE_CFG, -1, -1);
453453

@@ -464,14 +464,19 @@ static int bnxt_hwrm_func_vf_resc_cfg(struct bnxt *bp, int num_vfs)
464464

465465
req.min_rsscos_ctx = cpu_to_le16(BNXT_VF_MIN_RSS_CTX);
466466
req.max_rsscos_ctx = cpu_to_le16(BNXT_VF_MAX_RSS_CTX);
467-
if (pf->vf_resv_strategy == BNXT_VF_RESV_STRATEGY_MINIMAL) {
468-
req.min_cmpl_rings = cpu_to_le16(1);
469-
req.min_tx_rings = cpu_to_le16(1);
470-
req.min_rx_rings = cpu_to_le16(1);
471-
req.min_l2_ctxs = cpu_to_le16(BNXT_VF_MIN_L2_CTX);
472-
req.min_vnics = cpu_to_le16(1);
473-
req.min_stat_ctx = cpu_to_le16(1);
474-
req.min_hw_ring_grps = cpu_to_le16(1);
467+
if (pf->vf_resv_strategy == BNXT_VF_RESV_STRATEGY_MINIMAL_STATIC) {
468+
min = 0;
469+
req.min_rsscos_ctx = cpu_to_le16(min);
470+
}
471+
if (pf->vf_resv_strategy == BNXT_VF_RESV_STRATEGY_MINIMAL ||
472+
pf->vf_resv_strategy == BNXT_VF_RESV_STRATEGY_MINIMAL_STATIC) {
473+
req.min_cmpl_rings = cpu_to_le16(min);
474+
req.min_tx_rings = cpu_to_le16(min);
475+
req.min_rx_rings = cpu_to_le16(min);
476+
req.min_l2_ctxs = cpu_to_le16(min);
477+
req.min_vnics = cpu_to_le16(min);
478+
req.min_stat_ctx = cpu_to_le16(min);
479+
req.min_hw_ring_grps = cpu_to_le16(min);
475480
} else {
476481
vf_cp_rings /= num_vfs;
477482
vf_tx_rings /= num_vfs;

0 commit comments

Comments
 (0)