All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: nxp: lpc_eth.c: avoid hang when bringing interface down
@ 2021-10-24 17:50 ` Trevor Woerner
  0 siblings, 0 replies; 6+ messages in thread
From: Trevor Woerner @ 2021-10-24 17:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Vladimir Zapolskiy, David S. Miller, Jakub Kicinski,
	moderated list:ARM/LPC32XX SOC SUPPORT,
	open list:NETWORKING DRIVERS

A hard hang is observed whenever the ethernet interface is brought
down. If the PHY is stopped before the LPC core block is reset,
the SoC will hang. Comparing lpc_eth_close() and lpc_eth_open() I
re-arranged the ordering of the functions calls in lpc_eth_close() to
reset the hardware before stopping the PHY.

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
 drivers/net/ethernet/nxp/lpc_eth.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index d29fe562b3de..c910fa2f40a4 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1015,9 +1015,6 @@ static int lpc_eth_close(struct net_device *ndev)
 	napi_disable(&pldat->napi);
 	netif_stop_queue(ndev);
 
-	if (ndev->phydev)
-		phy_stop(ndev->phydev);
-
 	spin_lock_irqsave(&pldat->lock, flags);
 	__lpc_eth_reset(pldat);
 	netif_carrier_off(ndev);
@@ -1025,6 +1022,8 @@ static int lpc_eth_close(struct net_device *ndev)
 	writel(0, LPC_ENET_MAC2(pldat->net_base));
 	spin_unlock_irqrestore(&pldat->lock, flags);
 
+	if (ndev->phydev)
+		phy_stop(ndev->phydev);
 	clk_disable_unprepare(pldat->clk);
 
 	return 0;
-- 
2.30.0.rc0


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

* [PATCH] net: nxp: lpc_eth.c: avoid hang when bringing interface down
@ 2021-10-24 17:50 ` Trevor Woerner
  0 siblings, 0 replies; 6+ messages in thread
From: Trevor Woerner @ 2021-10-24 17:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Vladimir Zapolskiy, David S. Miller, Jakub Kicinski,
	moderated list:ARM/LPC32XX SOC SUPPORT,
	open list:NETWORKING DRIVERS

A hard hang is observed whenever the ethernet interface is brought
down. If the PHY is stopped before the LPC core block is reset,
the SoC will hang. Comparing lpc_eth_close() and lpc_eth_open() I
re-arranged the ordering of the functions calls in lpc_eth_close() to
reset the hardware before stopping the PHY.

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
 drivers/net/ethernet/nxp/lpc_eth.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index d29fe562b3de..c910fa2f40a4 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1015,9 +1015,6 @@ static int lpc_eth_close(struct net_device *ndev)
 	napi_disable(&pldat->napi);
 	netif_stop_queue(ndev);
 
-	if (ndev->phydev)
-		phy_stop(ndev->phydev);
-
 	spin_lock_irqsave(&pldat->lock, flags);
 	__lpc_eth_reset(pldat);
 	netif_carrier_off(ndev);
@@ -1025,6 +1022,8 @@ static int lpc_eth_close(struct net_device *ndev)
 	writel(0, LPC_ENET_MAC2(pldat->net_base));
 	spin_unlock_irqrestore(&pldat->lock, flags);
 
+	if (ndev->phydev)
+		phy_stop(ndev->phydev);
 	clk_disable_unprepare(pldat->clk);
 
 	return 0;
-- 
2.30.0.rc0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] net: nxp: lpc_eth.c: avoid hang when bringing interface down
  2021-10-24 17:50 ` Trevor Woerner
@ 2021-10-24 19:55   ` Vladimir Zapolskiy
  -1 siblings, 0 replies; 6+ messages in thread
From: Vladimir Zapolskiy @ 2021-10-24 19:55 UTC (permalink / raw)
  To: Trevor Woerner, linux-kernel
  Cc: David S. Miller, Jakub Kicinski,
	moderated list:ARM/LPC32XX SOC SUPPORT,
	open list:NETWORKING DRIVERS

Hi Trevor,

On 10/24/21 8:50 PM, Trevor Woerner wrote:
> A hard hang is observed whenever the ethernet interface is brought
> down. If the PHY is stopped before the LPC core block is reset,
> the SoC will hang. Comparing lpc_eth_close() and lpc_eth_open() I
> re-arranged the ordering of the functions calls in lpc_eth_close() to
> reset the hardware before stopping the PHY.
> 
> Signed-off-by: Trevor Woerner <twoerner@gmail.com>
> ---
>   drivers/net/ethernet/nxp/lpc_eth.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
> index d29fe562b3de..c910fa2f40a4 100644
> --- a/drivers/net/ethernet/nxp/lpc_eth.c
> +++ b/drivers/net/ethernet/nxp/lpc_eth.c
> @@ -1015,9 +1015,6 @@ static int lpc_eth_close(struct net_device *ndev)
>   	napi_disable(&pldat->napi);
>   	netif_stop_queue(ndev);
>   
> -	if (ndev->phydev)
> -		phy_stop(ndev->phydev);
> -
>   	spin_lock_irqsave(&pldat->lock, flags);
>   	__lpc_eth_reset(pldat);
>   	netif_carrier_off(ndev);
> @@ -1025,6 +1022,8 @@ static int lpc_eth_close(struct net_device *ndev)
>   	writel(0, LPC_ENET_MAC2(pldat->net_base));
>   	spin_unlock_irqrestore(&pldat->lock, flags);
>   
> +	if (ndev->phydev)
> +		phy_stop(ndev->phydev);
>   	clk_disable_unprepare(pldat->clk);
>   
>   	return 0;
> 

