linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 1/2] net: stmmac: remove redundant racy tear-down in stmmac_dvr_remove()
  2025-03-10 12:31 [PATCH net-next 0/2] net: stmmac: avoid unnecessary work in stmmac_release()/stmmac_dvr_remove() Russell King (Oracle)
@ 2025-03-10 12:31 ` Russell King (Oracle)
  2025-03-10 12:31 ` [PATCH net-next 2/2] net: stmmac: remove unnecessary stmmac_mac_set() in stmmac_release() Russell King (Oracle)
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Russell King (Oracle) @ 2025-03-10 12:31 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, linux-arm-kernel, linux-stm32, Maxime Coquelin,
	netdev, Paolo Abeni

While the network device is registered, it is published to userspace,
and thus userspace can change its state. This means calling
functions such as stmmac_stop_all_dma() and stmmac_mac_set() are
racy.

Moreover, unregister_netdev() will unpublish the network device, and
then if appropriate call the .ndo_stop() method, which is
stmmac_release(). This will first call phylink_stop() which will
synchronously take the link down, resulting in stmmac_mac_link_down()
and stmmac_mac_set(, false) being called.

stmmac_release() will also call stmmac_stop_all_dma().

Consequently, neither of these two functions need to called prior
to unregister_netdev() as that will safely call paths that will
result in this work being done if necessary.

Remove these redundant racy calls.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Furong Xu <0x1207@gmail.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index fa1d7d3a2f43..c2ee6c0af3fd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7768,8 +7768,6 @@ void stmmac_dvr_remove(struct device *dev)
 
 	pm_runtime_get_sync(dev);
 
-	stmmac_stop_all_dma(priv);
-	stmmac_mac_set(priv, priv->ioaddr, false);
 	unregister_netdev(ndev);
 
 #ifdef CONFIG_DEBUG_FS
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next 2/2] net: stmmac: remove unnecessary stmmac_mac_set() in stmmac_release()
  2025-03-10 12:31 [PATCH net-next 0/2] net: stmmac: avoid unnecessary work in stmmac_release()/stmmac_dvr_remove() Russell King (Oracle)
  2025-03-10 12:31 ` [PATCH net-next 1/2] net: stmmac: remove redundant racy tear-down in stmmac_dvr_remove() Russell King (Oracle)
@ 2025-03-10 12:31 ` Russell King (Oracle)
  2025-03-13  8:12 ` [PATCH net-next 0/2] net: stmmac: avoid unnecessary work in stmmac_release()/stmmac_dvr_remove() Russell King (Oracle)
  2025-03-17 20:50 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 6+ messages in thread
From: Russell King (Oracle) @ 2025-03-10 12:31 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, linux-arm-kernel, linux-stm32, Maxime Coquelin,
	netdev, Paolo Abeni

stmmac_release() calls phylink_stop() and then goes on to call
stmmac_mac_set(, false). However, phylink_stop() will call
stmmac_mac_link_down() before returning, which will do this work.
Remove this unnecessary call.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Furong Xu <0x1207@gmail.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index c2ee6c0af3fd..839ecebf5f5f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4129,9 +4129,6 @@ static int stmmac_release(struct net_device *dev)
 	/* Release and free the Rx/Tx resources */
 	free_dma_desc_resources(priv, &priv->dma_conf);
 
-	/* Disable the MAC Rx/Tx */
-	stmmac_mac_set(priv, priv->ioaddr, false);
-
 	/* Powerdown Serdes if there is */
 	if (priv->plat->serdes_powerdown)
 		priv->plat->serdes_powerdown(dev, priv->plat->bsp_priv);
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next 0/2] net: stmmac: avoid unnecessary work in stmmac_release()/stmmac_dvr_remove()
@ 2025-03-10 12:31 Russell King (Oracle)
  2025-03-10 12:31 ` [PATCH net-next 1/2] net: stmmac: remove redundant racy tear-down in stmmac_dvr_remove() Russell King (Oracle)
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Russell King (Oracle) @ 2025-03-10 12:31 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, linux-arm-kernel, linux-stm32, Maxime Coquelin,
	netdev, Paolo Abeni

Hi,

This small series is a subset of a RFC I sent earlier. These two
patches remove code that is unnecessary and/or wrong in these paths.
Details in each commit.

 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 -----
 1 file changed, 5 deletions(-)

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 0/2] net: stmmac: avoid unnecessary work in stmmac_release()/stmmac_dvr_remove()
  2025-03-10 12:31 [PATCH net-next 0/2] net: stmmac: avoid unnecessary work in stmmac_release()/stmmac_dvr_remove() Russell King (Oracle)
  2025-03-10 12:31 ` [PATCH net-next 1/2] net: stmmac: remove redundant racy tear-down in stmmac_dvr_remove() Russell King (Oracle)
  2025-03-10 12:31 ` [PATCH net-next 2/2] net: stmmac: remove unnecessary stmmac_mac_set() in stmmac_release() Russell King (Oracle)
