summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2023-06-07 23:23:58 +0300
committerJakub Kicinski <kuba@kernel.org>2023-06-09 00:01:10 +0300
commit37487f93b12551f82547e04b32d8d285818ea7a0 (patch)
tree10cdf9e73e40d1513af8a1b2de377c6efdfb7ca6 /tools
parent6afaa0ef9b0e446fde14a1424f2c2858484a3601 (diff)
downloadlinux-37487f93b12551f82547e04b32d8d285818ea7a0.tar.xz
tools: ynl-gen: inherit struct use info
We only render parse and netlink generation helpers as needed, to avoid generating dead code. Propagate the information from first- and second-layer attribute sets onto all children. Otherwise devlink won't work, it has a lot more levels of nesting. Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/net/ynl/ynl-gen-c.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py
index d9c74a678df8..1a97cd517116 100755
--- a/tools/net/ynl/ynl-gen-c.py
+++ b/tools/net/ynl/ynl-gen-c.py
@@ -896,6 +896,14 @@ class Family(SpecFamily):
pns_key_seen.add(name)
else:
pns_key_list.append(name)
+ # Propagate the request / reply
+ for attr_set, struct in reversed(self.pure_nested_structs.items()):
+ for _, spec in self.attr_sets[attr_set].items():
+ if 'nested-attributes' in spec:
+ child = self.pure_nested_structs.get(spec['nested-attributes'])
+ if child:
+ child.request |= struct.request
+ child.reply |= struct.reply
def _load_all_notify(self):
for op_name, op in self.ops.items():