Commit f551b438 authored by Shannon Nelson's avatar Shannon Nelson Committed by Jeff Kirsher

i40e: fix pf reset after offline test

When the ethtool testing starts it sets the I40E_TESTING state
bit, which blocks new netdev opens so that things don't get
confused, while the testing might be messing with register and
other things.  Unfortunately, that was keeping the PF resets
after the register test from working correctly because the netdev
would not get reopened.  This patch reorders the tests to put the
register test last as it is the only one that needs a reset, and
we wait to trigger the reset until after we clear the
I40E_TESTING bit.

Change-Id: Ieaa18d74264250ac336b0656b490125ee8a22d2a
Signed-off-by: default avatarShannon Nelson <shannon.nelson@intel.com>
Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: default avatarKavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent c9a3d471
...@@ -748,7 +748,6 @@ static int i40e_reg_test(struct net_device *netdev, u64 *data) ...@@ -748,7 +748,6 @@ static int i40e_reg_test(struct net_device *netdev, u64 *data)
netif_info(pf, hw, netdev, "register test\n"); netif_info(pf, hw, netdev, "register test\n");
*data = i40e_diag_reg_test(&pf->hw); *data = i40e_diag_reg_test(&pf->hw);
i40e_do_reset(pf, (1 << __I40E_PF_RESET_REQUESTED));
return *data; return *data;
} }
...@@ -796,20 +795,18 @@ static void i40e_diag_test(struct net_device *netdev, ...@@ -796,20 +795,18 @@ static void i40e_diag_test(struct net_device *netdev,
struct i40e_netdev_priv *np = netdev_priv(netdev); struct i40e_netdev_priv *np = netdev_priv(netdev);
struct i40e_pf *pf = np->vsi->back; struct i40e_pf *pf = np->vsi->back;
set_bit(__I40E_TESTING, &pf->state);
if (eth_test->flags == ETH_TEST_FL_OFFLINE) { if (eth_test->flags == ETH_TEST_FL_OFFLINE) {
/* Offline tests */ /* Offline tests */
netif_info(pf, drv, netdev, "offline testing starting\n"); netif_info(pf, drv, netdev, "offline testing starting\n");
set_bit(__I40E_TESTING, &pf->state);
/* Link test performed before hardware reset /* Link test performed before hardware reset
* so autoneg doesn't interfere with test result * so autoneg doesn't interfere with test result
*/ */
if (i40e_link_test(netdev, &data[I40E_ETH_TEST_LINK])) if (i40e_link_test(netdev, &data[I40E_ETH_TEST_LINK]))
eth_test->flags |= ETH_TEST_FL_FAILED; eth_test->flags |= ETH_TEST_FL_FAILED;
if (i40e_reg_test(netdev, &data[I40E_ETH_TEST_REG]))
eth_test->flags |= ETH_TEST_FL_FAILED;
if (i40e_eeprom_test(netdev, &data[I40E_ETH_TEST_EEPROM])) if (i40e_eeprom_test(netdev, &data[I40E_ETH_TEST_EEPROM]))
eth_test->flags |= ETH_TEST_FL_FAILED; eth_test->flags |= ETH_TEST_FL_FAILED;
...@@ -819,6 +816,12 @@ static void i40e_diag_test(struct net_device *netdev, ...@@ -819,6 +816,12 @@ static void i40e_diag_test(struct net_device *netdev,
if (i40e_loopback_test(netdev, &data[I40E_ETH_TEST_LOOPBACK])) if (i40e_loopback_test(netdev, &data[I40E_ETH_TEST_LOOPBACK]))
eth_test->flags |= ETH_TEST_FL_FAILED; eth_test->flags |= ETH_TEST_FL_FAILED;
/* run reg test last, a reset is required after it */
if (i40e_reg_test(netdev, &data[I40E_ETH_TEST_REG]))
eth_test->flags |= ETH_TEST_FL_FAILED;
clear_bit(__I40E_TESTING, &pf->state);
i40e_do_reset(pf, (1 << __I40E_PF_RESET_REQUESTED));
} else { } else {
/* Online tests */ /* Online tests */
netif_info(pf, drv, netdev, "online testing starting\n"); netif_info(pf, drv, netdev, "online testing starting\n");
...@@ -832,7 +835,6 @@ static void i40e_diag_test(struct net_device *netdev, ...@@ -832,7 +835,6 @@ static void i40e_diag_test(struct net_device *netdev,
data[I40E_ETH_TEST_INTR] = 0; data[I40E_ETH_TEST_INTR] = 0;
data[I40E_ETH_TEST_LOOPBACK] = 0; data[I40E_ETH_TEST_LOOPBACK] = 0;
} }
clear_bit(__I40E_TESTING, &pf->state);
netif_info(pf, drv, netdev, "testing finished\n"); netif_info(pf, drv, netdev, "testing finished\n");
} }
......
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