netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: bcmgenet: Restore phy_stop() depending upon suspend/close
@ 2023-05-09 22:59 Florian Fainelli
  2023-05-10 14:17 ` Florian Fainelli
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Fainelli @ 2023-05-09 22:59 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, Doug Berger,
	Broadcom internal kernel review list, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, open list

Removing the phy_stop() from bcmgenet_netif_stop() ended up causing
warnings from the PHY library that phy_start() is called from the
RUNNING state since we are no longer stopping the PHY state machine.

Restore the call to phy_stop() but make it conditional on being called
fro the close or suspend path.

Fixes: 93e0401e0fc0 ("net: bcmgenet: Remove phy_stop() from bcmgenet_netif_stop()")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index bbd9d4b73402..a6fb913fa32e 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -3462,7 +3462,7 @@ static int bcmgenet_open(struct net_device *dev)
 	return ret;
 }
 
-static void bcmgenet_netif_stop(struct net_device *dev)
+static void bcmgenet_netif_stop(struct net_device *dev, bool stop_phy)
 {
 	struct bcmgenet_priv *priv = netdev_priv(dev);
 
@@ -3477,6 +3477,8 @@ static void bcmgenet_netif_stop(struct net_device *dev)
 	/* Disable MAC transmit. TX DMA disabled must be done before this */
 	umac_enable_set(priv, CMD_TX_EN, false);
 
+	if (stop_phy)
+		phy_stop(dev->phydev);
 	bcmgenet_disable_rx_napi(priv);
 	bcmgenet_intr_disable(priv);
 
@@ -3497,7 +3499,7 @@ static int bcmgenet_close(struct net_device *dev)
 
 	netif_dbg(priv, ifdown, dev, "bcmgenet_close\n");
 
-	bcmgenet_netif_stop(dev);
+	bcmgenet_netif_stop(dev, false);
 
 	/* Really kill the PHY state machine and disconnect from it */
 	phy_disconnect(dev->phydev);
@@ -4315,7 +4317,7 @@ static int bcmgenet_suspend(struct device *d)
 
 	netif_device_detach(dev);
 
-	bcmgenet_netif_stop(dev);
+	bcmgenet_netif_stop(dev, true);
 
 	if (!device_may_wakeup(d))
 		phy_suspend(dev->phydev);
-- 
2.34.1


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

* Re: [PATCH net] net: bcmgenet: Restore phy_stop() depending upon suspend/close
  2023-05-09 22:59 [PATCH net] net: bcmgenet: Restore phy_stop() depending upon suspend/close Florian Fainelli
@ 2023-05-10 14:17 ` Florian Fainelli
  0 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2023-05-10 14:17 UTC (permalink / raw)
  To: netdev
  Cc: Doug Berger, Broadcom internal kernel review list,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	open list



On 5/9/2023 3:59 PM, Florian Fainelli wrote:
> Removing the phy_stop() from bcmgenet_netif_stop() ended up causing
> warnings from the PHY library that phy_start() is called from the
> RUNNING state since we are no longer stopping the PHY state machine.
> 
> Restore the call to phy_stop() but make it conditional on being called
> fro the close or suspend path.
> 
> Fixes: 93e0401e0fc0 ("net: bcmgenet: Remove phy_stop() from bcmgenet_netif_stop()")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Please do not apply this just yet, I need to run some additional tests, 
thanks!
-- 
Florian

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

* [PATCH net] net: bcmgenet: Restore phy_stop() depending upon suspend/close
@ 2023-05-15  2:56 Florian Fainelli
  2023-05-15  4:15 ` Pavan Chebbi
  2023-05-16  7:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: Florian Fainelli @ 2023-05-15  2:56 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, Doug Berger,
	Broadcom internal kernel review list, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, open list

Removing the phy_stop() from bcmgenet_netif_stop() ended up causing
warnings from the PHY library that phy_start() is called from the
RUNNING state since we are no longer stopping the PHY state machine
during bcmgenet_suspend().

Restore the call to phy_stop() but make it conditional on being called
from the close or suspend path.

Fixes: c96e731c93ff ("net: bcmgenet: connect and disconnect from the PHY state machine")
Fixes: 93e0401e0fc0 ("net: bcmgenet: Remove phy_stop() from bcmgenet_netif_stop()")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index f28ffc31df22..eca0c92c0c84 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -3450,7 +3450,7 @@ static int bcmgenet_open(struct net_device *dev)
 	return ret;
 }
 
-static void bcmgenet_netif_stop(struct net_device *dev)
+static void bcmgenet_netif_stop(struct net_device *dev, bool stop_phy)
 {
 	struct bcmgenet_priv *priv = netdev_priv(dev);
 
@@ -3465,6 +3465,8 @@ static void bcmgenet_netif_stop(struct net_device *dev)
 	/* Disable MAC transmit. TX DMA disabled must be done before this */
 	umac_enable_set(priv, CMD_TX_EN, false);
 
+	if (stop_phy)
+		phy_stop(dev->phydev);
 	bcmgenet_disable_rx_napi(priv);
 	bcmgenet_intr_disable(priv);
 
@@ -3485,7 +3487,7 @@ static int bcmgenet_close(struct net_device *dev)
 
 	netif_dbg(priv, ifdown, dev, "bcmgenet_close\n");
 
-	bcmgenet_netif_stop(dev);
+	bcmgenet_netif_stop(dev, false);
 
 	/* Really kill the PHY state machine and disconnect from it */
 	phy_disconnect(dev->phydev);
@@ -4303,7 +4305,7 @@ static int bcmgenet_suspend(struct device *d)
 
 	netif_device_detach(dev);
 
-	bcmgenet_netif_stop(dev);
+	bcmgenet_netif_stop(dev, true);
 
 	if (!device_may_wakeup(d))
 		phy_suspend(dev->phydev);
-- 
2.34.1


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

* Re: [PATCH net] net: bcmgenet: Restore phy_stop() depending upon suspend/close
  2023-05-15  2:56 Florian Fainelli
@ 2023-05-15  4:15 ` Pavan Chebbi
  2023-05-16  7:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: Pavan Chebbi @ 2023-05-15  4:15 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, Doug Berger, Broadcom internal kernel review list,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	open list

