From: Andrew Lunn <andrew@lunn.ch>
To: Aleksei Sviridkin <f@lex.la>
Cc: netdev@vger.kernel.org, andrew+netdev@lunn.ch,
hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net,
edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
horms@kernel.org, olteanv@gmail.com, Thangaraj.S@microchip.com,
UNGLinuxDriver@microchip.com, steve.glendinning@shawell.net,
f.fainelli@gmail.com, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v13 3/4] net: phy: take the interrupt back from the bus on detach
Date: Mon, 5 Oct 2026 18:55:39 +0200 [thread overview]
Message-ID: <15cfe73f-9547-4cbd-9c70-52d39766d85d@lunn.ch> (raw)
In-Reply-To: <20261001130236.106059-4-f@lex.la>
On Thu, Oct 01, 2026 at 04:02:35PM +0300, Aleksei Sviridkin wrote:
> When a PHY's driver is a module that is not loaded yet when the MAC
> connects, the PHY gets the generic driver first. phy_probe() then
> replaces phydev->irq with PHY_POLL, because genphy has no interrupt
> support. Nothing puts the number back, so after the real driver binds
> the PHY is polled for the rest of the uptime.
>
> Seen on a Keenetic KN-1012: the Airoha EN8811H behind an MT7531 port
> has its driver on the root filesystem. Its devicetree interrupt maps to
> irq 15, and after the real driver binds phydev->irq reads -1.
>
> Restore the number when the PHY detaches. It comes from the bus table,
> mdiobus->irq[], where the bus or the MAC driver recorded it. Do it only
> when phy_attach_direct() bound the generic driver, since that is the
> substitution being undone; otherwise the field belongs to whoever wrote
> it. Do it before device_release_driver(), because after the release a
> probing driver can write the same field.
>
> The store is ordered before the release rather than locked against it:
> device_release_driver() takes the device lock itself. A MAC that sets
> phydev->irq before phy_start(), as phy.rst describes, is not affected,
> since the restore runs on detach, between connections.
>
> Tested on the KN-1012 with a 6.18 distribution kernel: phydev->irq
> reads 15 after the real driver binds, and -1 without this patch.
>
> Fixes: 00db8189d984 ("This patch adds a PHY Abstraction Layer to the Linux Kernel, enabling ethernet drivers to remain as ignorant as is reasonable of the connected PHY's design and operation details.")
> Assisted-by: LLM
> Signed-off-by: Aleksei Sviridkin <f@lex.la>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
next prev parent reply other threads:[~2026-10-05 16:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 13:02 [PATCH net v13 0/4] net: phy: keep a PHY interrupt across a generic bind cycle Aleksei Sviridkin
2026-10-01 13:02 ` [PATCH net v13 1/4] net: usb: lan78xx: register the PHY interrupt with the MDIO bus Aleksei Sviridkin
2026-10-05 16:52 ` Andrew Lunn
2026-10-01 13:02 ` [PATCH net v13 2/4] net: usb: smsc95xx: " Aleksei Sviridkin
2026-10-05 16:53 ` Andrew Lunn
2026-10-01 13:02 ` [PATCH net v13 3/4] net: phy: take the interrupt back from the bus on detach Aleksei Sviridkin
2026-10-05 13:26 ` netdev-bot+sashiko
2026-10-05 16:55 ` Andrew Lunn [this message]
2026-10-01 13:02 ` [PATCH net v13 4/4] net: phy: restore the interrupt when the generic bind cycle fails Aleksei Sviridkin
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=15cfe73f-9547-4cbd-9c70-52d39766d85d@lunn.ch \
--to=andrew@lunn.ch \
--cc=Thangaraj.S@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=f.fainelli@gmail.com \
--cc=f@lex.la \
--cc=hkallweit1@gmail.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=steve.glendinning@shawell.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®