All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: "Ivan T. Ivanov" <iivanov@suse.de>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: phy: leds: Trigger leds only if PHY speed is known
Date: Mon, 19 Jul 2021 16:29:42 +0100	[thread overview]
Message-ID: <20210719152942.GQ22278@shell.armlinux.org.uk> (raw)
In-Reply-To: <162646032060.16633.4902744414139431224@localhost>

On Fri, Jul 16, 2021 at 09:32:00PM +0300, Ivan T. Ivanov wrote:
> Hi,
> 
> Quoting Andrew Lunn (2021-07-16 18:19:58)
> > On Fri, Jul 16, 2021 at 05:11:42PM +0300, Ivan T. Ivanov wrote:
> > > This prevents "No phy led trigger registered for speed(-1)"
> > > alert message which is coused by phy_led_trigger_chage_speed()
> > > being called during attaching phy to net_device where phy device
> > > speed could be still unknown.
> > 
> > Hi Ivan
> > 
> > It seems odd that when attaching the PHY we have link, but not the
> > speed. What PHY is this?
> 
> This is lan78xx on RPi3B+
> 
> > 
> > > -     if (phy->speed == 0)
> > > +     if (phy->speed == 0 || phy->speed == SPEED_UNKNOWN)
> > >               return;
> > 
> > This change makes sense. But i'm wondering if the original logic is
> > sound. We have link, but no speed information.
> 
> Well, probably my interpretation was not correct. The most probable
> call to phy_led_trigger_change_speed() which couses this alert is
> phy_attach_direct() -> phy_led_triggers_register(), I think. I am
> not sure that we have link at this stage or not.

This does sound weird.

When a phy_device is allocated, it's explicitly initialised with:

	dev->speed = SPEED_UNKNOWN;
	dev->duplex = DUPLEX_UNKNOWN;
	dev->link = 0;
	dev->state = PHY_DOWN;

so, unless something is causing state to be read before we've attached
the phy to a network device, this is how this state should remain. I
wonder why you are seeing dev->link be non-zero.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

  parent reply	other threads:[~2021-07-19 16:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-16 14:11 [PATCH] net: phy: leds: Trigger leds only if PHY speed is known Ivan T. Ivanov
2021-07-16 15:19 ` Andrew Lunn
     [not found]   ` <162646032060.16633.4902744414139431224@localhost>
2021-07-19 15:29     ` Russell King (Oracle) [this message]
     [not found]       ` <162737250593.8289.392757192031571742@localhost>
     [not found]         ` <162806599009.5748.14837844278631256325@localhost>
2021-08-09 14:16           ` Russell King (Oracle)
     [not found]             ` <162867546407.30043.9226294532918992883@localhost>
2021-08-11 14:39               ` Andrew Lunn
2021-08-11 15:10               ` Russell King (Oracle)
2021-08-11 22:23             ` Andrew Lunn

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=20210719152942.GQ22278@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=hkallweit1@gmail.com \
    --cc=iivanov@suse.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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.