Skip to content

Commit a33e611

Browse files
Kirill Kapranovdavem330
authored andcommitted
phy: Elimination the forced speed reduction algorithm.
In case of fixed speed set up for a NIC (e.g. ethtool -s eth0 autoneg off speed 100 duplex full) with an ethernet cable plugged off, the mentioned algorithm slows down a NIC speed, so further cable hook-up leads to nonoperable link state. Signed-off-by: Kirill Kapranov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1b5ab0d commit a33e611

File tree

1 file changed

+1
-49
lines changed

1 file changed

+1
-49
lines changed

drivers/net/phy/phy.c

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -462,33 +462,6 @@ void phy_stop_machine(struct phy_device *phydev)
462462
phydev->adjust_state = NULL;
463463
}
464464

465-
/**
466-
* phy_force_reduction - reduce PHY speed/duplex settings by one step
467-
* @phydev: target phy_device struct
468-
*
469-
* Description: Reduces the speed/duplex settings by one notch,
470-
* in this order--
471-
* 1000/FULL, 1000/HALF, 100/FULL, 100/HALF, 10/FULL, 10/HALF.
472-
* The function bottoms out at 10/HALF.
473-
*/
474-
static void phy_force_reduction(struct phy_device *phydev)
475-
{
476-
int idx;
477-
478-
idx = phy_find_setting(phydev->speed, phydev->duplex);
479-
480-
idx++;
481-
482-
idx = phy_find_valid(idx, phydev->supported);
483-
484-
phydev->speed = settings[idx].speed;
485-
phydev->duplex = settings[idx].duplex;
486-
487-
pr_info("Trying %d/%s\n",
488-
phydev->speed, DUPLEX_FULL == phydev->duplex ? "FULL" : "HALF");
489-
}
490-
491-
492465
/**
493466
* phy_error - enter HALTED state for this PHY device
494467
* @phydev: target phy_device struct
@@ -818,30 +791,11 @@ void phy_state_machine(struct work_struct *work)
818791
phydev->adjust_link(phydev->attached_dev);
819792

820793
} else if (0 == phydev->link_timeout--) {
821-
int idx;
822-
823794
needs_aneg = 1;
824795
/* If we have the magic_aneg bit,
825796
* we try again */
826797
if (phydev->drv->flags & PHY_HAS_MAGICANEG)
827798
break;
828-
829-
/* The timer expired, and we still
830-
* don't have a setting, so we try
831-
* forcing it until we find one that
832-
* works, starting from the fastest speed,
833-
* and working our way down */
834-
idx = phy_find_valid(0, phydev->supported);
835-
836-
phydev->speed = settings[idx].speed;
837-
phydev->duplex = settings[idx].duplex;
838-
839-
phydev->autoneg = AUTONEG_DISABLE;
840-
841-
pr_info("Trying %d/%s\n",
842-
phydev->speed,
843-
DUPLEX_FULL == phydev->duplex ?
844-
"FULL" : "HALF");
845799
}
846800
break;
847801
case PHY_NOLINK:
@@ -866,10 +820,8 @@ void phy_state_machine(struct work_struct *work)
866820
phydev->state = PHY_RUNNING;
867821
netif_carrier_on(phydev->attached_dev);
868822
} else {
869-
if (0 == phydev->link_timeout--) {
870-
phy_force_reduction(phydev);
823+
if (0 == phydev->link_timeout--)
871824
needs_aneg = 1;
872-
}
873825
}
874826

875827
phydev->adjust_link(phydev->attached_dev);

0 commit comments

Comments
 (0)