netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] net: phy: phylink: ensure the carrier is off when starting phylink
@ 2018-09-19  9:39 Antoine Tenart
  2018-09-19  9:39 ` [PATCH net-next 1/3] " Antoine Tenart
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Antoine Tenart @ 2018-09-19  9:39 UTC (permalink / raw)
  To: davem, linux, andrew, f.fainelli
  Cc: Antoine Tenart, netdev, linux-kernel, thomas.petazzoni,
	maxime.chevallier, gregory.clement, miquel.raynal, nadavh,
	stefanc, ymarkman, mw

Hi Russell,

Following the discussion we had regarding the phylink issue related to
the carrier link state not being off when starting phylink, I sent a fix
patch a few days ago for the PPv2 driver:
https://lkml.org/lkml/2018/9/14/633

The idea was to send a patch which could go to the stable branches, but
a better solution would be to directly call netif_carrier_off() from
within phylink_start(). This is the aim of this series.

Thanks!
Antoine

Antoine Tenart (3):
  net: phy: phylink: ensure the carrier is off when starting phylink
  net: mvpp2: do not explicitly set the carrier state in open
  net: mvneta: do not explicitly set the carrier state in open

 drivers/net/ethernet/marvell/mvneta.c           | 3 ---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 1 -
 drivers/net/phy/phylink.c                       | 3 +++
 3 files changed, 3 insertions(+), 4 deletions(-)

-- 
2.17.1

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

* [PATCH net-next 1/3] net: phy: phylink: ensure the carrier is off when starting phylink
  2018-09-19  9:39 [PATCH net-next 0/3] net: phy: phylink: ensure the carrier is off when starting phylink Antoine Tenart
@ 2018-09-19  9:39 ` Antoine Tenart
  2018-09-19 10:07   ` Russell King - ARM Linux
  2018-09-19  9:39 ` [PATCH net-next 2/3] net: mvpp2: do not explicitly set the carrier state in open Antoine Tenart
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Antoine Tenart @ 2018-09-19  9:39 UTC (permalink / raw)
  To: davem, linux, andrew, f.fainelli
  Cc: Antoine Tenart, netdev, linux-kernel, thomas.petazzoni,
	maxime.chevallier, gregory.clement, miquel.raynal, nadavh,
	stefanc, ymarkman, mw

Phylink made an assumption about the carrier state being down when
calling phylink_start(). If this assumption isn't satisfied, the
internal phylink state could misbehave and a net device could end up not
being functional.

This patch fixes this by explicitly calling netif_carrier_off() in
phylink_start().

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
---
 drivers/net/phy/phylink.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 3ba5cf2a8a5f..1d01e0c625a5 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -901,6 +901,9 @@ void phylink_start(struct phylink *pl)
 		    phylink_an_mode_str(pl->link_an_mode),
 		    phy_modes(pl->link_config.interface));
 
