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 <kapranoff@inbox.ru> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
1b5ab0def4
commit
a33e6112d9
|
@ -462,33 +462,6 @@ void phy_stop_machine(struct phy_device *phydev)
|
||||||
phydev->adjust_state = NULL;
|
phydev->adjust_state = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* phy_force_reduction - reduce PHY speed/duplex settings by one step
|
|
||||||
* @phydev: target phy_device struct
|
|
||||||
*
|
|
||||||
* Description: Reduces the speed/duplex settings by one notch,
|
|
||||||
* in this order--
|
|
||||||
* 1000/FULL, 1000/HALF, 100/FULL, 100/HALF, 10/FULL, 10/HALF.
|
|
||||||
* The function bottoms out at 10/HALF.
|
|
||||||
*/
|
|
||||||
static void phy_force_reduction(struct phy_device *phydev)
|
|
||||||
{
|
|
||||||
int idx;
|
|
||||||
|
|
||||||
idx = phy_find_setting(phydev->speed, phydev->duplex);
|
|
||||||
|
|
||||||
idx++;
|
|
||||||
|
|
||||||
idx = phy_find_valid(idx, phydev->supported);
|
|
||||||
|
|
||||||
phydev->speed = settings[idx].speed;
|
|
||||||
phydev->duplex = settings[idx].duplex;
|
|
||||||
|
|
||||||
pr_info("Trying %d/%s\n",
|
|
||||||
phydev->speed, DUPLEX_FULL == phydev->duplex ? "FULL" : "HALF");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* phy_error - enter HALTED state for this PHY device
|
* phy_error - enter HALTED state for this PHY device
|
||||||
* @phydev: target phy_device struct
|
* @phydev: target phy_device struct
|
||||||
|
@ -818,30 +791,11 @@ void phy_state_machine(struct work_struct *work)
|
||||||
phydev->adjust_link(phydev->attached_dev);
|
phydev->adjust_link(phydev->attached_dev);
|
||||||
|
|
||||||
} else if (0 == phydev->link_timeout--) {
|
} else if (0 == phydev->link_timeout--) {
|
||||||
int idx;
|
|
||||||
|
|
||||||
needs_aneg = 1;
|
needs_aneg = 1;
|
||||||
/* If we have the magic_aneg bit,
|
/* If we have the magic_aneg bit,
|
||||||
* we try again */
|
* we try again */
|
||||||
if (phydev->drv->flags & PHY_HAS_MAGICANEG)
|
if (phydev->drv->flags & PHY_HAS_MAGICANEG)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* The timer expired, and we still
|
|
||||||
* don't have a setting, so we try
|
|
||||||
* forcing it until we find one that
|
|
||||||
* works, starting from the fastest speed,
|
|
||||||
* and working our way down */
|
|
||||||
idx = phy_find_valid(0, phydev->supported);
|
|
||||||
|
|
||||||
phydev->speed = settings[idx].speed;
|
|
||||||
phydev->duplex = settings[idx].duplex;
|
|
||||||
|
|
||||||
phydev->autoneg = AUTONEG_DISABLE;
|
|
||||||
|
|
||||||
pr_info("Trying %d/%s\n",
|
|
||||||
phydev->speed,
|
|
||||||
DUPLEX_FULL == phydev->duplex ?
|
|
||||||
"FULL" : "HALF");
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PHY_NOLINK:
|
case PHY_NOLINK:
|
||||||
|
@ -866,10 +820,8 @@ void phy_state_machine(struct work_struct *work)
|
||||||
phydev->state = PHY_RUNNING;
|
phydev->state = PHY_RUNNING;
|
||||||
netif_carrier_on(phydev->attached_dev);
|
netif_carrier_on(phydev->attached_dev);
|
||||||
} else {
|
} else {
|
||||||
if (0 == phydev->link_timeout--) {
|
if (0 == phydev->link_timeout--)
|
||||||
phy_force_reduction(phydev);
|
|
||||||
needs_aneg = 1;
|
needs_aneg = 1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
phydev->adjust_link(phydev->attached_dev);
|
phydev->adjust_link(phydev->attached_dev);
|
||||||
|
|
Loading…
Reference in a new issue