Skip to content

Commit

Permalink
tools: ynl-gen: render rsp_parse() helpers if cmd has only dump op
Browse files Browse the repository at this point in the history
Due to the check in RenderInfo class constructor, type_consistent
flag is set to False to avoid rendering the same response parsing
helper for do and dump ops. However, in case there is no do, the helper
needs to be rendered for dump op. So split check to achieve that.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://lore.kernel.org/r/20231021112711.660606-4-jiri@resnulli.us
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jiri Pirko authored and Jakub Kicinski committed Oct 23, 2023
1 parent 4e2846f commit 2260d39
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tools/net/ynl/ynl-gen-c.py
Original file line number Diff line number Diff line change
Expand Up @@ -1112,10 +1112,13 @@ def __init__(self, cw, family, ku_space, op, op_mode, attr_set=None):

# 'do' and 'dump' response parsing is identical
self.type_consistent = True
if op_mode != 'do' and 'dump' in op and 'do' in op:
if ('reply' in op['do']) != ('reply' in op["dump"]):
self.type_consistent = False
elif 'reply' in op['do'] and op["do"]["reply"] != op["dump"]["reply"]:
if op_mode != 'do' and 'dump' in op:
if 'do' in op:
if ('reply' in op['do']) != ('reply' in op["dump"]):
self.type_consistent = False
elif 'reply' in op['do'] and op["do"]["reply"] != op["dump"]["reply"]:
self.type_consistent = False
else:
self.type_consistent = False

self.attr_set = attr_set
Expand Down

0 comments on commit 2260d39

Please sign in to comment.