diff mbox series

[net-next,15/15] net: mvpp2: set the GMAC, XLG MAC, XPCS and MPCS in reset when a port is down

Message ID 20190228132128.30154-16-antoine.tenart@bootlin.com
State Changes Requested
Delegated to: David Miller
Headers show
Series net: mvpp2: fixes and improvements | expand

Commit Message

Antoine Tenart Feb. 28, 2019, 1:21 p.m. UTC
This patch adds calls in the stop() helper to ensure both MACs and
both PCS blocks are set in reset when the user manually sets a port
down. This is done so that we have the exact same block reset states at
boot time and when a port is set down.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Yan Markman Feb. 28, 2019, 3 p.m. UTC | #1
Hi

The eth-down/stop may concurrent with pre-scheduled stats_work.
So it seems better to cancel stats_work first and then make resetS.

Yan Markman

-----Original Message-----
From: Antoine Tenart <antoine.tenart@bootlin.com> 
Sent: Thursday, February 28, 2019 3:21 PM
To: davem@davemloft.net; linux@armlinux.org.uk
Cc: Antoine Tenart <antoine.tenart@bootlin.com>; netdev@vger.kernel.org; linux-kernel@vger.kernel.org; thomas.petazzoni@bootlin.com; maxime.chevallier@bootlin.com; gregory.clement@bootlin.com; miquel.raynal@bootlin.com; Nadav Haklai <nadavh@marvell.com>; Stefan Chulski <stefanc@marvell.com>; Yan Markman <ymarkman@marvell.com>; mw@semihalf.com
Subject: [EXT] [PATCH net-next 15/15] net: mvpp2: set the GMAC, XLG MAC, XPCS and MPCS in reset when a port is down

External Email

----------------------------------------------------------------------
This patch adds calls in the stop() helper to ensure both MACs and
both PCS blocks are set in reset when the user manually sets a port
down. This is done so that we have the exact same block reset states at
boot time and when a port is set down.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 29d32cb3d52b..c10fd894c86f 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -3257,6 +3257,7 @@ static void mvpp2_stop_dev(struct mvpp2_port *port)
 
 	if (port->phylink)
 		phylink_stop(port->phylink);
+
 	phy_power_off(port->comphy);
 }
 
@@ -3520,6 +3521,9 @@ static int mvpp2_stop(struct net_device *dev)
 	mvpp2_cleanup_rxqs(port);
 	mvpp2_cleanup_txqs(port);
 
+	mvpp2_mac_reset(port);
+	mvpp22_pcs_reset(port);
+
 	cancel_delayed_work_sync(&port->stats_work);
 
 	return 0;
Antoine Tenart Feb. 28, 2019, 3:06 p.m. UTC | #2
Hi Yan,

On Thu, Feb 28, 2019 at 03:00:34PM +0000, Yan Markman wrote:
> 
> The eth-down/stop may concurrent with pre-scheduled stats_work.
> So it seems better to cancel stats_work first and then make resetS.

I'm not sure this would actually result in an issue, but to keep it
logical I'll change that.

Thanks,
Antoine

> diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> index 29d32cb3d52b..c10fd894c86f 100644
> --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> @@ -3257,6 +3257,7 @@ static void mvpp2_stop_dev(struct mvpp2_port *port)
>  
>  	if (port->phylink)
>  		phylink_stop(port->phylink);
> +
>  	phy_power_off(port->comphy);
>  }
>  
> @@ -3520,6 +3521,9 @@ static int mvpp2_stop(struct net_device *dev)
>  	mvpp2_cleanup_rxqs(port);
>  	mvpp2_cleanup_txqs(port);
>  
> +	mvpp2_mac_reset(port);
> +	mvpp22_pcs_reset(port);
> +
>  	cancel_delayed_work_sync(&port->stats_work);
>  
>  	return 0;
diff mbox series

Patch

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 29d32cb3d52b..c10fd894c86f 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -3257,6 +3257,7 @@  static void mvpp2_stop_dev(struct mvpp2_port *port)
 
 	if (port->phylink)
 		phylink_stop(port->phylink);
+
 	phy_power_off(port->comphy);
 }
 
@@ -3520,6 +3521,9 @@  static int mvpp2_stop(struct net_device *dev)
 	mvpp2_cleanup_rxqs(port);
 	mvpp2_cleanup_txqs(port);
 
+	mvpp2_mac_reset(port);
+	mvpp22_pcs_reset(port);
+
 	cancel_delayed_work_sync(&port->stats_work);
 
 	return 0;