Skip to content

Commit

Permalink
ynl-gen-c.py: filter rendering of validate field values for split ops
Browse files Browse the repository at this point in the history
For split ops, do and dump has different meaningful values in
validate field.

Fix the rendering to allow the values per op type as follows:
do: strict
dump: dump, strict-dump

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/r/20230803111340.1074067-3-jiri@resnulli.us
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jiri Pirko authored and Jakub Kicinski committed Aug 4, 2023
1 parent 78c96d7 commit dc7b81a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tools/net/ynl/ynl-gen-c.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 in ['dump', 'dump-strict']:
continue
if op_mode == "dump" and x == 'strict':
continue
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'])))
Expand Down

0 comments on commit dc7b81a

Please sign in to comment.