mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hangbin Liu <hangbin.liu@linux.dev>
To: David Ahern <dsahern@kernel.org>,
	Ido Schimmel <idosch@nvidia.com>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,  Simon Horman <horms@kernel.org>,
	Donald Hunter <donald.hunter@gmail.com>
Cc: Hangbin Liu <hangbin.liu@linux.dev>,
	Wessel Jacobi <wessel@jacobi.pw>,
	 Randy Dunlap <rdunlap@infradead.org>,
	linux-doc@vger.kernel.org,  netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	 Hangbin Liu <liuhangbin@kylinos.cn>
Subject: [PATCH net-next v2] tools: ynl: render operations-level fixed-header in docs
Date: Tue, 17 Nov 2026 11:16:40 +0800	[thread overview]
Message-ID: <20261117-ynl_fixed_header-v2-1-e7ac247956ee@kylinos.cn> (raw)

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
---
 tools/net/ynl/pyynl/lib/doc_generator.py | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --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>


                 reply	other threads:[~2026-11-17  3:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261117-ynl_fixed_header-v2-1-e7ac247956ee@kylinos.cn \
    --to=hangbin.liu@linux.dev \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuhangbin@kylinos.cn \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=wessel@jacobi.pw \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®