summaryrefslogtreecommitdiff
path: root/tools/net/ynl/lib/nlspec.py
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2023-03-30 23:29:58 -0700
committerJakub Kicinski <kuba@kernel.org>2023-03-30 23:30:18 -0700
commitdee1efb301f4c380f454bc84c2258b3d594c9615 (patch)
tree36f9bc892d5c61025457cd0bfe68d80c3f2ef464 /tools/net/ynl/lib/nlspec.py
parent709d0b880ceae9503ce4282fcfaf4cb59c6dd267 (diff)
parentf3d07b02b2b8eba5b0e168405614e15cd6617a43 (diff)
Merge branch 'tools-ynl-fill-in-some-gaps-of-ethtool-spec'
Stanislav Fomichev says: ==================== tools: ynl: fill in some gaps of ethtool spec I was trying to fill in the spec while exploring ethtool API for some related work. I don't think I'll have the patience to fill in the rest, so decided to share whatever I currently have. Patches 1-2 add the be16 + spec. Patches 3-4 implement an ethtool-like python tool to test the spec. Patches 3-4 are there because it felt more fun do the tool instead of writing the actual tests; feel free to drop it; sharing mostly to show that the spec is not a complete nonsense. The spec is not 100% complete, see patch 2 for what's missing. I was hoping to finish the stats-get message, but I'm too dump to implement bitmask marshaling (multi-attr). ==================== Link: https://lore.kernel.org/r/20230329221655.708489-1-sdf@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/net/ynl/lib/nlspec.py')
-rw-r--r--tools/net/ynl/lib/nlspec.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/net/ynl/lib/nlspec.py b/tools/net/ynl/lib/nlspec.py
index 06a906d74f0e..a0241add3839 100644
--- a/tools/net/ynl/lib/nlspec.py
+++ b/tools/net/ynl/lib/nlspec.py
@@ -163,6 +163,7 @@ class SpecAttr(SpecElement):
self.is_multi = yaml.get('multi-attr', False)
self.struct_name = yaml.get('struct')
self.sub_type = yaml.get('sub-type')
+ self.byte_order = yaml.get('byte-order')
class SpecAttrSet(SpecElement):
@@ -443,6 +444,15 @@ class SpecFamily(SpecElement):
self.msgs[op.name] = op
+ def find_operation(self, name):
+ """
+ For a given operation name, find and return operation spec.
+ """
+ for op in self.yaml['operations']['list']:
+ if name == op['name']:
+ return op
+ return None
+
def resolve(self):
self.resolve_up(super())