[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231211164039.83034-7-donald.hunter@gmail.com>
Date: Mon, 11 Dec 2023 16:40:34 +0000
From: Donald Hunter <donald.hunter@...il.com>
To: netdev@...r.kernel.org,
Jakub Kicinski <kuba@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>,
Jonathan Corbet <corbet@....net>,
linux-doc@...r.kernel.org,
Jacob Keller <jacob.e.keller@...el.com>
Cc: donald.hunter@...hat.com,
Donald Hunter <donald.hunter@...il.com>
Subject: [PATCH net-next v2 06/11] doc/netlink: Document the sub-message format for netlink-raw
Document the spec format used by netlink-raw families like rt and tc.
Signed-off-by: Donald Hunter <donald.hunter@...il.com>
---
.../userspace-api/netlink/netlink-raw.rst | 75 ++++++++++++++++++-
1 file changed, 74 insertions(+), 1 deletion(-)
diff --git a/Documentation/userspace-api/netlink/netlink-raw.rst b/Documentation/userspace-api/netlink/netlink-raw.rst
index f07fb9b9c101..e1d3e5ecfc6a 100644
--- a/Documentation/userspace-api/netlink/netlink-raw.rst
+++ b/Documentation/userspace-api/netlink/netlink-raw.rst
@@ -14,7 +14,8 @@ Specification
The netlink-raw schema extends the :doc:`genetlink-legacy <genetlink-legacy>`
schema with properties that are needed to specify the protocol numbers and
multicast IDs used by raw netlink families. See :ref:`classic_netlink` for more
-information.
+information. The raw netlink families also make use of type-specific
+sub-messages.
Globals
-------
@@ -56,3 +57,75 @@ group registration.
-
name: rtnlgrp-mctp-ifaddr
value: 34
+
+Sub-messages
+------------
+
+Several raw netlink families such as rt_link and tc have type-specific
+sub-messages. These sub-messages can appear as an attribute in a top-level or a
+nested attribute space.
+
+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:
+
+.. code-block:: json
+
+ { "kind": "gre" }
+
+and we encounter the following attribute spec:
+
+.. code-block:: yaml
+
+ -
+ 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:
+
+.. code-block:: yaml
+
+ 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:
+
+.. code-block:: yaml
+
+ 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
+
+Note that a selector attribute must appear in a netlink message before any
+sub-message attributes that depend on it.
--
2.42.0
Powered by blists - more mailing lists