aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Keller <jacob.e.keller@intel.com>2013-06-25 03:59:23 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2013-08-29 05:39:26 -0400
commitf4f1040ae63c7c40ef24c1892d32ceae46d9ea05 (patch)
treec1150e7996513235d93fec07be88c85649526402
parentcc328deac5a5f576aa79d87cfacf01e370e5e03e (diff)
ixgbe: disable link when adapter goes down
This patch fixes an issue with the 82599 adapter where it can potentially keep link lights up when the adapter has gone down. The patch adds a function which ensures link is disabled, and calls this function when the adapter transitions to a down state. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c20
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c3
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_type.h2
3 files changed, 25 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
index 207f68fbe3d3..51ee8ad44687 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
@@ -49,6 +49,7 @@ static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
49static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw, 49static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw,
50 ixgbe_link_speed speed, 50 ixgbe_link_speed speed,
51 bool autoneg_wait_to_complete); 51 bool autoneg_wait_to_complete);
52static void ixgbe_stop_mac_link_on_d3_82599(struct ixgbe_hw *hw);
52static s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw, 53static s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw,
53 bool autoneg_wait_to_complete); 54 bool autoneg_wait_to_complete);
54static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw, 55static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
@@ -432,6 +433,24 @@ out:
432} 433}
433 434
434/** 435/**
436 * ixgbe_stop_mac_link_on_d3_82599 - Disables link on D3
437 * @hw: pointer to hardware structure
438 *
439 * Disables link, should be called during D3 power down sequence.
440 *
441 */
442static void ixgbe_stop_mac_link_on_d3_82599(struct ixgbe_hw *hw)
443{
444 u32 autoc2_reg;
445
446 if (!hw->mng_fw_enabled && !hw->wol_enabled) {
447 autoc2_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC2);
448 autoc2_reg |= IXGBE_AUTOC2_LINK_DISABLE_ON_D3_MASK;
449 IXGBE_WRITE_REG(hw, IXGBE_AUTOC2, autoc2_reg);
450 }
451}
452
453/**
435 * ixgbe_start_mac_link_82599 - Setup MAC link settings 454 * ixgbe_start_mac_link_82599 - Setup MAC link settings
436 * @hw: pointer to hardware structure 455 * @hw: pointer to hardware structure
437 * @autoneg_wait_to_complete: true when waiting for completion is needed 456 * @autoneg_wait_to_complete: true when waiting for completion is needed
@@ -2477,6 +2496,7 @@ static struct ixgbe_mac_operations mac_ops_82599 = {
2477 .set_lan_id = &ixgbe_set_lan_id_multi_port_pcie, 2496 .set_lan_id = &ixgbe_set_lan_id_multi_port_pcie,
2478 .read_analog_reg8 = &ixgbe_read_analog_reg8_82599, 2497 .read_analog_reg8 = &ixgbe_read_analog_reg8_82599,
2479 .write_analog_reg8 = &ixgbe_write_analog_reg8_82599, 2498 .write_analog_reg8 = &ixgbe_write_analog_reg8_82599,
2499 .stop_link_on_d3 = &ixgbe_stop_mac_link_on_d3_82599,
2480 .setup_link = &ixgbe_setup_mac_link_82599, 2500 .setup_link = &ixgbe_setup_mac_link_82599,
2481 .set_rxpba = &ixgbe_set_rxpba_generic, 2501 .set_rxpba = &ixgbe_set_rxpba_generic,
2482 .check_link = &ixgbe_check_mac_link_generic, 2502 .check_link = &ixgbe_check_mac_link_generic,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 128d6b885326..cf1b41ebf655 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -5292,6 +5292,9 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake)
5292 return retval; 5292 return retval;
5293 5293
5294#endif 5294#endif
5295 if (hw->mac.ops.stop_link_on_d3)
5296 hw->mac.ops.stop_link_on_d3(hw);
5297
5295 if (wufc) { 5298 if (wufc) {
5296 ixgbe_set_rx_mode(netdev); 5299 ixgbe_set_rx_mode(netdev);
5297 5300
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
index 161ff18be775..6442cf8f9dce 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
@@ -1596,6 +1596,7 @@ enum {
1596#define IXGBE_AUTOC2_10G_KR (0x0 << IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_SHIFT) 1596#define IXGBE_AUTOC2_10G_KR (0x0 << IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_SHIFT)
1597#define IXGBE_AUTOC2_10G_XFI (0x1 << IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_SHIFT) 1597#define IXGBE_AUTOC2_10G_XFI (0x1 << IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_SHIFT)
1598#define IXGBE_AUTOC2_10G_SFI (0x2 << IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_SHIFT) 1598#define IXGBE_AUTOC2_10G_SFI (0x2 << IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_SHIFT)
1599#define IXGBE_AUTOC2_LINK_DISABLE_ON_D3_MASK 0x50000000
1599#define IXGBE_AUTOC2_LINK_DISABLE_MASK 0x70000000 1600#define IXGBE_AUTOC2_LINK_DISABLE_MASK 0x70000000
1600 1601
1601#define IXGBE_MACC_FLU 0x00000001 1602#define IXGBE_MACC_FLU 0x00000001
@@ -2847,6 +2848,7 @@ struct ixgbe_mac_operations {
2847 void (*disable_tx_laser)(struct ixgbe_hw *); 2848 void (*disable_tx_laser)(struct ixgbe_hw *);
2848 void (*enable_tx_laser)(struct ixgbe_hw *); 2849 void (*enable_tx_laser)(struct ixgbe_hw *);
2849 void (*flap_tx_laser)(struct ixgbe_hw *); 2850 void (*flap_tx_laser)(struct ixgbe_hw *);
2851 void (*stop_link_on_d3)(struct ixgbe_hw *);
2850 s32 (*setup_link)(struct ixgbe_hw *, ixgbe_link_speed, bool); 2852 s32 (*setup_link)(struct ixgbe_hw *, ixgbe_link_speed, bool);
2851 s32 (*check_link)(struct ixgbe_hw *, ixgbe_link_speed *, bool *, bool); 2853 s32 (*check_link)(struct ixgbe_hw *, ixgbe_link_speed *, bool *, bool);
2852 s32 (*get_link_capabilities)(struct ixgbe_hw *, ixgbe_link_speed *, 2854 s32 (*get_link_capabilities)(struct ixgbe_hw *, ixgbe_link_speed *,