Commit 4ec375b1 authored by Emil Tantilov's avatar Emil Tantilov Committed by Jeff Kirsher

ixgbe: fix link test when connected to 1Gbps link partner

This patch is a partial reverse of:
commit dfcc4615
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: default avatarEmil Tantilov <emil.s.tantilov@intel.com>
Tested-by: default avatarPhil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent bd8a1b12
...@@ -1885,11 +1885,12 @@ static void ixgbe_diag_test(struct net_device *netdev, ...@@ -1885,11 +1885,12 @@ static void ixgbe_diag_test(struct net_device *netdev,
struct ethtool_test *eth_test, u64 *data) struct ethtool_test *eth_test, u64 *data)
{ {
struct ixgbe_adapter *adapter = netdev_priv(netdev); struct ixgbe_adapter *adapter = netdev_priv(netdev);
struct ixgbe_hw *hw = &adapter->hw;
bool if_running = netif_running(netdev); bool if_running = netif_running(netdev);
set_bit(__IXGBE_TESTING, &adapter->state); set_bit(__IXGBE_TESTING, &adapter->state);
if (eth_test->flags == ETH_TEST_FL_OFFLINE) { if (eth_test->flags == ETH_TEST_FL_OFFLINE) {
struct ixgbe_hw *hw = &adapter->hw;
if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) { if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) {
int i; int i;
for (i = 0; i < adapter->num_vfs; i++) { for (i = 0; i < adapter->num_vfs; i++) {
...@@ -1913,21 +1914,18 @@ static void ixgbe_diag_test(struct net_device *netdev, ...@@ -1913,21 +1914,18 @@ static void ixgbe_diag_test(struct net_device *netdev,
/* Offline tests */ /* Offline tests */
e_info(hw, "offline testing starting\n"); e_info(hw, "offline testing starting\n");
if (if_running)
/* indicate we're in test mode */
dev_close(netdev);
/* bringing adapter down disables SFP+ optics */
if (hw->mac.ops.enable_tx_laser)
hw->mac.ops.enable_tx_laser(hw);
/* Link test performed before hardware reset so autoneg doesn't /* Link test performed before hardware reset so autoneg doesn't
* interfere with test result * interfere with test result
*/ */
if (ixgbe_link_test(adapter, &data[4])) if (ixgbe_link_test(adapter, &data[4]))
eth_test->flags |= ETH_TEST_FL_FAILED; eth_test->flags |= ETH_TEST_FL_FAILED;
if (if_running)
/* indicate we're in test mode */
dev_close(netdev);
else
ixgbe_reset(adapter); ixgbe_reset(adapter);
e_info(hw, "register testing starting\n"); e_info(hw, "register testing starting\n");
if (ixgbe_reg_test(adapter, &data[0])) if (ixgbe_reg_test(adapter, &data[0]))
eth_test->flags |= ETH_TEST_FL_FAILED; eth_test->flags |= ETH_TEST_FL_FAILED;
...@@ -1964,13 +1962,11 @@ static void ixgbe_diag_test(struct net_device *netdev, ...@@ -1964,13 +1962,11 @@ static void ixgbe_diag_test(struct net_device *netdev,
clear_bit(__IXGBE_TESTING, &adapter->state); clear_bit(__IXGBE_TESTING, &adapter->state);
if (if_running) if (if_running)
dev_open(netdev); dev_open(netdev);
else if (hw->mac.ops.disable_tx_laser)
hw->mac.ops.disable_tx_laser(hw);
} else { } else {
e_info(hw, "online testing starting\n"); e_info(hw, "online testing starting\n");
/* if adapter is down, SFP+ optics will be disabled */
if (!if_running && hw->mac.ops.enable_tx_laser)
hw->mac.ops.enable_tx_laser(hw);
/* Online tests */ /* Online tests */
if (ixgbe_link_test(adapter, &data[4])) if (ixgbe_link_test(adapter, &data[4]))
eth_test->flags |= ETH_TEST_FL_FAILED; eth_test->flags |= ETH_TEST_FL_FAILED;
...@@ -1984,9 +1980,6 @@ static void ixgbe_diag_test(struct net_device *netdev, ...@@ -1984,9 +1980,6 @@ static void ixgbe_diag_test(struct net_device *netdev,
clear_bit(__IXGBE_TESTING, &adapter->state); clear_bit(__IXGBE_TESTING, &adapter->state);
} }
/* if adapter was down, ensure SFP+ optics are disabled again */
if (!if_running && hw->mac.ops.disable_tx_laser)
hw->mac.ops.disable_tx_laser(hw);
skip_ol_tests: skip_ol_tests:
msleep_interruptible(4 * 1000); msleep_interruptible(4 * 1000);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment