From: Michael Chan <michael.chan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH net-next 14/14] bnxt_en: Reserve rings at driver open if none was reserved at probe time.
Date: Wed, 25 Apr 2018 20:40:57 -0400 [thread overview]
Message-ID: <1524703257-12812-15-git-send-email-michael.chan@broadcom.com> (raw)
In-Reply-To: <1524703257-12812-1-git-send-email-michael.chan@broadcom.com>
Add logic to reserve default rings at driver open time if none was
reserved during probe time. This will happen when the PF driver did
not provision minimum rings to the VF, due to more limited resources.
Driver open will only succeed if some minimum rings can be reserved.
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index fee1c0d..efe5c72 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -6844,6 +6844,8 @@ static void bnxt_preset_reg_win(struct bnxt *bp)
}
}
+static int bnxt_init_dflt_ring_mode(struct bnxt *bp);
+
static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
{
int rc = 0;
@@ -6851,6 +6853,12 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
bnxt_preset_reg_win(bp);
netif_carrier_off(bp->dev);
if (irq_re_init) {
+ /* Reserve rings now if none were reserved at driver probe. */
+ rc = bnxt_init_dflt_ring_mode(bp);
+ if (rc) {
+ netdev_err(bp->dev, "Failed to reserve default rings at open\n");
+ return rc;
+ }
rc = bnxt_reserve_rings(bp);
if (rc)
return rc;
@@ -8600,6 +8608,29 @@ static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh)
return rc;
}
+static int bnxt_init_dflt_ring_mode(struct bnxt *bp)
+{
+ int rc;
+
+ if (bp->tx_nr_rings)
+ return 0;
+
+ rc = bnxt_set_dflt_rings(bp, true);
+ if (rc) {
+ netdev_err(bp->dev, "Not enough rings available.\n");
+ return rc;
+ }
+ rc = bnxt_init_int_mode(bp);
+ if (rc)
+ return rc;
+ bp->tx_nr_rings_per_tc = bp->tx_nr_rings;
+ if (bnxt_rfs_supported(bp) && bnxt_rfs_capable(bp)) {
+ bp->flags |= BNXT_FLAG_RFS;
+ bp->dev->features |= NETIF_F_NTUPLE;
+ }
+ return 0;
+}
+
int bnxt_restore_pf_fw_resources(struct bnxt *bp)
{
int rc;
--
1.8.3.1
prev 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 ` [PATCH net-next 12/14] bnxt_en: Don't reserve rings on VF when min rings were not provisioned by PF Michael Chan
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 ` Michael Chan [this message]
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-15-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).