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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e0833448-1d00-497d-9f1b-b6075493982d@lunn.ch>
Date: Tue, 3 Sep 2024 21:28:27 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Niklas Söderlund <niklas.soderlund+renesas@...natech.se>
Cc: "David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	netdev@...r.kernel.org, linux-renesas-soc@...r.kernel.org
Subject: Re: [net-next] net: ethernet: rtsn: Add MDIO read/write support for
 C45

On Tue, Sep 03, 2024 at 07:18:53PM +0200, Niklas Söderlund wrote:
> Add C45 specific read and write implementations to support C45 PHY
> access using SIOCGMIIREG and SIOCSMIIREG IOCTLs.
> 
> While the core can handle a C45 PHY using only the MDIO bus C22 read()
> and write() callbacks there are PHY interactions that are not possible
> without them. One use-case is accessing PHY registers using the
> SIOCGMIIREG and SIOCSMIIREG IOCTLs. Without these callbacks trying to
> access C45 PHY registers using these IOCTLs result in -EOPNOTSUPP.

This is the wrong solution. You should not be reproducing
functionality which phylib already has.

Please extend the IOCTL code to do what the core does:

int __phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum)
{
        if (regnum > (u16)~0 || devad > 32)
                return -EINVAL;

        if (phydev->drv && phydev->drv->read_mmd)
                return phydev->drv->read_mmd(phydev, devad, regnum);

        return mmd_phy_read(phydev->mdio.bus, phydev->mdio.addr,
                            phydev->is_c45, devad, regnum);
}

mmd_phy_read() will fall back to indirect access if need be.

Just watch out for mii_data->phy_id and what it implies.

    Andrew

---
pw-bot: cr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