* [PATCH] gianfar: Call netif_carrier_off() prior to registration
@ 2014-06-03 22:55 Fabio Estevam
2014-06-03 23:04 ` Florian Fainelli
2014-06-05 22:04 ` David Miller
0 siblings, 2 replies; 6+ messages in thread
From: Fabio Estevam @ 2014-06-03 22:55 UTC (permalink / raw)
To: davem; +Cc: claudiu.manoil, netdev, Fabio Estevam
From: Fabio Estevam <fabio.estevam@freescale.com>
Quoting David Miller:
"At the moment you call register_netdev() the device is visible, notifications
are sent to userspace, and userland tools can try to bring the interface up
and see the incorrect link state, before you do the netif_carrier_off().
Said another way, between the register_netdev() and netif_carrier_off() call,
userspace can see the device in an inconsistent state."
So call netif_carrier_off() prior to register_netdev().
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
This is untested
drivers/net/ethernet/freescale/gianfar.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index a7fe6a7..861e0c9 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -1384,6 +1384,9 @@ static int gfar_probe(struct platform_device *ofdev)
gfar_hw_init(priv);
+ /* Carrier starts down, phylib will bring it up */
+ netif_carrier_off(dev);
+
err = register_netdev(dev);
if (err) {
@@ -1391,9 +1394,6 @@ static int gfar_probe(struct platform_device *ofdev)
goto register_fail;
}
- /* Carrier starts down, phylib will bring it up */
- netif_carrier_off(dev);
-
device_init_wakeup(&dev->dev,
priv->device_flags &
FSL_GIANFAR_DEV_HAS_MAGIC_PACKET);
--
1.8.3.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] gianfar: Call netif_carrier_off() prior to registration
2014-06-03 22:55 [PATCH] gianfar: Call netif_carrier_off() prior to registration Fabio Estevam
@ 2014-06-03 23:04 ` Florian Fainelli
2014-06-04 2:05 ` David Miller
2014-06-05 22:04 ` David Miller
1 sibling, 1 reply; 6+ messages in thread
From: Florian Fainelli @ 2014-06-03 23:04 UTC (permalink / raw)
To: Fabio Estevam; +Cc: David Miller, Claudiu Manoil, netdev, Fabio Estevam
2014-06-03 15:55 GMT-07:00 Fabio Estevam <festevam@gmail.com>:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Quoting David Miller:
> "At the moment you call register_netdev() the device is visible, notifications
> are sent to userspace, and userland tools can try to bring the interface up
> and see the incorrect link state, before you do the netif_carrier_off().
>
> Said another way, between the register_netdev() and netif_carrier_off() call,
> userspace can see the device in an inconsistent state."
>
> So call netif_carrier_off() prior to register_netdev().
Potentially all drivers implementing libphy correctly should be fixed
to start with a carrier off until the phy library has determined
otherwise.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> This is untested
>
> drivers/net/ethernet/freescale/gianfar.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
> index a7fe6a7..861e0c9 100644
> --- a/drivers/net/ethernet/freescale/gianfar.c
> +++ b/drivers/net/ethernet/freescale/gianfar.c
> @@ -1384,6 +1384,9 @@ static int gfar_probe(struct platform_device *ofdev)
>
> gfar_hw_init(priv);
>
> + /* Carrier starts down, phylib will bring it up */
> + netif_carrier_off(dev);
> +
> err = register_netdev(dev);
>
> if (err) {
> @@ -1391,9 +1394,6 @@ static int gfar_probe(struct platform_device *ofdev)
> goto register_fail;
> }
>
> - /* Carrier starts down, phylib will bring it up */
> - netif_carrier_off(dev);
> -
> device_init_wakeup(&dev->dev,
> priv->device_flags &
> FSL_GIANFAR_DEV_HAS_MAGIC_PACKET);
> --
> 1.8.3.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Florian
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] gianfar: Call netif_carrier_off() prior to registration
2014-06-03 23:04 ` Florian Fainelli
@ 2014-06-04 2:05 ` David Miller
2014-06-04 2:42 ` Florian Fainelli
0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2014-06-04 2:05 UTC (permalink / raw)
To: f.fainelli; +Cc: festevam, claudiu.manoil, netdev, fabio.estevam
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Tue, 3 Jun 2014 16:04:49 -0700
> 2014-06-03 15:55 GMT-07:00 Fabio Estevam <festevam@gmail.com>:
>> From: Fabio Estevam <fabio.estevam@freescale.com>
>>
>> Quoting David Miller:
>> "At the moment you call register_netdev() the device is visible, notifications
>> are sent to userspace, and userland tools can try to bring the interface up
>> and see the incorrect link state, before you do the netif_carrier_off().
>>
>> Said another way, between the register_netdev() and netif_carrier_off() call,
>> userspace can see the device in an inconsistent state."
>>
>> So call netif_carrier_off() prior to register_netdev().
>
> Potentially all drivers implementing libphy correctly should be fixed
> to start with a carrier off until the phy library has determined
> otherwise.
Are you saying we should hold off on this gianfar patch?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] gianfar: Call netif_carrier_off() prior to registration
2014-06-04 2:05 ` David Miller
@ 2014-06-04 2:42 ` Florian Fainelli
2014-06-04 2:51 ` Fabio Estevam
0 siblings, 1 reply; 6+ messages in thread
From: Florian Fainelli @ 2014-06-04 2:42 UTC (permalink / raw)
To: David Miller; +Cc: festevam, claudiu.manoil, netdev, fabio.estevam
Le 03/06/2014 19:05, David Miller a écrit :
> From: Florian Fainelli <f.fainelli@gmail.com>
> Date: Tue, 3 Jun 2014 16:04:49 -0700
>
>> 2014-06-03 15:55 GMT-07:00 Fabio Estevam <festevam@gmail.com>:
>>> From: Fabio Estevam <fabio.estevam@freescale.com>
>>>
>>> Quoting David Miller:
>>> "At the moment you call register_netdev() the device is visible, notifications
>>> are sent to userspace, and userland tools can try to bring the interface up
>>> and see the incorrect link state, before you do the netif_carrier_off().
>>>
>>> Said another way, between the register_netdev() and netif_carrier_off() call,
>>> userspace can see the device in an inconsistent state."
>>>
>>> So call netif_carrier_off() prior to register_netdev().
>>
>> Potentially all drivers implementing libphy correctly should be fixed
>> to start with a carrier off until the phy library has determined
>> otherwise.
>
> Are you saying we should hold off on this gianfar patch?
Not at all, I think this patch is fine. If Fabio wants/can audit the
other Freescale drivers I think this should be beneficial.
--
Florian
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] gianfar: Call netif_carrier_off() prior to registration
2014-06-04 2:42 ` Florian Fainelli
@ 2014-06-04 2:51 ` Fabio Estevam
0 siblings, 0 replies; 6+ messages in thread
From: Fabio Estevam @ 2014-06-04 2:51 UTC (permalink / raw)
To: Florian Fainelli; +Cc: David Miller, Claudiu Manoil, netdev, Fabio Estevam
On Tue, Jun 3, 2014 at 11:42 PM, Florian Fainelli <f.fainelli@gmail.com> wrote:
> Not at all, I think this patch is fine. If Fabio wants/can audit the other
> Freescale drivers I think this should be beneficial.
Yes, I have checked the other Freescale net drivers and the only one
with this particular problem was gianfar.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] gianfar: Call netif_carrier_off() prior to registration
2014-06-03 22:55 [PATCH] gianfar: Call netif_carrier_off() prior to registration Fabio Estevam
2014-06-03 23:04 ` Florian Fainelli
@ 2014-06-05 22:04 ` David Miller
1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2014-06-05 22:04 UTC (permalink / raw)
To: festevam; +Cc: claudiu.manoil, netdev, fabio.estevam
From: Fabio Estevam <festevam@gmail.com>
Date: Tue, 3 Jun 2014 19:55:38 -0300
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Quoting David Miller:
> "At the moment you call register_netdev() the device is visible, notifications
> are sent to userspace, and userland tools can try to bring the interface up
> and see the incorrect link state, before you do the netif_carrier_off().
>
> Said another way, between the register_netdev() and netif_carrier_off() call,
> userspace can see the device in an inconsistent state."
>
> So call netif_carrier_off() prior to register_netdev().
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Applied, thank you.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-06-05 22:04 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-03 22:55 [PATCH] gianfar: Call netif_carrier_off() prior to registration Fabio Estevam
2014-06-03 23:04 ` Florian Fainelli
2014-06-04 2:05 ` David Miller
2014-06-04 2:42 ` Florian Fainelli
2014-06-04 2:51 ` Fabio Estevam
2014-06-05 22:04 ` 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).