netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Jacob Keller <jacob.e.keller@intel.com>,
	netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
	jogreene@redhat.com, Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 04/18] fm10k: disable service task during suspend
Date: Tue, 15 Sep 2015 17:36:29 -0700	[thread overview]
Message-ID: <1442363803-47237-5-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1442363803-47237-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Jacob Keller <jacob.e.keller@intel.com>

The service task reads some registers as part of its normal routine,
even while the interface is down. Normally this is ok. However, during
suspend we have disabled the PCI device. Due to this, registers will
read in the same way as a surprise-remove event. Disable the service
task while we suspend, and re-enable it after we resume. If we don't do
this, the device could be UP when you suspend and come back from resume
as closed (since fm10k closes the device when it gets a surprise
remove).

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
index ce53ff2..8413ab5 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
@@ -1983,6 +1983,16 @@ static int fm10k_resume(struct pci_dev *pdev)
 	if (err)
 		return err;
 
+	/* assume host is not ready, to prevent race with watchdog in case we
+	 * actually don't have connection to the switch
+	 */
+	interface->host_ready = false;
+	fm10k_watchdog_host_not_ready(interface);
+
+	/* clear the service task disable bit to allow service task to start */
+	clear_bit(__FM10K_SERVICE_DISABLE, &interface->state);
+	fm10k_service_event_schedule(interface);
+
 	/* restore SR-IOV interface */
 	fm10k_iov_resume(pdev);
 
@@ -2010,6 +2020,15 @@ static int fm10k_suspend(struct pci_dev *pdev,
 
 	fm10k_iov_suspend(pdev);
 
+	/* the watchdog tasks may read registers, which will appear like a
+	 * surprise-remove event once the PCI device is disabled. This will
+	 * cause us to close the netdevice, so we don't retain the open/closed
+	 * state post-resume. Prevent this by disabling the service task while
+	 * suspended, until we actually resume.
+	 */
+	set_bit(__FM10K_SERVICE_DISABLE, &interface->state);
+	cancel_work_sync(&interface->service_task);
+
 	rtnl_lock();
 
 	if (netif_running(netdev))
-- 
2.4.3

  parent reply	other threads:[~2015-09-16  0:36 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-16  0:36 [net-next 00/18][pull request] Intel Wired LAN Driver Updates 2015-09-15 Jeff Kirsher
2015-09-16  0:36 ` [net-next 01/18] ixgbe: fix issue with SFP events with new X550 devices Jeff Kirsher
2015-09-16  0:36 ` [net-next 02/18] ixgbe: Teardown SR-IOV before unregister_netdev() Jeff Kirsher
2015-09-16  0:36 ` [net-next 03/18] ixgbe: Limit lowest interrupt rate for adaptive interrupt moderation to 12K Jeff Kirsher
2015-09-16  0:36 ` Jeff Kirsher [this message]
2015-09-16  0:36 ` [net-next 05/18] fm10k: only prevent removal of default VID rules Jeff Kirsher
2015-09-16  0:36 ` [net-next 06/18] fm10k: update fm10k_slot_warn to use pcie_get_minimum link Jeff Kirsher
2015-09-16  0:36 ` [net-next 07/18] fm10k: update netdev perm_addr during reinit, instead of at up Jeff Kirsher
2015-09-16  0:36 ` [net-next 08/18] fm10k: Don't assume page fragments are page size Jeff Kirsher
2015-09-16  0:36 ` [net-next 09/18] fm10k: Report MAC address on driver load Jeff Kirsher
2015-09-16  0:36 ` [net-next 10/18] fm10k: allow creation of VLAN interfaces even while down Jeff Kirsher
2015-09-16  0:36 ` [net-next 11/18] fm10k: don't store sw_vid at reset Jeff Kirsher
2015-09-16  0:36 ` [net-next 12/18] fm10k: remove is_slot_appropriate Jeff Kirsher
2015-09-16  0:36 ` [net-next 13/18] fm10k: TRIVIAL fix up ordering of __always_unused and style Jeff Kirsher
2015-09-16  0:36 ` [net-next 14/18] fm10k: send traffic on default VID to VLAN device if we have one Jeff Kirsher
2015-09-16  0:36 ` [net-next 15/18] fm10k: TRIVIAL fix typo in fm10k_netdev.c Jeff Kirsher
2015-09-16  0:36 ` [net-next 16/18] fm10k: re-enable VF after a full reset on detection of a Malicious event Jeff Kirsher
2015-09-16  0:36 ` [net-next 17/18] fm10k: Only trigger data path reset if fabric is up Jeff Kirsher
2015-09-16  0:36 ` [net-next 18/18] fm10k: fix iov_msg_mac_vlan_pf VID checks Jeff Kirsher
2015-09-17 23:50 ` [net-next 00/18][pull request] Intel Wired LAN Driver Updates 2015-09-15 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=1442363803-47237-5-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=davem@davemloft.net \
    --cc=jacob.e.keller@intel.com \
    --cc=jogreene@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@redhat.com \
    --cc=sassmann@redhat.com \
    /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).