Skip to content

Commit 6479c97

Browse files
dcarattikuba-moo
authored andcommitted
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: Jakub Kicinski <[email protected]> Signed-off-by: Davide Caratti <[email protected]> Link: https://lore.kernel.org/r/12d4ed0116d8883cf4b533b856f3125a34e56749.1698415310.git.dcaratti@redhat.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent d96e48a commit 6479c97

File tree

6 files changed

+24
-8
lines changed

6 files changed

+24
-8
lines changed

Documentation/netlink/genetlink-c.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ properties:
4747
max-by-define:
4848
description: Makes the number of attributes and commands be specified by a define, not an enum value.
4949
type: boolean
50+
cmd-max-name:
51+
description: Name of the define for the last operation in the list.
52+
type: string
53+
cmd-cnt-name:
54+
description: The explicit name for constant holding the count of operations (last operation + 1).
55+
type: string
5056
# End genetlink-c
5157

5258
definitions:

Documentation/netlink/genetlink-legacy.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ properties:
4747
max-by-define:
4848
description: Makes the number of attributes and commands be specified by a define, not an enum value.
4949
type: boolean
50+
cmd-max-name:
51+
description: Name of the define for the last operation in the list.
52+
type: string
53+
cmd-cnt-name:
54+
description: The explicit name for constant holding the count of operations (last operation + 1).
55+
type: string
5056
# End genetlink-c
5157
# Start genetlink-legacy
5258
kernel-policy:

Documentation/netlink/netlink-raw.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ properties:
4747
max-by-define:
4848
description: Makes the number of attributes and commands be specified by a define, not an enum value.
4949
type: boolean
50+
cmd-max-name:
51+
description: Name of the define for the last operation in the list.
52+
type: string
53+
cmd-cnt-name:
54+
description: The explicit name for constant holding the count of operations (last operation + 1).
55+
type: string
5056
# End genetlink-c
5157
# Start genetlink-legacy
5258
kernel-policy:

Documentation/netlink/specs/mptcp.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ c-family-name: mptcp-pm-name
88
c-version-name: mptcp-pm-ver
99
max-by-define: true
1010
kernel-policy: per-op
11+
cmd-cnt-name: --mptcp-pm-cmd-after-last
1112

1213
definitions:
1314
-
@@ -167,6 +168,7 @@ attribute-sets:
167168
-
168169
name: attr
169170
name-prefix: mptcp-pm-attr-
171+
attr-cnt-name: --mptcp-attr-after-last
170172
attributes:
171173
-
172174
name: unspec

include/uapi/linux/mptcp.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@
2828

2929
#include <linux/mptcp_pm.h>
3030

31-
/* for backward compatibility */
32-
#define __MPTCP_PM_CMD_AFTER_LAST __MPTCP_PM_CMD_MAX
33-
#define __MPTCP_ATTR_AFTER_LAST __MPTCP_ATTR_MAX
34-
3531
#define MPTCP_INFO_FLAG_FALLBACK _BITUL(0)
3632
#define MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED _BITUL(1)
3733

include/uapi/linux/mptcp_pm.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ enum {
100100
MPTCP_PM_ATTR_LOC_ID,
101101
MPTCP_PM_ATTR_ADDR_REMOTE,
102102

103-
__MPTCP_PM_ATTR_MAX
103+
__MPTCP_ATTR_AFTER_LAST
104104
};
105-
#define MPTCP_PM_ATTR_MAX (__MPTCP_PM_ATTR_MAX - 1)
105+
#define MPTCP_PM_ATTR_MAX (__MPTCP_ATTR_AFTER_LAST - 1)
106106

107107
enum mptcp_event_attr {
108108
MPTCP_ATTR_UNSPEC,
@@ -143,8 +143,8 @@ enum {
143143
MPTCP_PM_CMD_SUBFLOW_CREATE,
144144
MPTCP_PM_CMD_SUBFLOW_DESTROY,
145145

146-
__MPTCP_PM_CMD_MAX
146+
__MPTCP_PM_CMD_AFTER_LAST
147147
};
148-
#define MPTCP_PM_CMD_MAX (__MPTCP_PM_CMD_MAX - 1)
148+
#define MPTCP_PM_CMD_MAX (__MPTCP_PM_CMD_AFTER_LAST - 1)
149149

150150
#endif /* _UAPI_LINUX_MPTCP_PM_H */

0 commit comments

Comments
 (0)