[PATCH net-next v5 09/16] netlink: specs: Introduce new netlink command to get current timestamp

Köry Maincent posted 16 patches 2 years, 2 months ago
There is a newer version of this series
[PATCH net-next v5 09/16] netlink: specs: Introduce new netlink command to get current timestamp
Posted by Köry Maincent 2 years, 2 months ago
From: Kory Maincent <kory.maincent@bootlin.com>

Add a new commands allowing to get the current time stamping on a
netdevice's link.

Example usage :
./ynl/cli.py --spec netlink/specs/ethtool.yaml --no-schema --do ts-get \
	     --json '{"header":{"dev-name":"eth0"}}'
{'header': {'dev-index': 3, 'dev-name': 'eth0'}, 'ts-layer': 1}

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
 Documentation/netlink/specs/ethtool.yaml | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/Documentation/netlink/specs/ethtool.yaml b/Documentation/netlink/specs/ethtool.yaml
index 837b565577ca..49ee028e97ca 100644
--- a/Documentation/netlink/specs/ethtool.yaml
+++ b/Documentation/netlink/specs/ethtool.yaml
@@ -942,6 +942,16 @@ attribute-sets:
       -
         name: burst-tmr
         type: u32
+  -
+    name: ts
+    attributes:
+      -
+        name: header
+        type: nest
+        nested-attributes: header
+      -
+        name: ts-layer
+        type: u32
 
 operations:
   enum-model: directional
@@ -1692,3 +1702,17 @@ operations:
       name: mm-ntf
       doc: Notification for change in MAC Merge configuration.
       notify: mm-get
+    -
+      name: ts-get
+      doc: Get current timestamp
+
+      attribute-set: ts
+
+      do:
+        request:
+          attributes:
+            - header
+        reply:
+          attributes: &ts
+            - header
+            - ts-layer
-- 
2.25.1
Re: [PATCH net-next v5 09/16] netlink: specs: Introduce new netlink command to get current timestamp
Posted by Florian Fainelli 2 years, 2 months ago
On 10/9/23 08:51, Köry Maincent wrote:
> From: Kory Maincent <kory.maincent@bootlin.com>
> 
> Add a new commands allowing to get the current time stamping on a
> netdevice's link.
> 
> Example usage :
> ./ynl/cli.py --spec netlink/specs/ethtool.yaml --no-schema --do ts-get \
> 	     --json '{"header":{"dev-name":"eth0"}}'
> {'header': {'dev-index': 3, 'dev-name': 'eth0'}, 'ts-layer': 1}
> 
> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>

This is small enough you could probably fold this patch into patch 8.
-- 
Florian

Re: [PATCH net-next v5 09/16] netlink: specs: Introduce new netlink command to get current timestamp
Posted by Köry Maincent 2 years, 2 months ago
On Mon, 9 Oct 2023 14:21:42 -0700
Florian Fainelli <florian.fainelli@broadcom.com> wrote:

> On 10/9/23 08:51, Köry Maincent wrote:
> > From: Kory Maincent <kory.maincent@bootlin.com>
> > 
> > Add a new commands allowing to get the current time stamping on a
> > netdevice's link.
> > 
> > Example usage :
> > ./ynl/cli.py --spec netlink/specs/ethtool.yaml --no-schema --do ts-get \
> > 	     --json '{"header":{"dev-name":"eth0"}}'
> > {'header': {'dev-index': 3, 'dev-name': 'eth0'}, 'ts-layer': 1}
> > 
> > Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>  
> 
> This is small enough you could probably fold this patch into patch 8.

I like having it separate. Indeed the ynl tool does not have a proper usage
documentation. I took quite some times to me to understand how use it
especially with bitset. Using the commit messages to add examples like that
would have help me a lot in the process.
I could also squash the example in the previous commit message but then it
become more noisy.
What do you think?