netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: Expose phydev::dev_flags through sysfs
@ 2021-03-10 22:12 Florian Fainelli
  2021-03-10 22:48 ` Jakub Kicinski
  2021-03-11 20:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 4+ messages in thread
From: Florian Fainelli @ 2021-03-10 22:12 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, Andrew Lunn, Heiner Kallweit, Russell King,
	David S. Miller, Jakub Kicinski, open list

phydev::dev_flags contains a bitmask of configuration bits requested by
the consumer of a PHY device (Ethernet MAC or switch) towards the PHY
driver. Since these flags are often used for requesting LED or other
type of configuration being able to quickly audit them without
instrumenting the kernel is useful.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 Documentation/ABI/testing/sysfs-class-net-phydev | 12 ++++++++++++
 drivers/net/phy/phy_device.c                     | 11 +++++++++++
 2 files changed, 23 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-class-net-phydev b/Documentation/ABI/testing/sysfs-class-net-phydev
index 40ced0ea4316..ac722dd5e694 100644
--- a/Documentation/ABI/testing/sysfs-class-net-phydev
+++ b/Documentation/ABI/testing/sysfs-class-net-phydev
@@ -51,3 +51,15 @@ Description:
 		Boolean value indicating whether the PHY device is used in
 		standalone mode, without a net_device associated, by PHYLINK.
 		Attribute created only when this is the case.
+
+What:		/sys/class/mdio_bus/<bus>/<device>/phy_dev_flags
+Date:		March 2021
+KernelVersion:	5.13
+Contact:	netdev@vger.kernel.org
+Description:
+		32-bit hexadecimal number representing a bit mask of the
+		configuration bits passed from the consumer of the PHY
+		(Ethernet MAC, switch, etc.) to the PHY driver. The flags are
+		only used internally by the kernel and their placement are
+		not meant to be stable across kernel versions. This is intended
+		for facilitating the debugging of PHY drivers.
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index cc38e326405a..a009d1769b08 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -512,10 +512,21 @@ phy_has_fixups_show(struct device *dev, struct device_attribute *attr,
 }
 static DEVICE_ATTR_RO(phy_has_fixups);
 
+static ssize_t phy_dev_flags_show(struct device *dev,
+				  struct device_attribute *attr,
+				  char *buf)
+{
+	struct phy_device *phydev = to_phy_device(dev);
+
+	return sprintf(buf, "0x%08x\n", phydev->dev_flags);
+}
+static DEVICE_ATTR_RO(phy_dev_flags);
+
 static struct attribute *phy_dev_attrs[] = {
 	&dev_attr_phy_id.attr,
 	&dev_attr_phy_interface.attr,
 	&dev_attr_phy_has_fixups.attr,
+	&dev_attr_phy_dev_flags.attr,
 	NULL,
 };
 ATTRIBUTE_GROUPS(phy_dev);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net: phy: Expose phydev::dev_flags through sysfs
  2021-03-10 22:12 [PATCH net-next] net: phy: Expose phydev::dev_flags through sysfs Florian Fainelli
@ 2021-03-10 22:48 ` Jakub Kicinski
  2021-03-10 22:50   ` Florian Fainelli
  2021-03-11 20:50 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2021-03-10 22:48 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, Andrew Lunn, Heiner Kallweit, Russell King,
	David S. Miller, open list

On Wed, 10 Mar 2021 14:12:43 -0800 Florian Fainelli wrote:
> phydev::dev_flags contains a bitmask of configuration bits requested by
> the consumer of a PHY device (Ethernet MAC or switch) towards the PHY
> driver. Since these flags are often used for requesting LED or other
> type of configuration being able to quickly audit them without
> instrumenting the kernel is useful.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  Documentation/ABI/testing/sysfs-class-net-phydev | 12 ++++++++++++
>  drivers/net/phy/phy_device.c                     | 11 +++++++++++
>  2 files changed, 23 insertions(+)
> 
> diff --git a/Documentation/ABI/testing/sysfs-class-net-phydev b/Documentation/ABI/testing/sysfs-class-net-phydev
> index 40ced0ea4316..ac722dd5e694 100644
> --- a/Documentation/ABI/testing/sysfs-class-net-phydev
> +++ b/Documentation/ABI/testing/sysfs-class-net-phydev
> @@ -51,3 +51,15 @@ Description:
>  		Boolean value indicating whether the PHY device is used in
>  		standalone mode, without a net_device associated, by PHYLINK.
>  		Attribute created only when this is the case.
> +
> +What:		/sys/class/mdio_bus/<bus>/<device>/phy_dev_flags
> +Date:		March 2021
> +KernelVersion:	5.13
> +Contact:	netdev@vger.kernel.org
> +Description:
> +		32-bit hexadecimal number representing a bit mask of the
> +		configuration bits passed from the consumer of the PHY
> +		(Ethernet MAC, switch, etc.) to the PHY driver. The flags are
> +		only used internally by the kernel and their placement are
> +		not meant to be stable across kernel versions. This is intended
> +		for facilitating the debugging of PHY drivers.

Why not debugfs, then?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net: phy: Expose phydev::dev_flags through sysfs
  2021-03-10 22:48 ` Jakub Kicinski
