summaryrefslogtreecommitdiffstats
path: root/Documentation/userspace-api/netlink
diff options
context:
space:
mode:
authorDonald Hunter <donald.hunter@gmail.com>2024-01-29 23:34:56 +0100
committerJakub Kicinski <kuba@kernel.org>2024-02-01 06:19:19 +0100
commit9d6429c33976fcce0d46124a9151314137687e0f (patch)
treea493bd8341684e1feff0823b039c0e1a585735eb /Documentation/userspace-api/netlink
parenttools/net/ynl: Add support for nested structs (diff)
downloadlinux-9d6429c33976fcce0d46124a9151314137687e0f.tar.xz
linux-9d6429c33976fcce0d46124a9151314137687e0f.zip
doc/netlink: Describe nested structs in netlink raw docs
Add a description and example of nested struct definitions to the netlink raw documentation. Signed-off-by: Donald Hunter <donald.hunter@gmail.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Link: https://lore.kernel.org/r/20240129223458.52046-12-donald.hunter@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'Documentation/userspace-api/netlink')
-rw-r--r--Documentation/userspace-api/netlink/netlink-raw.rst34
1 files changed, 34 insertions, 0 deletions
diff --git a/Documentation/userspace-api/netlink/netlink-raw.rst b/Documentation/userspace-api/netlink/netlink-raw.rst
index 32197f3cb40e..1990eea772d0 100644
--- a/Documentation/userspace-api/netlink/netlink-raw.rst
+++ b/Documentation/userspace-api/netlink/netlink-raw.rst
@@ -158,3 +158,37 @@ alongside a sub-message selector and also in a top level ``attribute-set``, then
the selector will be resolved using the value 'closest' to the selector. If the
value is not present in the message at the same level as defined in the spec
then this is an error.
+
+Nested struct definitions
+-------------------------
+
+Many raw netlink families such as :doc:`tc<../../networking/netlink_spec/tc>`
+make use of nested struct definitions. The ``netlink-raw`` schema makes it
+possible to embed a struct within a struct definition using the ``struct``
+property. For example, the following struct definition embeds the
+``tc-ratespec`` struct definition for both the ``rate`` and the ``peakrate``
+members of ``struct tc-tbf-qopt``.
+
+.. code-block:: yaml
+
+ -
+ name: tc-tbf-qopt
+ type: struct
+ members:
+ -
+ name: rate
+ type: binary
+ struct: tc-ratespec
+ -
+ name: peakrate
+ type: binary
+ struct: tc-ratespec
+ -
+ name: limit
+ type: u32
+ -
+ name: buffer
+ type: u32
+ -
+ name: mtu
+ type: u32