From: "Michael Chan" <mchan@broadcom.com>
To: "David Miller" <davem@davemloft.net>
Cc: joachim.deguara@amd.com, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org, michal.k.k.piotrowski@gmail.com,
"netdev" <netdev@vger.kernel.org>,
linux-acpi@vger.kernel.org
Subject: Re: [REGRESSION] tg3 dead after s2ram
Date: Thu, 02 Aug 2007 12:10:29 -0700 [thread overview]
Message-ID: <1186081829.18322.20.camel@dell> (raw)
In-Reply-To: <20070802.022317.66176729.davem@davemloft.net>
On Thu, 2007-08-02 at 02:23 -0700, David Miller wrote:
> From: "Joachim Deguara" <joachim.deguara@amd.com>
> Date: Thu, 2 Aug 2007 11:15:05 +0200
>
> > Seams like even if powersave shuts down the network that the device should
> > still work after a suspend to ram, so who is at fault here?
>
> It's a good question.
>
> The pci_enable() is done on the PCI device at probe time, at least in
> the tg3 driver, and with such a model restoring and saving of PCI
> config space should not be dependant upon whether the netdev is
> running or not.
>
Alternatively, we can also fix it by calling pci_enable_device() again
in tg3_open(). But I think it is better to just always save and restore
in suspend/resume. bnx2.c will also require the same fix.
Thanks Joachim for helping to debug this problem. Please try this
patch:
[TG3]: Fix suspend/resume problem.
Joachim Deguara <joachim.deguara@amd.com> reported that tg3 devices
would not resume properly if the device was shutdown before the system
was suspended. In such scenario where the netif_running state is 0,
tg3_suspend() would not save the PCI state and so the memory enable bit
and bus master enable bit would be lost.
We fix this by always saving and restoring the PCI state in
tg3_suspend() and tg3_resume() regardless of netif_running() state.
Signed-off-by: Michael Chan <mchan@broadcom.com>
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index dc41c05..5874042 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -64,8 +64,8 @@
#define DRV_MODULE_NAME "tg3"
#define PFX DRV_MODULE_NAME ": "
-#define DRV_MODULE_VERSION "3.79"
-#define DRV_MODULE_RELDATE "July 18, 2007"
+#define DRV_MODULE_VERSION "3.80"
+#define DRV_MODULE_RELDATE "August 2, 2007"
#define TG3_DEF_MAC_MODE 0
#define TG3_DEF_RX_MODE 0
@@ -12111,6 +12111,12 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state)
struct tg3 *tp = netdev_priv(dev);
int err;
+ /* PCI register 4 needs to be saved whether netif_running() or not.
+ * MSI address and data need to be saved if using MSI and
+ * netif_running().
+ */
+ pci_save_state(pdev);
+
if (!netif_running(dev))
return 0;
@@ -12130,9 +12136,6 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state)
tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE;
tg3_full_unlock(tp);
- /* Save MSI address and data for resume. */
- pci_save_state(pdev);
-
err = tg3_set_power_state(tp, pci_choose_state(pdev, state));
if (err) {
tg3_full_lock(tp, 0);
@@ -12160,11 +12163,11 @@ static int tg3_resume(struct pci_dev *pdev)
struct tg3 *tp = netdev_priv(dev);
int err;
+ pci_restore_state(tp->pdev);
+
if (!netif_running(dev))
return 0;
- pci_restore_state(tp->pdev);
-
err = tg3_set_power_state(tp, PCI_D0);
if (err)
return err;
next prev parent reply other threads:[~2007-08-02 18:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200707311128.32528.joachim.deguara@amd.com>
2007-08-01 0:45 ` [REGRESSION] tg3 dead after s2ram Andrew Morton
2007-08-01 7:53 ` Michael Chan
2007-08-01 8:01 ` Joachim Deguara
2007-08-01 17:47 ` Michael Chan
2007-08-01 21:00 ` Michael Chan
2007-08-02 8:05 ` Joachim Deguara
2007-08-02 9:15 ` Joachim Deguara
2007-08-02 9:23 ` David Miller
2007-08-02 19:10 ` Michael Chan [this message]
2007-08-02 22:06 ` David Miller
2007-08-02 23:38 ` Michael Chan
2007-08-03 9:47 ` Joachim Deguara
2007-08-04 3:57 ` 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=1186081829.18322.20.camel@dell \
--to=mchan@broadcom.com \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=joachim.deguara@amd.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.k.k.piotrowski@gmail.com \
--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).