diff mbox series

[net-next,v5,7/7] docs: netlink: document the sub-type attribute property

Message ID 20230327083138.96044-8-donald.hunter@gmail.com (mailing list archive)
State Accepted
Commit 04eac39361d3506c82ccf932cb288e84d5746969
Delegated to: Netdev Maintainers
Headers show
Series ynl: add support for user headers and struct attrs | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 18 this patch: 18
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 18 this patch: 18
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 18 this patch: 18
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 36 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Donald Hunter March 27, 2023, 8:31 a.m. UTC
Add a definition for sub-type to the protocol spec doc and a description of
its usage for C arrays in genetlink-legacy.

Signed-off-by: Donald Hunter <donald.hunter@gmail.com>
---
 .../userspace-api/netlink/genetlink-legacy.rst     | 14 ++++++++++++++
 Documentation/userspace-api/netlink/specs.rst      | 10 ++++++++++
 2 files changed, 24 insertions(+)

Comments

Bagas Sanjaya March 27, 2023, 12:45 p.m. UTC | #1
On Mon, Mar 27, 2023 at 09:31:38AM +0100, Donald Hunter wrote:
> diff --git a/Documentation/userspace-api/netlink/genetlink-legacy.rst b/Documentation/userspace-api/netlink/genetlink-legacy.rst
> index b8fdcf7f6615..802875a37a27 100644
> --- a/Documentation/userspace-api/netlink/genetlink-legacy.rst
> +++ b/Documentation/userspace-api/netlink/genetlink-legacy.rst
> @@ -234,6 +234,20 @@ specify a sub-type.
>            type: binary
>            struct: vport-stats
>  
> +C Arrays
> +--------
> +
> +Legacy families also use ``binary`` attributes to encapsulate C arrays. The
> +``sub-type`` is used to identify the type of scalar to extract.
> +
> +.. code-block:: yaml
> +
> +  attributes:
> +    -
> +      name: ports
> +      type: binary
> +      sub-type: u32
> +
>  Multi-message DO
>  ----------------
>  
> diff --git a/Documentation/userspace-api/netlink/specs.rst b/Documentation/userspace-api/netlink/specs.rst
> index a22442ba1d30..2e4acde890b7 100644
> --- a/Documentation/userspace-api/netlink/specs.rst
> +++ b/Documentation/userspace-api/netlink/specs.rst
> @@ -254,6 +254,16 @@ rather than depend on what is specified in the spec file.
>  The validation policy in the kernel is formed by combining the type
>  definition (``type`` and ``nested-attributes``) and the ``checks``.
>  
> +sub-type
> +~~~~~~~~
> +
> +Legacy families have special ways of expressing arrays. ``sub-type`` can be
> +used to define the type of array members in case array members are not
> +fully defined as attributes (in a bona fide attribute space). For instance
> +a C array of u32 values can be specified with ``type: binary`` and
> +``sub-type: u32``. Binary types and legacy array formats are described in
> +more detail in :doc:`genetlink-legacy`.
> +
>  operations
>  ----------
>  

The doc LGTM, thanks!

Reviewed-by: Bagas Sanjaya <bagasdotme@gmail.com>
diff mbox series

Patch

diff --git a/Documentation/userspace-api/netlink/genetlink-legacy.rst b/Documentation/userspace-api/netlink/genetlink-legacy.rst
index b8fdcf7f6615..802875a37a27 100644
--- a/Documentation/userspace-api/netlink/genetlink-legacy.rst
+++ b/Documentation/userspace-api/netlink/genetlink-legacy.rst
@@ -234,6 +234,20 @@  specify a sub-type.
           type: binary
           struct: vport-stats
 
+C Arrays
+--------
+
+Legacy families also use ``binary`` attributes to encapsulate C arrays. The
+``sub-type`` is used to identify the type of scalar to extract.
+
+.. code-block:: yaml
+
+  attributes:
+    -
+      name: ports
+      type: binary
+      sub-type: u32
+
 Multi-message DO
 ----------------
 
diff --git a/Documentation/userspace-api/netlink/specs.rst b/Documentation/userspace-api/netlink/specs.rst
index a22442ba1d30..2e4acde890b7 100644
--- a/Documentation/userspace-api/netlink/specs.rst
+++ b/Documentation/userspace-api/netlink/specs.rst
@@ -254,6 +254,16 @@  rather than depend on what is specified in the spec file.
 The validation policy in the kernel is formed by combining the type
 definition (``type`` and ``nested-attributes``) and the ``checks``.
 
+sub-type
+~~~~~~~~
+
+Legacy families have special ways of expressing arrays. ``sub-type`` can be
+used to define the type of array members in case array members are not
+fully defined as attributes (in a bona fide attribute space). For instance
+a C array of u32 values can be specified with ``type: binary`` and
+``sub-type: u32``. Binary types and legacy array formats are described in
+more detail in :doc:`genetlink-legacy`.
+
 operations
 ----------