[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fad26dc95cbe08a87b30d98a55b7e3d987683589@linux.dev>
Date: Mon, 26 May 2025 08:11:21 +0000
From: "Yajun Deng" <yajun.deng@...ux.dev>
To: "Andrew Lunn" <andrew@...n.ch>
Cc: hkallweit1@...il.com, linux@...linux.org.uk, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next] net: phy: Add c45_phy_ids sysfs entry
May 23, 2025 at 9:55 PM, "Andrew Lunn" <andrew@...n.ch> wrote:
>
> >
> > +What: /sys/class/mdio_bus/<bus>/<device>/c45_phy_ids
> >
> > +Date: May 2025
> >
> > +KernelVersion: 6.16
> >
> > +Contact: netdev@...r.kernel.org
> >
> > +Description:
> >
> > + This attribute contains the 32-bit PHY Identifier as reported
> >
> > + by the device during bus enumeration, encoded in hexadecimal.
> >
> > + These C45 IDs are used to match the device with the appropriate
> >
> > + driver.
> >
>
> https://docs.kernel.org/filesystems/sysfs.html#attributes
>
> Attributes should be ASCII text files, preferably with only one
>
> value per file. It is noted that it may not be efficient to contain
>
> only one value per file, so it is socially acceptable to express an
>
> array of values of the same type.
>
> These are static values, so efficiency is not an issue.
>
> It might be better to have a directory
>
> /sys/class/mdio_bus/<bus>/<device>/c45_phy_ids and then for each MMD
>
> create a file. I would also suggest using is_visible() == 0 for those
>
> with an ID == 0.
>
is_visible only hide files, not directory. It will look like this:
c45 device:
$ ls /sys/class/net/eth0/phydev/
attached_dev driver of_node phy_id power subsystem
c45_phy_ids hwmon phy_has_fixups phy_interface statistics uevent
$ ls /sys/class/net/eth0/phydev/c45_phy_ids
mmd10_device_id mmd17_device_id mmd23_device_id mmd2_device_id mmd7_device_id
mmd11_device_id mmd18_device_id mmd24_device_id mmd30_device_id mmd8_device_id
mmd12_device_id mmd19_device_id mmd25_device_id mmd31_device_id mmd9_device_id
mmd13_device_id mmd1_device_id mmd26_device_id mmd3_device_id
mmd14_device_id mmd20_device_id mmd27_device_id mmd4_device_id
mmd15_device_id mmd21_device_id mmd28_device_id mmd5_device_id
mmd16_device_id mmd22_device_id mmd29_device_id mmd6_device_id
c22 device:
$ ls /sys/class/net/eth0/phydev/
attached_dev driver of_node phy_id power subsystem
c45_phy_ids hwmon phy_has_fixups phy_interface statistics uevent
$ ls /sys/class/net/eth0/phydev/c45_phy_ids
So is that fine?
> Andrew
>
Powered by blists - more mailing lists