Netdev List
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, pabeni@redhat.com, davem@davemloft.net,
	edumazet@google.com, moshe@nvidia.com, saeedm@nvidia.com,
	idosch@nvidia.com, petrm@nvidia.com
Subject: Re: [patch net-next 1/8] ynl-gen-c.py: fix rendering of validate field
Date: Wed, 2 Aug 2023 08:41:48 +0200	[thread overview]
Message-ID: <ZMn6rLwl8tL+RmNh@nanopsycho> (raw)
In-Reply-To: <20230801112530.277d3090@kernel.org>

Tue, Aug 01, 2023 at 08:25:30PM CEST, kuba@kernel.org wrote:
>On Tue,  1 Aug 2023 16:19:00 +0200 Jiri Pirko wrote:
>> From: Jiri Pirko <jiri@nvidia.com>
>> 
>> For split ops, do and dump has different value in validate field. Fix
>> the rendering so for do op, only "strict" is filled out and for dump op,
>> "strict" is prefixed by "dump-".
>> 
>> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
>> ---
>>  tools/net/ynl/ynl-gen-c.py | 10 +++++++++-
>>  1 file changed, 9 insertions(+), 1 deletion(-)
>> 
>> diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py
>> index 650be9b8b693..1c36d0c935da 100755
>> --- a/tools/net/ynl/ynl-gen-c.py
>> +++ b/tools/net/ynl/ynl-gen-c.py
>> @@ -1988,9 +1988,17 @@ def print_kernel_op_table(family, cw):
>>                  cw.block_start()
>>                  members = [('cmd', op.enum_name)]
>>                  if 'dont-validate' in op:
>> +                    dont_validate = []
>> +                    for x in op['dont-validate']:
>> +                        if op_mode == 'do' and x == 'dump':
>> +                            continue
>> +                        if op_mode == "dump" and x == 'strict':
>> +                            x = 'dump-' + x
>> +                        dont_validate.append(x)
>> +
>>                      members.append(('validate',
>>                                      ' | '.join([c_upper('genl-dont-validate-' + x)
>> -                                                for x in op['dont-validate']])), )
>> +                                                for x in dont_validate])), )
>>                  name = c_lower(f"{family.name}-nl-{op_name}-{op_mode}it")
>>                  if 'pre' in op[op_mode]:
>>                      members.append((cb_names[op_mode]['pre'], c_lower(op[op_mode]['pre'])))
>
>I was hoping we can delete GENL_DONT_VALIDATE_DUMP_STRICT
>but there is one cmd (TIPC_NL_LINK_GET) which
>sets GENL_DONT_VALIDATE_STRICT and nothing about the dump.

I need GENL_DONT_VALIDATE_STRICT for devlink dump selectors as well. I
don't want to break existing user that may pass garbage attributes.

>
>To express something like that we should add dump-strict as
>an allowed flag explicitly rather than doing the auto-prepending

Yeah, that was an option. But strict means GENL_DONT_VALIDATE_STRICT
for do and GENL_DONT_VALIDATE_DUMP_STRICT for dump. That is why I
decided to go this way.

I will add dump-strict if you prefer it, I don't care.

>-- 
>pw-bot: cr

  reply	other threads:[~2023-08-02  6:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-01 14:18 [patch net-next 0/8] devlink: use spec to generate split ops Jiri Pirko
2023-08-01 14:19 ` [patch net-next 1/8] ynl-gen-c.py: fix rendering of validate field Jiri Pirko
2023-08-01 18:25   ` Jakub Kicinski
2023-08-02  6:41     ` Jiri Pirko [this message]
2023-08-01 14:19 ` [patch net-next 2/8] ynl-gen-c.py: allow directional model for kernel mode Jiri Pirko
2023-08-01 18:27   ` Jakub Kicinski
2023-08-02  6:42     ` Jiri Pirko
2023-08-02  8:51     ` Jiri Pirko
2023-08-01 14:19 ` [patch net-next 3/8] devlink: rename devlink_nl_ops to devlink_nl_small_ops Jiri Pirko
2023-08-01 14:19 ` [patch net-next 4/8] devlink: add split ops generated according to spec Jiri Pirko
2023-08-01 18:56   ` Jakub Kicinski
2023-08-02  6:44     ` Jiri Pirko
2023-08-01 14:19 ` [patch net-next 5/8] devlink: include the generated netlink header Jiri Pirko
2023-08-01 14:19 ` [patch net-next 6/8] devlink: rename couple of doit netlink callbacks to match generated names Jiri Pirko
2023-08-01 14:19 ` [patch net-next 7/8] devlink: introduce couple of dumpit callback for split ops Jiri Pirko
2023-08-01 14:19 ` [patch net-next 8/8] devlink: use generated split ops and remove duplicated commands from small ops Jiri Pirko

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=ZMn6rLwl8tL+RmNh@nanopsycho \
    --to=jiri@resnulli.us \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=moshe@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=saeedm@nvidia.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