All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: phy: don't reschedule state machine when PHY is halted
@ 2018-09-18 19:12 Heiner Kallweit
  2018-09-18 20:02 ` Florian Fainelli
  2018-09-20 20:34 ` [PATCH net-next v2] " Heiner Kallweit
  0 siblings, 2 replies; 6+ messages in thread
From: Heiner Kallweit @ 2018-09-18 19:12 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, David Miller; +Cc: netdev

I think I've seen a similar or same patch before, not sure why it
didn't make it yet. When being in state PHY_HALTED we don't have to
reschedule the state machine, phy_start() will start it again.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 1ee25877c..c78203b25 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1123,7 +1123,7 @@ void phy_state_machine(struct work_struct *work)
 	 * PHY, if PHY_IGNORE_INTERRUPT is set, then we will be moving
 	 * between states from phy_mac_interrupt()
 	 */
-	if (phy_polling_mode(phydev))
+	if (phy_polling_mode(phydev) && old_state != PHY_HALTED)
 		queue_delayed_work(system_power_efficient_wq, &phydev->state_queue,
 				   PHY_STATE_TIME * HZ);
 }
-- 
2.19.0

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

* Re: [PATCH] net: phy: don't reschedule state machine when PHY is halted
  2018-09-18 19:12 [PATCH] net: phy: don't reschedule state machine when PHY is halted Heiner Kallweit
@ 2018-09-18 20:02 ` Florian Fainelli
  2018-09-18 20:17   ` Heiner Kallweit
  2018-09-20 20:34 ` [PATCH net-next v2] " Heiner Kallweit
  1 sibling, 1 reply; 6+ messages in thread
From: Florian Fainelli @ 2018-09-18 20:02 UTC (permalink / raw)
  To: Heiner Kallweit, Andrew Lunn, David Miller; +Cc: netdev

On 09/18/2018 12:12 PM, Heiner Kallweit wrote:
> I think I've seen a similar or same patch before, not sure why it
> didn't make it yet. When being in state PHY_HALTED we don't have to
> reschedule the state machine, phy_start() will start it again.

Yes, this is conceptually the same patch as as this one:

https://patchwork.ozlabs.org/patch/830415/

I prefer your version, though the comment in the original patch explains
why.

> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/net/phy/phy.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 1ee25877c..c78203b25 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -1123,7 +1123,7 @@ void phy_state_machine(struct work_struct *work)
>  	 * PHY, if PHY_IGNORE_INTERRUPT is set, then we will be moving
>  	 * between states from phy_mac_interrupt()
>  	 */
> -	if (phy_polling_mode(phydev))
> +	if (phy_polling_mode(phydev) && old_state != PHY_HALTED)
>  		queue_delayed_work(system_power_efficient_wq, &phydev->state_queue,
>  				   PHY_STATE_TIME * HZ);
>  }
> 


-- 
Florian

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

* Re: [PATCH] net: phy: don't reschedule state machine when PHY is halted
  2018-09-18 20:02 ` Florian Fainelli
@ 2018-09-18 20:17   ` Heiner Kallweit
  2018-09-20  0:04     ` Florian Fainelli
  0 siblings, 1 reply; 6+ messages in thread
From: Heiner Kallweit @ 2018-09-18 20:17 UTC (permalink / raw)
  To: Florian Fainelli, Andrew Lunn, David Miller; +Cc: netdev

On 18.09.2018 22:02, Florian Fainelli wrote:
> On 09/18/2018 12:12 PM, Heiner Kallweit wrote:
>> I think I've seen a similar or same patch before, not sure why it
>> didn't make it yet. When being in state PHY_HALTED we don't have to
>> reschedule the state machine, phy_start() will start it again.
> 
> Yes, this is conceptually the same patch as as this one:
> 
> https://patchwork.ozlabs.org/patch/830415/
> 
Thanks for the link, this is what I was referring to.

> I prefer your version, though the comment in the original patch explains
> why.
> 
To be sure I understand you correctly:
You're fine with the patch as is or would you prefer to add a comment
like in the original patch ?

>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>> ---
>>  drivers/net/phy/phy.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
>> index 1ee25877c..c78203b25 100644
>> --- a/drivers/net/phy/phy.c
>> +++ b/drivers/net/phy/phy.c
>> @@ -1123,7 +1123,7 @@ void phy_state_machine(struct work_struct *work)
>>  	 * PHY, if PHY_IGNORE_INTERRUPT is set, then we will be moving
>>  	 * between states from phy_mac_interrupt()
>>  	 */
>> -	if (phy_polling_mode(phydev))
>> +	if (phy_polling_mode(phydev) && old_state != PHY_HALTED)
>>  		queue_delayed_work(system_power_efficient_wq, &phydev->state_queue,
>>  				   PHY_STATE_TIME * HZ);
>>  }
>>
> 
> 

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

* Re: [PATCH] net: phy: don't reschedule state machine when PHY is halted
  2018-09-18 20:17   ` Heiner Kallweit
@ 2018-09-20  0:04     ` Florian Fainelli
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2018-09-20  0:04 UTC (permalink / raw)
  To: Heiner Kallweit, Andrew Lunn, David Miller; +Cc: netdev

On 09/18/2018 01:17 PM, Heiner Kallweit wrote:
> On 18.09.2018 22:02, Florian Fainelli wrote:
>> On 09/18/2018 12:12 PM, Heiner Kallweit wrote:
>>> I think I've seen a similar or same patch before, not sure why it
>>> didn't make it yet. When being in state PHY_HALTED we don't have to
>>> reschedule the state machine, phy_start() will start it again.
>>
>> Yes, this is conceptually the same patch as as this one:
>>
>> https://patchwork.ozlabs.org/patch/830415/
>>
> Thanks for the link, this is what I was referring to.
> 
>> I prefer your version, though the comment in the original patch explains
>> why.
>>
> To be sure I understand you correctly:
> You're fine with the patch as is or would you prefer to add a comment
> like in the original patch ?

Correct, unless you think this does not warrant a comment and it is
clear enough as-is?

> 
>>>
>>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>>> ---
>>>  drivers/net/phy/phy.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
>>> index 1ee25877c..c78203b25 100644
>>> --- a/drivers/net/phy/phy.c
>>> +++ b/drivers/net/phy/phy.c
>>> @@ -1123,7 +1123,7 @@ void phy_state_machine(struct work_struct *work)
>>>  	 * PHY, if PHY_IGNORE_INTERRUPT is set, then we will be moving
>>>  	 * between states from phy_mac_interrupt()
>>>  	 */
>>> -	if (phy_polling_mode(phydev))
>>> +	if (phy_polling_mode(phydev) && old_state != PHY_HALTED)
>>>  		queue_delayed_work(system_power_efficient_wq, &phydev->state_queue,
>>>  				   PHY_STATE_TIME * HZ);
>>>  }
>>>
>>
>>
> 


-- 
Florian

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

* [PATCH net-next v2] net: phy: don't reschedule state machine when PHY is halted
  2018-09-18 19:12 [PATCH] net: phy: don't reschedule state machine when PHY is halted Heiner Kallweit
  2018-09-18 20:02 ` Florian Fainelli
@ 2018-09-20 20:34 ` Heiner Kallweit
  2018-09-22 19:21   ` Florian Fainelli
  1 sibling, 1 reply; 6+ messages in thread
From: Heiner Kallweit @ 2018-09-20 20:34 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, David Miller; +Cc: netdev

When being in state PHY_HALTED we don't have to reschedule the
state machine, phy_start() will start it again.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
v2:
- added comment
---
 drivers/net/phy/phy.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index a5e0f0721..a1f8e4816 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1123,9 +1123,13 @@ void phy_state_machine(struct work_struct *work)
 
 	/* Only re-schedule a PHY state machine change if we are polling the
 	 * PHY, if PHY_IGNORE_INTERRUPT is set, then we will be moving
-	 * between states from phy_mac_interrupt()
+	 * between states from phy_mac_interrupt().
+	 *
+	 * In state PHY_HALTED the PHY gets suspended, so rescheduling the
+	 * state machine would be pointless and possibly error prone when
+	 * called from phy_disconnect() synchronously.
 	 */
-	if (phy_polling_mode(phydev))
+	if (phy_polling_mode(phydev) && old_state != PHY_HALTED)
 		queue_delayed_work(system_power_efficient_wq, &phydev->state_queue,
 				   PHY_STATE_TIME * HZ);
 }
-- 
2.19.0

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

* Re: [PATCH net-next v2] net: phy: don't reschedule state machine when PHY is halted
  2018-09-20 20:34 ` [PATCH net-next v2] " Heiner Kallweit
@ 2018-09-22 19:21   ` Florian Fainelli
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2018-09-22 19:21 UTC (permalink / raw)
  To: Heiner Kallweit, Andrew Lunn, David Miller; +Cc: netdev



On September 20, 2018 1:34:25 PM PDT, Heiner Kallweit <hkallweit1@gmail.com> wrote:
>When being in state PHY_HALTED we don't have to reschedule the
>state machine, phy_start() will start it again.
>
>Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

end of thread, other threads:[~2018-09-23  1:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-18 19:12 [PATCH] net: phy: don't reschedule state machine when PHY is halted Heiner Kallweit
2018-09-18 20:02 ` Florian Fainelli
2018-09-18 20:17   ` Heiner Kallweit
2018-09-20  0:04     ` Florian Fainelli
2018-09-20 20:34 ` [PATCH net-next v2] " Heiner Kallweit
2018-09-22 19:21   ` Florian Fainelli

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.