Netdev List
 help / color / mirror / Atom feed
From: Michael Chan <michael.chan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH net-next 09/16] bnxt_en: Improve resource accounting for SRIOV.
Date: Sat, 31 Mar 2018 13:54:14 -0400	[thread overview]
Message-ID: <1522518861-9845-10-git-send-email-michael.chan@broadcom.com> (raw)
In-Reply-To: <1522518861-9845-1-git-send-email-michael.chan@broadcom.com>

When VFs are created, the current code subtracts the maximum VF
resources from the PF's pool.  This under-estimates the resources
remaining in the PF pool.  Instead, we should subtract the minimum
VF resources.  The VF minimum resources are guaranteed to the VFs
and only these should be subtracted from the PF's pool.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
index a3d368e..4fa4761 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
@@ -510,18 +510,16 @@ static int bnxt_hwrm_func_vf_resc_cfg(struct bnxt *bp, int num_vfs)
 	}
 	mutex_unlock(&bp->hwrm_cmd_lock);
 	if (pf->active_vfs) {
-		u16 n = 1;
+		u16 n = pf->active_vfs;
 
-		if (pf->vf_resv_strategy != BNXT_VF_RESV_STRATEGY_MINIMAL)
-			n = pf->active_vfs;
-
-		hw_resc->max_tx_rings -= vf_tx_rings * n;
-		hw_resc->max_rx_rings -= vf_rx_rings * n;
-		hw_resc->max_hw_ring_grps -= vf_ring_grps * n;
-		hw_resc->max_cp_rings -= vf_cp_rings * n;
+		hw_resc->max_tx_rings -= le16_to_cpu(req.min_tx_rings) * n;
+		hw_resc->max_rx_rings -= le16_to_cpu(req.min_rx_rings) * n;
+		hw_resc->max_hw_ring_grps -= le16_to_cpu(req.min_hw_ring_grps) *
+					     n;
+		hw_resc->max_cp_rings -= le16_to_cpu(req.min_cmpl_rings) * n;
 		hw_resc->max_rsscos_ctxs -= pf->active_vfs;
-		hw_resc->max_stat_ctxs -= vf_stat_ctx * n;
-		hw_resc->max_vnics -= vf_vnics * n;
+		hw_resc->max_stat_ctxs -= le16_to_cpu(req.min_stat_ctx) * n;
+		hw_resc->max_vnics -= le16_to_cpu(req.min_vnics) * n;
 
 		rc = pf->active_vfs;
 	}
-- 
1.8.3.1

  parent reply	other threads:[~2018-03-31 17:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-31 17:54 [PATCH net-next 00/16] bnxt_en: Update for net-next Michael Chan
2018-03-31 17:54 ` [PATCH net-next 01/16] bnxt_en: Update firmware interface to 1.9.1.15 Michael Chan
2018-03-31 17:54 ` [PATCH net-next 02/16] bnxt_en: Adjust default rings for multi-port NICs Michael Chan
2018-03-31 17:54 ` [PATCH net-next 03/16] bnxt_en: Use a dedicated VNIC mode for RDMA Michael Chan
2018-03-31 17:54 ` [PATCH net-next 04/16] bnxt_en: fix clear flags in ethtool reset handling Michael Chan
2018-03-31 17:54 ` [PATCH net-next 05/16] bnxt_en: Add support for ndo_set_vf_trust Michael Chan
2018-03-31 17:54 ` [PATCH net-next 06/16] bnxt_en: Include additional hardware port statistics in ethtool -S Michael Chan
2018-03-31 17:54 ` [PATCH net-next 07/16] bnxt_en: Add extended port statistics support Michael Chan
2018-03-31 17:54 ` [PATCH net-next 08/16] bnxt_en: Check max_tx_scheduler_inputs value from firmware Michael Chan
2018-03-31 17:54 ` Michael Chan [this message]
2018-03-31 17:54 ` [PATCH net-next 10/16] bnxt_en: Improve valid bit checking in firmware response message Michael Chan
2018-03-31 17:54 ` [PATCH net-next 11/16] bnxt_en: Improve ring allocation logic Michael Chan
2018-03-31 17:54 ` [PATCH net-next 12/16] bnxt_en: Change IRQ assignment for RDMA driver Michael Chan
2018-03-31 17:54 ` [PATCH net-next 13/16] bnxt_en: Add IRQ remapping logic Michael Chan
2018-03-31 17:54 ` [PATCH net-next 14/16] bnxt_en: Refactor bnxt_need_reserve_rings() Michael Chan
2018-03-31 17:54 ` [PATCH net-next 15/16] bnxt_en: Reserve completion rings and MSIX for bnxt_re RDMA driver Michael Chan
2018-03-31 17:54 ` [PATCH net-next 16/16] bnxt_en: Add ULP calls to stop and restart IRQs Michael Chan
2018-04-01  3:24 ` [PATCH net-next 00/16] bnxt_en: Update for net-next David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1522518861-9845-10-git-send-email-michael.chan@broadcom.com \
    --to=michael.chan@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox