From: Jakub Kicinski <kuba@kernel.org>
To: Stanislav Fomichev <stfomichev@gmail.com>
Cc: Stanislav Fomichev <sdf@fomichev.me>,
netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, linux-kernel@vger.kernel.org,
horms@kernel.org, donald.hunter@gmail.com, andrew+netdev@lunn.ch,
kory.maincent@bootlin.com, nicolas.dichtel@6wind.com
Subject: Re: [PATCH net-next 3/7] ynl: support directional specs in ynl-gen-c.py
Date: Wed, 13 Nov 2024 18:32:29 -0800 [thread overview]
Message-ID: <20241113183230.4d908a54@kernel.org> (raw)
In-Reply-To: <ZzU6ET2KV-D9Av0a@mini-arch>
On Wed, 13 Nov 2024 15:45:21 -0800 Stanislav Fomichev wrote:
> On 11/13, Jakub Kicinski wrote:
> > On Wed, 13 Nov 2024 10:10:19 -0800 Stanislav Fomichev wrote:
> > > - supported_models = ['unified']
> > > - if args.mode in ['user', 'kernel']:
> > > - supported_models += ['directional']
> > > - if parsed.msg_id_model not in supported_models:
> > > - print(f'Message enum-model {parsed.msg_id_model} not supported for {args.mode} generation')
> > > - os.sys.exit(1)
> >
> > Don't we still need to validate that it's one of the two options?
>
> I removed it because I'm assuming only two modes exist (and we support
> them both now). Are you suggesting it's better to future-proof it and
> still keep the check in case we add some new modes in the future? (or
> running against some rogue specs?)
TBH I don't remember how much precedent there is for C codegen
depending on jsonschema for spec input validation. My gut tells
me to do:
+ if family.msg_id_model == 'unified':
+ render_uapi_unified(family, cw, max_by_define, separate_ntf)
+ elif family.msg_id_model == 'directional':
+ render_uapi_directional(family, cw, max_by_define)
+ else:
+ raise ..
and then we can indeed drop the validation of the arg directly
next prev parent reply other threads:[~2024-11-14 2:32 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-13 18:10 [PATCH net-next 0/7] ethtool: generate uapi header from the spec Stanislav Fomichev
2024-11-13 18:10 ` [PATCH net-next 1/7] ynl: support attr-cnt-name attribute in legacy definitions Stanislav Fomichev
2024-11-13 20:03 ` Jakub Kicinski
2024-11-13 23:39 ` Stanislav Fomichev
2024-11-13 18:10 ` [PATCH net-next 2/7] ynl: support render " Stanislav Fomichev
2024-11-13 20:11 ` Jakub Kicinski
2024-11-13 23:40 ` Stanislav Fomichev
2024-11-14 2:33 ` Jakub Kicinski
2024-11-13 18:10 ` [PATCH net-next 3/7] ynl: support directional specs in ynl-gen-c.py Stanislav Fomichev
2024-11-13 20:12 ` Jakub Kicinski
2024-11-13 23:45 ` Stanislav Fomichev
2024-11-14 2:32 ` Jakub Kicinski [this message]
2024-11-13 18:10 ` [PATCH net-next 4/7] ynl: add missing pieces to ethtool spec to better match uapi header Stanislav Fomichev
2024-11-13 20:14 ` Jakub Kicinski
2024-11-13 23:48 ` Stanislav Fomichev
2024-11-13 18:10 ` [PATCH net-next 5/7] ethtool: separate definitions that are gonna be generated Stanislav Fomichev
2024-11-13 18:10 ` [PATCH net-next 6/7] ethtool: remove the comments that are not " Stanislav Fomichev
2024-11-13 18:10 ` [PATCH net-next 7/7] ethtool: regenerate uapi header from the spec Stanislav Fomichev
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=20241113183230.4d908a54@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kory.maincent@bootlin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nicolas.dichtel@6wind.com \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=stfomichev@gmail.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;
as well as URLs for NNTP newsgroup(s).