summaryrefslogtreecommitdiff
path: root/tools/net/ynl/lib/nlspec.py
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2023-06-09 14:43:35 -0700
committerDavid S. Miller <davem@davemloft.net>2023-06-12 11:01:02 +0100
commit008bcd6835a2f00a46bc91cad32de50d57d1b196 (patch)
treea615cea5fc885d36b7efa9df250935e895b82348 /tools/net/ynl/lib/nlspec.py
parentb30a1f305b7bfde19c2ddbb053b51705eef65553 (diff)
tools: ynl-gen: support excluding tricky ops
The ethtool family has a small handful of quite tricky ops and a lot of simple very useful ops. Teach ynl-gen to skip ops so that we can bypass the tricky ones. Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/net/ynl/lib/nlspec.py')
-rw-r--r--tools/net/ynl/lib/nlspec.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/net/ynl/lib/nlspec.py b/tools/net/ynl/lib/nlspec.py
index c5d4a6d476a0..1ba572cae27b 100644
--- a/tools/net/ynl/lib/nlspec.py
+++ b/tools/net/ynl/lib/nlspec.py
@@ -334,7 +334,7 @@ class SpecFamily(SpecElement):
consts dict of all constants/enums
fixed_header string, optional name of family default fixed header struct
"""
- def __init__(self, spec_path, schema_path=None):
+ def __init__(self, spec_path, schema_path=None, exclude_ops=None):
with open(spec_path, "r") as stream:
prefix = '# SPDX-License-Identifier: '
first = stream.readline().strip()
@@ -349,6 +349,8 @@ class SpecFamily(SpecElement):
super().__init__(self, spec)
+ self._exclude_ops = exclude_ops if exclude_ops else []
+
self.proto = self.yaml.get('protocol', 'genetlink')
self.msg_id_model = self.yaml['operations'].get('enum-model', 'unified')
@@ -449,7 +451,13 @@ class SpecFamily(SpecElement):
req_val = None
if rsp_val == rsp_val_next:
rsp_val = None
- op = self.new_operation(elem, req_val, rsp_val)
+
+ skip = False
+ for exclude in self._exclude_ops:
+ skip |= bool(exclude.match(elem['name']))
+ if not skip:
+ op = self.new_operation(elem, req_val, rsp_val)
+
req_val = req_val_next
rsp_val = rsp_val_next