Thread (35 messages) 35 messages, 6 authors, 2023-10-03
STALE1012d

[RFC PATCH net-next 5/7] netlink: specs: add phy_list command

From: Maxime Chevallier <maxime.chevallier@bootlin.com>
Date: 2023-09-07 15:39:16
Also in: lkml
Subsystem: networking [ethtool], networking [general], the rest, yaml netlink (ynl) · Maintainers: Andrew Lunn, Jakub Kicinski, "David S. Miller", Eric Dumazet, Paolo Abeni, Linus Torvalds, Donald Hunter

Add a new command allowing to list PHYs that are present on a
netdevice's link. The list is an array of phyindex, per-netdevice unique
numbers that describe a PHY device.

Example messages :

 - No PHY on the link (Pure SFP interface) :

./cli.py --spec specs/ethtool.yaml --schema genetlink-legacy.yaml \
	 --do phy-list-get --json '{"header" : {"dev-name" : "eth3"}}'
{'header': {'dev-index': 5, 'dev-name': 'eth3'}, 'phy-count': 0}

 - One PHY on the link :

./cli.py --spec specs/ethtool.yaml --schema genetlink-legacy.yaml \
         --do phy-list-get --json '{"header" : {"dev-name" : "eth2"}}'
{'header': {'dev-index': 4, 'dev-name': 'eth2'},
 'phy-count': 1,
 'phy-indices': b'\x01\x00\x00\x00'}

 - 2 PHYs on the link (MAC - PHY - SFP[PHY]) :

./cli.py --spec specs/ethtool.yaml --schema genetlink-legacy.yaml \
         --do phy-list-get --json '{"header" : {"dev-name" : "eth0"}}'
{'header': {'dev-index': 2, 'dev-name': 'eth0'},
 'phy-count': 2,
 'phy-indices': b'\x02\x00\x00\x00\x01\x00\x00\x00'}

This PHY inddices can then be used by other netlink commands that would
target PHYs.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
 Documentation/netlink/specs/ethtool.yaml | 28 ++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
diff --git a/Documentation/netlink/specs/ethtool.yaml b/Documentation/netlink/specs/ethtool.yaml
index 837b565577ca..1139c88ed65c 100644
--- a/Documentation/netlink/specs/ethtool.yaml
+++ b/Documentation/netlink/specs/ethtool.yaml
@@ -942,6 +942,19 @@ attribute-sets:
       -
         name: burst-tmr
         type: u32
+  -
+    name: phy-list
+    attributes:
+      -
+        name: header
+        type: nest
+        nested-attributes: header
+      -
+        name: phy-count
+        type: u8
+      -
+        name: phy-indices
+        type: binary
 
 operations:
   enum-model: directional
@@ -1692,3 +1705,18 @@ operations:
       name: mm-ntf
       doc: Notification for change in MAC Merge configuration.
       notify: mm-get
+    -
+      name: phy-list-get
+      doc: Get list of PHY devices attached to an interface
+
+      attribute-set: phy-list
+
+      do: &phy-list-get-op
+        request:
+          attributes:
+            - header
+        reply:
+          attributes:
+            - header
+            - phy-count
+            - phy-indices
-- 
2.41.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help