[-- Attachment #1: Type: text/plain, Size: 2564 bytes --]

On Mon, May 15, 2023 at 8:26 AM Florian Fainelli <f.fainelli@gmail.com> wrote:
>
> Removing the phy_stop() from bcmgenet_netif_stop() ended up causing
> warnings from the PHY library that phy_start() is called from the
> RUNNING state since we are no longer stopping the PHY state machine
> during bcmgenet_suspend().
>
> Restore the call to phy_stop() but make it conditional on being called
> from the close or suspend path.
>
> Fixes: c96e731c93ff ("net: bcmgenet: connect and disconnect from the PHY state machine")
> Fixes: 93e0401e0fc0 ("net: bcmgenet: Remove phy_stop() from bcmgenet_netif_stop()")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---

Looks good to me.
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>

PS: I was only curious as to why is it not a v2 (I see only another
Fixes got added though)

>  drivers/net/ethernet/broadcom/genet/bcmgenet.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> index f28ffc31df22..eca0c92c0c84 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> @@ -3450,7 +3450,7 @@ static int bcmgenet_open(struct net_device *dev)
>         return ret;
>  }
>
> -static void bcmgenet_netif_stop(struct net_device *dev)
> +static void bcmgenet_netif_stop(struct net_device *dev, bool stop_phy)
>  {
>         struct bcmgenet_priv *priv = netdev_priv(dev);
>
> @@ -3465,6 +3465,8 @@ static void bcmgenet_netif_stop(struct net_device *dev)
>         /* Disable MAC transmit. TX DMA disabled must be done before this */
>         umac_enable_set(priv, CMD_TX_EN, false);
>
> +       if (stop_phy)
> +               phy_stop(dev->phydev);
>         bcmgenet_disable_rx_napi(priv);
>         bcmgenet_intr_disable(priv);
>
> @@ -3485,7 +3487,7 @@ static int bcmgenet_close(struct net_device *dev)
>
>         netif_dbg(priv, ifdown, dev, "bcmgenet_close\n");
>
> -       bcmgenet_netif_stop(dev);
> +       bcmgenet_netif_stop(dev, false);
>
>         /* Really kill the PHY state machine and disconnect from it */
>         phy_disconnect(dev->phydev);
> @@ -4303,7 +4305,7 @@ static int bcmgenet_suspend(struct device *d)
>
>         netif_device_detach(dev);
>
> -       bcmgenet_netif_stop(dev);
> +       bcmgenet_netif_stop(dev, true);
>
>         if (!device_may_wakeup(d))
>                 phy_suspend(dev->phydev);
> --
> 2.34.1
>
>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]

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

* Re: [PATCH net] net: bcmgenet: Restore phy_stop() depending upon suspend/close
  2023-05-15  2:56 Florian Fainelli
  2023-05-15  4:15 ` Pavan Chebbi
@ 2023-05-16  7:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-05-16  7:50 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, opendmb, bcm-kernel-feedback-list, davem, edumazet, kuba,
	pabeni, linux-kernel

Hello:

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

On Sun, 14 May 2023 19:56:07 -0700 you wrote:
> Removing the phy_stop() from bcmgenet_netif_stop() ended up causing
> warnings from the PHY library that phy_start() is called from the
> RUNNING state since we are no longer stopping the PHY state machine
> during bcmgenet_suspend().
> 
> Restore the call to phy_stop() but make it conditional on being called
> from the close or suspend path.
> 
> [...]

Here is the summary with links:
  - [net] net: bcmgenet: Restore phy_stop() depending upon suspend/close
    https://git.kernel.org/netdev/net/c/225c657945c4

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] 5+ messages in thread

end of thread, other threads:[~2023-05-16  7:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-09 22:59 [PATCH net] net: bcmgenet: Restore phy_stop() depending upon suspend/close Florian Fainelli
2023-05-10 14:17 ` Florian Fainelli
  -- strict thread matches above, loose matches on Subject: below --
2023-05-15  2:56 Florian Fainelli
2023-05-15  4:15 ` Pavan Chebbi
2023-05-16  7: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).