netdev.vger.kernel.org archive mirror
 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 12/14] bnxt_en: Don't reserve rings on VF when min rings were not provisioned by PF.
Date: Wed, 25 Apr 2018 20:40:55 -0400	[thread overview]
Message-ID: <1524703257-12812-13-git-send-email-michael.chan@broadcom.com> (raw)
In-Reply-To: <1524703257-12812-1-git-send-email-michael.chan@broadcom.com>

When rings are more limited and the PF has not provisioned minimum
guaranteed rings to the VF, do not reserve rings during driver probe.
Wait till device open before reserving rings when they will be used.
Device open will succeed if some minimum rings can be successfully
reserved and allocated.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index a45e692..0884e49 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -5952,6 +5952,9 @@ static int bnxt_init_msix(struct bnxt *bp)
 	if (total_vecs > max)
 		total_vecs = max;
 
+	if (!total_vecs)
+		return 0;
+
 	msix_ent = kcalloc(total_vecs, sizeof(struct msix_entry), GFP_KERNEL);
 	if (!msix_ent)
 		return -ENOMEM;
@@ -7276,6 +7279,25 @@ static int bnxt_cfg_rx_mode(struct bnxt *bp)
 	return rc;
 }
 
+static bool bnxt_can_reserve_rings(struct bnxt *bp)
+{
+#ifdef CONFIG_BNXT_SRIOV
+	if ((bp->flags & BNXT_FLAG_NEW_RM) && BNXT_VF(bp)) {
+		struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
+
+		/* No minimum rings were provisioned by the PF.  Don't
+		 * reserve rings by default when device is down.
+		 */
+		if (hw_resc->min_tx_rings || hw_resc->resv_tx_rings)
+			return true;
+
+		if (!netif_running(bp->dev))
+			return false;
+	}
+#endif
+	return true;
+}
+
 /* If the chip and firmware supports RFS */
 static bool bnxt_rfs_supported(struct bnxt *bp)
 {
@@ -7292,7 +7314,7 @@ static bool bnxt_rfs_capable(struct bnxt *bp)
 #ifdef CONFIG_RFS_ACCEL
 	int vnics, max_vnics, max_rss_ctxs;
 
-	if (!(bp->flags & BNXT_FLAG_MSIX_CAP))
+	if (!(bp->flags & BNXT_FLAG_MSIX_CAP) || !bnxt_can_reserve_rings(bp))
 		return false;
 
 	vnics = 1 + bp->rx_nr_rings;
@@ -8526,6 +8548,9 @@ static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh)
 {
 	int dflt_rings, max_rx_rings, max_tx_rings, rc;
 
+	if (!bnxt_can_reserve_rings(bp))
+		return 0;
+
 	if (sh)
 		bp->flags |= BNXT_FLAG_SHARED_RINGS;
 	dflt_rings = netif_get_num_default_rss_queues();
-- 
1.8.3.1

  parent reply	other threads:[~2018-04-26  0:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-26  0:40 [PATCH net-next 00/14] bnxt_en: Net-next updates Michael Chan
2018-04-26  0:40 ` [PATCH net-next 01/14] bnxt_en: Add TC to hardware QoS queue mapping logic Michael Chan
2018-04-26  0:40 ` [PATCH net-next 02/14] bnxt_en: Remap TC to hardware queues when configuring PFC Michael Chan
2018-04-26  0:40 ` [PATCH net-next 03/14] bnxt_en: Check the lengths of encapsulated firmware responses Michael Chan
2018-04-26  0:40 ` [PATCH net-next 04/14] bnxt_en: Do not set firmware time from VF driver on older firmware Michael Chan
2018-04-26  0:40 ` [PATCH net-next 05/14] bnxt_en: Simplify ring alloc/free error messages Michael Chan
2018-04-26  0:40 ` [PATCH net-next 06/14] bnxt_en: Display function level rx/tx_discard_pkts via ethtool Michael Chan
2018-04-26  0:40 ` [PATCH net-next 07/14] bnxt_en: Do not allow VF to read EEPEOM Michael Chan
2018-04-26  1:38   ` Andrew Lunn
2018-04-26  2:40     ` Michael Chan
2018-04-26  0:40 ` [PATCH net-next 08/14] bnxt_en: Increase RING_IDLE minimum threshold to 50 Michael Chan
2018-04-26  0:40 ` [PATCH net-next 09/14] bnxt_en: reduce timeout on initial HWRM calls Michael Chan
2018-04-26  0:40 ` [PATCH net-next 10/14] bnxt_en: add debugfs support for DIM Michael Chan
2018-04-26  0:40 ` [PATCH net-next 11/14] bnxt_en: Reserve rings in bnxt_set_channels() if device is down Michael Chan
2018-04-26  0:40 ` Michael Chan [this message]
2018-04-26  0:40 ` [PATCH net-next 13/14] bnxt_en: Reserve RSS and L2 contexts for VF Michael Chan
2018-04-26  0:40 ` [PATCH net-next 14/14] bnxt_en: Reserve rings at driver open if none was reserved at probe time Michael Chan

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=1524703257-12812-13-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;
as well as URLs for NNTP newsgroup(s).