mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-16 18:26:42 +00:00
Merge branch 'net-phylink-phylink_resolve-cleanups'
Russell King says: ==================== net: phylink: phylink_resolve() cleanups This series does a bit of clean-up in phylink_resolve() to make the code a little easier to follow. Patch 1 moves the manual flow control setting in two of the switch cases to after the switch(). Patch 2 changes the MLO_AN_FIXED case to be a simple if() statement, reducing its indentation. Patch 3 changes the MLO_AN_PHY case to also be a simple if() statment, also reducing its indentation. Patch 4 does the same for the last case. Patch 5 reformats the code and comments for the reduced indentation, making it easier to read. ==================== Link: https://patch.msgid.link/Zy411lVWe2SikuOs@shell.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
874ed898a2
@ -1463,76 +1463,66 @@ static void phylink_resolve(struct work_struct *w)
|
||||
} else if (pl->mac_link_dropped) {
|
||||
link_state.link = false;
|
||||
retrigger = true;
|
||||
} else if (pl->cur_link_an_mode == MLO_AN_FIXED) {
|
||||
phylink_get_fixed_state(pl, &link_state);
|
||||
mac_config = link_state.link;
|
||||
} else if (pl->cur_link_an_mode == MLO_AN_PHY) {
|
||||
link_state = pl->phy_state;
|
||||
mac_config = link_state.link;
|
||||
} else {
|
||||
switch (pl->cur_link_an_mode) {
|
||||
case MLO_AN_PHY:
|
||||
link_state = pl->phy_state;
|
||||
phylink_apply_manual_flow(pl, &link_state);
|
||||
mac_config = link_state.link;
|
||||
break;
|
||||
phylink_mac_pcs_get_state(pl, &link_state);
|
||||
|
||||
case MLO_AN_FIXED:
|
||||
phylink_get_fixed_state(pl, &link_state);
|
||||
mac_config = link_state.link;
|
||||
break;
|
||||
/* The PCS may have a latching link-fail indicator. If the link
|
||||
* was up, bring the link down and re-trigger the resolve.
|
||||
* Otherwise, re-read the PCS state to get the current status
|
||||
* of the link.
|
||||
*/
|
||||
if (!link_state.link) {
|
||||
if (cur_link_state)
|
||||
retrigger = true;
|
||||
else
|
||||
phylink_mac_pcs_get_state(pl, &link_state);
|
||||
}
|
||||
|
||||
case MLO_AN_INBAND:
|
||||
phylink_mac_pcs_get_state(pl, &link_state);
|
||||
/* If we have a phy, the "up" state is the union of both the
|
||||
* PHY and the MAC
|
||||
*/
|
||||
if (pl->phydev)
|
||||
link_state.link &= pl->phy_state.link;
|
||||
|
||||
/* The PCS may have a latching link-fail indicator.
|
||||
* If the link was up, bring the link down and
|
||||
* re-trigger the resolve. Otherwise, re-read the
|
||||
* PCS state to get the current status of the link.
|
||||
/* Only update if the PHY link is up */
|
||||
if (pl->phydev && pl->phy_state.link) {
|
||||
/* If the interface has changed, force a link down
|
||||
* event if the link isn't already down, and re-resolve.
|
||||
*/
|
||||
if (!link_state.link) {
|
||||
if (cur_link_state)
|
||||
retrigger = true;
|
||||
else
|
||||
phylink_mac_pcs_get_state(pl,
|
||||
&link_state);
|
||||
if (link_state.interface != pl->phy_state.interface) {
|
||||
retrigger = true;
|
||||
link_state.link = false;
|
||||
}
|
||||
|
||||
/* If we have a phy, the "up" state is the union of
|
||||
* both the PHY and the MAC
|
||||
link_state.interface = pl->phy_state.interface;
|
||||
|
||||
/* If we are doing rate matching, then the link
|
||||
* speed/duplex comes from the PHY
|
||||
*/
|
||||
if (pl->phydev)
|
||||
link_state.link &= pl->phy_state.link;
|
||||
|
||||
/* Only update if the PHY link is up */
|
||||
if (pl->phydev && pl->phy_state.link) {
|
||||
/* If the interface has changed, force a
|
||||
* link down event if the link isn't already
|
||||
* down, and re-resolve.
|
||||
*/
|
||||
if (link_state.interface !=
|
||||
pl->phy_state.interface) {
|
||||
retrigger = true;
|
||||
link_state.link = false;
|
||||
}
|
||||
link_state.interface = pl->phy_state.interface;
|
||||
|
||||
/* If we are doing rate matching, then the
|
||||
* link speed/duplex comes from the PHY
|
||||
*/
|
||||
if (pl->phy_state.rate_matching) {
|
||||
link_state.rate_matching =
|
||||
pl->phy_state.rate_matching;
|
||||
link_state.speed = pl->phy_state.speed;
|
||||
link_state.duplex =
|
||||
pl->phy_state.duplex;
|
||||
}
|
||||
|
||||
/* If we have a PHY, we need to update with
|
||||
* the PHY flow control bits.
|
||||
*/
|
||||
link_state.pause = pl->phy_state.pause;
|
||||
mac_config = true;
|
||||
if (pl->phy_state.rate_matching) {
|
||||
link_state.rate_matching =
|
||||
pl->phy_state.rate_matching;
|
||||
link_state.speed = pl->phy_state.speed;
|
||||
link_state.duplex = pl->phy_state.duplex;
|
||||
}
|
||||
phylink_apply_manual_flow(pl, &link_state);
|
||||
break;
|
||||
|
||||
/* If we have a PHY, we need to update with the PHY
|
||||
* flow control bits.
|
||||
*/
|
||||
link_state.pause = pl->phy_state.pause;
|
||||
mac_config = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (pl->cur_link_an_mode != MLO_AN_FIXED)
|
||||
phylink_apply_manual_flow(pl, &link_state);
|
||||
|
||||
if (mac_config) {
|
||||
if (link_state.interface != pl->link_config.interface) {
|
||||
/* The interface has changed, force the link down and
|
||||
|
Loading…
x
Reference in New Issue
Block a user