* [PATCH net-next v2] Revert "sh_eth: remove open coded netif_running()"
@ 2023-03-27 15:21 Wolfram Sang
2023-03-27 18:06 ` Sergey Shtylyov
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Wolfram Sang @ 2023-03-27 15:21 UTC (permalink / raw)
To: netdev
Cc: linux-renesas-soc, Wolfram Sang, Sergey Shtylyov,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
linux-kernel
This reverts commit ce1fdb065695f49ef6f126d35c1abbfe645d62d5. It turned
out this actually introduces a race condition. netif_running() is not a
suitable check for get_stats.
Reported-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
Change since v1:
* added 'net-next' to $subject
drivers/net/ethernet/renesas/sh_eth.c | 6 +++++-
drivers/net/ethernet/renesas/sh_eth.h | 1 +
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 2d9787231099..d8ec729825be 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -2441,6 +2441,8 @@ static int sh_eth_open(struct net_device *ndev)
netif_start_queue(ndev);
+ mdp->is_opened = 1;
+
return ret;
out_free_irq:
@@ -2563,7 +2565,7 @@ static struct net_device_stats *sh_eth_get_stats(struct net_device *ndev)
if (mdp->cd->no_tx_cntrs)
return &ndev->stats;
- if (!netif_running(ndev))
+ if (!mdp->is_opened)
return &ndev->stats;
sh_eth_update_stat(ndev, &ndev->stats.tx_dropped, TROCR);
@@ -2612,6 +2614,8 @@ static int sh_eth_close(struct net_device *ndev)
/* Free all the skbuffs in the Rx queue and the DMA buffer. */
sh_eth_ring_free(ndev);
+ mdp->is_opened = 0;
+
pm_runtime_put(&mdp->pdev->dev);
return 0;
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
index f56dbc8a064a..a5c07c6ff44a 100644
--- a/drivers/net/ethernet/renesas/sh_eth.h
+++ b/drivers/net/ethernet/renesas/sh_eth.h
@@ -560,6 +560,7 @@ struct sh_eth_private {
unsigned no_ether_link:1;
unsigned ether_link_active_low:1;
+ unsigned is_opened:1;
unsigned wol_enabled:1;
};
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v2] Revert "sh_eth: remove open coded netif_running()"
2023-03-27 15:21 [PATCH net-next v2] Revert "sh_eth: remove open coded netif_running()" Wolfram Sang
@ 2023-03-27 18:06 ` Sergey Shtylyov
2023-03-28 15:03 ` Simon Horman
2023-03-29 2:30 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Sergey Shtylyov @ 2023-03-27 18:06 UTC (permalink / raw)
To: Wolfram Sang, netdev
Cc: linux-renesas-soc, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, linux-kernel
On 3/27/23 6:21 PM, Wolfram Sang wrote:
> This reverts commit ce1fdb065695f49ef6f126d35c1abbfe645d62d5. It turned
> out this actually introduces a race condition. netif_running() is not a
> suitable check for get_stats.
>
> Reported-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
[...]
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
MBR, Sergey
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v2] Revert "sh_eth: remove open coded netif_running()"
2023-03-27 15:21 [PATCH net-next v2] Revert "sh_eth: remove open coded netif_running()" Wolfram Sang
2023-03-27 18:06 ` Sergey Shtylyov
@ 2023-03-28 15:03 ` Simon Horman
2023-03-29 2:30 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2023-03-28 15:03 UTC (permalink / raw)
To: Wolfram Sang
Cc: netdev, linux-renesas-soc, Sergey Shtylyov, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-kernel
On Mon, Mar 27, 2023 at 05:21:12PM +0200, Wolfram Sang wrote:
> This reverts commit ce1fdb065695f49ef6f126d35c1abbfe645d62d5. It turned
> out this actually introduces a race condition. netif_running() is not a
> suitable check for get_stats.
>
> Reported-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v2] Revert "sh_eth: remove open coded netif_running()"
2023-03-27 15:21 [PATCH net-next v2] Revert "sh_eth: remove open coded netif_running()" Wolfram Sang
2023-03-27 18:06 ` Sergey Shtylyov
2023-03-28 15:03 ` Simon Horman
@ 2023-03-29 2:30 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-03-29 2:30 UTC (permalink / raw)
To: Wolfram Sang
Cc: netdev, linux-renesas-soc, s.shtylyov, davem, edumazet, kuba,
pabeni, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 27 Mar 2023 17:21:12 +0200 you wrote:
> This reverts commit ce1fdb065695f49ef6f126d35c1abbfe645d62d5. It turned
> out this actually introduces a race condition. netif_running() is not a
> suitable check for get_stats.
>
> Reported-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
> [...]
Here is the summary with links:
- [net-next,v2] Revert "sh_eth: remove open coded netif_running()"
https://git.kernel.org/netdev/net-next/c/cdeccd13a03f
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] 4+ messages in thread
end of thread, other threads:[~2023-03-29 2:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-27 15:21 [PATCH net-next v2] Revert "sh_eth: remove open coded netif_running()" Wolfram Sang
2023-03-27 18:06 ` Sergey Shtylyov
2023-03-28 15:03 ` Simon Horman
2023-03-29 2:30 ` 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).