i40e: don't restart nway if autoneg not supported
[ 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>
This commit is contained in:
parent
d4e3d38b90
commit
095d4dbe73
@ -969,6 +969,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
|
||||
@ -981,15 +982,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");
|
||||
}
|
||||
@ -1040,7 +1040,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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user