@ 2021-03-10 22:50   ` Florian Fainelli
  0 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2021-03-10 22:50 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: netdev, Andrew Lunn, Heiner Kallweit, Russell King,
	David S. Miller, open list

On 3/10/21 2:48 PM, Jakub Kicinski wrote:
> On Wed, 10 Mar 2021 14:12:43 -0800 Florian Fainelli wrote:
>> phydev::dev_flags contains a bitmask of configuration bits requested by
>> the consumer of a PHY device (Ethernet MAC or switch) towards the PHY
>> driver. Since these flags are often used for requesting LED or other
>> type of configuration being able to quickly audit them without
>> instrumenting the kernel is useful.
>>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>> ---
>>  Documentation/ABI/testing/sysfs-class-net-phydev | 12 ++++++++++++
>>  drivers/net/phy/phy_device.c                     | 11 +++++++++++
>>  2 files changed, 23 insertions(+)
>>
>> diff --git a/Documentation/ABI/testing/sysfs-class-net-phydev b/Documentation/ABI/testing/sysfs-class-net-phydev
>> index 40ced0ea4316..ac722dd5e694 100644
>> --- a/Documentation/ABI/testing/sysfs-class-net-phydev
>> +++ b/Documentation/ABI/testing/sysfs-class-net-phydev
>> @@ -51,3 +51,15 @@ Description:
>>  		Boolean value indicating whether the PHY device is used in
>>  		standalone mode, without a net_device associated, by PHYLINK.
>>  		Attribute created only when this is the case.
>> +
>> +What:		/sys/class/mdio_bus/<bus>/<device>/phy_dev_flags
>> +Date:		March 2021
>> +KernelVersion:	5.13
>> +Contact:	netdev@vger.kernel.org
>> +Description:
>> +		32-bit hexadecimal number representing a bit mask of the
>> +		configuration bits passed from the consumer of the PHY
>> +		(Ethernet MAC, switch, etc.) to the PHY driver. The flags are
>> +		only used internally by the kernel and their placement are
>> +		not meant to be stable across kernel versions. This is intended
>> +		for facilitating the debugging of PHY drivers.
> 
> Why not debugfs, then?
> 

Mostly for consistency with what we already have exposed, I suppose that
could be moved to debugfs.

-- 
Florian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net: phy: Expose phydev::dev_flags through sysfs
  2021-03-10 22:12 [PATCH net-next] net: phy: Expose phydev::dev_flags through sysfs Florian Fainelli
  2021-03-10 22:48 ` Jakub Kicinski
@ 2021-03-11 20:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-03-11 20:50 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, andrew, hkallweit1, linux, davem, kuba, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Wed, 10 Mar 2021 14:12:43 -0800 you wrote:
> phydev::dev_flags contains a bitmask of configuration bits requested by
> the consumer of a PHY device (Ethernet MAC or switch) towards the PHY
> driver. Since these flags are often used for requesting LED or other
> type of configuration being able to quickly audit them without
> instrumenting the kernel is useful.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> 
> [...]

Here is the summary with links:
  - [net-next] net: phy: Expose phydev::dev_flags through sysfs
    https://git.kernel.org/netdev/net-next/c/b0bade515d36

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-11 20:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10 22:12 [PATCH net-next] net: phy: Expose phydev::dev_flags through sysfs Florian Fainelli
2021-03-10 22:48 ` Jakub Kicinski
2021-03-10 22:50   ` Florian Fainelli
2021-03-11 20:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).