Skip to content

Commit

Permalink
doc/netlink: Describe nested structs in netlink raw docs
Browse files Browse the repository at this point in the history
Add a description and example of nested struct definitions
to the netlink raw documentation.

Signed-off-by: Donald Hunter <[email protected]>
Reviewed-by: Jiri Pirko <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
donaldh authored and kuba-moo committed Feb 1, 2024
1 parent bf08f32 commit 9d6429c
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Documentation/userspace-api/netlink/netlink-raw.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 9d6429c

Please sign in to comment.