]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Dec 2019 07:51:17 +0000 (08:51 +0100)
[ Upstream commit 7c3758f7839377ab67529cc50264a640636c47af ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/intel/i40e/i40e_ethtool.c

index 5ff6caa83948c2c14a6b85070ddaba54e0c50c3a..a6b0f605a7d8b64edd4dc39ebb346bc7bc3a29c5 100644 (file)
@@ -1136,6 +1136,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
@@ -1148,15 +1149,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");
        }
@@ -1207,7 +1207,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))