* [PATCH v2] net: macb: ensure the device is available before accessing GEMGXL control registers
@ 2021-05-22 9:16 Zong Li
2021-05-23 23:20 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Zong Li @ 2021-05-22 9:16 UTC (permalink / raw)
To: nicolas.ferre, claudiu.beznea, davem, kuba, f.fainelli, palmer,
paul.walmsley, schwab, sboyd, aou, mturquette, geert, yixun.lan,
netdev, linux-kernel, linux-riscv
Cc: Zong Li
If runtime power menagement is enabled, the gigabit ethernet PLL would
be disabled after macb_probe(). During this period of time, the system
would hang up if we try to access GEMGXL control registers.
We can't put runtime_pm_get/runtime_pm_put/ there due to the issue of
sleep inside atomic section (7fa2955ff70ce453 ("sh_eth: Fix sleeping
function called from invalid context"). Add netif_running checking to
ensure the device is available before accessing GEMGXL device.
Changed in v2:
- Use netif_running instead of its own flag
Signed-off-by: Zong Li <zong.li@sifive.com>
---
drivers/net/ethernet/cadence/macb_main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 6bc7d41d519b..a0c7b1167dbb 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -2867,6 +2867,9 @@ static struct net_device_stats *gem_get_stats(struct macb *bp)
struct gem_stats *hwstat = &bp->hw_stats.gem;
struct net_device_stats *nstat = &bp->dev->stats;
+ if (!netif_running(bp->dev))
+ return nstat;
+
gem_update_stats(bp);
nstat->rx_errors = (hwstat->rx_frame_check_sequence_errors +
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] net: macb: ensure the device is available before accessing GEMGXL control registers
2021-05-22 9:16 [PATCH v2] net: macb: ensure the device is available before accessing GEMGXL control registers Zong Li
@ 2021-05-23 23:20 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-05-23 23:20 UTC (permalink / raw)
To: Zong Li
Cc: nicolas.ferre, claudiu.beznea, davem, kuba, f.fainelli, palmer,
paul.walmsley, schwab, sboyd, aou, mturquette, geert, yixun.lan,
netdev, linux-kernel, linux-riscv
Hello:
This patch was applied to netdev/net.git (refs/heads/master):
On Sat, 22 May 2021 17:16:11 +0800 you wrote:
> If runtime power menagement is enabled, the gigabit ethernet PLL would
> be disabled after macb_probe(). During this period of time, the system
> would hang up if we try to access GEMGXL control registers.
>
> We can't put runtime_pm_get/runtime_pm_put/ there due to the issue of
> sleep inside atomic section (7fa2955ff70ce453 ("sh_eth: Fix sleeping
> function called from invalid context"). Add netif_running checking to
> ensure the device is available before accessing GEMGXL device.
>
> [...]
Here is the summary with links:
- [v2] net: macb: ensure the device is available before accessing GEMGXL control registers
https://git.kernel.org/netdev/net/c/5eff1461a6de
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] 2+ messages in thread
end of thread, other threads:[~2021-05-23 23:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-22 9:16 [PATCH v2] net: macb: ensure the device is available before accessing GEMGXL control registers Zong Li
2021-05-23 23:20 ` 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).