doc/netlink: Update schema to support cmd-cnt-name and cmd-max-name
authorDavide Caratti <dcaratti@redhat.com>
Fri, 27 Oct 2023 14:04:54 +0000 (16:04 +0200)
committerJakub Kicinski <kuba@kernel.org>
Fri, 27 Oct 2023 21:56:04 +0000 (14:56 -0700)
allow specifying cmd-cnt-name and cmd-max-name in netlink specs, in
accordance with Documentation/userspace-api/netlink/c-code-gen.rst.

Use cmd-cnt-name and attr-cnt-name in the mptcp yaml spec and in the
corresponding uAPI headers, to preserve the #defines we had in the past
and avoid adding new ones.

v2:
 - squash modification in mptcp.yaml and MPTCP uAPI headers

Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Link: https://lore.kernel.org/r/12d4ed0116d8883cf4b533b856f3125a34e56749.1698415310.git.dcaratti@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Documentation/netlink/genetlink-c.yaml
Documentation/netlink/genetlink-legacy.yaml
Documentation/netlink/netlink-raw.yaml
Documentation/netlink/specs/mptcp.yaml
include/uapi/linux/mptcp.h
include/uapi/linux/mptcp_pm.h

index 9d13bbb7ae4736bb5fd8fcadcbeb3ccdf395edb2..c58f7153fcf82845eaad7c2f2a8d5c0803341aff 100644 (file)
@@ -47,6 +47,12 @@ properties:
   max-by-define:
     description: Makes the number of attributes and commands be specified by a define, not an enum value.
     type: boolean
+  cmd-max-name:
+    description: Name of the define for the last operation in the list.
+    type: string
+  cmd-cnt-name:
+    description: The explicit name for constant holding the count of operations (last operation + 1).
+    type: string
   # End genetlink-c
 
   definitions:
index 0daf40402a29d77169177d2e19162770a4dc2649..938703088306ba76bacb747f0ac3ed17e42f35d4 100644 (file)
@@ -47,6 +47,12 @@ properties:
   max-by-define:
     description: Makes the number of attributes and commands be specified by a define, not an enum value.
     type: boolean
+  cmd-max-name:
+    description: Name of the define for the last operation in the list.
+    type: string
+  cmd-cnt-name:
+    description: The explicit name for constant holding the count of operations (last operation + 1).
+    type: string
   # End genetlink-c
   # Start genetlink-legacy
   kernel-policy:
index 48db31f1d059fb2465bffc6bd2453ea4c97e0b7e..775cce8c548a4c424361677b1d657ffba9987f8b 100644 (file)
@@ -47,6 +47,12 @@ properties:
   max-by-define:
     description: Makes the number of attributes and commands be specified by a define, not an enum value.
     type: boolean
+  cmd-max-name:
+    description: Name of the define for the last operation in the list.
+    type: string
+  cmd-cnt-name:
+    description: The explicit name for constant holding the count of operations (last operation + 1).
+    type: string
   # End genetlink-c
   # Start genetlink-legacy
   kernel-policy:
index ec5c454a87ea58f6c93fd4d41003b16f31e37d29..49f90cfb469894a547e8c1bcbe4b0c095a59ed15 100644 (file)
@@ -8,6 +8,7 @@ c-family-name: mptcp-pm-name
 c-version-name: mptcp-pm-ver
 max-by-define: true
 kernel-policy: per-op
+cmd-cnt-name: --mptcp-pm-cmd-after-last
 
 definitions:
   -
@@ -167,6 +168,7 @@ attribute-sets:
   -
     name: attr
     name-prefix: mptcp-pm-attr-
+    attr-cnt-name: --mptcp-attr-after-last
     attributes:
       -
         name: unspec
index 64ecc8a3f9f2bb4186b9217c95e76749e52fff80..a6451561f3f8c7b286a46afe5f8a45aabe36aa8d 100644 (file)
 
 #include <linux/mptcp_pm.h>
 
-/* for backward compatibility */
-#define        __MPTCP_PM_CMD_AFTER_LAST       __MPTCP_PM_CMD_MAX
-#define        __MPTCP_ATTR_AFTER_LAST         __MPTCP_ATTR_MAX
-
 #define MPTCP_INFO_FLAG_FALLBACK               _BITUL(0)
 #define MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED    _BITUL(1)
 
index 0ad598fe940b5176e49de47e14e5cbf6be63e93c..b5d11aece4089dfe6784d091e5f7107f2ff77653 100644 (file)
@@ -100,9 +100,9 @@ enum {
        MPTCP_PM_ATTR_LOC_ID,
        MPTCP_PM_ATTR_ADDR_REMOTE,
 
-       __MPTCP_PM_ATTR_MAX
+       __MPTCP_ATTR_AFTER_LAST
 };
-#define MPTCP_PM_ATTR_MAX (__MPTCP_PM_ATTR_MAX - 1)
+#define MPTCP_PM_ATTR_MAX (__MPTCP_ATTR_AFTER_LAST - 1)
 
 enum mptcp_event_attr {
        MPTCP_ATTR_UNSPEC,
@@ -143,8 +143,8 @@ enum {
        MPTCP_PM_CMD_SUBFLOW_CREATE,
        MPTCP_PM_CMD_SUBFLOW_DESTROY,
 
-       __MPTCP_PM_CMD_MAX
+       __MPTCP_PM_CMD_AFTER_LAST
 };
-#define MPTCP_PM_CMD_MAX (__MPTCP_PM_CMD_MAX - 1)
+#define MPTCP_PM_CMD_MAX (__MPTCP_PM_CMD_AFTER_LAST - 1)
 
 #endif /* _UAPI_LINUX_MPTCP_PM_H */