Re: [PATCH] net: stmmac: enable MAC rx/tx after DMA start

From: Abid Ali

Date: Mon Jul 27 2026 - 01:58:43 EST


On Sun, Jul 26, 2026 at 18:15:20 +0000, Andrew Lunn wrote:
> There should be a function which is the opposite of stmmac_hw_setup(),
> which tears it down. What order are things done there? tear down is
> generally done in the opposite order to setup, so does the "Disable
> the MAC Rx/Tx" also need to move?

I have not seen the FIFO stall in the teardown in my testing,
but the MAC Rx/Tx should be disabled before the DMA engine is stopped.
For the normal path (__stmmac_release), phylink_stop() is called first
which triggers stmmac_mac_link_down() -> stmmac_mac_set(false), so the
MAC is already disabled before stmmac_stop_all_dma(). The teardown
order is already correct there.

> Same comment for the opposite of stmmac_xdp_open().

Currently, stmmac_xdp_release() does:

stmmac_stop_all_dma(priv);
...
stmmac_mac_set(priv, priv->ioaddr, false);

The ordering is not followed here, I'll make it follow the similar
ordering to (__stmmac_release) in v2.

Thanks,
Abid