From: Demos Ra via B4 Relay <devnull+demosthenes.ra.gmail.com@kernel.org>
To: Donald Hunter <donald.hunter@gmail.com>,
Jakub Kicinski <kuba@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>, David Ahern <dsahern@kernel.org>,
Ido Schimmel <idosch@nvidia.com>,
netdev@vger.kernel.org, Demos Ra <demosthenes.ra@gmail.com>
Subject: [PATCH net 1/2] tools: ynl-gen-c: handle classic notifications without a matching request
Date: Sun, 25 Oct 2026 00:13:55 +0700 [thread overview]
Message-ID: <20261025-ynl-ntf-bucket-v1-1-65aef308d62c@gmail.com> (raw)
In-Reply-To: <20261025-ynl-ntf-bucket-v1-0-65aef308d62c@gmail.com>
From: Demos Ra <demosthenes.ra@gmail.com>
For classic Netlink families the notification table in the generated
user code is indexed by the message type the kernel sends. Since
commit 49398830a4aa ("tools: ynl-gen: support CRUD-like notifications
for classic Netlink") ynl-gen writes each index as the name of the
request that has the same message type, and fails if no request has
it:
$ ./tools/net/ynl/pyynl/ynl_gen_c.py --mode user --source \
--spec Documentation/netlink/specs/rt-nexthop.yaml
...
crud_op = ri.family.req_by_value[op.rsp_value]
KeyError: 116
rt-nexthop's newnexthopbucket-ntf is the only such notification: the
kernel sends it as RTM_NEWNEXTHOPBUCKET (116), and no request uses
that message type.
When no request matches, write the message type as a number, as
put_op_name() already does for messages whose request and reply types
differ. The generated code for every spec in the tree is unchanged.
Signed-off-by: Demos Ra <demosthenes.ra@gmail.com>
---
tools/net/ynl/pyynl/ynl_gen_c.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen_c.py
index 4aca51396a9e..a009a842fb36 100755
--- a/tools/net/ynl/pyynl/ynl_gen_c.py
+++ b/tools/net/ynl/pyynl/ynl_gen_c.py
@@ -3409,9 +3409,11 @@ def render_scoped_consts(family, cw, scope):
def _render_user_ntf_entry(ri, op):
if not ri.family.is_classic():
ri.cw.block_start(line=f"[{op.enum_name}] = ")
- else:
+ elif op.rsp_value in ri.family.req_by_value:
crud_op = ri.family.req_by_value[op.rsp_value]
ri.cw.block_start(line=f"[{crud_op.enum_name}] = ")
+ else:
+ ri.cw.block_start(line=f"[{op.rsp_value}] = ")
ri.cw.p(f".alloc_sz\t= sizeof({type_name(ri, 'event')}),")
ri.cw.p(f".cb\t\t= {op_prefix(ri, 'reply', deref=True)}_parse,")
ri.cw.p(f".policy\t\t= &{ri.struct['reply'].render_name}_nest,")
--
2.53.0
next prev parent reply other threads:[~2026-10-24 17:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-24 17:13 [PATCH net 0/2] tools: ynl: generate code for rt-nexthop bucket notifications Demos Ra via B4 Relay
2026-10-24 17:13 ` Demos Ra via B4 Relay [this message]
2026-10-24 17:13 ` [PATCH net 2/2] " Demos Ra via B4 Relay
2026-10-26 22:59 ` [PATCH net 0/2] " Jakub Kicinski
2026-10-27 1:29 ` Demos Ra
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=20261025-ynl-ntf-bucket-v1-1-65aef308d62c@gmail.com \
--to=devnull+demosthenes.ra.gmail.com@kernel.org \
--cc=davem@davemloft.net \
--cc=demosthenes.ra@gmail.com \
--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=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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