Commit 33faac8e authored by Russell King's avatar Russell King Committed by David S. Miller

net: phylink: use phylib resolved flow control modes

Use the new phy_get_pause() helper to get the resolved pause modes for
a PHY rather than resolving the pause modes ourselves. We temporarily
retain our pause mode resolution for causes where there is no PHY
attached, e.g. for fixed-link modes.
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2d5fbef0
...@@ -500,7 +500,6 @@ static void phylink_resolve(struct work_struct *w) ...@@ -500,7 +500,6 @@ static void phylink_resolve(struct work_struct *w)
switch (pl->cur_link_an_mode) { switch (pl->cur_link_an_mode) {
case MLO_AN_PHY: case MLO_AN_PHY:
link_state = pl->phy_state; link_state = pl->phy_state;
phylink_resolve_flow(pl, &link_state);
phylink_apply_manual_flow(pl, &link_state); phylink_apply_manual_flow(pl, &link_state);
phylink_mac_config_up(pl, &link_state); phylink_mac_config_up(pl, &link_state);
break; break;
...@@ -523,9 +522,8 @@ static void phylink_resolve(struct work_struct *w) ...@@ -523,9 +522,8 @@ static void phylink_resolve(struct work_struct *w)
link_state.interface = pl->phy_state.interface; link_state.interface = pl->phy_state.interface;
/* If we have a PHY, we need to update with /* If we have a PHY, we need to update with
* the pause mode bits. */ * the PHY flow control bits. */
link_state.pause |= pl->phy_state.pause; link_state.pause = pl->phy_state.pause;
phylink_resolve_flow(pl, &link_state);
phylink_apply_manual_flow(pl, &link_state); phylink_apply_manual_flow(pl, &link_state);
phylink_mac_config(pl, &link_state); phylink_mac_config(pl, &link_state);
} }
...@@ -714,15 +712,18 @@ static void phylink_phy_change(struct phy_device *phydev, bool up, ...@@ -714,15 +712,18 @@ static void phylink_phy_change(struct phy_device *phydev, bool up,
bool do_carrier) bool do_carrier)
{ {
struct phylink *pl = phydev->phylink; struct phylink *pl = phydev->phylink;
bool tx_pause, rx_pause;
phy_get_pause(phydev, &tx_pause, &rx_pause);
mutex_lock(&pl->state_mutex); mutex_lock(&pl->state_mutex);
pl->phy_state.speed = phydev->speed; pl->phy_state.speed = phydev->speed;
pl->phy_state.duplex = phydev->duplex; pl->phy_state.duplex = phydev->duplex;
pl->phy_state.pause = MLO_PAUSE_NONE; pl->phy_state.pause = MLO_PAUSE_NONE;
if (phydev->pause) if (tx_pause)
pl->phy_state.pause |= MLO_PAUSE_SYM; pl->phy_state.pause |= MLO_PAUSE_TX;
if (phydev->asym_pause) if (rx_pause)
pl->phy_state.pause |= MLO_PAUSE_ASYM; pl->phy_state.pause |= MLO_PAUSE_RX;
pl->phy_state.interface = phydev->interface; pl->phy_state.interface = phydev->interface;
pl->phy_state.link = up; pl->phy_state.link = up;
mutex_unlock(&pl->state_mutex); mutex_unlock(&pl->state_mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment