aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/igb/igb_main.c
diff options
context:
space:
mode:
authorNick Nunley <nicholasx.d.nunley@intel.com>2010-02-16 20:01:59 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-17 16:21:33 -0500
commit88a268c1a11a2e94b7c55a8cfe97892d845887c8 (patch)
treeb748dcd6491b17376c984145c2dca02165d92547 /drivers/net/igb/igb_main.c
parent53c992fa8497286f24f279ebec5a8c7a58d4e68c (diff)
igb: Power down link when interface is down
This changes the behavior of the driver to power down the link when the associated interface is down, unless management is enabled. Signed-off-by: Nicholas Nunley <nicholasx.d.nunley@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/igb/igb_main.c')
-rw-r--r--drivers/net/igb/igb_main.c39
1 files changed, 31 insertions, 8 deletions
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index e40319e2ec25..0427e7c10295 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -1114,6 +1114,29 @@ static void igb_configure(struct igb_adapter *adapter)
1114 adapter->tx_queue_len = netdev->tx_queue_len; 1114 adapter->tx_queue_len = netdev->tx_queue_len;
1115} 1115}
1116 1116
1117/**
1118 * igb_power_up_link - Power up the phy/serdes link
1119 * @adapter: address of board private structure
1120 **/
1121void igb_power_up_link(struct igb_adapter *adapter)
1122{
1123 if (adapter->hw.phy.media_type == e1000_media_type_copper)
1124 igb_power_up_phy_copper(&adapter->hw);
1125 else
1126 igb_power_up_serdes_link_82575(&adapter->hw);
1127}
1128
1129/**
1130 * igb_power_down_link - Power down the phy/serdes link
1131 * @adapter: address of board private structure
1132 */
1133static void igb_power_down_link(struct igb_adapter *adapter)
1134{
1135 if (adapter->hw.phy.media_type == e1000_media_type_copper)
1136 igb_power_down_phy_copper_82575(&adapter->hw);
1137 else
1138 igb_shutdown_serdes_link_82575(&adapter->hw);
1139}
1117 1140
1118/** 1141/**
1119 * igb_up - Open the interface and prepare it to handle traffic 1142 * igb_up - Open the interface and prepare it to handle traffic
@@ -1335,6 +1358,9 @@ void igb_reset(struct igb_adapter *adapter)
1335 wr32(E1000_PCIEMISC, 1358 wr32(E1000_PCIEMISC,
1336 reg & ~E1000_PCIEMISC_LX_DECISION); 1359 reg & ~E1000_PCIEMISC_LX_DECISION);
1337 } 1360 }
1361 if (!netif_running(adapter->netdev))
1362 igb_power_down_link(adapter);
1363
1338 igb_update_mng_vlan(adapter); 1364 igb_update_mng_vlan(adapter);
1339 1365
1340 /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */ 1366 /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */
@@ -1717,9 +1743,6 @@ static void __devexit igb_remove(struct pci_dev *pdev)
1717 1743
1718 unregister_netdev(netdev); 1744 unregister_netdev(netdev);
1719 1745
1720 if (!igb_check_reset_block(hw))
1721 igb_reset_phy(hw);
1722
1723 igb_clear_interrupt_scheme(adapter); 1746 igb_clear_interrupt_scheme(adapter);
1724 1747
1725#ifdef CONFIG_PCI_IOV 1748#ifdef CONFIG_PCI_IOV
@@ -1995,7 +2018,7 @@ static int igb_open(struct net_device *netdev)
1995 if (err) 2018 if (err)
1996 goto err_setup_rx; 2019 goto err_setup_rx;
1997 2020
1998 /* e1000_power_up_phy(adapter); */ 2021 igb_power_up_link(adapter);
1999 2022
2000 /* before we allocate an interrupt, we must be ready to handle it. 2023 /* before we allocate an interrupt, we must be ready to handle it.
2001 * Setting DEBUG_SHIRQ in the kernel makes it fire an interrupt 2024 * Setting DEBUG_SHIRQ in the kernel makes it fire an interrupt
@@ -2037,7 +2060,7 @@ static int igb_open(struct net_device *netdev)
2037 2060
2038err_req_irq: 2061err_req_irq:
2039 igb_release_hw_control(adapter); 2062 igb_release_hw_control(adapter);
2040 /* e1000_power_down_phy(adapter); */ 2063 igb_power_down_link(adapter);
2041 igb_free_all_rx_resources(adapter); 2064 igb_free_all_rx_resources(adapter);
2042err_setup_rx: 2065err_setup_rx:
2043 igb_free_all_tx_resources(adapter); 2066 igb_free_all_tx_resources(adapter);
@@ -5820,7 +5843,9 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake)
5820 5843
5821 *enable_wake = wufc || adapter->en_mng_pt; 5844 *enable_wake = wufc || adapter->en_mng_pt;
5822 if (!*enable_wake) 5845 if (!*enable_wake)
5823 igb_shutdown_serdes_link_82575(hw); 5846 igb_power_down_link(adapter);
5847 else
5848 igb_power_up_link(adapter);
5824 5849
5825 /* Release control of h/w to f/w. If f/w is AMT enabled, this 5850 /* Release control of h/w to f/w. If f/w is AMT enabled, this
5826 * would have already happened in close and is redundant. */ 5851 * would have already happened in close and is redundant. */
@@ -5877,8 +5902,6 @@ static int igb_resume(struct pci_dev *pdev)
5877 return -ENOMEM; 5902 return -ENOMEM;
5878 } 5903 }
5879 5904
5880 /* e1000_power_up_phy(adapter); */
5881
5882 igb_reset(adapter); 5905 igb_reset(adapter);
5883 5906
5884 /* let the f/w know that the h/w is now under the control of the 5907 /* let the f/w know that the h/w is now under the control of the