Message ID | 20241113181023.2030098-3-sdf@fomichev.me (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | ethtool: generate uapi header from the spec | expand |
On Wed, 13 Nov 2024 10:10:18 -0800 Stanislav Fomichev wrote: > To allow omitting some of the attributes in the final generated file. > Some of the definitions that seemingly belong to the spec > are defined in the ethtool.h. To minimize the amount of churn, > skip rendering a similar (and conflicting) definition from the spec. Hm, is this mostly for enums and definitions? We have header: for this. "header" should tell the codegen that the define is "foreign" and should be skipped in uAPI, and in -user codegen we need an include. Coincidentally make -C tools/net/ynl/ -j In file included from ethtool-user.c:9: ethtool-user.h:13:10: fatal error: linux/ethetool_netlink_generated.h: No such file or directory 13 | #include <linux/ethetool_netlink_generated.h> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
On 11/13, Jakub Kicinski wrote: > On Wed, 13 Nov 2024 10:10:18 -0800 Stanislav Fomichev wrote: > > To allow omitting some of the attributes in the final generated file. > > Some of the definitions that seemingly belong to the spec > > are defined in the ethtool.h. To minimize the amount of churn, > > skip rendering a similar (and conflicting) definition from the spec. > > Hm, is this mostly for enums and definitions? We have header: for this. > "header" should tell the codegen that the define is "foreign" and > should be skipped in uAPI, and in -user codegen we need an include. > > Coincidentally > > make -C tools/net/ynl/ -j > > In file included from ethtool-user.c:9: > ethtool-user.h:13:10: fatal error: linux/ethetool_netlink_generated.h: No such file or directory > 13 | #include <linux/ethetool_netlink_generated.h> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I don't see any existing usage (or maybe I'm looking at the wrong place), but will spend some time reading the c-gen part. Worst case I might refresh this thread with more questions.
On Wed, 13 Nov 2024 15:40:00 -0800 Stanislav Fomichev wrote: > > In file included from ethtool-user.c:9: > > ethtool-user.h:13:10: fatal error: linux/ethetool_netlink_generated.h: No such file or directory > > 13 | #include <linux/ethetool_netlink_generated.h> > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > I don't see any existing usage (or maybe I'm looking at the wrong > place), but will spend some time reading the c-gen part. Worst case I > might refresh this thread with more questions. Could be the magic in the makefiles that tries to include uAPI headers directly that needs updating.
diff --git a/Documentation/netlink/genetlink-legacy.yaml b/Documentation/netlink/genetlink-legacy.yaml index 83f874ae7198..cdda9e6f4062 100644 --- a/Documentation/netlink/genetlink-legacy.yaml +++ b/Documentation/netlink/genetlink-legacy.yaml @@ -83,6 +83,11 @@ additionalProperties: False enum: [ const, enum, flags, struct ] # Trim doc: type: string + # Start genetlink-legacy + render: + description: Render this definition (true by default) or not. + type: boolean + # End genetlink-legacy # For const value: description: For const - the value. diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py index 210972b4796a..0de918c7f18d 100755 --- a/tools/net/ynl/ynl-gen-c.py +++ b/tools/net/ynl/ynl-gen-c.py @@ -798,6 +798,7 @@ from lib import SpecFamily, SpecAttrSet, SpecAttr, SpecOperation, SpecEnumSet, S self.user_type = 'int' self.value_pfx = yaml.get('name-prefix', f"{family.ident_name}-{yaml['name']}-") + self.render = yaml.get('render', True) self.attr_cnt_name = yaml.get('attr-cnt-name', None) super().__init__(family, yaml) @@ -2437,6 +2438,9 @@ _C_KW = { if const['type'] == 'enum' or const['type'] == 'flags': enum = family.consts[const['name']] + if not enum.render: + continue + if enum.has_doc(): if enum.has_entry_doc(): cw.p('/**')
To allow omitting some of the attributes in the final generated file. Some of the definitions that seemingly belong to the spec are defined in the ethtool.h. To minimize the amount of churn, skip rendering a similar (and conflicting) definition from the spec. Signed-off-by: Stanislav Fomichev <sdf@fomichev.me> --- Documentation/netlink/genetlink-legacy.yaml | 5 +++++ tools/net/ynl/ynl-gen-c.py | 4 ++++ 2 files changed, 9 insertions(+)