1 /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
2 /*
3  * include/uapi/linux/ethtool_netlink.h - netlink interface for ethtool
4  *
5  * See Documentation/networking/ethtool-netlink.txt in kernel source tree for
6  * doucumentation of the interface.
7  */
8 
9 #ifndef _UAPI_LINUX_ETHTOOL_NETLINK_H_
10 #define _UAPI_LINUX_ETHTOOL_NETLINK_H_
11 
12 #include <linux/ethtool.h>
13 
14 /* message types - userspace to kernel */
15 enum {
16 	ETHTOOL_MSG_USER_NONE,
17 	ETHTOOL_MSG_STRSET_GET,
18 	ETHTOOL_MSG_LINKINFO_GET,
19 	ETHTOOL_MSG_LINKINFO_SET,
20 	ETHTOOL_MSG_LINKMODES_GET,
21 	ETHTOOL_MSG_LINKMODES_SET,
22 	ETHTOOL_MSG_LINKSTATE_GET,
23 	ETHTOOL_MSG_DEBUG_GET,
24 	ETHTOOL_MSG_DEBUG_SET,
25 	ETHTOOL_MSG_WOL_GET,
26 	ETHTOOL_MSG_WOL_SET,
27 	ETHTOOL_MSG_FEATURES_GET,
28 	ETHTOOL_MSG_FEATURES_SET,
29 	ETHTOOL_MSG_PRIVFLAGS_GET,
30 	ETHTOOL_MSG_PRIVFLAGS_SET,
31 	ETHTOOL_MSG_RINGS_GET,
32 	ETHTOOL_MSG_RINGS_SET,
33 	ETHTOOL_MSG_CHANNELS_GET,
34 	ETHTOOL_MSG_CHANNELS_SET,
35 
36 	/* add new constants above here */
37 	__ETHTOOL_MSG_USER_CNT,
38 	ETHTOOL_MSG_USER_MAX = __ETHTOOL_MSG_USER_CNT - 1
39 };
40 
41 /* message types - kernel to userspace */
42 enum {
43 	ETHTOOL_MSG_KERNEL_NONE,
44 	ETHTOOL_MSG_STRSET_GET_REPLY,
45 	ETHTOOL_MSG_LINKINFO_GET_REPLY,
46 	ETHTOOL_MSG_LINKINFO_NTF,
47 	ETHTOOL_MSG_LINKMODES_GET_REPLY,
48 	ETHTOOL_MSG_LINKMODES_NTF,
49 	ETHTOOL_MSG_LINKSTATE_GET_REPLY,
50 	ETHTOOL_MSG_DEBUG_GET_REPLY,
51 	ETHTOOL_MSG_DEBUG_NTF,
52 	ETHTOOL_MSG_WOL_GET_REPLY,
53 	ETHTOOL_MSG_WOL_NTF,
54 	ETHTOOL_MSG_FEATURES_GET_REPLY,
55 	ETHTOOL_MSG_FEATURES_SET_REPLY,
56 	ETHTOOL_MSG_FEATURES_NTF,
57 	ETHTOOL_MSG_PRIVFLAGS_GET_REPLY,
58 	ETHTOOL_MSG_PRIVFLAGS_NTF,
59 	ETHTOOL_MSG_RINGS_GET_REPLY,
60 	ETHTOOL_MSG_RINGS_NTF,
61 	ETHTOOL_MSG_CHANNELS_GET_REPLY,
62 	ETHTOOL_MSG_CHANNELS_NTF,
63 
64 	/* add new constants above here */
65 	__ETHTOOL_MSG_KERNEL_CNT,
66 	ETHTOOL_MSG_KERNEL_MAX = __ETHTOOL_MSG_KERNEL_CNT - 1
67 };
68 
69 /* request header */
70 
71 /* use compact bitsets in reply */
72 #define ETHTOOL_FLAG_COMPACT_BITSETS	(1 << 0)
73 /* provide optional reply for SET or ACT requests */
74 #define ETHTOOL_FLAG_OMIT_REPLY	(1 << 1)
75 
76 #define ETHTOOL_FLAG_ALL (ETHTOOL_FLAG_COMPACT_BITSETS | \
77 			  ETHTOOL_FLAG_OMIT_REPLY)
78 
79 enum {
80 	ETHTOOL_A_HEADER_UNSPEC,
81 	ETHTOOL_A_HEADER_DEV_INDEX,		/* u32 */
82 	ETHTOOL_A_HEADER_DEV_NAME,		/* string */
83 	ETHTOOL_A_HEADER_FLAGS,			/* u32 - ETHTOOL_FLAG_* */
84 
85 	/* add new constants above here */
86 	__ETHTOOL_A_HEADER_CNT,
87 	ETHTOOL_A_HEADER_MAX = __ETHTOOL_A_HEADER_CNT - 1
88 };
89 
90 /* bit sets */
91 
92 enum {
93 	ETHTOOL_A_BITSET_BIT_UNSPEC,
94 	ETHTOOL_A_BITSET_BIT_INDEX,		/* u32 */
95 	ETHTOOL_A_BITSET_BIT_NAME,		/* string */
96 	ETHTOOL_A_BITSET_BIT_VALUE,		/* flag */
97 
98 	/* add new constants above here */
99 	__ETHTOOL_A_BITSET_BIT_CNT,
100 	ETHTOOL_A_BITSET_BIT_MAX = __ETHTOOL_A_BITSET_BIT_CNT - 1
101 };
102 
103 enum {
104 	ETHTOOL_A_BITSET_BITS_UNSPEC,
105 	ETHTOOL_A_BITSET_BITS_BIT,		/* nest - _A_BITSET_BIT_* */
106 
107 	/* add new constants above here */
108 	__ETHTOOL_A_BITSET_BITS_CNT,
109 	ETHTOOL_A_BITSET_BITS_MAX = __ETHTOOL_A_BITSET_BITS_CNT - 1
110 };
111 
112 enum {
113 	ETHTOOL_A_BITSET_UNSPEC,
114 	ETHTOOL_A_BITSET_NOMASK,		/* flag */
115 	ETHTOOL_A_BITSET_SIZE,			/* u32 */
116 	ETHTOOL_A_BITSET_BITS,			/* nest - _A_BITSET_BITS_* */
117 	ETHTOOL_A_BITSET_VALUE,			/* binary */
118 	ETHTOOL_A_BITSET_MASK,			/* binary */
119 
120 	/* add new constants above here */
121 	__ETHTOOL_A_BITSET_CNT,
122 	ETHTOOL_A_BITSET_MAX = __ETHTOOL_A_BITSET_CNT - 1
123 };
124 
125 /* string sets */
126 
127 enum {
128 	ETHTOOL_A_STRING_UNSPEC,
129 	ETHTOOL_A_STRING_INDEX,			/* u32 */
130 	ETHTOOL_A_STRING_VALUE,			/* string */
131 
132 	/* add new constants above here */
133 	__ETHTOOL_A_STRING_CNT,
134 	ETHTOOL_A_STRING_MAX = __ETHTOOL_A_STRING_CNT - 1
135 };
136 
137 enum {
138 	ETHTOOL_A_STRINGS_UNSPEC,
139 	ETHTOOL_A_STRINGS_STRING,		/* nest - _A_STRINGS_* */
140 
141 	/* add new constants above here */
142 	__ETHTOOL_A_STRINGS_CNT,
143 	ETHTOOL_A_STRINGS_MAX = __ETHTOOL_A_STRINGS_CNT - 1
144 };
145 
146 enum {
147 	ETHTOOL_A_STRINGSET_UNSPEC,
148 	ETHTOOL_A_STRINGSET_ID,			/* u32 */
149 	ETHTOOL_A_STRINGSET_COUNT,		/* u32 */
150 	ETHTOOL_A_STRINGSET_STRINGS,		/* nest - _A_STRINGS_* */
151 
152 	/* add new constants above here */
153 	__ETHTOOL_A_STRINGSET_CNT,
154 	ETHTOOL_A_STRINGSET_MAX = __ETHTOOL_A_STRINGSET_CNT - 1
155 };
156 
157 enum {
158 	ETHTOOL_A_STRINGSETS_UNSPEC,
159 	ETHTOOL_A_STRINGSETS_STRINGSET,		/* nest - _A_STRINGSET_* */
160 
161 	/* add new constants above here */
162 	__ETHTOOL_A_STRINGSETS_CNT,
163 	ETHTOOL_A_STRINGSETS_MAX = __ETHTOOL_A_STRINGSETS_CNT - 1
164 };
165 
166 /* STRSET */
167 
168 enum {
169 	ETHTOOL_A_STRSET_UNSPEC,
170 	ETHTOOL_A_STRSET_HEADER,		/* nest - _A_HEADER_* */
171 	ETHTOOL_A_STRSET_STRINGSETS,		/* nest - _A_STRINGSETS_* */
172 	ETHTOOL_A_STRSET_COUNTS_ONLY,		/* flag */
173 
174 	/* add new constants above here */
175 	__ETHTOOL_A_STRSET_CNT,
176 	ETHTOOL_A_STRSET_MAX = __ETHTOOL_A_STRSET_CNT - 1
177 };
178 
179 /* LINKINFO */
180 
181 enum {
182 	ETHTOOL_A_LINKINFO_UNSPEC,
183 	ETHTOOL_A_LINKINFO_HEADER,		/* nest - _A_HEADER_* */
184 	ETHTOOL_A_LINKINFO_PORT,		/* u8 */
185 	ETHTOOL_A_LINKINFO_PHYADDR,		/* u8 */
186 	ETHTOOL_A_LINKINFO_TP_MDIX,		/* u8 */
187 	ETHTOOL_A_LINKINFO_TP_MDIX_CTRL,	/* u8 */
188 	ETHTOOL_A_LINKINFO_TRANSCEIVER,		/* u8 */
189 
190 	/* add new constants above here */
191 	__ETHTOOL_A_LINKINFO_CNT,
192 	ETHTOOL_A_LINKINFO_MAX = __ETHTOOL_A_LINKINFO_CNT - 1
193 };
194 
195 /* LINKMODES */
196 
197 enum {
198 	ETHTOOL_A_LINKMODES_UNSPEC,
199 	ETHTOOL_A_LINKMODES_HEADER,		/* nest - _A_HEADER_* */
200 	ETHTOOL_A_LINKMODES_AUTONEG,		/* u8 */
201 	ETHTOOL_A_LINKMODES_OURS,		/* bitset */
202 	ETHTOOL_A_LINKMODES_PEER,		/* bitset */
203 	ETHTOOL_A_LINKMODES_SPEED,		/* u32 */
204 	ETHTOOL_A_LINKMODES_DUPLEX,		/* u8 */
205 
206 	/* add new constants above here */
207 	__ETHTOOL_A_LINKMODES_CNT,
208 	ETHTOOL_A_LINKMODES_MAX = __ETHTOOL_A_LINKMODES_CNT - 1
209 };
210 
211 /* LINKSTATE */
212 
213 enum {
214 	ETHTOOL_A_LINKSTATE_UNSPEC,
215 	ETHTOOL_A_LINKSTATE_HEADER,		/* nest - _A_HEADER_* */
216 	ETHTOOL_A_LINKSTATE_LINK,		/* u8 */
217 
218 	/* add new constants above here */
219 	__ETHTOOL_A_LINKSTATE_CNT,
220 	ETHTOOL_A_LINKSTATE_MAX = __ETHTOOL_A_LINKSTATE_CNT - 1
221 };
222 
223 /* DEBUG */
224 
225 enum {
226 	ETHTOOL_A_DEBUG_UNSPEC,
227 	ETHTOOL_A_DEBUG_HEADER,			/* nest - _A_HEADER_* */
228 	ETHTOOL_A_DEBUG_MSGMASK,		/* bitset */
229 
230 	/* add new constants above here */
231 	__ETHTOOL_A_DEBUG_CNT,
232 	ETHTOOL_A_DEBUG_MAX = __ETHTOOL_A_DEBUG_CNT - 1
233 };
234 
235 /* WOL */
236 
237 enum {
238 	ETHTOOL_A_WOL_UNSPEC,
239 	ETHTOOL_A_WOL_HEADER,			/* nest - _A_HEADER_* */
240 	ETHTOOL_A_WOL_MODES,			/* bitset */
241 	ETHTOOL_A_WOL_SOPASS,			/* binary */
242 
243 	/* add new constants above here */
244 	__ETHTOOL_A_WOL_CNT,
245 	ETHTOOL_A_WOL_MAX = __ETHTOOL_A_WOL_CNT - 1
246 };
247 
248 /* FEATURES */
249 
250 enum {
251 	ETHTOOL_A_FEATURES_UNSPEC,
252 	ETHTOOL_A_FEATURES_HEADER,			/* nest - _A_HEADER_* */
253 	ETHTOOL_A_FEATURES_HW,				/* bitset */
254 	ETHTOOL_A_FEATURES_WANTED,			/* bitset */
255 	ETHTOOL_A_FEATURES_ACTIVE,			/* bitset */
256 	ETHTOOL_A_FEATURES_NOCHANGE,			/* bitset */
257 
258 	/* add new constants above here */
259 	__ETHTOOL_A_FEATURES_CNT,
260 	ETHTOOL_A_FEATURES_MAX = __ETHTOOL_A_FEATURES_CNT - 1
261 };
262 
263 /* PRIVFLAGS */
264 
265 enum {
266 	ETHTOOL_A_PRIVFLAGS_UNSPEC,
267 	ETHTOOL_A_PRIVFLAGS_HEADER,			/* nest - _A_HEADER_* */
268 	ETHTOOL_A_PRIVFLAGS_FLAGS,			/* bitset */
269 
270 	/* add new constants above here */
271 	__ETHTOOL_A_PRIVFLAGS_CNT,
272 	ETHTOOL_A_PRIVFLAGS_MAX = __ETHTOOL_A_PRIVFLAGS_CNT - 1
273 };
274 
275 /* RINGS */
276 
277 enum {
278 	ETHTOOL_A_RINGS_UNSPEC,
279 	ETHTOOL_A_RINGS_HEADER,				/* nest - _A_HEADER_* */
280 	ETHTOOL_A_RINGS_RX_MAX,				/* u32 */
281 	ETHTOOL_A_RINGS_RX_MINI_MAX,			/* u32 */
282 	ETHTOOL_A_RINGS_RX_JUMBO_MAX,			/* u32 */
283 	ETHTOOL_A_RINGS_TX_MAX,				/* u32 */
284 	ETHTOOL_A_RINGS_RX,				/* u32 */
285 	ETHTOOL_A_RINGS_RX_MINI,			/* u32 */
286 	ETHTOOL_A_RINGS_RX_JUMBO,			/* u32 */
287 	ETHTOOL_A_RINGS_TX,				/* u32 */
288 
289 	/* add new constants above here */
290 	__ETHTOOL_A_RINGS_CNT,
291 	ETHTOOL_A_RINGS_MAX = (__ETHTOOL_A_RINGS_CNT - 1)
292 };
293 
294 /* CHANNELS */
295 
296 enum {
297 	ETHTOOL_A_CHANNELS_UNSPEC,
298 	ETHTOOL_A_CHANNELS_HEADER,			/* nest - _A_HEADER_* */
299 	ETHTOOL_A_CHANNELS_RX_MAX,			/* u32 */
300 	ETHTOOL_A_CHANNELS_TX_MAX,			/* u32 */
301 	ETHTOOL_A_CHANNELS_OTHER_MAX,			/* u32 */
302 	ETHTOOL_A_CHANNELS_COMBINED_MAX,		/* u32 */
303 	ETHTOOL_A_CHANNELS_RX_COUNT,			/* u32 */
304 	ETHTOOL_A_CHANNELS_TX_COUNT,			/* u32 */
305 	ETHTOOL_A_CHANNELS_OTHER_COUNT,			/* u32 */
306 	ETHTOOL_A_CHANNELS_COMBINED_COUNT,		/* u32 */
307 
308 	/* add new constants above here */
309 	__ETHTOOL_A_CHANNELS_CNT,
310 	ETHTOOL_A_CHANNELS_MAX = (__ETHTOOL_A_CHANNELS_CNT - 1)
311 };
312 
313 /* generic netlink info */
314 #define ETHTOOL_GENL_NAME "ethtool"
315 #define ETHTOOL_GENL_VERSION 1
316 
317 #define ETHTOOL_MCGRP_MONITOR_NAME "monitor"
318 
319 #endif /* _UAPI_LINUX_ETHTOOL_NETLINK_H_ */
320