i40e: don't restart nway if autoneg not supported
authorMitch Williams <mitch.a.williams@intel.com>
Fri, 26 Oct 2018 21:33:28 +0000 (14:33 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Wed, 14 Nov 2018 18:56:33 +0000 (10:56 -0800)
On link types that do not support autoneg, we cannot attempt to restart
nway negotiation. This results in a dead link that requires a power
cycle to remedy.

Fix this by saving off the autoneg state and checking this value before
we try to restart nway.

Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_ethtool.c

index 311edac..1ed241a 100644 (file)
@@ -1335,6 +1335,7 @@ static int i40e_set_pauseparam(struct net_device *netdev,
        i40e_status status;
        u8 aq_failures;
        int err = 0;
+       u32 is_an;
 
        /* Changing the port's flow control is not supported if this isn't the
         * port's controlling PF
@@ -1347,15 +1348,14 @@ static int i40e_set_pauseparam(struct net_device *netdev,
        if (vsi != pf->vsi[pf->lan_vsi])
                return -EOPNOTSUPP;
 
-       if (pause->autoneg != ((hw_link_info->an_info & I40E_AQ_AN_COMPLETED) ?
-           AUTONEG_ENABLE : AUTONEG_DISABLE)) {
+       is_an = hw_link_info->an_info & I40E_AQ_AN_COMPLETED;
+       if (pause->autoneg != is_an) {
                netdev_info(netdev, "To change autoneg please use: ethtool -s <dev> autoneg <on|off>\n");
                return -EOPNOTSUPP;
        }
 
        /* If we have link and don't have autoneg */
-       if (!test_bit(__I40E_DOWN, pf->state) &&
-           !(hw_link_info->an_info & I40E_AQ_AN_COMPLETED)) {
+       if (!test_bit(__I40E_DOWN, pf->state) && !is_an) {
                /* Send message that it might not necessarily work*/
                netdev_info(netdev, "Autoneg did not complete so changing settings may not result in an actual change.\n");
        }
@@ -1406,7 +1406,7 @@ static int i40e_set_pauseparam(struct net_device *netdev,
                err = -EAGAIN;
        }
 
-       if (!test_bit(__I40E_DOWN, pf->state)) {
+       if (!test_bit(__I40E_DOWN, pf->state) && is_an) {
                /* Give it a little more time to try to come back */
                msleep(75);
                if (!test_bit(__I40E_DOWN, pf->state))