diff options
author | Emil Tantilov <emil.s.tantilov@intel.com> | 2013-07-09 22:47:24 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2013-08-29 05:58:04 -0400 |
commit | 4ec375b1ec8ede2691a6511fff91a2b67fe73c3b (patch) | |
tree | 31a420738e344fc3875af488c7d015898013fdff /drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | |
parent | bd8a1b12907e314c3630c18da2bc0a07f5ae72e7 (diff) |
ixgbe: fix link test when connected to 1Gbps link partner
This patch is a partial reverse of:
commit dfcc4615f09c33454bc553567f7c7506cae60cb9
Author: Jacob Keller <jacob.e.keller@intel.com>
Date: Thu Nov 8 07:07:08 2012 +0000
ixgbe: ethtool ixgbe_diag_test cleanup
Specifically forcing the laser before the link check can lead to
inconsistent results because it does not guarantee that the link will be
negotiated correctly. Such is the case when dual speed SFP+ module is
connected to a gigabit link partner.
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c')
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c index db0dbf668b14..b6f1592bbcc8 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | |||
@@ -1885,11 +1885,12 @@ static void ixgbe_diag_test(struct net_device *netdev, | |||
1885 | struct ethtool_test *eth_test, u64 *data) | 1885 | struct ethtool_test *eth_test, u64 *data) |
1886 | { | 1886 | { |
1887 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 1887 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
1888 | struct ixgbe_hw *hw = &adapter->hw; | ||
1889 | bool if_running = netif_running(netdev); | 1888 | bool if_running = netif_running(netdev); |
1890 | 1889 | ||
1891 | set_bit(__IXGBE_TESTING, &adapter->state); | 1890 | set_bit(__IXGBE_TESTING, &adapter->state); |
1892 | if (eth_test->flags == ETH_TEST_FL_OFFLINE) { | 1891 | if (eth_test->flags == ETH_TEST_FL_OFFLINE) { |
1892 | struct ixgbe_hw *hw = &adapter->hw; | ||
1893 | |||
1893 | if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) { | 1894 | if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) { |
1894 | int i; | 1895 | int i; |
1895 | for (i = 0; i < adapter->num_vfs; i++) { | 1896 | for (i = 0; i < adapter->num_vfs; i++) { |
@@ -1913,21 +1914,18 @@ static void ixgbe_diag_test(struct net_device *netdev, | |||
1913 | /* Offline tests */ | 1914 | /* Offline tests */ |
1914 | e_info(hw, "offline testing starting\n"); | 1915 | e_info(hw, "offline testing starting\n"); |
1915 | 1916 | ||
1916 | if (if_running) | ||
1917 | /* indicate we're in test mode */ | ||
1918 | dev_close(netdev); | ||
1919 | |||
1920 | /* bringing adapter down disables SFP+ optics */ | ||
1921 | if (hw->mac.ops.enable_tx_laser) | ||
1922 | hw->mac.ops.enable_tx_laser(hw); | ||
1923 | |||
1924 | /* Link test performed before hardware reset so autoneg doesn't | 1917 | /* Link test performed before hardware reset so autoneg doesn't |
1925 | * interfere with test result | 1918 | * interfere with test result |
1926 | */ | 1919 | */ |
1927 | if (ixgbe_link_test(adapter, &data[4])) | 1920 | if (ixgbe_link_test(adapter, &data[4])) |
1928 | eth_test->flags |= ETH_TEST_FL_FAILED; | 1921 | eth_test->flags |= ETH_TEST_FL_FAILED; |
1929 | 1922 | ||
1930 | ixgbe_reset(adapter); | 1923 | if (if_running) |
1924 | /* indicate we're in test mode */ | ||
1925 | dev_close(netdev); | ||
1926 | else | ||
1927 | ixgbe_reset(adapter); | ||
1928 | |||
1931 | e_info(hw, "register testing starting\n"); | 1929 | e_info(hw, "register testing starting\n"); |
1932 | if (ixgbe_reg_test(adapter, &data[0])) | 1930 | if (ixgbe_reg_test(adapter, &data[0])) |
1933 | eth_test->flags |= ETH_TEST_FL_FAILED; | 1931 | eth_test->flags |= ETH_TEST_FL_FAILED; |
@@ -1964,13 +1962,11 @@ skip_loopback: | |||
1964 | clear_bit(__IXGBE_TESTING, &adapter->state); | 1962 | clear_bit(__IXGBE_TESTING, &adapter->state); |
1965 | if (if_running) | 1963 | if (if_running) |
1966 | dev_open(netdev); | 1964 | dev_open(netdev); |
1965 | else if (hw->mac.ops.disable_tx_laser) | ||
1966 | hw->mac.ops.disable_tx_laser(hw); | ||
1967 | } else { | 1967 | } else { |
1968 | e_info(hw, "online testing starting\n"); | 1968 | e_info(hw, "online testing starting\n"); |
1969 | 1969 | ||
1970 | /* if adapter is down, SFP+ optics will be disabled */ | ||
1971 | if (!if_running && hw->mac.ops.enable_tx_laser) | ||
1972 | hw->mac.ops.enable_tx_laser(hw); | ||
1973 | |||
1974 | /* Online tests */ | 1970 | /* Online tests */ |
1975 | if (ixgbe_link_test(adapter, &data[4])) | 1971 | if (ixgbe_link_test(adapter, &data[4])) |
1976 | eth_test->flags |= ETH_TEST_FL_FAILED; | 1972 | eth_test->flags |= ETH_TEST_FL_FAILED; |
@@ -1984,9 +1980,6 @@ skip_loopback: | |||
1984 | clear_bit(__IXGBE_TESTING, &adapter->state); | 1980 | clear_bit(__IXGBE_TESTING, &adapter->state); |
1985 | } | 1981 | } |
1986 | 1982 | ||
1987 | /* if adapter was down, ensure SFP+ optics are disabled again */ | ||
1988 | if (!if_running && hw->mac.ops.disable_tx_laser) | ||
1989 | hw->mac.ops.disable_tx_laser(hw); | ||
1990 | skip_ol_tests: | 1983 | skip_ol_tests: |
1991 | msleep_interruptible(4 * 1000); | 1984 | msleep_interruptible(4 * 1000); |
1992 | } | 1985 | } |