@ 2025-03-13  8:12 ` Russell King (Oracle)
  2025-03-17 20:34   ` Paolo Abeni
  2025-03-17 20:50 ` patchwork-bot+netdevbpf
  3 siblings, 1 reply; 6+ messages in thread
From: Russell King (Oracle) @ 2025-03-13  8:12 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Andrew Lunn, Heiner Kallweit, Alexandre Torgue, Andrew Lunn,
	David S. Miller, Eric Dumazet, linux-arm-kernel, linux-stm32,
	Maxime Coquelin, netdev, Paolo Abeni

On Mon, Mar 10, 2025 at 12:31:32PM +0000, Russell King (Oracle) wrote:
> Hi,
> 
> This small series is a subset of a RFC I sent earlier. These two
> patches remove code that is unnecessary and/or wrong in these paths.
> Details in each commit.
> 
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 -----
>  1 file changed, 5 deletions(-)

Hi Jakub,

Why is this series showing in patchwork, but not being subjected to
any nipabot tests?

There's also "net: phylink: expand on .pcs_config() method
documentation" which isn't being subjected to nipabot tests.

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 0/2] net: stmmac: avoid unnecessary work in stmmac_release()/stmmac_dvr_remove()
  2025-03-13  8:12 ` [PATCH net-next 0/2] net: stmmac: avoid unnecessary work in stmmac_release()/stmmac_dvr_remove() Russell King (Oracle)
@ 2025-03-17 20:34   ` Paolo Abeni
  0 siblings, 0 replies; 6+ messages in thread
From: Paolo Abeni @ 2025-03-17 20:34 UTC (permalink / raw)
  To: Russell King (Oracle), Jakub Kicinski
  Cc: Andrew Lunn, Heiner Kallweit, Alexandre Torgue, Andrew Lunn,
	David S. Miller, Eric Dumazet, linux-arm-kernel, linux-stm32,
	Maxime Coquelin, netdev

On 3/13/25 9:12 AM, Russell King (Oracle) wrote:
> On Mon, Mar 10, 2025 at 12:31:32PM +0000, Russell King (Oracle) wrote:
>> Hi,
>>
>> This small series is a subset of a RFC I sent earlier. These two
>> patches remove code that is unnecessary and/or wrong in these paths.
>> Details in each commit.
>>
>>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 -----
>>  1 file changed, 5 deletions(-)
> 
> Hi Jakub,
> 
> Why is this series showing in patchwork, but not being subjected to
> any nipabot tests?
> 
> There's also "net: phylink: expand on .pcs_config() method
> documentation" which isn't being subjected to nipabot tests.

We had an outage in the nipa infra that caused no test running for a
while. At least it entered later CI runs.

Cheers,

Paolo



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 0/2] net: stmmac: avoid unnecessary work in stmmac_release()/stmmac_dvr_remove()
  2025-03-10 12:31 [PATCH net-next 0/2] net: stmmac: avoid unnecessary work in stmmac_release()/stmmac_dvr_remove() Russell King (Oracle)
                   ` (2 preceding siblings ...)
  2025-03-13  8:12 ` [PATCH net-next 0/2] net: stmmac: avoid unnecessary work in stmmac_release()/stmmac_dvr_remove() Russell King (Oracle)
@ 2025-03-17 20:50 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-03-17 20:50 UTC (permalink / raw)
  To: Russell King
  Cc: andrew, hkallweit1, alexandre.torgue, andrew+netdev, davem,
	edumazet, kuba, linux-arm-kernel, linux-stm32, mcoquelin.stm32,
	netdev, pabeni

Hello:

This series was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Mon, 10 Mar 2025 12:31:32 +0000 you wrote:
> Hi,
> 
> This small series is a subset of a RFC I sent earlier. These two
> patches remove code that is unnecessary and/or wrong in these paths.
> Details in each commit.
> 
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 -----
>  1 file changed, 5 deletions(-)

Here is the summary with links:
  - [net-next,1/2] net: stmmac: remove redundant racy tear-down in stmmac_dvr_remove()
    https://git.kernel.org/netdev/net-next/c/180fa8d0a2cb
  - [net-next,2/2] net: stmmac: remove unnecessary stmmac_mac_set() in stmmac_release()
    https://git.kernel.org/netdev/net-next/c/39b0a10d80d6

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-03-17 20:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-10 12:31 [PATCH net-next 0/2] net: stmmac: avoid unnecessary work in stmmac_release()/stmmac_dvr_remove() Russell King (Oracle)
2025-03-10 12:31 ` [PATCH net-next 1/2] net: stmmac: remove redundant racy tear-down in stmmac_dvr_remove() Russell King (Oracle)
2025-03-10 12:31 ` [PATCH net-next 2/2] net: stmmac: remove unnecessary stmmac_mac_set() in stmmac_release() Russell King (Oracle)
2025-03-13  8:12 ` [PATCH net-next 0/2] net: stmmac: avoid unnecessary work in stmmac_release()/stmmac_dvr_remove() Russell King (Oracle)
2025-03-17 20:34   ` Paolo Abeni
2025-03-17 20:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).