thank you for the fix!

Fixes: b7370112f519 ("lpc32xx: Added ethernet driver")
Acked-by: Vladimir Zapolskiy <vz@mleia.com>

--
Best wishes,
Vladimir

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] net: nxp: lpc_eth.c: avoid hang when bringing interface down
@ 2021-10-24 19:55   ` Vladimir Zapolskiy
  0 siblings, 0 replies; 6+ messages in thread
From: Vladimir Zapolskiy @ 2021-10-24 19:55 UTC (permalink / raw)
  To: Trevor Woerner, linux-kernel
  Cc: David S. Miller, Jakub Kicinski,
	moderated list:ARM/LPC32XX SOC SUPPORT,
	open list:NETWORKING DRIVERS

Hi Trevor,

On 10/24/21 8:50 PM, Trevor Woerner wrote:
> A hard hang is observed whenever the ethernet interface is brought
> down. If the PHY is stopped before the LPC core block is reset,
> the SoC will hang. Comparing lpc_eth_close() and lpc_eth_open() I
> re-arranged the ordering of the functions calls in lpc_eth_close() to
> reset the hardware before stopping the PHY.
> 
> Signed-off-by: Trevor Woerner <twoerner@gmail.com>
> ---
>   drivers/net/ethernet/nxp/lpc_eth.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
> index d29fe562b3de..c910fa2f40a4 100644
> --- a/drivers/net/ethernet/nxp/lpc_eth.c
> +++ b/drivers/net/ethernet/nxp/lpc_eth.c
> @@ -1015,9 +1015,6 @@ static int lpc_eth_close(struct net_device *ndev)
>   	napi_disable(&pldat->napi);
>   	netif_stop_queue(ndev);
>   
> -	if (ndev->phydev)
> -		phy_stop(ndev->phydev);
> -
>   	spin_lock_irqsave(&pldat->lock, flags);
>   	__lpc_eth_reset(pldat);
>   	netif_carrier_off(ndev);
> @@ -1025,6 +1022,8 @@ static int lpc_eth_close(struct net_device *ndev)
>   	writel(0, LPC_ENET_MAC2(pldat->net_base));
>   	spin_unlock_irqrestore(&pldat->lock, flags);
>   
> +	if (ndev->phydev)
> +		phy_stop(ndev->phydev);
>   	clk_disable_unprepare(pldat->clk);
>   
>   	return 0;
> 

thank you for the fix!

Fixes: b7370112f519 ("lpc32xx: Added ethernet driver")
Acked-by: Vladimir Zapolskiy <vz@mleia.com>

--
Best wishes,
Vladimir

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

* Re: [PATCH] net: nxp: lpc_eth.c: avoid hang when bringing interface down
  2021-10-24 17:50 ` Trevor Woerner
@ 2021-10-25 14:50   ` patchwork-bot+netdevbpf
  -1 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-10-25 14:50 UTC (permalink / raw)
  To: Trevor Woerner; +Cc: linux-kernel, vz, davem, kuba, linux-arm-kernel, netdev

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Sun, 24 Oct 2021 13:50:02 -0400 you wrote:
> A hard hang is observed whenever the ethernet interface is brought
> down. If the PHY is stopped before the LPC core block is reset,
> the SoC will hang. Comparing lpc_eth_close() and lpc_eth_open() I
> re-arranged the ordering of the functions calls in lpc_eth_close() to
> reset the hardware before stopping the PHY.
> 
> Signed-off-by: Trevor Woerner <twoerner@gmail.com>
> 
> [...]

Here is the summary with links:
  - net: nxp: lpc_eth.c: avoid hang when bringing interface down
    https://git.kernel.org/netdev/net/c/ace19b992436

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

* Re: [PATCH] net: nxp: lpc_eth.c: avoid hang when bringing interface down
@ 2021-10-25 14:50   ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-10-25 14:50 UTC (permalink / raw)
  To: Trevor Woerner; +Cc: linux-kernel, vz, davem, kuba, linux-arm-kernel, netdev

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Sun, 24 Oct 2021 13:50:02 -0400 you wrote:
> A hard hang is observed whenever the ethernet interface is brought
> down. If the PHY is stopped before the LPC core block is reset,
> the SoC will hang. Comparing lpc_eth_close() and lpc_eth_open() I
> re-arranged the ordering of the functions calls in lpc_eth_close() to
> reset the hardware before stopping the PHY.
> 
> Signed-off-by: Trevor Woerner <twoerner@gmail.com>
> 
> [...]

Here is the summary with links:
  - net: nxp: lpc_eth.c: avoid hang when bringing interface down
    https://git.kernel.org/netdev/net/c/ace19b992436

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



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-10-25 14:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-24 17:50 [PATCH] net: nxp: lpc_eth.c: avoid hang when bringing interface down Trevor Woerner
2021-10-24 17:50 ` Trevor Woerner
2021-10-24 19:55 ` Vladimir Zapolskiy
2021-10-24 19:55   ` Vladimir Zapolskiy
2021-10-25 14:50 ` patchwork-bot+netdevbpf
2021-10-25 14:50   ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.