From: Jakub Kicinski <kuba@kernel.org>
To: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
davem@davemloft.net, pabeni@redhat.com, edumazet@google.com,
chuck.lever@oracle.com
Subject: Re: [PATCH net-next] tools: ynl-gen: generate docs for <name>_max/_mask enums
Date: Tue, 13 Jun 2023 17:59:28 -0700 [thread overview]
Message-ID: <20230613175928.4ea56833@kernel.org> (raw)
In-Reply-To: <20230613231709.150622-3-arkadiusz.kubalewski@intel.com>
On Wed, 14 Jun 2023 01:17:09 +0200 Arkadiusz Kubalewski wrote:
> Including ynl generated uapi header files into source kerneldocs
> (rst files in Documentation/) produces warnings during documentation
> builds (i.e. make htmldocs)
>
> Prevent warnings by generating also description for enums where rander_max
> was selected.
Do you reckon that documenting the meta-values makes sense, or should
we throw a:
/* private: */
comment in front of them so that kdoc ignores them? Does user space
have any use for those? If we want to document them...
> diff --git a/include/uapi/linux/netdev.h b/include/uapi/linux/netdev.h
> index 639524b59930..d78f7ae95092 100644
> --- a/include/uapi/linux/netdev.h
> +++ b/include/uapi/linux/netdev.h
> @@ -24,6 +24,7 @@
> * XDP buffer support in the driver napi callback.
> * @NETDEV_XDP_ACT_NDO_XMIT_SG: This feature informs if netdev implements
> * non-linear XDP buffer support in ndo_xdp_xmit callback.
> + * @NETDEV_XDP_ACT_MASK: valid values mask
... I think we need to include some sort of indication that the value
will change as the uAPI is extended. Unlike the other values which are
set in stone, so to speak. "mask of currently defines values" ? Dunno.
> */
> enum netdev_xdp_act {
> NETDEV_XDP_ACT_BASIC = 1,
> diff --git a/tools/include/uapi/linux/netdev.h b/tools/include/uapi/linux/netdev.h
> index 639524b59930..d78f7ae95092 100644
> --- a/tools/include/uapi/linux/netdev.h
> +++ b/tools/include/uapi/linux/netdev.h
> @@ -24,6 +24,7 @@
> * XDP buffer support in the driver napi callback.
> * @NETDEV_XDP_ACT_NDO_XMIT_SG: This feature informs if netdev implements
> * non-linear XDP buffer support in ndo_xdp_xmit callback.
> + * @NETDEV_XDP_ACT_MASK: valid values mask
> */
> enum netdev_xdp_act {
> NETDEV_XDP_ACT_BASIC = 1,
> diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py
> index 0b5e0802a9a7..0d396bf98c27 100755
> --- a/tools/net/ynl/ynl-gen-c.py
> +++ b/tools/net/ynl/ynl-gen-c.py
> @@ -2011,6 +2011,7 @@ def render_uapi(family, cw):
> # Write kdoc for enum and flags (one day maybe also structs)
> if const['type'] == 'enum' or const['type'] == 'flags':
> enum = family.consts[const['name']]
> + name_pfx = const.get('name-prefix', f"{family.name}-{const['name']}-")
>
> if enum.has_doc():
> cw.p('/**')
> @@ -2022,10 +2023,18 @@ def render_uapi(family, cw):
> if entry.has_doc():
> doc = '@' + entry.c_name + ': ' + entry['doc']
> cw.write_doc_line(doc)
> + if const.get('render-max', False):
> + if const['type'] == 'flags':
> + doc = '@' + c_upper(name_pfx + 'mask') + ': valid values mask'
> + cw.write_doc_line(doc)
> + else:
> + doc = '@' + c_upper(name_pfx + 'max') + ': max valid value'
> + cw.write_doc_line(doc)
> + doc = '@__' + c_upper(name_pfx + 'max') + ': do not use'
This one is definitely a candidate for /* private: */
> + cw.write_doc_line(doc)
> cw.p(' */')
>
> uapi_enum_start(family, cw, const, 'name')
> - name_pfx = const.get('name-prefix', f"{family.name}-{const['name']}-")
> for entry in enum.entries.values():
> suffix = ','
> if entry.value_change:
--
pw-bot: cr
next prev parent reply other threads:[~2023-06-14 0:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-13 23:17 [PATCH net-next] tools: ynl-gen: fix nested policy attribute type Arkadiusz Kubalewski
2023-06-13 23:17 ` [PATCH net-next] tools: ynl-gen: fix NLA_POLICY_MAX on enums with value Arkadiusz Kubalewski
2023-06-13 23:17 ` [PATCH net-next] tools: ynl-gen: generate docs for <name>_max/_mask enums Arkadiusz Kubalewski
2023-06-14 0:59 ` Jakub Kicinski [this message]
2023-06-14 12:48 ` Kubalewski, Arkadiusz
2023-06-14 17:38 ` Jakub Kicinski
2023-06-14 22:11 ` Kubalewski, Arkadiusz
2023-06-15 4:17 ` Jakub Kicinski
2023-06-14 0:50 ` [PATCH net-next] tools: ynl-gen: fix nested policy attribute type Jakub Kicinski
2023-06-14 12:28 ` Kubalewski, Arkadiusz
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=20230613175928.4ea56833@kernel.org \
--to=kuba@kernel.org \
--cc=arkadiusz.kubalewski@intel.com \
--cc=chuck.lever@oracle.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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).