lkml.org 
[lkml]   [2021]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH] net: phy/mdio: enable mmd indirect access through phy_mii_ioctl()
> @@ -300,8 +301,18 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
> prtad = mii_data->phy_id;
> devad = mii_data->reg_num;
> }
> - mii_data->val_out = mdiobus_read(phydev->mdio.bus, prtad,
> - devad);
> +
> + if (prtad != phydev->mdio.addr)
> + phydev_rq = mdiobus_get_phy(phydev->mdio.bus, prtad);
> +
> + if (!phydev_rq) {
> + mii_data->val_out = mdiobus_read(phydev->mdio.bus, prtad, devad);
> + } else if (mdio_phy_id_is_c45(mii_data->phy_id) && !phydev->is_c45) {
> + mii_data->val_out = phy_read_mmd(phydev_rq, mdio_phy_id_devad(mii_data->phy_id), mii_data->reg_num);
> + } else {
> + mii_data->val_out = phy_read(phydev_rq, mii_data->reg_num);
> + }
> +

One thing i don't like about this is you have little idea what it has
actually done.

If you pass a C45 address, i expect a C45 access. If i pass a C22 i
expect a C22 access.

What i find interesting is that you and the other resent requester are
using the same user space tool. If you implement C45 over C22 in that
tool, you get your solution, and it will work for older kernels as
well. Also, given the diverse implementations of this IOTCL, it
probably works for more drivers than just those using phy_mii_ioctl().

Andrew



\
 
 \ /
  Last update: 2021-11-02 22:47    [W:0.058 / U:0.372 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site