* [PATCH net-next v2] tools: ynl: render operations-level fixed-header in docs
@ 2026-11-17 3:16 Hangbin Liu
0 siblings, 0 replies; only message in thread
From: Hangbin Liu @ 2026-11-17 3:16 UTC (permalink / raw)
To: David Ahern, Ido Schimmel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Donald Hunter
Cc: Hangbin Liu, Wessel Jacobi, Randy Dunlap, linux-doc, netdev,
linux-kernel, Hangbin Liu
From: Hangbin Liu <liuhangbin@kylinos.cn>
The doc generator only rendered keys on each operations list entry, so
operations-level fixed-header (the family default) never showed up in the
generated HTML. Add a fallback to emit the default_fixed_header on ops
that do not set their own.
After update, rt-route, rt-addr, rt-rule, rt-nexthop and ovs_* all
shows the fixed header correctly in generated html doc.
Reported-by: Wessel Jacobi <wessel@jacobi.pw>
Closes: https://patch.msgid.link/8610ee11-e1dc-481a-9654-11188a06786a@jacobi.pw
Signed-off-by: Hangbin Liu <liuhangbin@kylinos.cn>
---
I rebuilt the HTML documentation, the `fixed-header` shows up correctly
for rt-addr.yaml, rt-route.yaml, rt-rule.yaml, rt-nexthop.yaml, ovs_*.yaml
---
Changes in v2:
- Fix the issue in doc_generator instead of specific yaml file
- Link to v1: https://patch.msgid.link/20261112-ynl_fixed_header-v1-1-8475ea19e409@kylinos.cn
---
| 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
--git a/tools/net/ynl/pyynl/lib/doc_generator.py b/tools/net/ynl/pyynl/lib/doc_generator.py
index 74f5d408e048..0bd83da9a654 100644
--- a/tools/net/ynl/pyynl/lib/doc_generator.py
+++ b/tools/net/ynl/pyynl/lib/doc_generator.py
@@ -17,7 +17,7 @@
2) YAML Netlink (YNL) doc generator: Generate docs from YAML data
"""
-from typing import Any, Dict, List
+from typing import Any, Dict, List, Optional
import yaml
LINE_STR = '__lineno__'
@@ -181,7 +181,8 @@ class YnlDocGenerator:
return "\n".join(lines)
- def parse_operations(self, operations: List[Dict[str, Any]], namespace: str) -> str:
+ def parse_operations(self, operations: List[Dict[str, Any]], namespace: str,
+ default_fixed_header: Optional[str] = None) -> str:
"""Parse operations block"""
preprocessed = ["name", "doc", "title", "do", "dump", "flags", "event"]
linkable = ["fixed-header", "attribute-set"]
@@ -206,6 +207,13 @@ class YnlDocGenerator:
if key in linkable:
value = self.fmt.rst_ref(namespace, key, value)
lines.append(self.fmt.rst_fields(key, value, 0))
+
+ # Show the family-wide default when the op does not set its own
+ if default_fixed_header and "fixed-header" not in operation:
+ value = self.fmt.rst_ref(namespace, "fixed-header",
+ default_fixed_header)
+ lines.append(self.fmt.rst_fields("fixed-header", value, 0))
+
if 'flags' in operation:
lines.append(self.fmt.rst_fields('flags',
self.fmt.rst_list_inline(operation['flags'])))
@@ -367,8 +375,10 @@ class YnlDocGenerator:
# Operations
if "operations" in obj:
lines.append(self.fmt.rst_subtitle("Operations"))
- lines.append(self.parse_operations(obj["operations"]["list"],
- family))
+ lines.append(self.parse_operations(
+ obj["operations"]["list"],
+ family,
+ obj["operations"].get("fixed-header")))
# Multicast groups
if "mcast-groups" in obj:
---
base-commit: c88fd6989aea9237a60a4859139a265bfb7ddc0b
change-id: 20261112-ynl_fixed_header-2d7acfcb54f8
Best regards,
--
Hangbin Liu <liuhangbin@kylinos.cn>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-17 3:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-17 3:16 [PATCH net-next v2] tools: ynl: render operations-level fixed-header in docs Hangbin Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®