netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: kuba@kernel.org, pabeni@redhat.com, davem@davemloft.net,
	edumazet@google.com, moshe@nvidia.com, saeedm@nvidia.com,
	idosch@nvidia.com, petrm@nvidia.com
Subject: [patch net-next 1/8] ynl-gen-c.py: fix rendering of validate field
Date: Tue,  1 Aug 2023 16:19:00 +0200	[thread overview]
Message-ID: <20230801141907.816280-2-jiri@resnulli.us> (raw)
In-Reply-To: <20230801141907.816280-1-jiri@resnulli.us>

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'])))
-- 
2.41.0


  reply	other threads:[~2023-08-01 14:19 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 ` Jiri Pirko [this message]
2023-08-01 18:25   ` [patch net-next 1/8] ynl-gen-c.py: fix rendering of validate field Jakub Kicinski
2023-08-02  6:41     ` Jiri Pirko
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=20230801141907.816280-2-jiri@resnulli.us \
    --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;
as well as URLs for NNTP newsgroup(s).