Skip to content

Commit 0946cf1

Browse files
Russell Kingdavem330
authored andcommitted
net: phylink: only call mac_config() during resolve when link is up
There's little point calling mac_config() when the link is down. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent da203df commit 0946cf1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/net/phy/phylink.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,13 @@ static void phylink_mac_config(struct phylink *pl,
302302
pl->ops->mac_config(pl->netdev, pl->link_an_mode, state);
303303
}
304304

305+
static void phylink_mac_config_up(struct phylink *pl,
306+
const struct phylink_link_state *state)
307+
{
308+
if (state->link)
309+
phylink_mac_config(pl, state);
310+
}
311+
305312
static void phylink_mac_an_restart(struct phylink *pl)
306313
{
307314
if (pl->link_config.an_enabled &&
@@ -401,12 +408,12 @@ static void phylink_resolve(struct work_struct *w)
401408
case MLO_AN_PHY:
402409
link_state = pl->phy_state;
403410
phylink_resolve_flow(pl, &link_state);
404-
phylink_mac_config(pl, &link_state);
411+
phylink_mac_config_up(pl, &link_state);
405412
break;
406413

407414
case MLO_AN_FIXED:
408415
phylink_get_fixed_state(pl, &link_state);
409-
phylink_mac_config(pl, &link_state);
416+
phylink_mac_config_up(pl, &link_state);
410417
break;
411418

412419
case MLO_AN_INBAND:

0 commit comments

Comments
 (0)