From: Donald Hunter <donald.hunter@gmail•com>
To: Jakub Kicinski <kuba@kernel•org>
Cc: davem@davemloft•net, netdev@vger•kernel.org,
edumazet@google•com, pabeni@redhat•com
Subject: Re: [PATCH net-next 4/5] tools: ynl-gen: support empty attribute lists
Date: Thu, 24 Aug 2023 14:10:13 +0100 [thread overview]
Message-ID: <m21qfsh9hm.fsf@gmail.com> (raw)
In-Reply-To: <20230824003056.1436637-5-kuba@kernel.org> (Jakub Kicinski's message of "Wed, 23 Aug 2023 17:30:55 -0700")
Jakub Kicinski <kuba@kernel•org> writes:
> Differentiate between empty list and None for member lists.
> New families may want to create request responses with no attribute.
> If we treat those the same as None we end up rendering
> a full parsing policy in user space, instead of an empty one.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel•org>
> ---
> tools/net/ynl/ynl-gen-c.py | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py
> index 13d06931c045..9209bdcca9c6 100755
> --- a/tools/net/ynl/ynl-gen-c.py
> +++ b/tools/net/ynl/ynl-gen-c.py
> @@ -615,7 +615,7 @@ from lib import SpecFamily, SpecAttrSet, SpecAttr, SpecOperation, SpecEnumSet, S
>
> self.attr_list = []
> self.attrs = dict()
> - if type_list:
> + if type_list is not None:
> for t in type_list:
> self.attr_list.append((t, self.attr_set[t]),)
> else:
> @@ -1543,7 +1543,14 @@ _C_KW = {
>
> ri.cw.write_func_prot('int', f'{op_prefix(ri, "reply", deref=deref)}_parse', func_args)
>
> - _multi_parse(ri, ri.struct["reply"], init_lines, local_vars)
> + if ri.struct["reply"].member_list():
> + _multi_parse(ri, ri.struct["reply"], init_lines, local_vars)
> + else:
> + # Empty reply
> + ri.cw.block_start()
> + ri.cw.p('return MNL_CB_OK;')
> + ri.cw.block_end()
> + ri.cw.nl()
>
>
> def print_req(ri):
Reviewed-by: Donald Hunter <donald.hunter@gmail•com>
next prev parent reply other threads:[~2023-08-24 13:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-24 0:30 [PATCH net-next 0/5] tools: ynl: handful of forward looking updates Jakub Kicinski
2023-08-24 0:30 ` [PATCH net-next 1/5] tools: ynl: allow passing binary data Jakub Kicinski
2023-08-24 13:09 ` Donald Hunter
2023-08-24 0:30 ` [PATCH net-next 2/5] tools: ynl-gen: set length of binary fields Jakub Kicinski
2023-08-24 13:16 ` Donald Hunter
2023-08-24 0:30 ` [PATCH net-next 3/5] tools: ynl-gen: fix collecting global policy attrs Jakub Kicinski
2023-08-24 13:11 ` Donald Hunter
2023-08-24 0:30 ` [PATCH net-next 4/5] tools: ynl-gen: support empty attribute lists Jakub Kicinski
2023-08-24 13:10 ` Donald Hunter [this message]
2023-08-24 0:30 ` [PATCH net-next 5/5] netlink: specs: fix indent in fou Jakub Kicinski
2023-08-24 13:17 ` Donald Hunter
2023-08-25 2:10 ` [PATCH net-next 0/5] tools: ynl: handful of forward looking updates patchwork-bot+netdevbpf
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=m21qfsh9hm.fsf@gmail.com \
--to=donald.hunter@gmail$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=edumazet@google$(echo .)com \
--cc=kuba@kernel$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=pabeni@redhat$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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