Skip to content

Commit

Permalink
net/macb: Only adjust tx_clk on link change
Browse files Browse the repository at this point in the history
The PHY state machine (in drivers/net/phy/phy.c) will unconditionally
call phydev->adjust_link (macb_handle_link_change) when polling in the
PHY_CHANGELINK state. As currently written, macb always ends up
requesting a new tx_clk frequency in macb_handle_link_change. It is a
waste of time to request a new tx_clk frequency if the link state hasn't
changed, as the tx_clk will already be configured properly.

Let's only request a new tx_clk clock frequency when necessary.

Signed-off-by: Jaeden Amero <jaeden.amero@ni.com>
Cc: Josh Cartwright <joshc@ni.com>
Cc: Soren Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jaeden Amero authored and David S. Miller committed Mar 13, 2015
1 parent 3936194 commit 2c29b23
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/net/ethernet/cadence/macb.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,13 @@ static void macb_handle_link_change(struct net_device *dev)

spin_unlock_irqrestore(&bp->lock, flags);

macb_set_tx_clk(bp->tx_clk, phydev->speed, dev);

if (status_change) {
if (phydev->link) {
/* Update the TX clock rate if and only if the link is
* up and there has been a link change.
*/
macb_set_tx_clk(bp->tx_clk, phydev->speed, dev);

netif_carrier_on(dev);
netdev_info(dev, "link up (%d/%s)\n",
phydev->speed,
Expand Down

0 comments on commit 2c29b23

Please sign in to comment.