From: Jakub Kicinski <kuba@kernel.org>
To: Donald Hunter <donald.hunter@gmail.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Jonathan Corbet <corbet@lwn.net>,
linux-doc@vger.kernel.org,
Jacob Keller <jacob.e.keller@intel.com>,
donald.hunter@redhat.com
Subject: Re: [PATCH net-next v1 2/6] doc/netlink: Add sub-message support to netlink-raw
Date: Fri, 1 Dec 2023 17:53:14 -0800 [thread overview]
Message-ID: <20231201175314.26cfcefa@kernel.org> (raw)
In-Reply-To: <20231130214959.27377-3-donald.hunter@gmail.com>
On Thu, 30 Nov 2023 21:49:54 +0000 Donald Hunter wrote:
> Add a 'sub-message' attribute type with a selector that supports
> polymorphic attribute formats for raw netlink families like tc.
>
> A sub-message attribute uses the value of another attribute as a
> selector key to choose the right sub-message format. For example if the
> following attribute has already been decoded:
>
> { "kind": "gre" }
>
> and we encounter the following attribute spec:
>
> -
> name: data
> type: sub-message
> sub-message: linkinfo-data-msg
> selector: kind
>
> Then we look for a sub-message definition called 'linkinfo-data-msg' and
> use the value of the 'kind' attribute i.e. 'gre' as the key to choose
> the correct format for the sub-message:
>
> sub-messages:
> name: linkinfo-data-msg
> formats:
> -
> value: bridge
> attribute-set: linkinfo-bridge-attrs
> -
> value: gre
> attribute-set: linkinfo-gre-attrs
> -
> value: geneve
> attribute-set: linkinfo-geneve-attrs
>
> This would decode the attribute value as a sub-message with the
> attribute-set called 'linkinfo-gre-attrs' as the attribute space.
>
> A sub-message can have an optional 'fixed-header' followed by zero or
> more attributes from an attribute-set. For example the following
> 'tc-options-msg' sub-message defines message formats that use a mixture
> of fixed-header, attribute-set or both together:
>
> sub-messages:
> -
> name: tc-options-msg
> formats:
> -
> value: bfifo
> fixed-header: tc-fifo-qopt
> -
> value: cake
> attribute-set: tc-cake-attrs
> -
> value: netem
> fixed-header: tc-netem-qopt
> attribute-set: tc-netem-attrs
SGTM, could you add all the info from the commit message somewhere
in the documentation? Perhaps a new section at the end of
Documentation/userspace-api/netlink/specs.rst
> @@ -261,6 +262,17 @@ properties:
> description: Name of the struct type used for the attribute.
> type: string
> # End genetlink-legacy
> + # Start netlink-raw
> + sub-message:
> + description:
> + Name of the sub-message definition to use for the attribute.
> + type: string
> + selector:
> + description:
> + Name of the attribute to use for dynamic selection of sub-message
> + format specifier.
> + type: string
We can leave it for later either way, but have you seen any selectors
which would key on an integer, rather than a string?
next prev parent reply other threads:[~2023-12-02 1:53 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-30 21:49 [PATCH net-next v1 0/6] tools/net/ynl: Add 'sub-message' support to ynl Donald Hunter
2023-11-30 21:49 ` [PATCH net-next v1 1/6] doc/netlink: Add bitfield32, s8, s16 to the netlink-raw schema Donald Hunter
2023-12-02 1:47 ` Jakub Kicinski
2023-11-30 21:49 ` [PATCH net-next v1 2/6] doc/netlink: Add sub-message support to netlink-raw Donald Hunter
2023-12-02 1:53 ` Jakub Kicinski [this message]
2023-12-04 15:58 ` Donald Hunter
2023-11-30 21:49 ` [PATCH net-next v1 3/6] tools/net/ynl: Add 'sub-message' attribute decoding to ynl Donald Hunter
2023-12-02 2:00 ` Jakub Kicinski
2023-12-04 15:59 ` Donald Hunter
2023-11-30 21:49 ` [PATCH net-next v1 4/6] tools/net/ynl: Add binary and pad support to structs for tc Donald Hunter
2023-12-02 2:06 ` Jakub Kicinski
2023-12-04 16:18 ` Donald Hunter
2023-12-04 18:21 ` Jakub Kicinski
2023-11-30 21:49 ` [PATCH net-next v1 5/6] doc/netlink/specs: add sub-message type to rt_link family Donald Hunter
2023-12-02 2:10 ` Jakub Kicinski
2023-12-04 16:22 ` Donald Hunter
2023-11-30 21:49 ` [PATCH net-next v1 6/6] doc/netlink/specs: Add a spec for tc Donald Hunter
2023-12-02 2:13 ` Jakub Kicinski
2023-12-04 16:27 ` Donald Hunter
2023-12-04 18:32 ` Jakub Kicinski
2023-12-04 22:38 ` Donald Hunter
2023-12-02 1:50 ` [PATCH net-next v1 0/6] tools/net/ynl: Add 'sub-message' support to ynl patchwork-bot+netdevbpf
2023-12-02 2:15 ` Jakub Kicinski
2023-12-04 15:54 ` Donald Hunter
2023-12-04 18:33 ` Jakub Kicinski
-- strict thread matches above, loose matches on Subject: below --
2023-11-30 17:10 Donald Hunter
2023-11-30 17:10 ` [PATCH net-next v1 2/6] doc/netlink: Add sub-message support to netlink-raw Donald Hunter
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=20231201175314.26cfcefa@kernel.org \
--to=kuba@kernel.org \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=donald.hunter@redhat.com \
--cc=edumazet@google.com \
--cc=jacob.e.keller@intel.com \
--cc=linux-doc@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).