#
f32c821a |
| 20-Aug-2024 |
Paolo Abeni <pabeni@redhat.com> |
tools: ynl: lift an assumption about spec file name
Currently the parsing code generator assumes that the yaml specification file name and the main 'name' attribute carried inside correspond, that i
tools: ynl: lift an assumption about spec file name
Currently the parsing code generator assumes that the yaml specification file name and the main 'name' attribute carried inside correspond, that is the field is the c-name representation of the file basename.
The above assumption held true within the current tree, but will be hopefully broken soon by the upcoming net shaper specification. Additionally, it makes the field 'name' itself useless.
Lift the assumption, always computing the generated include file name from the generated c file name.
Signed-off-by: Paolo Abeni <pabeni@redhat.com> Link: https://patch.msgid.link/24da5a3596d814beeb12bd7139a6b4f89756cc19.1724165948.git.pabeni@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
8c5a9f29 |
| 02-Jul-2024 |
Paolo Abeni <pabeni@redhat.com> |
tools: ynl: use ident name for Family, too.
This allow consistent naming convention between Family and others element's name.
Signed-off-by: Paolo Abeni <pabeni@redhat.com> Link: https://patch.msgi
tools: ynl: use ident name for Family, too.
This allow consistent naming convention between Family and others element's name.
Signed-off-by: Paolo Abeni <pabeni@redhat.com> Link: https://patch.msgid.link/9bbcab3094970b371bd47aa18481ae6ca5a93687.1719930479.git.pabeni@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
924ee531 |
| 05-Jun-2024 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: make user space policies const
Dan, who's working on C++ YNL, pointed out that the C code does not make policies const. Sprinkle some 'const's around.
Reported-by: Dan Melnic <dmm@meta.
tools: ynl: make user space policies const
Dan, who's working on C++ YNL, pointed out that the C code does not make policies const. Sprinkle some 'const's around.
Reported-by: Dan Melnic <dmm@meta.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Reviewed-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
ec8c2574 |
| 10-May-2024 |
Antonio Quartulli <a@unstable.cc> |
ynl: ensure exact-len value is resolved
For type String and Binary we are currently usinig the exact-len limit value as is without attempting any name resolution. However, the spec may specify the n
ynl: ensure exact-len value is resolved
For type String and Binary we are currently usinig the exact-len limit value as is without attempting any name resolution. However, the spec may specify the name of a constant rather than an actual value, which would result in using the constant name as is and thus break the policy.
Ensure the limit value is passed to get_limit(), which will always attempt resolving the name before printing the policy rule.
Signed-off-by: Antonio Quartulli <a@unstable.cc> Link: https://lore.kernel.org/r/20240510232202.24051-1-a@unstable.cc Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
aa6485d8 |
| 04-Apr-2024 |
Hangbin Liu <liuhangbin@gmail.com> |
ynl: rename array-nest to indexed-array
Some implementations, like bonding, has nest array with same attr type. To support all kinds of entries under one nest array. As discussed[1], let's rename ar
ynl: rename array-nest to indexed-array
Some implementations, like bonding, has nest array with same attr type. To support all kinds of entries under one nest array. As discussed[1], let's rename array-nest to indexed-array, and assuming the value is a nest by passing the type via sub-type.
[1] https://lore.kernel.org/netdev/20240312100105.16a59086@kernel.org/
Suggested-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> Link: https://lore.kernel.org/r/20240404063114.1221532-2-liuhangbin@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
f6c8f5e8 |
| 21-Mar-2024 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: fix setting presence bits in simple nests
When we set members of simple nested structures in requests we need to set "presence" bits for all the nesting layers below. This has nothing to
tools: ynl: fix setting presence bits in simple nests
When we set members of simple nested structures in requests we need to set "presence" bits for all the nesting layers below. This has nothing to do with the presence type of the last layer.
Fixes: be5bea1cc0bf ("net: add basic C code generators for Netlink") Reviewed-by: Breno Leitao <leitao@debian.org> Link: https://lore.kernel.org/r/20240321020214.1250202-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
ba980f8d |
| 08-Mar-2024 |
Jakub Kicinski <kuba@kernel.org> |
netlink: specs: support generating code for genl socket priv
The family struct is auto-generated for new families, support use of the sock_priv_* mechanism added in commit a731132424ad ("genetlink:
netlink: specs: support generating code for genl socket priv
The family struct is auto-generated for new families, support use of the sock_priv_* mechanism added in commit a731132424ad ("genetlink: introduce per-sock family private storage").
For example if the family wants to use struct sk_buff as its private struct (unrealistic but just for illustration), it would add to its spec:
kernel-family: headers: [ "linux/skbuff.h" ] sock-priv: struct sk_buff
ynl-gen-c will declare the appropriate priv size and hook in function prototypes to be implemented by the family.
Link: https://lore.kernel.org/r/20240308190319.2523704-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
8d0c314c |
| 11-Mar-2024 |
Hangbin Liu <liuhangbin@gmail.com> |
tools: ynl-gen: support using pre-defined values in attr checks
Support using pre-defined values in checks so we don't need to use hard code number for the string, binary length. e.g. we have a defi
tools: ynl-gen: support using pre-defined values in attr checks
Support using pre-defined values in checks so we don't need to use hard code number for the string, binary length. e.g. we have a definition like
#define TEAM_STRING_MAX_LEN 32
Which defined in yaml like:
definitions: - name: string-max-len type: const value: 32
It can be used in the attribute-sets like
attribute-sets: - name: attr-option name-prefix: team-attr-option- attributes: - name: name type: string checks: len: string-max-len
With this patch it will be converted to
[TEAM_ATTR_OPTION_NAME] = { .type = NLA_STRING, .len = TEAM_STRING_MAX_LEN, }
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> Link: https://lore.kernel.org/r/20240311140727.109562-1-liuhangbin@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
6fe7de5e |
| 06-Mar-2024 |
Donald Hunter <donald.hunter@gmail.com> |
tools/net/ynl: Fix c codegen for array-nest
ynl-gen-c generates e.g. 'calloc(mcast_groups, sizeof(*dst->mcast_groups))' for array-nest attrs when it should be 'n_mcast_groups'.
Add a 'n_' prefix in
tools/net/ynl: Fix c codegen for array-nest
ynl-gen-c generates e.g. 'calloc(mcast_groups, sizeof(*dst->mcast_groups))' for array-nest attrs when it should be 'n_mcast_groups'.
Add a 'n_' prefix in the generated code for array-nests.
Signed-off-by: Donald Hunter <donald.hunter@gmail.com> Link: https://lore.kernel.org/r/20240306231046.97158-4-donald.hunter@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
73395b43 |
| 27-Feb-2024 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: remove the libmnl dependency
We don't use libmnl any more.
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Link: https://lore.kernel.org/r/20240227223032.1835527-15-kuba@kernel.or
tools: ynl: remove the libmnl dependency
We don't use libmnl any more.
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Link: https://lore.kernel.org/r/20240227223032.1835527-15-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
50042e80 |
| 27-Feb-2024 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: switch away from MNL_CB_*
Create a local version of the MNL_CB_* parser control values.
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Link: https://lore.kernel.org/r/20240227223
tools: ynl: switch away from MNL_CB_*
Create a local version of the MNL_CB_* parser control values.
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Link: https://lore.kernel.org/r/20240227223032.1835527-13-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
dd0973d7 |
| 27-Feb-2024 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: switch away from mnl_cb_t
All YNL parsing callbacks take struct ynl_parse_arg as the argument. Make that official by using a local callback type instead of mnl_cb_t.
Acked-by: Nicolas D
tools: ynl: switch away from mnl_cb_t
All YNL parsing callbacks take struct ynl_parse_arg as the argument. Make that official by using a local callback type instead of mnl_cb_t.
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Link: https://lore.kernel.org/r/20240227223032.1835527-12-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
9c29a113 |
| 27-Feb-2024 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl-gen: remove unused parse code
Commit f2ba1e5e2208 ("tools: ynl-gen: stop generating common notification handlers") removed the last caller of the parse_cb_run() helper. We no longer need
tools: ynl-gen: remove unused parse code
Commit f2ba1e5e2208 ("tools: ynl-gen: stop generating common notification handlers") removed the last caller of the parse_cb_run() helper. We no longer need to export ynl_cb_array.
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Link: https://lore.kernel.org/r/20240227223032.1835527-8-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
d62c5d48 |
| 27-Feb-2024 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: make yarg the first member of struct ynl_dump_state
All YNL parsing code expects a pointer to struct ynl_parse_arg AKA yarg. For dump was pass in struct ynl_dump_state, which works fine,
tools: ynl: make yarg the first member of struct ynl_dump_state
All YNL parsing code expects a pointer to struct ynl_parse_arg AKA yarg. For dump was pass in struct ynl_dump_state, which works fine, because struct ynl_dump_state and struct ynl_parse_arg have identical layout for the members that matter.. but it's a bit hacky.
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Link: https://lore.kernel.org/r/20240227223032.1835527-7-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
7600875f |
| 27-Feb-2024 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: create local ARRAY_SIZE() helper
libc doesn't have an ARRAY_SIZE() create one locally.
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Link: https://lore.kernel.org/r/202402272230
tools: ynl: create local ARRAY_SIZE() helper
libc doesn't have an ARRAY_SIZE() create one locally.
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Link: https://lore.kernel.org/r/20240227223032.1835527-6-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
0b3ece44 |
| 27-Feb-2024 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: create local nlmsg access helpers
Create helpers for accessing payloads of struct nlmsg. Use them instead of the libmnl ones.
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Link:
tools: ynl: create local nlmsg access helpers
Create helpers for accessing payloads of struct nlmsg. Use them instead of the libmnl ones.
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Link: https://lore.kernel.org/r/20240227223032.1835527-5-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
66fcdad0 |
| 27-Feb-2024 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: create local for_each helpers
Create ynl_attr_for_each*() iteration helpers. Use them instead of the mnl ones.
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Link: https://lore.k
tools: ynl: create local for_each helpers
Create ynl_attr_for_each*() iteration helpers. Use them instead of the mnl ones.
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Link: https://lore.kernel.org/r/20240227223032.1835527-4-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
5600c580 |
| 27-Feb-2024 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: create local attribute helpers
Don't use mnl attr helpers, we're trying to remove the libmnl dependency. Create both signed and unsigned helpers, libmnl had unsigned helpers, so code gen
tools: ynl: create local attribute helpers
Don't use mnl attr helpers, we're trying to remove the libmnl dependency. Create both signed and unsigned helpers, libmnl had unsigned helpers, so code generator no longer needs the mnl_type() hack.
The new helpers are written from first principles, but are hopefully not too buggy.
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Link: https://lore.kernel.org/r/20240227223032.1835527-3-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
7b5fe80e |
| 13-Dec-2023 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl-gen: print prototypes for recursive stuff
We avoid printing forward declarations and prototypes for most types by sorting things topologically. But if structs nest we do need the forward
tools: ynl-gen: print prototypes for recursive stuff
We avoid printing forward declarations and prototypes for most types by sorting things topologically. But if structs nest we do need the forward declarations, there's no other way.
Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://lore.kernel.org/r/20231213231432.2944749-9-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
461f25a2 |
| 13-Dec-2023 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl-gen: store recursive nests by a pointer
To avoid infinite nesting store recursive structs by pointer. If recursive struct is placed in the op directly - the first instance can be stored b
tools: ynl-gen: store recursive nests by a pointer
To avoid infinite nesting store recursive structs by pointer. If recursive struct is placed in the op directly - the first instance can be stored by value. That makes the code much less of a pain for majority of practical uses.
Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://lore.kernel.org/r/20231213231432.2944749-8-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
aa75783b |
| 13-Dec-2023 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl-gen: re-sort ignoring recursive nests
We try to keep the structures and helpers "topologically sorted", to avoid forward declarations. When recursive nests are at play we need to sort twi
tools: ynl-gen: re-sort ignoring recursive nests
We try to keep the structures and helpers "topologically sorted", to avoid forward declarations. When recursive nests are at play we need to sort twice, because structs which end up being marked as recursive will get a full set of forward declarations, so we should ignore them for the purpose of sorting.
Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://lore.kernel.org/r/20231213231432.2944749-7-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
38329fcf |
| 13-Dec-2023 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl-gen: record information about recursive nests
Track which nests are recursive. Non-recursive nesting gets rendered in C as directly nested structs. For recursive ones we need to put a poi
tools: ynl-gen: record information about recursive nests
Track which nests are recursive. Non-recursive nesting gets rendered in C as directly nested structs. For recursive ones we need to put a pointer in, rather than full struct.
Track this information, no change to generated code, yet.
Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://lore.kernel.org/r/20231213231432.2944749-6-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
f967a498 |
| 13-Dec-2023 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl-gen: fill in implementations for TypeUnused
Fill in more empty handlers for TypeUnused. When 'unused' attr gets specified in a nested set we have to cleanly skip it during code generation
tools: ynl-gen: fill in implementations for TypeUnused
Fill in more empty handlers for TypeUnused. When 'unused' attr gets specified in a nested set we have to cleanly skip it during code generation.
Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://lore.kernel.org/r/20231213231432.2944749-5-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
f6805072 |
| 13-Dec-2023 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl-gen: support fixed headers in genetlink
Support genetlink families using simple fixed headers. Assume fixed header is identical for all ops of the family for now.
Fixed headers are added
tools: ynl-gen: support fixed headers in genetlink
Support genetlink families using simple fixed headers. Assume fixed header is identical for all ops of the family for now.
Fixed headers are added to the request and reply structs as a _hdr member, and copied to/from netlink messages appropriately.
Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://lore.kernel.org/r/20231213231432.2944749-4-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
139c163b |
| 13-Dec-2023 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl-gen: use enum user type for members and args
Commit 30c902001534 ("tools: ynl-gen: use enum name from the spec") added pre-cooked user type for enums. Use it to fix ignoring enum-name pro
tools: ynl-gen: use enum user type for members and args
Commit 30c902001534 ("tools: ynl-gen: use enum name from the spec") added pre-cooked user type for enums. Use it to fix ignoring enum-name provided in the spec.
This changes a type in struct ethtool_tunnel_udp_entry but is generally inconsequential for current families.
Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://lore.kernel.org/r/20231213231432.2944749-3-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|