All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Mason <slash.tmp@free.fr>, Andrew Lunn <andrew@lunn.ch>,
	Mans Rullgard <mans@mansr.com>
Cc: netdev <netdev@vger.kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: Problem with PHY state machine when using interrupts
Date: Mon, 24 Jul 2017 15:39:07 -0700	[thread overview]
Message-ID: <eb09bda5-c972-0c2c-2693-982c02c8c87c@gmail.com> (raw)
In-Reply-To: <62085f48-df18-f987-f521-dcdfbd7f574b@gmail.com>

On 07/24/2017 03:36 PM, Florian Fainelli wrote:
> On 07/24/2017 02:20 PM, Mason wrote:
>> On 24/07/2017 21:53, Florian Fainelli wrote:
>>
>>> Well now that I see the possible interrupts generated, I indeed don't
>>> see how you can get a link down notification unless you somehow force
>>> the link down yourself, which would certainly happen in phy_suspend()
>>> when we set BMCR.pwrdwn, but that may be too late.
>>>
>>> You should still expect the adjust_link() function to be called though
>>> with PHY_HALTED being set and that takes care of doing phydev->link = 0
>>> and netif_carrier_off(). If that still does not work, then see whether
>>> removing the call to phy_stop() does help (it really should).
>>
>> The only functions setting phydev->state to PHY_HALTED
>> are phy_error() and phy_stop() AFAICT.
>>
>> I am aware that when phy_state_machine() handles the
>> PHY_HALTED state, it will set phydev->link = 0;
>> and call netif_carrier_off() -- because that's where
>> I copied that code from.
>>
>> My issue is that phy_state_machine() does not run when
>> I run 'ip set link dev eth0 down' from the command line.
> 
> Yes, that much is clear, which is why I suggested earlier you try the
> patch at the end now.

This sentence was referring to this patch that I changed mid way through
this email:

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index d0626bf5c540..652e24b53f3f 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -968,6 +968,8 @@ void phy_stop(struct phy_device *phydev)
         * of rtnl_lock(), but PHY_HALTED shall guarantee phy_change()
         * will not reenable interrupts.
         */
+       if (phy_interrupt_is_valid(phydev))
+               phy_change(phydev);
 }
 EXPORT_SYMBOL(phy_stop);
-- 
Florian

WARNING: multiple messages have this Message-ID (diff)
From: f.fainelli@gmail.com (Florian Fainelli)
To: linux-arm-kernel@lists.infradead.org
Subject: Problem with PHY state machine when using interrupts
Date: Mon, 24 Jul 2017 15:39:07 -0700	[thread overview]
Message-ID: <eb09bda5-c972-0c2c-2693-982c02c8c87c@gmail.com> (raw)
In-Reply-To: <62085f48-df18-f987-f521-dcdfbd7f574b@gmail.com>

On 07/24/2017 03:36 PM, Florian Fainelli wrote:
> On 07/24/2017 02:20 PM, Mason wrote:
>> On 24/07/2017 21:53, Florian Fainelli wrote:
>>
>>> Well now that I see the possible interrupts generated, I indeed don't
>>> see how you can get a link down notification unless you somehow force
>>> the link down yourself, which would certainly happen in phy_suspend()
>>> when we set BMCR.pwrdwn, but that may be too late.
>>>
>>> You should still expect the adjust_link() function to be called though
>>> with PHY_HALTED being set and that takes care of doing phydev->link = 0
>>> and netif_carrier_off(). If that still does not work, then see whether
>>> removing the call to phy_stop() does help (it really should).
>>
>> The only functions setting phydev->state to PHY_HALTED
>> are phy_error() and phy_stop() AFAICT.
>>
>> I am aware that when phy_state_machine() handles the
>> PHY_HALTED state, it will set phydev->link = 0;
>> and call netif_carrier_off() -- because that's where
>> I copied that code from.
>>
>> My issue is that phy_state_machine() does not run when
>> I run 'ip set link dev eth0 down' from the command line.
> 
> Yes, that much is clear, which is why I suggested earlier you try the
> patch at the end now.

This sentence was referring to this patch that I changed mid way through
this email:

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index d0626bf5c540..652e24b53f3f 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -968,6 +968,8 @@ void phy_stop(struct phy_device *phydev)
         * of rtnl_lock(), but PHY_HALTED shall guarantee phy_change()
         * will not reenable interrupts.
         */
+       if (phy_interrupt_is_valid(phydev))
+               phy_change(phydev);
 }
 EXPORT_SYMBOL(phy_stop);
-- 
Florian

  reply	other threads:[~2017-07-24 22:39 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-24 11:07 Problem with PHY state machine when using interrupts Mason
2017-07-24 11:07 ` Mason
2017-07-24 15:01 ` Mason
2017-07-24 15:01   ` Mason
2017-07-24 16:49   ` Florian Fainelli
2017-07-24 16:49     ` Florian Fainelli
2017-07-24 19:13     ` Mason
2017-07-24 19:13       ` Mason
2017-07-24 19:32       ` Florian Fainelli
2017-07-24 19:32         ` Florian Fainelli
2017-07-24 19:53         ` Florian Fainelli
2017-07-24 19:53           ` Florian Fainelli
2017-07-24 21:20           ` Mason
2017-07-24 21:20             ` Mason
2017-07-24 22:36             ` Florian Fainelli
2017-07-24 22:36               ` Florian Fainelli
2017-07-24 22:39               ` Florian Fainelli [this message]
2017-07-24 22:39                 ` Florian Fainelli
2017-07-25 10:51                 ` Mason
2017-07-25 10:51                   ` Mason
2017-07-25 11:41                   ` Mason
2017-07-25 11:41                     ` Mason
2017-07-25 17:55                     ` Florian Fainelli
2017-07-25 17:55                       ` Florian Fainelli
2017-07-24 22:53               ` Mason
2017-07-24 22:53                 ` Mason
2017-07-24 22:59                 ` Florian Fainelli
2017-07-24 22:59                   ` Florian Fainelli
2017-07-25  0:30                   ` Florian Fainelli
2017-07-25  0:30                     ` Florian Fainelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eb09bda5-c972-0c2c-2693-982c02c8c87c@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mans@mansr.com \
    --cc=netdev@vger.kernel.org \
    --cc=slash.tmp@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.