+	/* Always set the carrier off */
+	netif_carrier_off(pl->netdev);
+
 	/* Apply the link configuration to the MAC when starting. This allows
 	 * a fixed-link to start with the correct parameters, and also
 	 * ensures that we set the appropriate advertisement for Serdes links.
-- 
2.17.1

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

* [PATCH net-next 2/3] net: mvpp2: do not explicitly set the carrier state in open
  2018-09-19  9:39 [PATCH net-next 0/3] net: phy: phylink: ensure the carrier is off when starting phylink Antoine Tenart
  2018-09-19  9:39 ` [PATCH net-next 1/3] " Antoine Tenart
@ 2018-09-19  9:39 ` Antoine Tenart
  2018-09-19  9:39 ` [PATCH net-next 3/3] net: mvneta: " Antoine Tenart
  2018-09-20  4:15 ` [PATCH net-next 0/3] net: phy: phylink: ensure the carrier is off when starting phylink David Miller
  3 siblings, 0 replies; 6+ messages in thread
From: Antoine Tenart @ 2018-09-19  9:39 UTC (permalink / raw)
  To: davem, linux, andrew, f.fainelli
  Cc: Antoine Tenart, netdev, linux-kernel, thomas.petazzoni,
	maxime.chevallier, gregory.clement, miquel.raynal, nadavh,
	stefanc, ymarkman, mw

This patch removes the explicit call to netif_carrier_off() in PPv2's
open() path, as this is now handled in phylink_start().

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

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index af6e62c6579b..21da835b1c52 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -3196,7 +3196,6 @@ static void mvpp2_start_dev(struct mvpp2_port *port)
 		mvpp22_mode_reconfigure(port);
 
 	if (port->phylink) {
-		netif_carrier_off(port->dev);
 		phylink_start(port->phylink);
 	} else {
 		/* Phylink isn't used as of now for ACPI, so the MAC has to be
-- 
2.17.1

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

* [PATCH net-next 3/3] net: mvneta: do not explicitly set the carrier state in open
  2018-09-19  9:39 [PATCH net-next 0/3] net: phy: phylink: ensure the carrier is off when starting phylink Antoine Tenart
  2018-09-19  9:39 ` [PATCH net-next 1/3] " Antoine Tenart
  2018-09-19  9:39 ` [PATCH net-next 2/3] net: mvpp2: do not explicitly set the carrier state in open Antoine Tenart
@ 2018-09-19  9:39 ` Antoine Tenart
  2018-09-20  4:15 ` [PATCH net-next 0/3] net: phy: phylink: ensure the carrier is off when starting phylink David Miller
  3 siblings, 0 replies; 6+ messages in thread
From: Antoine Tenart @ 2018-09-19  9:39 UTC (permalink / raw)
  To: davem, linux, andrew, f.fainelli
  Cc: Antoine Tenart, netdev, linux-kernel, thomas.petazzoni,
	maxime.chevallier, gregory.clement, miquel.raynal, nadavh,
	stefanc, ymarkman, mw

This patch removes the explicit call to netif_carrier_off() in
mvneta_open() as this is already handled in phylink_start().

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
---
 drivers/net/ethernet/marvell/mvneta.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index fe3edb3c2bf4..89ed1df7b3e7 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -3791,9 +3791,6 @@ static int mvneta_open(struct net_device *dev)
 			goto err_free_online_hp;
 	}
 
-	/* In default link is down */
-	netif_carrier_off(pp->dev);
-
 	ret = mvneta_mdio_probe(pp);
 	if (ret < 0) {
 		netdev_err(dev, "cannot probe MDIO bus\n");
-- 
2.17.1

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

* Re: [PATCH net-next 1/3] net: phy: phylink: ensure the carrier is off when starting phylink
  2018-09-19  9:39 ` [PATCH net-next 1/3] " Antoine Tenart
@ 2018-09-19 10:07   ` Russell King - ARM Linux
  0 siblings, 0 replies; 6+ messages in thread
From: Russell King - ARM Linux @ 2018-09-19 10:07 UTC (permalink / raw)
  To: Antoine Tenart
  Cc: davem, andrew, f.fainelli, netdev, linux-kernel, thomas.petazzoni,
	maxime.chevallier, gregory.clement, miquel.raynal, nadavh,
	stefanc, ymarkman, mw

On Wed, Sep 19, 2018 at 11:39:31AM +0200, Antoine Tenart wrote:
> Phylink made an assumption about the carrier state being down when
> calling phylink_start(). If this assumption isn't satisfied, the
> internal phylink state could misbehave and a net device could end up not
> being functional.
> 
> This patch fixes this by explicitly calling netif_carrier_off() in
> phylink_start().
> 
> Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>

Acked-by: Russell King <rmk+kernel@armlinux.org.uk>

Thanks.

> ---
>  drivers/net/phy/phylink.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index 3ba5cf2a8a5f..1d01e0c625a5 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -901,6 +901,9 @@ void phylink_start(struct phylink *pl)
>  		    phylink_an_mode_str(pl->link_an_mode),
>  		    phy_modes(pl->link_config.interface));
>  
> +	/* Always set the carrier off */
> +	netif_carrier_off(pl->netdev);
> +
>  	/* Apply the link configuration to the MAC when starting. This allows
>  	 * a fixed-link to start with the correct parameters, and also
>  	 * ensures that we set the appropriate advertisement for Serdes links.
> -- 
> 2.17.1
> 

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 13.8Mbps down 630kbps up
According to speedtest.net: 13Mbps down 490kbps up

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

* Re: [PATCH net-next 0/3] net: phy: phylink: ensure the carrier is off when starting phylink
  2018-09-19  9:39 [PATCH net-next 0/3] net: phy: phylink: ensure the carrier is off when starting phylink Antoine Tenart
                   ` (2 preceding siblings ...)
  2018-09-19  9:39 ` [PATCH net-next 3/3] net: mvneta: " Antoine Tenart
@ 2018-09-20  4:15 ` David Miller
  3 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2018-09-20  4:15 UTC (permalink / raw)
  To: antoine.tenart
  Cc: linux, andrew, f.fainelli, netdev, linux-kernel, thomas.petazzoni,
	maxime.chevallier, gregory.clement, miquel.raynal, nadavh,
	stefanc, ymarkman, mw

From: Antoine Tenart <antoine.tenart@bootlin.com>
Date: Wed, 19 Sep 2018 11:39:30 +0200

> Hi Russell,
> 
> Following the discussion we had regarding the phylink issue related to
> the carrier link state not being off when starting phylink, I sent a fix
> patch a few days ago for the PPv2 driver:
> https://lkml.org/lkml/2018/9/14/633
> 
> The idea was to send a patch which could go to the stable branches, but
> a better solution would be to directly call netif_carrier_off() from
> within phylink_start(). This is the aim of this series.

Series applied.

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

end of thread, other threads:[~2018-09-20  4:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-19  9:39 [PATCH net-next 0/3] net: phy: phylink: ensure the carrier is off when starting phylink Antoine Tenart
2018-09-19  9:39 ` [PATCH net-next 1/3] " Antoine Tenart
2018-09-19 10:07   ` Russell King - ARM Linux
2018-09-19  9:39 ` [PATCH net-next 2/3] net: mvpp2: do not explicitly set the carrier state in open Antoine Tenart
2018-09-19  9:39 ` [PATCH net-next 3/3] net: mvneta: " Antoine Tenart
2018-09-20  4:15 ` [PATCH net-next 0/3] net: phy: phylink: ensure the carrier is off when starting phylink David Miller

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).