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 03/11] bnxt_en: Do function reset on the 1st PF open only.
Date: Fri,  1 Jul 2016 18:46:21 -0400	[thread overview]
Message-ID: <1467413189-29566-4-git-send-email-michael.chan@broadcom.com> (raw)
In-Reply-To: <1467413189-29566-1-git-send-email-michael.chan@broadcom.com>

Calling the firmware to do function reset on the PF will kill all the VFs.
To prevent that, we call function reset on the 1st PF open before any VF
can be activated.  On subsequent PF opens (with possibly some active VFs),
a bit has been set and we'll skip the function reset.  VF driver will
always do function reset on every open.  If there is an AER event, we will
always do function reset.

Signed-off-by: Michael Chan <michael.chan@broadocm.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 22 ++++++++++++++++------
 drivers/net/ethernet/broadcom/bnxt/bnxt.h |  1 +
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 673f4d6..b489fb6 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -5295,12 +5295,19 @@ static int bnxt_open(struct net_device *dev)
 	struct bnxt *bp = netdev_priv(dev);
 	int rc = 0;
 
-	rc = bnxt_hwrm_func_reset(bp);
-	if (rc) {
-		netdev_err(bp->dev, "hwrm chip reset failure rc: %x\n",
-			   rc);
-		rc = -1;
-		return rc;
+	if (!test_bit(BNXT_STATE_FN_RST_DONE, &bp->state)) {
+		rc = bnxt_hwrm_func_reset(bp);
+		if (rc) {
+			netdev_err(bp->dev, "hwrm chip reset failure rc: %x\n",
+				   rc);
+			rc = -EBUSY;
+			return rc;
+		}
+		/* Do func_reset during the 1st PF open only to prevent killing
+		 * the VFs when the PF is brought down and up.
+		 */
+		if (BNXT_PF(bp))
+			set_bit(BNXT_STATE_FN_RST_DONE, &bp->state);
 	}
 	return __bnxt_open_nic(bp, true, true);
 }
@@ -6676,6 +6683,7 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev,
 					       pci_channel_state_t state)
 {
 	struct net_device *netdev = pci_get_drvdata(pdev);
+	struct bnxt *bp = netdev_priv(netdev);
 
 	netdev_info(netdev, "PCI I/O error detected\n");
 
@@ -6690,6 +6698,8 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev,
 	if (netif_running(netdev))
 		bnxt_close(netdev);
 
+	/* So that func_reset will be done during slot_reset */
+	clear_bit(BNXT_STATE_FN_RST_DONE, &bp->state);
 	pci_disable_device(pdev);
 	rtnl_unlock();
 
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
index 084b3f2..1d5a3cd 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
@@ -1018,6 +1018,7 @@ struct bnxt {
 	unsigned long		state;
 #define BNXT_STATE_OPEN		0
 #define BNXT_STATE_IN_SP_TASK	1
+#define BNXT_STATE_FN_RST_DONE	2
 
 	struct bnxt_irq	*irq_tbl;
 	u8			mac_addr[ETH_ALEN];
-- 
1.8.3.1

  parent reply	other threads:[~2016-07-01 22:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-01 22:46 [PATCH net-next 00/11] bnxt_en updates for net-next Michael Chan
2016-07-01 22:46 ` [PATCH net-next 01/11] bnxt_en: VF/NPAR should return -EOPNOTSUPP for unsupported ethtool ops Michael Chan
2016-07-01 22:46 ` [PATCH net-next 02/11] bnxt_en: Update firmware spec. to 1.3.0 Michael Chan
2016-07-01 22:46 ` Michael Chan [this message]
2016-07-01 22:46 ` [PATCH net-next 04/11] bnxt_en: Add support for updating flash more securely Michael Chan
2016-07-01 22:46 ` [PATCH net-next 05/11] bnxt_en: Request firmware reset after successful firwmare update Michael Chan
2016-07-01 22:46 ` [PATCH net-next 06/11] bnxt_en: Add support for firmware updates for additional processors Michael Chan
2016-07-01 22:46 ` [PATCH net-next 07/11] bnxt_en: Enable MRU enables bit when configuring VNIC MRU Michael Chan
2016-07-01 22:46 ` [PATCH net-next 08/11] bnxt_en: Increase maximum supported MTU to 9500 Michael Chan
2016-07-01 22:46 ` [PATCH net-next 09/11] bnxt_en: Allow promiscuous mode for VF if default VLAN is enabled Michael Chan
2016-07-01 22:46 ` [PATCH net-next 10/11] bnxt_en: Assign netdev->dev_port with port ID Michael Chan
2016-07-01 22:46 ` [PATCH net-next 11/11] bnxt_en: Allow statistics DMA to be configurable using ethtool -C Michael Chan
2016-07-02 18:55 ` [PATCH net-next 00/11] bnxt_en updates 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=1467413189-29566-4-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).