Skip to content

Commit 598ca0d

Browse files
vladimirolteankuba-moo
authored andcommitted
net: enetc: move phylink_start/stop out of enetc_start/stop
We want to introduce a fast interface reconfiguration procedure, which involves temporarily stopping the rings. But we want enetc_start() and enetc_stop() to not restart PHY autoneg, because that can take a few seconds until it completes again. So we need part of enetc_start() and enetc_stop(), but not all of them. Move phylink_start() right next to phylink_of_phy_connect(), and phylink_stop() right next to phylink_disconnect_phy(), both still in ndo_open() and ndo_stop(). Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent f3ce29e commit 598ca0d

File tree

1 file changed

+13
-13
lines changed
  • drivers/net/ethernet/freescale/enetc

1 file changed

+13
-13
lines changed

drivers/net/ethernet/freescale/enetc/enetc.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2322,8 +2322,11 @@ static int enetc_phylink_connect(struct net_device *ndev)
23222322
struct ethtool_eee edata;
23232323
int err;
23242324

2325-
if (!priv->phylink)
2326-
return 0; /* phy-less mode */
2325+
if (!priv->phylink) {
2326+
/* phy-less mode */
2327+
netif_carrier_on(ndev);
2328+
return 0;
2329+
}
23272330

23282331
err = phylink_of_phy_connect(priv->phylink, priv->dev->of_node, 0);
23292332
if (err) {
@@ -2335,6 +2338,8 @@ static int enetc_phylink_connect(struct net_device *ndev)
23352338
memset(&edata, 0, sizeof(struct ethtool_eee));
23362339
phylink_ethtool_set_eee(priv->phylink, &edata);
23372340

2341+
phylink_start(priv->phylink);
2342+
23382343
return 0;
23392344
}
23402345

@@ -2376,11 +2381,6 @@ void enetc_start(struct net_device *ndev)
23762381
enable_irq(irq);
23772382
}
23782383

2379-
if (priv->phylink)
2380-
phylink_start(priv->phylink);
2381-
else
2382-
netif_carrier_on(ndev);
2383-
23842384
netif_tx_start_all_queues(ndev);
23852385
}
23862386

@@ -2461,11 +2461,6 @@ void enetc_stop(struct net_device *ndev)
24612461
napi_disable(&priv->int_vector[i]->napi);
24622462
}
24632463

2464-
if (priv->phylink)
2465-
phylink_stop(priv->phylink);
2466-
else
2467-
netif_carrier_off(ndev);
2468-
24692464
enetc_clear_interrupts(priv);
24702465
}
24712466

@@ -2476,8 +2471,13 @@ int enetc_close(struct net_device *ndev)
24762471
enetc_stop(ndev);
24772472
enetc_clear_bdrs(priv);
24782473

2479-
if (priv->phylink)
2474+
if (priv->phylink) {
2475+
phylink_stop(priv->phylink);
24802476
phylink_disconnect_phy(priv->phylink);
2477+
} else {
2478+
netif_carrier_off(ndev);
2479+
}
2480+
24812481
enetc_free_rxtx_rings(priv);
24822482

24832483
/* Avoids dangling pointers and also frees old resources */

0 commit comments

Comments
 (0)