netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next-2.6 PATCH 1/2] e1000: Report link status in ethtool when interface is down
@ 2010-02-04  0:49 Jeff Kirsher
  2010-02-04  0:49 ` [net-next-2.6 PATCH 2/2] e1000: call pci_save_state after pci_restore_state Jeff Kirsher
  2010-02-04  3:47 ` [net-next-2.6 PATCH 1/2] e1000: Report link status in ethtool when interface is down David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Jeff Kirsher @ 2010-02-04  0:49 UTC (permalink / raw)
  To: davem; +Cc: netdev, gospo, Nicholas Nunley, Jeff Kirsher

From: Nick Nunley <nicholasx.d.nunley@intel.com>

With this change ethtool will correctly report link status when
the interface is down. Currently ethtool reports the link as not
detected when the interface is down.

Signed-off-by: Nicholas Nunley <nicholasx.d.nunley@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 drivers/net/e1000/e1000.h         |    1 +
 drivers/net/e1000/e1000_ethtool.c |   19 ++++++++++++++++++-
 drivers/net/e1000/e1000_main.c    |    2 +-
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index e8932db..9902b33 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -349,6 +349,7 @@ extern int e1000_setup_all_tx_resources(struct e1000_adapter *adapter);
 extern void e1000_free_all_rx_resources(struct e1000_adapter *adapter);
 extern void e1000_free_all_tx_resources(struct e1000_adapter *adapter);
 extern void e1000_update_stats(struct e1000_adapter *adapter);
+extern bool e1000_has_link(struct e1000_adapter *adapter);
 extern void e1000_power_up_phy(struct e1000_adapter *);
 extern void e1000_set_ethtool_ops(struct net_device *netdev);
 extern void e1000_check_options(struct e1000_adapter *adapter);
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index 13e9ece..c67e931 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -215,6 +215,23 @@ static int e1000_set_settings(struct net_device *netdev,
 	return 0;
 }
 
+static u32 e1000_get_link(struct net_device *netdev)
+{
+	struct e1000_adapter *adapter = netdev_priv(netdev);
+
+	/*
+	 * If the link is not reported up to netdev, interrupts are disabled,
+	 * and so the physical link state may have changed since we last
+	 * looked. Set get_link_status to make sure that the true link
+	 * state is interrogated, rather than pulling a cached and possibly
+	 * stale link state from the driver.
+	 */
+	if (!netif_carrier_ok(netdev))
+		adapter->hw.get_link_status = 1;
+
+	return e1000_has_link(adapter);
+}
+
 static void e1000_get_pauseparam(struct net_device *netdev,
 				 struct ethtool_pauseparam *pause)
 {
@@ -1892,7 +1909,7 @@ static const struct ethtool_ops e1000_ethtool_ops = {
 	.get_msglevel           = e1000_get_msglevel,
 	.set_msglevel           = e1000_set_msglevel,
 	.nway_reset             = e1000_nway_reset,
-	.get_link               = ethtool_op_get_link,
+	.get_link               = e1000_get_link,
 	.get_eeprom_len         = e1000_get_eeprom_len,
 	.get_eeprom             = e1000_get_eeprom,
 	.set_eeprom             = e1000_set_eeprom,
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index b608528..4ff50d6 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -2246,7 +2246,7 @@ static void e1000_82547_tx_fifo_stall(unsigned long data)
 	}
 }
 
-static bool e1000_has_link(struct e1000_adapter *adapter)
+bool e1000_has_link(struct e1000_adapter *adapter)
 {
 	struct e1000_hw *hw = &adapter->hw;
 	bool link_active = false;


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [net-next-2.6 PATCH 2/2] e1000: call pci_save_state after pci_restore_state
  2010-02-04  0:49 [net-next-2.6 PATCH 1/2] e1000: Report link status in ethtool when interface is down Jeff Kirsher
@ 2010-02-04  0:49 ` Jeff Kirsher
  2010-02-04  3:47   ` David Miller
  2010-02-04  3:47 ` [net-next-2.6 PATCH 1/2] e1000: Report link status in ethtool when interface is down David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Jeff Kirsher @ 2010-02-04  0:49 UTC (permalink / raw)
  To: davem; +Cc: netdev, gospo, Nicholas Nunley, Jeff Kirsher

From: Nick Nunley <nicholasx.d.nunley@intel.com>

This patch adds a call to pci_save_state() immediately after
the call to pci_restore_state(). Due to a change in the behavior
of pci_restore_state() it is necessary to call pci_save_state()
to keep the state_saved flag. This patch is based on a similar
patch for ixgbe.

Signed-off-by: Nicholas Nunley <nicholasx.d.nunley@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 drivers/net/e1000/e1000_main.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 4ff50d6..3b14dd7 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -847,6 +847,9 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
 		goto err_pci_reg;
 
 	pci_set_master(pdev);
+	err = pci_save_state(pdev);
+	if (err)
+		goto err_alloc_etherdev;
 
 	err = -ENOMEM;
 	netdev = alloc_etherdev(sizeof(struct e1000_adapter));
@@ -4596,6 +4599,7 @@ static int e1000_resume(struct pci_dev *pdev)
 
 	pci_set_power_state(pdev, PCI_D0);
 	pci_restore_state(pdev);
+	pci_save_state(pdev);
 
 	if (adapter->need_ioport)
 		err = pci_enable_device(pdev);


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [net-next-2.6 PATCH 1/2] e1000: Report link status in ethtool when interface is down
  2010-02-04  0:49 [net-next-2.6 PATCH 1/2] e1000: Report link status in ethtool when interface is down Jeff Kirsher
  2010-02-04  0:49 ` [net-next-2.6 PATCH 2/2] e1000: call pci_save_state after pci_restore_state Jeff Kirsher
@ 2010-02-04  3:47 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2010-02-04  3:47 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: netdev, gospo, nicholasx.d.nunley

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Wed, 03 Feb 2010 16:49:28 -0800

> From: Nick Nunley <nicholasx.d.nunley@intel.com>
> 
> With this change ethtool will correctly report link status when
> the interface is down. Currently ethtool reports the link as not
> detected when the interface is down.
> 
> Signed-off-by: Nicholas Nunley <nicholasx.d.nunley@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [net-next-2.6 PATCH 2/2] e1000: call pci_save_state after pci_restore_state
  2010-02-04  0:49 ` [net-next-2.6 PATCH 2/2] e1000: call pci_save_state after pci_restore_state Jeff Kirsher
@ 2010-02-04  3:47   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2010-02-04  3:47 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: netdev, gospo, nicholasx.d.nunley

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Wed, 03 Feb 2010 16:49:48 -0800

> From: Nick Nunley <nicholasx.d.nunley@intel.com>
> 
> This patch adds a call to pci_save_state() immediately after
> the call to pci_restore_state(). Due to a change in the behavior
> of pci_restore_state() it is necessary to call pci_save_state()
> to keep the state_saved flag. This patch is based on a similar
> patch for ixgbe.
> 
> Signed-off-by: Nicholas Nunley <nicholasx.d.nunley@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-02-04  3:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-04  0:49 [net-next-2.6 PATCH 1/2] e1000: Report link status in ethtool when interface is down Jeff Kirsher
2010-02-04  0:49 ` [net-next-2.6 PATCH 2/2] e1000: call pci_save_state after pci_restore_state Jeff Kirsher
2010-02-04  3:47   ` David Miller
2010-02-04  3:47 ` [net-next-2.6 PATCH 1/2] e1000: Report link status in ethtool when interface is down David Miller

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).