Re: [PATCH net-next] net: mdio: Add netlink interface

From: Russell King (Oracle)
Date: Tue Mar 07 2023 - 10:02:53 EST


On Tue, Mar 07, 2023 at 03:22:46PM +0100, Andrew Lunn wrote:
> > + switch ((enum mdio_nl_op)insn->op) {
> > + case MDIO_NL_OP_READ:
> > + phy_id = __arg_ri(insn->arg0, regs);
> > + prtad = mdio_phy_id_prtad(phy_id);
> > + devad = mdio_phy_id_devad(phy_id);
> > + reg = __arg_ri(insn->arg1, regs);
> > +
> > + if (mdio_phy_id_is_c45(phy_id))
> > + ret = __mdiobus_c45_read(xfer->mdio, prtad,
> > + devad, reg);
> > + else
> > + ret = __mdiobus_read(xfer->mdio, phy_id, reg);
>
> The application should say if it want to do C22 or C45. As you said in
> the cover note, the ioctl interface is limiting when there is no PHY,
> so you are artificially adding the same restriction here. Also, you
> might want to do C45 on a C22 PHY, e.g. to access EEE registers. Plus
> you could consider adding C45 over C22 here.

Remembering of course that C45-over-C22 on a device that isn't a PHY
could end up causing havoc, but then if you are using this interface,
you already have the gun pointing at your foot... and if you go and
try C45-over-C22 to scan a MDIO bus, you'd definitely be pulling the
trigger too.

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