OSDN Git Service

bnxt_en: Add new VF resource allocation strategy mode.
authorMichael Chan <michael.chan@broadcom.com>
Sun, 5 Aug 2018 20:51:50 +0000 (16:51 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 6 Aug 2018 00:08:26 +0000 (17:08 -0700)
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 <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c

index fd936c5..e0e3b4b 100644 (file)
@@ -5162,7 +5162,7 @@ int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp, bool all)
 
                pf->vf_resv_strategy =
                        le16_to_cpu(resp->vf_reservation_strategy);
-               if (pf->vf_resv_strategy > BNXT_VF_RESV_STRATEGY_MINIMAL)
+               if (pf->vf_resv_strategy > BNXT_VF_RESV_STRATEGY_MINIMAL_STATIC)
                        pf->vf_resv_strategy = BNXT_VF_RESV_STRATEGY_MAXIMAL;
        }
 hwrm_func_resc_qcaps_exit:
index 47eec14..b44a758 100644 (file)
@@ -862,6 +862,7 @@ struct bnxt_pf_info {
        u8      vf_resv_strategy;
 #define BNXT_VF_RESV_STRATEGY_MAXIMAL  0
 #define BNXT_VF_RESV_STRATEGY_MINIMAL  1
+#define BNXT_VF_RESV_STRATEGY_MINIMAL_STATIC   2
        void                    *hwrm_cmd_req_addr[4];
        dma_addr_t              hwrm_cmd_req_dma_addr[4];
        struct bnxt_vf_info     *vf;
index f560845..b896a52 100644 (file)
@@ -447,7 +447,7 @@ static int bnxt_hwrm_func_vf_resc_cfg(struct bnxt *bp, int num_vfs)
        u16 vf_tx_rings, vf_rx_rings, vf_cp_rings;
        u16 vf_stat_ctx, vf_vnics, vf_ring_grps;
        struct bnxt_pf_info *pf = &bp->pf;
-       int i, rc = 0;
+       int i, rc = 0, min = 1;
 
        bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_VF_RESOURCE_CFG, -1, -1);
 
@@ -464,14 +464,19 @@ static int bnxt_hwrm_func_vf_resc_cfg(struct bnxt *bp, int num_vfs)
 
        req.min_rsscos_ctx = cpu_to_le16(BNXT_VF_MIN_RSS_CTX);
        req.max_rsscos_ctx = cpu_to_le16(BNXT_VF_MAX_RSS_CTX);
-       if (pf->vf_resv_strategy == BNXT_VF_RESV_STRATEGY_MINIMAL) {
-               req.min_cmpl_rings = cpu_to_le16(1);
-               req.min_tx_rings = cpu_to_le16(1);
-               req.min_rx_rings = cpu_to_le16(1);
-               req.min_l2_ctxs = cpu_to_le16(BNXT_VF_MIN_L2_CTX);
-               req.min_vnics = cpu_to_le16(1);
-               req.min_stat_ctx = cpu_to_le16(1);
-               req.min_hw_ring_grps = cpu_to_le16(1);
+       if (pf->vf_resv_strategy == BNXT_VF_RESV_STRATEGY_MINIMAL_STATIC) {
+               min = 0;
+               req.min_rsscos_ctx = cpu_to_le16(min);
+       }
+       if (pf->vf_resv_strategy == BNXT_VF_RESV_STRATEGY_MINIMAL ||
+           pf->vf_resv_strategy == BNXT_VF_RESV_STRATEGY_MINIMAL_STATIC) {
+               req.min_cmpl_rings = cpu_to_le16(min);
+               req.min_tx_rings = cpu_to_le16(min);
+               req.min_rx_rings = cpu_to_le16(min);
+               req.min_l2_ctxs = cpu_to_le16(min);
+               req.min_vnics = cpu_to_le16(min);
+               req.min_stat_ctx = cpu_to_le16(min);
+               req.min_hw_ring_grps = cpu_to_le16(min);
        } else {
                vf_cp_rings /= num_vfs;
                vf_tx_rings /= num_vfs;