[PATCH net-next v4 4/4] net: stmmac: restore EST before starting DMA on open and resume
James Hilliard
james.hilliard1 at gmail.com
Wed Sep 30 21:12:52 PDT 2026
From: Lorenzo Bianconi <lorenzo.bianconi at oss.qualcomm.com>
The core reset clears the MTL_EST registers while the cached TAPRIO
schedule remains installed. Reapply that schedule after timestamp
initialization in open and resume, advancing its base time by whole
cycles through the shared replay helper.
Move DMA start out of hardware setup and into its callers after EST
replay succeeds. An EST setup failure must not expose an active
datapath without its installed gate schedule.
Fixes: b60189e0392f ("net: stmmac: Integrate EST with TAPRIO scheduler API")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi at oss.qualcomm.com>
Signed-off-by: James Hilliard <james.hilliard1 at gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index e93f3238be1f..2104eaef8806 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -48,6 +48,7 @@
#include "stmmac_ptp.h"
#include "stmmac_fpe.h"
#include "stmmac.h"
+#include "stmmac_est.h"
#include "stmmac_pcs.h"
#include "stmmac_xdp.h"
#include <linux/reset.h>
@@ -3779,8 +3780,6 @@ static int stmmac_hw_setup(struct net_device *dev)
netif_set_real_num_rx_queues(dev, priv->plat->rx_queues_to_use);
netif_set_real_num_tx_queues(dev, priv->plat->tx_queues_to_use);
- /* Start the ball rolling... */
- stmmac_start_all_dma(priv);
phylink_rx_clk_stop_block(priv->phylink);
stmmac_set_hw_vlan_mode(priv, priv->hw);
@@ -4200,12 +4199,22 @@ static int __stmmac_open(struct net_device *dev,
if (ret)
goto ptp_error;
+ /* The core soft reset in stmmac_hw_setup() clears the MTL_EST
+ * registers, so re-apply the taprio offload after PTP is up.
+ */
+ ret = stmmac_setup_est(priv);
+ if (ret < 0)
+ goto est_error;
+
stmmac_init_coalesce(priv);
phylink_start(priv->phylink);
stmmac_vlan_restore(priv);
+ /* Restore the installed schedule before starting DMA. */
+ stmmac_start_all_dma(priv);
+
ret = stmmac_request_irq(dev);
if (ret)
goto irq_error;
@@ -4224,6 +4233,7 @@ static int __stmmac_open(struct net_device *dev,
for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer);
+est_error:
stmmac_release_ptp(priv);
ptp_error:
stmmac_stop_all_dma(priv);
@@ -8420,6 +8430,10 @@ int stmmac_resume(struct device *dev)
}
init_coalesce:
+ ret = stmmac_setup_est(priv);
+ if (ret < 0)
+ goto error_stop_dma;
+
stmmac_init_coalesce(priv);
phylink_rx_clk_stop_block(priv->phylink);
stmmac_set_rx_mode(ndev);
@@ -8427,6 +8441,9 @@ int stmmac_resume(struct device *dev)
stmmac_vlan_restore(priv);
+ /* Restore the installed schedule before starting DMA. */
+ stmmac_start_all_dma(priv);
+
stmmac_enable_all_queues(priv);
stmmac_enable_all_dma_irq(priv);
--
2.53.0
More information about the linux-arm-kernel
mailing list