lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7fc065e8-c85b-4faf-9104-1b6b54327a02@bootlin.com>
Date: Fri, 30 Jan 2026 10:12:40 +0100
From: Maxime Chevallier <maxime.chevallier@...tlin.com>
To: Wei Fang <wei.fang@....com>, Russell King <linux@...linux.org.uk>,
 Jakub Kicinski <kuba@...nel.org>
Cc: "andrew@...n.ch" <andrew@...n.ch>,
 "hkallweit1@...il.com" <hkallweit1@...il.com>,
 "florian.fainelli@...adcom.com" <florian.fainelli@...adcom.com>,
 "xiaolei.wang" <xiaolei.wang@...driver.com>,
 "davem@...emloft.net" <davem@...emloft.net>,
 "edumazet@...gle.com" <edumazet@...gle.com>,
 "pabeni@...hat.com" <pabeni@...hat.com>,
 "quic_abchauha@...cinc.com" <quic_abchauha@...cinc.com>,
 "quic_sarohasa@...cinc.com" <quic_sarohasa@...cinc.com>,
 "imx@...ts.linux.dev" <imx@...ts.linux.dev>,
 "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
 "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net] net: phy: add device link between MAC device and MDIO
 device

Hi again,

On 30/01/2026 04:41, Wei Fang wrote:
[...]
> 
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index 81984d4ebb7c..c48335bfc7b6 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -1771,9 +1771,17 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
>          * another mac interface, so we should create a device link between
>          * phy dev and mac dev.
>          */
> -       if (dev && phydev->mdio.bus->parent && dev->dev.parent != phydev->mdio.bus->parent)
> -               phydev->devlink = device_link_add(dev->dev.parent, &phydev->mdio.dev,
> -                                                 DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS);
> +       if (dev && bus->parent && dev->dev.parent != bus->parent) {
> +               if (phydev->sfp_bus_attached)
                      ^ assuming we replace with phy_on_sfp()
> +                       phydev->devlink = device_link_add(dev->dev.parent,
> +                                                         bus->parent,
> +                                                         DL_FLAG_PM_RUNTIME |
> +                                                         DL_FLAG_STATELESS);
> +               else
> +                       device_link_add(dev->dev.parent, bus->parent,
> +                                       DL_FLAG_PM_RUNTIME |
> +                                       DL_FLAG_AUTOREMOVE_SUPPLIER);
> +       }

I think we should let the phy_on_sfp() case alone for now. The lifetime
of the SFP phydev and the MAC are completely independent here, the PHY
can be probed/removed without the MAC being there, and vice versa.

The MDIO bus that controls that SFP PHY's lifetime is the same as the
PHY itself, the mdio bus in that case exists solely to drive that single
PHY, and in can't be shared between multiple PHYs even if we have
multiple SFP ports in the entire system.

The logical thing to do IMO is not to tie the MAC and the MDIO Bus
itself, but rather the MAC and the PHY as was done before. As you state,
we couldn't set DL_FLAG_AUTOREMOVE_SUPPLIER because of SFP PHYs, but
if we add the check on "phy_on_sfp()", it should now be fine.

Maxime




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