* [PATCH 6.12.y 0/4] tools: ynl: fix spec validation in 6.12.y
[not found] <2026060807-egging-prune-a3ae@gregkh>
@ 2026-10-10 3:51 ` Anton Danilov
2026-10-10 3:51 ` [PATCH 6.12.y 1/4] tools: ynl-gen: use names of constants in generated limits Anton Danilov
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Anton Danilov @ 2026-10-10 3:51 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, Sasha Levin, Thorsten Leemhuis, Chuck Lever,
Jakub Kicinski, Donald Hunter, Paolo Abeni, Remy D. Farley,
Rachel Menge, netdev
Two 6.12.y backports added YNL spec features that the 6.12.y YNL tools
do not support:
- 6.12.93: a2de9c7f01b3 ("net/handshake: Pass negative errno through
handshake_complete()") adds a "scope: kernel" definition to
handshake.yaml and uses it in "checks: max";
- 6.12.111: 45ca9f59b6c7 ("net: reject oversized tx_queue_len at
netlink parse time") adds "checks: max" to rt_link.yaml, which
netlink-raw.yaml does not allow.
Since 6.12.93 "make -C tools/net/ynl" fails on handshake:
jsonschema.exceptions.ValidationError: Additional properties are not allowed ('scope' was unexpected)
and since 6.12.111 the in-tree CLI fails on rt_link:
$ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/rt_link.yaml --dump getlink
jsonschema.exceptions.ValidationError: Additional properties are not allowed ('max' was unexpected)
Greg queued fbf5df34a4db ("tools: ynl: add scope qualifier for
definitions") for newer trees and asked for a 6.12.y backport in
https://lore.kernel.org/all/2026060807-egging-prune-a3ae@gregkh/
fbf5df34a4db alone is not enough: handshake.yaml then fails on the
constant name in "checks: max", and the 6.12.y generator cannot
resolve such names. Patches 1 and 2 add that, patch 3 is fbf5df34a4db.
Patch 4 is bf5a54bc0e3d ("doc/netlink: netlink-raw: Add max check"),
requested for 6.18.y in
https://lore.kernel.org/all/899bd843-fd19-418e-8913-91bfb6e760a2@linux.microsoft.com/
Patches 2-4 carry the upstream changes as is; in 6.12.y the generator
is tools/net/ynl/ynl-gen-c.py. Patch 1 needed adjustments, they are
described in its commit message. Like upstream, it also updates the
generated net/core/netdev-genl-gen.c (4294967295ULL -> U32_MAX,
2147483647ULL -> S32_MAX); the object file is byte-identical before
and after (x86_64 defconfig).
Tested on top of v6.12.112:
- all 19 specs validate against their schemas (2 fail before);
- make -C tools/net/ynl builds without warnings (fails before);
- tools/net/ynl/ynl-regen.sh -f regenerates all 24 generated kernel
and uAPI files with no changes, net/handshake/genl.c included;
- cli.py --spec rt_link.yaml --dump getlink works.
Jakub Kicinski (3):
tools: ynl-gen: use names of constants in generated limits
tools: ynl-gen: support limits using definitions
tools: ynl: add scope qualifier for definitions
Remy D. Farley (1):
doc/netlink: netlink-raw: Add max check
Documentation/netlink/genetlink-c.yaml | 14 ++++-
Documentation/netlink/genetlink-legacy.yaml | 14 ++++-
Documentation/netlink/genetlink.yaml | 14 ++++-
Documentation/netlink/netlink-raw.yaml | 20 +++++-
net/core/netdev-genl-gen.c | 4 +-
tools/net/ynl/ynl-gen-c.py | 70 ++++++++++++++++-----
6 files changed, 112 insertions(+), 24 deletions(-)
--
2.47.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 6.12.y 1/4] tools: ynl-gen: use names of constants in generated limits
2026-10-10 3:51 ` [PATCH 6.12.y 0/4] tools: ynl: fix spec validation in 6.12.y Anton Danilov
@ 2026-10-10 3:51 ` Anton Danilov
2026-10-10 3:51 ` [PATCH 6.12.y 2/4] tools: ynl-gen: support limits using definitions Anton Danilov
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Anton Danilov @ 2026-10-10 3:51 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, Sasha Levin, Thorsten Leemhuis, Chuck Lever,
Jakub Kicinski, Donald Hunter, Paolo Abeni, Remy D. Farley,
Rachel Menge, netdev
From: Jakub Kicinski <kuba@kernel.org>
commit bcbbfaa2612d7d0e9c3eafade5f6e93c3672f34f upstream.
YNL specs can use string expressions for limits, like s32-min
or u16-max. We convert all of those into their numeric values
when generating the code, which isn't always helpful. Try to
retain the string representations in the output. Any sort of
calculations still need the integers.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Joe Damato <jdamato@fastly.com>
Link: https://patch.msgid.link/20241010151248.2049755-1-kuba@kernel.org
[pabeni@redhat.com: regenerated netdev-genl-gen.c]
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[ Anton: 6.12.y has the older TypeBinary._attr_policy(), switch its
get_limit() calls to get_limit_str() there. Drop the
netdev_a_napi_defer_hard_irqs_range hunk from netdev-genl-gen.c,
that range does not exist in 6.12.y. The file now matches what
ynl-gen-c.py generates. ]
Assisted-by: LLM
Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
---
net/core/netdev-genl-gen.c | 4 ++--
tools/net/ynl/ynl-gen-c.py | 36 +++++++++++++++++++++++-------------
2 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/net/core/netdev-genl-gen.c b/net/core/netdev-genl-gen.c
index 8614988fc67b..b54f5948555f 100644
--- a/net/core/netdev-genl-gen.c
+++ b/net/core/netdev-genl-gen.c
@@ -14,12 +14,12 @@
/* Integer value ranges */
static const struct netlink_range_validation netdev_a_page_pool_id_range = {
.min = 1ULL,
- .max = 4294967295ULL,
+ .max = U32_MAX,
};
static const struct netlink_range_validation netdev_a_page_pool_ifindex_range = {
.min = 1ULL,
- .max = 2147483647ULL,
+ .max = S32_MAX,
};
/* Common nested types */
diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py
index c78f1c1bca75..00c05791a669 100755
--- a/tools/net/ynl/ynl-gen-c.py
+++ b/tools/net/ynl/ynl-gen-c.py
@@ -80,11 +80,21 @@ class Type(SpecAttr):
value = self.checks.get(limit, default)
if value is None:
return value
- elif value in self.family.consts:
+ if isinstance(value, int):
+ return value
+ if value in self.family.consts:
+ raise Exception("Resolving family constants not implemented, yet")
+ return limit_to_number(value)
+
+ def get_limit_str(self, limit, default=None, suffix=''):
+ value = self.checks.get(limit, default)
+ if value is None:
+ return ''
+ if isinstance(value, int):
+ return str(value) + suffix
+ if value in self.family.consts:
return c_upper(f"{self.family['name']}-{value}")
- if not isinstance(value, int):
- value = limit_to_number(value)
- return value
+ return c_upper(value)
def resolve(self):
if 'name-prefix' in self.attr:
@@ -358,11 +368,11 @@ class TypeScalar(Type):
elif 'full-range' in self.checks:
return f"NLA_POLICY_FULL_RANGE({policy}, &{c_lower(self.enum_name)}_range)"
elif 'range' in self.checks:
- return f"NLA_POLICY_RANGE({policy}, {self.get_limit('min')}, {self.get_limit('max')})"
+ return f"NLA_POLICY_RANGE({policy}, {self.get_limit_str('min')}, {self.get_limit_str('max')})"
elif 'min' in self.checks:
- return f"NLA_POLICY_MIN({policy}, {self.get_limit('min')})"
+ return f"NLA_POLICY_MIN({policy}, {self.get_limit_str('min')})"
elif 'max' in self.checks:
- return f"NLA_POLICY_MAX({policy}, {self.get_limit('max')})"
+ return f"NLA_POLICY_MAX({policy}, {self.get_limit_str('max')})"
return super()._attr_policy(policy)
def _attr_typol(self):
@@ -413,11 +423,11 @@ class TypeString(Type):
def _attr_policy(self, policy):
if 'exact-len' in self.checks:
- mem = 'NLA_POLICY_EXACT_LEN(' + str(self.get_limit('exact-len')) + ')'
+ mem = 'NLA_POLICY_EXACT_LEN(' + self.get_limit_str('exact-len') + ')'
else:
mem = '{ .type = ' + policy
if 'max-len' in self.checks:
- mem += ', .len = ' + str(self.get_limit('max-len'))
+ mem += ', .len = ' + self.get_limit_str('max-len')
mem += ', }'
return mem
@@ -465,11 +475,11 @@ class TypeBinary(Type):
def _attr_policy(self, policy):
if 'exact-len' in self.checks:
- mem = 'NLA_POLICY_EXACT_LEN(' + str(self.get_limit('exact-len')) + ')'
+ mem = 'NLA_POLICY_EXACT_LEN(' + self.get_limit_str('exact-len') + ')'
else:
mem = '{ '
if len(self.checks) == 1 and 'min-len' in self.checks:
- mem += '.len = ' + str(self.get_limit('min-len'))
+ mem += '.len = ' + self.get_limit_str('min-len')
elif len(self.checks) == 0:
mem += '.type = NLA_BINARY'
else:
@@ -2161,9 +2171,9 @@ def print_kernel_policy_ranges(family, cw):
cw.block_start(line=f'static const struct netlink_range_validation{sign} {c_lower(attr.enum_name)}_range =')
members = []
if 'min' in attr.checks:
- members.append(('min', str(attr.get_limit('min')) + suffix))
+ members.append(('min', attr.get_limit_str('min', suffix=suffix)))
if 'max' in attr.checks:
- members.append(('max', str(attr.get_limit('max')) + suffix))
+ members.append(('max', attr.get_limit_str('max', suffix=suffix)))
cw.write_struct_init(members)
cw.block_end(line=';')
cw.nl()
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 6.12.y 2/4] tools: ynl-gen: support limits using definitions
2026-10-10 3:51 ` [PATCH 6.12.y 0/4] tools: ynl: fix spec validation in 6.12.y Anton Danilov
2026-10-10 3:51 ` [PATCH 6.12.y 1/4] tools: ynl-gen: use names of constants in generated limits Anton Danilov
@ 2026-10-10 3:51 ` Anton Danilov
2026-10-10 3:51 ` [PATCH 6.12.y 3/4] tools: ynl: add scope qualifier for definitions Anton Danilov
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Anton Danilov @ 2026-10-10 3:51 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, Sasha Levin, Thorsten Leemhuis, Chuck Lever,
Jakub Kicinski, Donald Hunter, Paolo Abeni, Remy D. Farley,
Rachel Menge, netdev
From: Jakub Kicinski <kuba@kernel.org>
commit fa796178e5eb0078a9a6c36f60fd6494cfc3f81d upstream.
Support using defines / constants in integer checks.
Carolina will need this for rate API extensions.
Reported-by: Carolina Jubran <cjubran@nvidia.com>
Link: https://lore.kernel.org/1e886aaf-e1eb-4f1a-b7ef-f63b350a3320@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Link: https://patch.msgid.link/20250203215510.1288728-2-kuba@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[ Anton: the generator is tools/net/ynl/ynl-gen-c.py in 6.12.y. ]
Assisted-by: LLM
Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
---
Documentation/netlink/genetlink-c.yaml | 5 +++--
Documentation/netlink/genetlink-legacy.yaml | 5 +++--
Documentation/netlink/genetlink.yaml | 5 +++--
tools/net/ynl/ynl-gen-c.py | 5 ++++-
4 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/Documentation/netlink/genetlink-c.yaml b/Documentation/netlink/genetlink-c.yaml
index 4f803eaac6d8..12c60a6d88a7 100644
--- a/Documentation/netlink/genetlink-c.yaml
+++ b/Documentation/netlink/genetlink-c.yaml
@@ -14,9 +14,10 @@ $defs:
pattern: ^[0-9A-Za-z_-]+( - 1)?$
minimum: 0
len-or-limit:
- # literal int or limit based on fixed-width type e.g. u8-min, u16-max, etc.
+ # literal int, const name, or limit based on fixed-width type
+ # e.g. u8-min, u16-max, etc.
type: [ string, integer ]
- pattern: ^[su](8|16|32|64)-(min|max)$
+ pattern: ^[0-9A-Za-z_-]+$
minimum: 0
# Schema for specs
diff --git a/Documentation/netlink/genetlink-legacy.yaml b/Documentation/netlink/genetlink-legacy.yaml
index 8db0e22fa72c..d2ee1199bdf2 100644
--- a/Documentation/netlink/genetlink-legacy.yaml
+++ b/Documentation/netlink/genetlink-legacy.yaml
@@ -14,9 +14,10 @@ $defs:
pattern: ^[0-9A-Za-z_-]+( - 1)?$
minimum: 0
len-or-limit:
- # literal int or limit based on fixed-width type e.g. u8-min, u16-max, etc.
+ # literal int, const name, or limit based on fixed-width type
+ # e.g. u8-min, u16-max, etc.
type: [ string, integer ]
- pattern: ^[su](8|16|32|64)-(min|max)$
+ pattern: ^[0-9A-Za-z_-]+$
minimum: 0
# Schema for specs
diff --git a/Documentation/netlink/genetlink.yaml b/Documentation/netlink/genetlink.yaml
index b036227b46f1..e43e50dba2e4 100644
--- a/Documentation/netlink/genetlink.yaml
+++ b/Documentation/netlink/genetlink.yaml
@@ -14,9 +14,10 @@ $defs:
pattern: ^[0-9A-Za-z_-]+( - 1)?$
minimum: 0
len-or-limit:
- # literal int or limit based on fixed-width type e.g. u8-min, u16-max, etc.
+ # literal int, const name, or limit based on fixed-width type
+ # e.g. u8-min, u16-max, etc.
type: [ string, integer ]
- pattern: ^[su](8|16|32|64)-(min|max)$
+ pattern: ^[0-9A-Za-z_-]+$
minimum: 0
# Schema for specs
diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py
index 00c05791a669..7e6b38ada78f 100755
--- a/tools/net/ynl/ynl-gen-c.py
+++ b/tools/net/ynl/ynl-gen-c.py
@@ -83,7 +83,7 @@ class Type(SpecAttr):
if isinstance(value, int):
return value
if value in self.family.consts:
- raise Exception("Resolving family constants not implemented, yet")
+ return self.family.consts[value]["value"]
return limit_to_number(value)
def get_limit_str(self, limit, default=None, suffix=''):
@@ -93,6 +93,9 @@ class Type(SpecAttr):
if isinstance(value, int):
return str(value) + suffix
if value in self.family.consts:
+ const = self.family.consts[value]
+ if const.get('header'):
+ return c_upper(value)
return c_upper(f"{self.family['name']}-{value}")
return c_upper(value)
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 6.12.y 3/4] tools: ynl: add scope qualifier for definitions
2026-10-10 3:51 ` [PATCH 6.12.y 0/4] tools: ynl: fix spec validation in 6.12.y Anton Danilov
2026-10-10 3:51 ` [PATCH 6.12.y 1/4] tools: ynl-gen: use names of constants in generated limits Anton Danilov
2026-10-10 3:51 ` [PATCH 6.12.y 2/4] tools: ynl-gen: support limits using definitions Anton Danilov
@ 2026-10-10 3:51 ` Anton Danilov
2026-10-10 3:51 ` [PATCH 6.12.y 4/4] doc/netlink: netlink-raw: Add max check Anton Danilov
2026-10-11 16:48 ` [PATCH 6.12.y 0/4] tools: ynl: fix spec validation in 6.12.y Sasha Levin
4 siblings, 0 replies; 6+ messages in thread
From: Anton Danilov @ 2026-10-10 3:51 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, Sasha Levin, Thorsten Leemhuis, Chuck Lever,
Jakub Kicinski, Donald Hunter, Paolo Abeni, Remy D. Farley,
Rachel Menge, netdev
From: Jakub Kicinski <kuba@kernel.org>
commit fbf5df34a4dbcd09d433dd4f0916bf9b2ddb16de upstream.
Using definitions in kernel policies is awkward right now.
On one hand we want defines for max values and such.
On the other we don't have a way of adding kernel-only defines.
Adding unnecessary defines to uAPI is a bad idea, we won't
be able to delete them. And when it comes to policy user
space should just query it via the policy dump, not use
hard coded defines.
Add a "scope" property to definitions, which will let us tell
the codegen that a definition is for kernel use only. Support
following values:
- uapi: render into the uAPI header (default, today's behavior)
- kernel: render to kernel header only
- user: same as kernel but for the user-side generated header
Definitions may have a header property (definition is "external",
provided by existing header). Extend the scope to headers, too.
If definition has both scope and header properties we will only
generate the includes in the right scope.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Link: https://patch.msgid.link/20260510192904.3987113-8-kuba@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[ Anton: the generator is tools/net/ynl/ynl-gen-c.py in 6.12.y and its
context differs, the hunks were applied by hand without changes.
6.12.y lacks commit 3ff5258b9781 ("tools: ynl-gen: allow overriding
name-prefix for constants"), so render_uapi() ignores name-prefix of
constants while render_scoped_consts() honours it, as upstream does.
No spec in 6.12.y has a constant with name-prefix. ]
Assisted-by: LLM
Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
---
Documentation/netlink/genetlink-c.yaml | 9 ++++++
Documentation/netlink/genetlink-legacy.yaml | 9 ++++++
Documentation/netlink/genetlink.yaml | 9 ++++++
Documentation/netlink/netlink-raw.yaml | 9 ++++++
tools/net/ynl/ynl-gen-c.py | 31 +++++++++++++++++++--
5 files changed, 65 insertions(+), 2 deletions(-)
diff --git a/Documentation/netlink/genetlink-c.yaml b/Documentation/netlink/genetlink-c.yaml
index 12c60a6d88a7..228b6bacd3d0 100644
--- a/Documentation/netlink/genetlink-c.yaml
+++ b/Documentation/netlink/genetlink-c.yaml
@@ -69,6 +69,15 @@ properties:
header:
description: For C-compatible languages, header which already defines this value.
type: string
+ scope:
+ description: |
+ Visibility of this definition. "uapi" (default) renders into
+ the uAPI header, "kernel" renders into the kernel-side
+ generated header, "user" renders into the user-side
+ generated header. When combined with `header:`, the
+ definition is not rendered, and the named header is
+ included only by code matching the scope.
+ enum: [ uapi, kernel, user ]
type:
enum: [ const, enum, flags ]
doc:
diff --git a/Documentation/netlink/genetlink-legacy.yaml b/Documentation/netlink/genetlink-legacy.yaml
index d2ee1199bdf2..c9f1b8120912 100644
--- a/Documentation/netlink/genetlink-legacy.yaml
+++ b/Documentation/netlink/genetlink-legacy.yaml
@@ -80,6 +80,15 @@ properties:
header:
description: For C-compatible languages, header which already defines this value.
type: string
+ scope:
+ description: |
+ Visibility of this definition. "uapi" (default) renders into
+ the uAPI header, "kernel" renders into the kernel-side
+ generated header, "user" renders into the user-side
+ generated header. When combined with `header:`, the
+ definition is not rendered, and the named header is
+ included only by code matching the scope.
+ enum: [ uapi, kernel, user ]
type:
enum: [ const, enum, flags, struct ] # Trim
doc:
diff --git a/Documentation/netlink/genetlink.yaml b/Documentation/netlink/genetlink.yaml
index e43e50dba2e4..179e6000c0a2 100644
--- a/Documentation/netlink/genetlink.yaml
+++ b/Documentation/netlink/genetlink.yaml
@@ -52,6 +52,15 @@ properties:
header:
description: For C-compatible languages, header which already defines this value.
type: string
+ scope:
+ description: |
+ Visibility of this definition. "uapi" (default) renders into
+ the uAPI header, "kernel" renders into the kernel-side
+ generated header, "user" renders into the user-side
+ generated header. When combined with `header:`, the
+ definition is not rendered, and the named header is
+ included only by code matching the scope.
+ enum: [ uapi, kernel, user ]
type:
enum: [ const, enum, flags ]
doc:
diff --git a/Documentation/netlink/netlink-raw.yaml b/Documentation/netlink/netlink-raw.yaml
index 914aa1c0a273..d8ae7f7365b0 100644
--- a/Documentation/netlink/netlink-raw.yaml
+++ b/Documentation/netlink/netlink-raw.yaml
@@ -75,6 +75,15 @@ properties:
header:
description: For C-compatible languages, header which already defines this value.
type: string
+ scope:
+ description: |
+ Visibility of this definition. "uapi" (default) renders into
+ the uAPI header, "kernel" renders into the kernel-side
+ generated header, "user" renders into the user-side
+ generated header. When combined with `header:`, the
+ definition is not rendered, and the named header is
+ included only by code matching the scope.
+ enum: [ uapi, kernel, user ]
type:
enum: [ const, enum, flags, struct ] # Trim
doc:
diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py
index 7e6b38ada78f..07786d7e9b0b 100755
--- a/tools/net/ynl/ynl-gen-c.py
+++ b/tools/net/ynl/ynl-gen-c.py
@@ -2432,6 +2432,8 @@ def render_uapi(family, cw):
for const in family['definitions']:
if const.get('header'):
continue
+ if const.get('scope', 'uapi') != 'uapi':
+ continue
if const['type'] != 'const':
cw.writes_defines(defines)
@@ -2565,6 +2567,25 @@ def render_uapi(family, cw):
cw.p(f'#endif /* {hdr_prot} */')
+def render_scoped_consts(family, cw, scope):
+ defines = []
+ for const in family['definitions']:
+ if const['type'] != 'const':
+ continue
+ if const.get('header'):
+ continue
+ if const.get('scope') != scope:
+ continue
+ name_pfx = const.get('name-prefix', f"{family.ident_name}-")
+ defines.append([
+ c_upper(family.get('c-define-name',
+ f"{name_pfx}{const['name']}")),
+ const['value']])
+ if defines:
+ cw.writes_defines(defines)
+ cw.nl()
+
+
def _render_user_ntf_entry(ri, op):
ri.cw.block_start(line=f"[{op.enum_name}] = ")
ri.cw.p(f".alloc_sz\t= sizeof({type_name(ri, 'event')}),")
@@ -2718,8 +2739,12 @@ def main():
cw.p('#include "ynl.h"')
headers = [parsed.uapi_header]
for definition in parsed['definitions']:
- if 'header' in definition:
- headers.append(definition['header'])
+ if 'header' not in definition:
+ continue
+ scope = definition.get('scope', 'uapi')
+ if scope != 'uapi' and scope != args.mode:
+ continue
+ headers.append(definition['header'])
for one in headers:
cw.p(f"#include <{one}>")
cw.nl()
@@ -2731,6 +2756,7 @@ def main():
for one in args.user_header:
cw.p(f'#include "{one}"')
else:
+ render_scoped_consts(parsed, cw, 'user')
cw.p('struct ynl_sock;')
cw.nl()
render_user_family(parsed, cw, True)
@@ -2738,6 +2764,7 @@ def main():
if args.mode == "kernel":
if args.header:
+ render_scoped_consts(parsed, cw, 'kernel')
for _, struct in sorted(parsed.pure_nested_structs.items()):
if struct.request:
cw.p('/* Common nested types */')
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 6.12.y 4/4] doc/netlink: netlink-raw: Add max check
2026-10-10 3:51 ` [PATCH 6.12.y 0/4] tools: ynl: fix spec validation in 6.12.y Anton Danilov
` (2 preceding siblings ...)
2026-10-10 3:51 ` [PATCH 6.12.y 3/4] tools: ynl: add scope qualifier for definitions Anton Danilov
@ 2026-10-10 3:51 ` Anton Danilov
2026-10-11 16:48 ` [PATCH 6.12.y 0/4] tools: ynl: fix spec validation in 6.12.y Sasha Levin
4 siblings, 0 replies; 6+ messages in thread
From: Anton Danilov @ 2026-10-10 3:51 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, Sasha Levin, Thorsten Leemhuis, Chuck Lever,
Jakub Kicinski, Donald Hunter, Paolo Abeni, Remy D. Farley,
Rachel Menge, netdev
From: "Remy D. Farley" <one-d-wide@protonmail.com>
commit bf5a54bc0e3d8962474fcd611f1266eba036232f upstream.
Add definitions for max check and len-or-limit type, the same as in other
specifications.
Suggested-by: Donald Hunter <donald.hunter@gmail.com>
Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
Signed-off-by: Remy D. Farley <one-d-wide@protonmail.com>
Link: https://patch.msgid.link/20260303195638.381642-2-one-d-wide@protonmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
---
Documentation/netlink/netlink-raw.yaml | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/Documentation/netlink/netlink-raw.yaml b/Documentation/netlink/netlink-raw.yaml
index d8ae7f7365b0..d6d58ac63b7c 100644
--- a/Documentation/netlink/netlink-raw.yaml
+++ b/Documentation/netlink/netlink-raw.yaml
@@ -13,6 +13,12 @@ $defs:
type: [ string, integer ]
pattern: ^[0-9A-Za-z_-]+( - 1)?$
minimum: 0
+ len-or-limit:
+ # literal int, const name, or limit based on fixed-width type
+ # e.g. u8-min, u16-max, etc.
+ type: [ string, integer ]
+ pattern: ^[0-9A-Za-z_-]+$
+ minimum: 0
# Schema for specs
title: Protocol
@@ -270,7 +276,10 @@ properties:
type: string
min:
description: Min value for an integer attribute.
- type: integer
+ $ref: '#/$defs/len-or-limit'
+ max:
+ description: Max value for an integer attribute.
+ $ref: '#/$defs/len-or-limit'
min-len:
description: Min length for a binary attribute.
$ref: '#/$defs/len-or-define'
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 6.12.y 0/4] tools: ynl: fix spec validation in 6.12.y
2026-10-10 3:51 ` [PATCH 6.12.y 0/4] tools: ynl: fix spec validation in 6.12.y Anton Danilov
` (3 preceding siblings ...)
2026-10-10 3:51 ` [PATCH 6.12.y 4/4] doc/netlink: netlink-raw: Add max check Anton Danilov
@ 2026-10-11 16:48 ` Sasha Levin
4 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2026-10-11 16:48 UTC (permalink / raw)
To: stable
Cc: Sasha Levin, Greg Kroah-Hartman, Thorsten Leemhuis, Chuck Lever,
Jakub Kicinski, Donald Hunter, Paolo Abeni, Remy D. Farley,
Rachel Menge, netdev, Anton Danilov
> Two 6.12.y backports added YNL spec features that the 6.12.y YNL tools
> do not support:
Queued the series for 6.12, thanks.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-10-11 16:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <2026060807-egging-prune-a3ae@gregkh>
2026-10-10 3:51 ` [PATCH 6.12.y 0/4] tools: ynl: fix spec validation in 6.12.y Anton Danilov
2026-10-10 3:51 ` [PATCH 6.12.y 1/4] tools: ynl-gen: use names of constants in generated limits Anton Danilov
2026-10-10 3:51 ` [PATCH 6.12.y 2/4] tools: ynl-gen: support limits using definitions Anton Danilov
2026-10-10 3:51 ` [PATCH 6.12.y 3/4] tools: ynl: add scope qualifier for definitions Anton Danilov
2026-10-10 3:51 ` [PATCH 6.12.y 4/4] doc/netlink: netlink-raw: Add max check Anton Danilov
2026-10-11 16:48 ` [PATCH 6.12.y 0/4] tools: ynl: fix spec validation in 6.12.y Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox