Commit 6479c975 authored by Davide Caratti's avatar Davide Caratti Committed by Jakub Kicinski

doc/netlink: Update schema to support cmd-cnt-name and cmd-max-name

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: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavide Caratti <dcaratti@redhat.com>
Link: https://lore.kernel.org/r/12d4ed0116d8883cf4b533b856f3125a34e56749.1698415310.git.dcaratti@redhat.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent d96e48a3
...@@ -47,6 +47,12 @@ properties: ...@@ -47,6 +47,12 @@ properties:
max-by-define: max-by-define:
description: Makes the number of attributes and commands be specified by a define, not an enum value. description: Makes the number of attributes and commands be specified by a define, not an enum value.
type: boolean 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 # End genetlink-c
definitions: definitions:
......
...@@ -47,6 +47,12 @@ properties: ...@@ -47,6 +47,12 @@ properties:
max-by-define: max-by-define:
description: Makes the number of attributes and commands be specified by a define, not an enum value. description: Makes the number of attributes and commands be specified by a define, not an enum value.
type: boolean 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 # End genetlink-c
# Start genetlink-legacy # Start genetlink-legacy
kernel-policy: kernel-policy:
......
...@@ -47,6 +47,12 @@ properties: ...@@ -47,6 +47,12 @@ properties:
max-by-define: max-by-define:
description: Makes the number of attributes and commands be specified by a define, not an enum value. description: Makes the number of attributes and commands be specified by a define, not an enum value.
type: boolean 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 # End genetlink-c
# Start genetlink-legacy # Start genetlink-legacy
kernel-policy: kernel-policy:
......
...@@ -8,6 +8,7 @@ c-family-name: mptcp-pm-name ...@@ -8,6 +8,7 @@ c-family-name: mptcp-pm-name
c-version-name: mptcp-pm-ver c-version-name: mptcp-pm-ver
max-by-define: true max-by-define: true
kernel-policy: per-op kernel-policy: per-op
cmd-cnt-name: --mptcp-pm-cmd-after-last
definitions: definitions:
- -
...@@ -167,6 +168,7 @@ attribute-sets: ...@@ -167,6 +168,7 @@ attribute-sets:
- -
name: attr name: attr
name-prefix: mptcp-pm-attr- name-prefix: mptcp-pm-attr-
attr-cnt-name: --mptcp-attr-after-last
attributes: attributes:
- -
name: unspec name: unspec
......
...@@ -28,10 +28,6 @@ ...@@ -28,10 +28,6 @@
#include <linux/mptcp_pm.h> #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_FALLBACK _BITUL(0)
#define MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED _BITUL(1) #define MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED _BITUL(1)
......
...@@ -100,9 +100,9 @@ enum { ...@@ -100,9 +100,9 @@ enum {
MPTCP_PM_ATTR_LOC_ID, MPTCP_PM_ATTR_LOC_ID,
MPTCP_PM_ATTR_ADDR_REMOTE, 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 { enum mptcp_event_attr {
MPTCP_ATTR_UNSPEC, MPTCP_ATTR_UNSPEC,
...@@ -143,8 +143,8 @@ enum { ...@@ -143,8 +143,8 @@ enum {
MPTCP_PM_CMD_SUBFLOW_CREATE, MPTCP_PM_CMD_SUBFLOW_CREATE,
MPTCP_PM_CMD_SUBFLOW_DESTROY, 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 */ #endif /* _UAPI_LINUX_MPTCP_PM_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment