1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2 /*
3  * include/linux/if_team.h - Network team device driver header
4  * Copyright (c) 2011 Jiri Pirko <jpirko@redhat.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  */
11 
12 #ifndef _UAPI_LINUX_IF_TEAM_H_
13 #define _UAPI_LINUX_IF_TEAM_H_
14 
15 
16 #define TEAM_STRING_MAX_LEN 32
17 
18 /**********************************
19  * NETLINK_GENERIC netlink family.
20  **********************************/
21 
22 enum {
23 	TEAM_CMD_NOOP,
24 	TEAM_CMD_OPTIONS_SET,
25 	TEAM_CMD_OPTIONS_GET,
26 	TEAM_CMD_PORT_LIST_GET,
27 
28 	__TEAM_CMD_MAX,
29 	TEAM_CMD_MAX = (__TEAM_CMD_MAX - 1),
30 };
31 
32 enum {
33 	TEAM_ATTR_UNSPEC,
34 	TEAM_ATTR_TEAM_IFINDEX,		/* u32 */
35 	TEAM_ATTR_LIST_OPTION,		/* nest */
36 	TEAM_ATTR_LIST_PORT,		/* nest */
37 
38 	__TEAM_ATTR_MAX,
39 	TEAM_ATTR_MAX = __TEAM_ATTR_MAX - 1,
40 };
41 
42 /* Nested layout of get/set msg:
43  *
44  *	[TEAM_ATTR_LIST_OPTION]
45  *		[TEAM_ATTR_ITEM_OPTION]
46  *			[TEAM_ATTR_OPTION_*], ...
47  *		[TEAM_ATTR_ITEM_OPTION]
48  *			[TEAM_ATTR_OPTION_*], ...
49  *		...
50  *	[TEAM_ATTR_LIST_PORT]
51  *		[TEAM_ATTR_ITEM_PORT]
52  *			[TEAM_ATTR_PORT_*], ...
53  *		[TEAM_ATTR_ITEM_PORT]
54  *			[TEAM_ATTR_PORT_*], ...
55  *		...
56  */
57 
58 enum {
59 	TEAM_ATTR_ITEM_OPTION_UNSPEC,
60 	TEAM_ATTR_ITEM_OPTION,		/* nest */
61 
62 	__TEAM_ATTR_ITEM_OPTION_MAX,
63 	TEAM_ATTR_ITEM_OPTION_MAX = __TEAM_ATTR_ITEM_OPTION_MAX - 1,
64 };
65 
66 enum {
67 	TEAM_ATTR_OPTION_UNSPEC,
68 	TEAM_ATTR_OPTION_NAME,		/* string */
69 	TEAM_ATTR_OPTION_CHANGED,	/* flag */
70 	TEAM_ATTR_OPTION_TYPE,		/* u8 */
71 	TEAM_ATTR_OPTION_DATA,		/* dynamic */
72 	TEAM_ATTR_OPTION_REMOVED,	/* flag */
73 	TEAM_ATTR_OPTION_PORT_IFINDEX,	/* u32 */ /* for per-port options */
74 	TEAM_ATTR_OPTION_ARRAY_INDEX,	/* u32 */ /* for array options */
75 
76 	__TEAM_ATTR_OPTION_MAX,
77 	TEAM_ATTR_OPTION_MAX = __TEAM_ATTR_OPTION_MAX - 1,
78 };
79 
80 enum {
81 	TEAM_ATTR_ITEM_PORT_UNSPEC,
82 	TEAM_ATTR_ITEM_PORT,		/* nest */
83 
84 	__TEAM_ATTR_ITEM_PORT_MAX,
85 	TEAM_ATTR_ITEM_PORT_MAX = __TEAM_ATTR_ITEM_PORT_MAX - 1,
86 };
87 
88 enum {
89 	TEAM_ATTR_PORT_UNSPEC,
90 	TEAM_ATTR_PORT_IFINDEX,		/* u32 */
91 	TEAM_ATTR_PORT_CHANGED,		/* flag */
92 	TEAM_ATTR_PORT_LINKUP,		/* flag */
93 	TEAM_ATTR_PORT_SPEED,		/* u32 */
94 	TEAM_ATTR_PORT_DUPLEX,		/* u8 */
95 	TEAM_ATTR_PORT_REMOVED,		/* flag */
96 
97 	__TEAM_ATTR_PORT_MAX,
98 	TEAM_ATTR_PORT_MAX = __TEAM_ATTR_PORT_MAX - 1,
99 };
100 
101 /*
102  * NETLINK_GENERIC related info
103  */
104 #define TEAM_GENL_NAME "team"
105 #define TEAM_GENL_VERSION 0x1
106 #define TEAM_GENL_CHANGE_EVENT_MC_GRP_NAME "change_event"
107 
108 #endif /* _UAPI_LINUX_IF_TEAM_H_ */
109