1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2 /*
3  * include/uapi/linux/devlink.h - Network physical device Netlink interface
4  * Copyright (c) 2016 Mellanox Technologies. All rights reserved.
5  * Copyright (c) 2016 Jiri Pirko <jiri@mellanox.com>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #ifndef _UAPI_LINUX_DEVLINK_H_
14 #define _UAPI_LINUX_DEVLINK_H_
15 
16 #include <linux/const.h>
17 
18 #define DEVLINK_GENL_NAME "devlink"
19 #define DEVLINK_GENL_VERSION 0x1
20 #define DEVLINK_GENL_MCGRP_CONFIG_NAME "config"
21 
22 enum devlink_command {
23 	/* don't change the order or add anything between, this is ABI! */
24 	DEVLINK_CMD_UNSPEC,
25 
26 	DEVLINK_CMD_GET,		/* can dump */
27 	DEVLINK_CMD_SET,
28 	DEVLINK_CMD_NEW,
29 	DEVLINK_CMD_DEL,
30 
31 	DEVLINK_CMD_PORT_GET,		/* can dump */
32 	DEVLINK_CMD_PORT_SET,
33 	DEVLINK_CMD_PORT_NEW,
34 	DEVLINK_CMD_PORT_DEL,
35 
36 	DEVLINK_CMD_PORT_SPLIT,
37 	DEVLINK_CMD_PORT_UNSPLIT,
38 
39 	DEVLINK_CMD_SB_GET,		/* can dump */
40 	DEVLINK_CMD_SB_SET,
41 	DEVLINK_CMD_SB_NEW,
42 	DEVLINK_CMD_SB_DEL,
43 
44 	DEVLINK_CMD_SB_POOL_GET,	/* can dump */
45 	DEVLINK_CMD_SB_POOL_SET,
46 	DEVLINK_CMD_SB_POOL_NEW,
47 	DEVLINK_CMD_SB_POOL_DEL,
48 
49 	DEVLINK_CMD_SB_PORT_POOL_GET,	/* can dump */
50 	DEVLINK_CMD_SB_PORT_POOL_SET,
51 	DEVLINK_CMD_SB_PORT_POOL_NEW,
52 	DEVLINK_CMD_SB_PORT_POOL_DEL,
53 
54 	DEVLINK_CMD_SB_TC_POOL_BIND_GET,	/* can dump */
55 	DEVLINK_CMD_SB_TC_POOL_BIND_SET,
56 	DEVLINK_CMD_SB_TC_POOL_BIND_NEW,
57 	DEVLINK_CMD_SB_TC_POOL_BIND_DEL,
58 
59 	/* Shared buffer occupancy monitoring commands */
60 	DEVLINK_CMD_SB_OCC_SNAPSHOT,
61 	DEVLINK_CMD_SB_OCC_MAX_CLEAR,
62 
63 	DEVLINK_CMD_ESWITCH_GET,
64 #define DEVLINK_CMD_ESWITCH_MODE_GET /* obsolete, never use this! */ \
65 	DEVLINK_CMD_ESWITCH_GET
66 
67 	DEVLINK_CMD_ESWITCH_SET,
68 #define DEVLINK_CMD_ESWITCH_MODE_SET /* obsolete, never use this! */ \
69 	DEVLINK_CMD_ESWITCH_SET
70 
71 	DEVLINK_CMD_DPIPE_TABLE_GET,
72 	DEVLINK_CMD_DPIPE_ENTRIES_GET,
73 	DEVLINK_CMD_DPIPE_HEADERS_GET,
74 	DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET,
75 	DEVLINK_CMD_RESOURCE_SET,
76 	DEVLINK_CMD_RESOURCE_DUMP,
77 
78 	/* Hot driver reload, makes configuration changes take place. The
79 	 * devlink instance is not released during the process.
80 	 */
81 	DEVLINK_CMD_RELOAD,
82 
83 	DEVLINK_CMD_PARAM_GET,		/* can dump */
84 	DEVLINK_CMD_PARAM_SET,
85 	DEVLINK_CMD_PARAM_NEW,
86 	DEVLINK_CMD_PARAM_DEL,
87 
88 	DEVLINK_CMD_REGION_GET,
89 	DEVLINK_CMD_REGION_SET,
90 	DEVLINK_CMD_REGION_NEW,
91 	DEVLINK_CMD_REGION_DEL,
92 	DEVLINK_CMD_REGION_READ,
93 
94 	DEVLINK_CMD_PORT_PARAM_GET,	/* can dump */
95 	DEVLINK_CMD_PORT_PARAM_SET,
96 	DEVLINK_CMD_PORT_PARAM_NEW,
97 	DEVLINK_CMD_PORT_PARAM_DEL,
98 
99 	DEVLINK_CMD_INFO_GET,		/* can dump */
100 
101 	DEVLINK_CMD_HEALTH_REPORTER_GET,
102 	DEVLINK_CMD_HEALTH_REPORTER_SET,
103 	DEVLINK_CMD_HEALTH_REPORTER_RECOVER,
104 	DEVLINK_CMD_HEALTH_REPORTER_DIAGNOSE,
105 	DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET,
106 	DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR,
107 
108 	DEVLINK_CMD_FLASH_UPDATE,
109 	DEVLINK_CMD_FLASH_UPDATE_END,		/* notification only */
110 	DEVLINK_CMD_FLASH_UPDATE_STATUS,	/* notification only */
111 
112 	DEVLINK_CMD_TRAP_GET,		/* can dump */
113 	DEVLINK_CMD_TRAP_SET,
114 	DEVLINK_CMD_TRAP_NEW,
115 	DEVLINK_CMD_TRAP_DEL,
116 
117 	DEVLINK_CMD_TRAP_GROUP_GET,	/* can dump */
118 	DEVLINK_CMD_TRAP_GROUP_SET,
119 	DEVLINK_CMD_TRAP_GROUP_NEW,
120 	DEVLINK_CMD_TRAP_GROUP_DEL,
121 
122 	DEVLINK_CMD_TRAP_POLICER_GET,	/* can dump */
123 	DEVLINK_CMD_TRAP_POLICER_SET,
124 	DEVLINK_CMD_TRAP_POLICER_NEW,
125 	DEVLINK_CMD_TRAP_POLICER_DEL,
126 
127 	DEVLINK_CMD_HEALTH_REPORTER_TEST,
128 
129 	/* add new commands above here */
130 	__DEVLINK_CMD_MAX,
131 	DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1
132 };
133 
134 enum devlink_port_type {
135 	DEVLINK_PORT_TYPE_NOTSET,
136 	DEVLINK_PORT_TYPE_AUTO,
137 	DEVLINK_PORT_TYPE_ETH,
138 	DEVLINK_PORT_TYPE_IB,
139 };
140 
141 enum devlink_sb_pool_type {
142 	DEVLINK_SB_POOL_TYPE_INGRESS,
143 	DEVLINK_SB_POOL_TYPE_EGRESS,
144 };
145 
146 /* static threshold - limiting the maximum number of bytes.
147  * dynamic threshold - limiting the maximum number of bytes
148  *   based on the currently available free space in the shared buffer pool.
149  *   In this mode, the maximum quota is calculated based
150  *   on the following formula:
151  *     max_quota = alpha / (1 + alpha) * Free_Buffer
152  *   While Free_Buffer is the amount of none-occupied buffer associated to
153  *   the relevant pool.
154  *   The value range which can be passed is 0-20 and serves
155  *   for computation of alpha by following formula:
156  *     alpha = 2 ^ (passed_value - 10)
157  */
158 
159 enum devlink_sb_threshold_type {
160 	DEVLINK_SB_THRESHOLD_TYPE_STATIC,
161 	DEVLINK_SB_THRESHOLD_TYPE_DYNAMIC,
162 };
163 
164 #define DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX 20
165 
166 enum devlink_eswitch_mode {
167 	DEVLINK_ESWITCH_MODE_LEGACY,
168 	DEVLINK_ESWITCH_MODE_SWITCHDEV,
169 };
170 
171 enum devlink_eswitch_inline_mode {
172 	DEVLINK_ESWITCH_INLINE_MODE_NONE,
173 	DEVLINK_ESWITCH_INLINE_MODE_LINK,
174 	DEVLINK_ESWITCH_INLINE_MODE_NETWORK,
175 	DEVLINK_ESWITCH_INLINE_MODE_TRANSPORT,
176 };
177 
178 enum devlink_eswitch_encap_mode {
179 	DEVLINK_ESWITCH_ENCAP_MODE_NONE,
180 	DEVLINK_ESWITCH_ENCAP_MODE_BASIC,
181 };
182 
183 enum devlink_port_flavour {
184 	DEVLINK_PORT_FLAVOUR_PHYSICAL, /* Any kind of a port physically
185 					* facing the user.
186 					*/
187 	DEVLINK_PORT_FLAVOUR_CPU, /* CPU port */
188 	DEVLINK_PORT_FLAVOUR_DSA, /* Distributed switch architecture
189 				   * interconnect port.
190 				   */
191 	DEVLINK_PORT_FLAVOUR_PCI_PF, /* Represents eswitch port for
192 				      * the PCI PF. It is an internal
193 				      * port that faces the PCI PF.
194 				      */
195 	DEVLINK_PORT_FLAVOUR_PCI_VF, /* Represents eswitch port
196 				      * for the PCI VF. It is an internal
197 				      * port that faces the PCI VF.
198 				      */
199 	DEVLINK_PORT_FLAVOUR_VIRTUAL, /* Any virtual port facing the user. */
200 	DEVLINK_PORT_FLAVOUR_UNUSED, /* Port which exists in the switch, but
201 				      * is not used in any way.
202 				      */
203 };
204 
205 enum devlink_param_cmode {
206 	DEVLINK_PARAM_CMODE_RUNTIME,
207 	DEVLINK_PARAM_CMODE_DRIVERINIT,
208 	DEVLINK_PARAM_CMODE_PERMANENT,
209 
210 	/* Add new configuration modes above */
211 	__DEVLINK_PARAM_CMODE_MAX,
212 	DEVLINK_PARAM_CMODE_MAX = __DEVLINK_PARAM_CMODE_MAX - 1
213 };
214 
215 enum devlink_param_fw_load_policy_value {
216 	DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_DRIVER,
217 	DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_FLASH,
218 	DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_DISK,
219 	DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_UNKNOWN,
220 };
221 
222 enum devlink_param_reset_dev_on_drv_probe_value {
223 	DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_UNKNOWN,
224 	DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_ALWAYS,
225 	DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_NEVER,
226 	DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_DISK,
227 };
228 
229 enum {
230 	DEVLINK_ATTR_STATS_RX_PACKETS,		/* u64 */
231 	DEVLINK_ATTR_STATS_RX_BYTES,		/* u64 */
232 	DEVLINK_ATTR_STATS_RX_DROPPED,		/* u64 */
233 
234 	__DEVLINK_ATTR_STATS_MAX,
235 	DEVLINK_ATTR_STATS_MAX = __DEVLINK_ATTR_STATS_MAX - 1
236 };
237 
238 /* Specify what sections of a flash component can be overwritten when
239  * performing an update. Overwriting of firmware binary sections is always
240  * implicitly assumed to be allowed.
241  *
242  * Each section must be documented in
243  * Documentation/networking/devlink/devlink-flash.rst
244  *
245  */
246 enum {
247 	DEVLINK_FLASH_OVERWRITE_SETTINGS_BIT,
248 	DEVLINK_FLASH_OVERWRITE_IDENTIFIERS_BIT,
249 
250 	__DEVLINK_FLASH_OVERWRITE_MAX_BIT,
251 	DEVLINK_FLASH_OVERWRITE_MAX_BIT = __DEVLINK_FLASH_OVERWRITE_MAX_BIT - 1
252 };
253 
254 #define DEVLINK_FLASH_OVERWRITE_SETTINGS _BITUL(DEVLINK_FLASH_OVERWRITE_SETTINGS_BIT)
255 #define DEVLINK_FLASH_OVERWRITE_IDENTIFIERS _BITUL(DEVLINK_FLASH_OVERWRITE_IDENTIFIERS_BIT)
256 
257 #define DEVLINK_SUPPORTED_FLASH_OVERWRITE_SECTIONS \
258 	(_BITUL(__DEVLINK_FLASH_OVERWRITE_MAX_BIT) - 1)
259 
260 /**
261  * enum devlink_trap_action - Packet trap action.
262  * @DEVLINK_TRAP_ACTION_DROP: Packet is dropped by the device and a copy is not
263  *                            sent to the CPU.
264  * @DEVLINK_TRAP_ACTION_TRAP: The sole copy of the packet is sent to the CPU.
265  * @DEVLINK_TRAP_ACTION_MIRROR: Packet is forwarded by the device and a copy is
266  *                              sent to the CPU.
267  */
268 enum devlink_trap_action {
269 	DEVLINK_TRAP_ACTION_DROP,
270 	DEVLINK_TRAP_ACTION_TRAP,
271 	DEVLINK_TRAP_ACTION_MIRROR,
272 };
273 
274 /**
275  * enum devlink_trap_type - Packet trap type.
276  * @DEVLINK_TRAP_TYPE_DROP: Trap reason is a drop. Trapped packets are only
277  *                          processed by devlink and not injected to the
278  *                          kernel's Rx path.
279  * @DEVLINK_TRAP_TYPE_EXCEPTION: Trap reason is an exception. Packet was not
280  *                               forwarded as intended due to an exception
281  *                               (e.g., missing neighbour entry) and trapped to
282  *                               control plane for resolution. Trapped packets
283  *                               are processed by devlink and injected to
284  *                               the kernel's Rx path.
285  * @DEVLINK_TRAP_TYPE_CONTROL: Packet was trapped because it is required for
286  *                             the correct functioning of the control plane.
287  *                             For example, an ARP request packet. Trapped
288  *                             packets are injected to the kernel's Rx path,
289  *                             but not reported to drop monitor.
290  */
291 enum devlink_trap_type {
292 	DEVLINK_TRAP_TYPE_DROP,
293 	DEVLINK_TRAP_TYPE_EXCEPTION,
294 	DEVLINK_TRAP_TYPE_CONTROL,
295 };
296 
297 enum {
298 	/* Trap can report input port as metadata */
299 	DEVLINK_ATTR_TRAP_METADATA_TYPE_IN_PORT,
300 	/* Trap can report flow action cookie as metadata */
301 	DEVLINK_ATTR_TRAP_METADATA_TYPE_FA_COOKIE,
302 };
303 
304 enum devlink_reload_action {
305 	DEVLINK_RELOAD_ACTION_UNSPEC,
306 	DEVLINK_RELOAD_ACTION_DRIVER_REINIT,	/* Driver entities re-instantiation */
307 	DEVLINK_RELOAD_ACTION_FW_ACTIVATE,	/* FW activate */
308 
309 	/* Add new reload actions above */
310 	__DEVLINK_RELOAD_ACTION_MAX,
311 	DEVLINK_RELOAD_ACTION_MAX = __DEVLINK_RELOAD_ACTION_MAX - 1
312 };
313 
314 enum devlink_reload_limit {
315 	DEVLINK_RELOAD_LIMIT_UNSPEC,	/* unspecified, no constraints */
316 	DEVLINK_RELOAD_LIMIT_NO_RESET,	/* No reset allowed, no down time allowed,
317 					 * no link flap and no configuration is lost.
318 					 */
319 
320 	/* Add new reload limit above */
321 	__DEVLINK_RELOAD_LIMIT_MAX,
322 	DEVLINK_RELOAD_LIMIT_MAX = __DEVLINK_RELOAD_LIMIT_MAX - 1
323 };
324 
325 #define DEVLINK_RELOAD_LIMITS_VALID_MASK (BIT(__DEVLINK_RELOAD_LIMIT_MAX) - 1)
326 
327 enum devlink_attr {
328 	/* don't change the order or add anything between, this is ABI! */
329 	DEVLINK_ATTR_UNSPEC,
330 
331 	/* bus name + dev name together are a handle for devlink entity */
332 	DEVLINK_ATTR_BUS_NAME,			/* string */
333 	DEVLINK_ATTR_DEV_NAME,			/* string */
334 
335 	DEVLINK_ATTR_PORT_INDEX,		/* u32 */
336 	DEVLINK_ATTR_PORT_TYPE,			/* u16 */
337 	DEVLINK_ATTR_PORT_DESIRED_TYPE,		/* u16 */
338 	DEVLINK_ATTR_PORT_NETDEV_IFINDEX,	/* u32 */
339 	DEVLINK_ATTR_PORT_NETDEV_NAME,		/* string */
340 	DEVLINK_ATTR_PORT_IBDEV_NAME,		/* string */
341 	DEVLINK_ATTR_PORT_SPLIT_COUNT,		/* u32 */
342 	DEVLINK_ATTR_PORT_SPLIT_GROUP,		/* u32 */
343 	DEVLINK_ATTR_SB_INDEX,			/* u32 */
344 	DEVLINK_ATTR_SB_SIZE,			/* u32 */
345 	DEVLINK_ATTR_SB_INGRESS_POOL_COUNT,	/* u16 */
346 	DEVLINK_ATTR_SB_EGRESS_POOL_COUNT,	/* u16 */
347 	DEVLINK_ATTR_SB_INGRESS_TC_COUNT,	/* u16 */
348 	DEVLINK_ATTR_SB_EGRESS_TC_COUNT,	/* u16 */
349 	DEVLINK_ATTR_SB_POOL_INDEX,		/* u16 */
350 	DEVLINK_ATTR_SB_POOL_TYPE,		/* u8 */
351 	DEVLINK_ATTR_SB_POOL_SIZE,		/* u32 */
352 	DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE,	/* u8 */
353 	DEVLINK_ATTR_SB_THRESHOLD,		/* u32 */
354 	DEVLINK_ATTR_SB_TC_INDEX,		/* u16 */
355 	DEVLINK_ATTR_SB_OCC_CUR,		/* u32 */
356 	DEVLINK_ATTR_SB_OCC_MAX,		/* u32 */
357 	DEVLINK_ATTR_ESWITCH_MODE,		/* u16 */
358 	DEVLINK_ATTR_ESWITCH_INLINE_MODE,	/* u8 */
359 
360 	DEVLINK_ATTR_DPIPE_TABLES,		/* nested */
361 	DEVLINK_ATTR_DPIPE_TABLE,		/* nested */
362 	DEVLINK_ATTR_DPIPE_TABLE_NAME,		/* string */
363 	DEVLINK_ATTR_DPIPE_TABLE_SIZE,		/* u64 */
364 	DEVLINK_ATTR_DPIPE_TABLE_MATCHES,	/* nested */
365 	DEVLINK_ATTR_DPIPE_TABLE_ACTIONS,	/* nested */
366 	DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED,	/* u8 */
367 
368 	DEVLINK_ATTR_DPIPE_ENTRIES,		/* nested */
369 	DEVLINK_ATTR_DPIPE_ENTRY,		/* nested */
370 	DEVLINK_ATTR_DPIPE_ENTRY_INDEX,		/* u64 */
371 	DEVLINK_ATTR_DPIPE_ENTRY_MATCH_VALUES,	/* nested */
372 	DEVLINK_ATTR_DPIPE_ENTRY_ACTION_VALUES,	/* nested */
373 	DEVLINK_ATTR_DPIPE_ENTRY_COUNTER,	/* u64 */
374 
375 	DEVLINK_ATTR_DPIPE_MATCH,		/* nested */
376 	DEVLINK_ATTR_DPIPE_MATCH_VALUE,		/* nested */
377 	DEVLINK_ATTR_DPIPE_MATCH_TYPE,		/* u32 */
378 
379 	DEVLINK_ATTR_DPIPE_ACTION,		/* nested */
380 	DEVLINK_ATTR_DPIPE_ACTION_VALUE,	/* nested */
381 	DEVLINK_ATTR_DPIPE_ACTION_TYPE,		/* u32 */
382 
383 	DEVLINK_ATTR_DPIPE_VALUE,
384 	DEVLINK_ATTR_DPIPE_VALUE_MASK,
385 	DEVLINK_ATTR_DPIPE_VALUE_MAPPING,	/* u32 */
386 
387 	DEVLINK_ATTR_DPIPE_HEADERS,		/* nested */
388 	DEVLINK_ATTR_DPIPE_HEADER,		/* nested */
389 	DEVLINK_ATTR_DPIPE_HEADER_NAME,		/* string */
390 	DEVLINK_ATTR_DPIPE_HEADER_ID,		/* u32 */
391 	DEVLINK_ATTR_DPIPE_HEADER_FIELDS,	/* nested */
392 	DEVLINK_ATTR_DPIPE_HEADER_GLOBAL,	/* u8 */
393 	DEVLINK_ATTR_DPIPE_HEADER_INDEX,	/* u32 */
394 
395 	DEVLINK_ATTR_DPIPE_FIELD,		/* nested */
396 	DEVLINK_ATTR_DPIPE_FIELD_NAME,		/* string */
397 	DEVLINK_ATTR_DPIPE_FIELD_ID,		/* u32 */
398 	DEVLINK_ATTR_DPIPE_FIELD_BITWIDTH,	/* u32 */
399 	DEVLINK_ATTR_DPIPE_FIELD_MAPPING_TYPE,	/* u32 */
400 
401 	DEVLINK_ATTR_PAD,
402 
403 	DEVLINK_ATTR_ESWITCH_ENCAP_MODE,	/* u8 */
404 	DEVLINK_ATTR_RESOURCE_LIST,		/* nested */
405 	DEVLINK_ATTR_RESOURCE,			/* nested */
406 	DEVLINK_ATTR_RESOURCE_NAME,		/* string */
407 	DEVLINK_ATTR_RESOURCE_ID,		/* u64 */
408 	DEVLINK_ATTR_RESOURCE_SIZE,		/* u64 */
409 	DEVLINK_ATTR_RESOURCE_SIZE_NEW,		/* u64 */
410 	DEVLINK_ATTR_RESOURCE_SIZE_VALID,	/* u8 */
411 	DEVLINK_ATTR_RESOURCE_SIZE_MIN,		/* u64 */
412 	DEVLINK_ATTR_RESOURCE_SIZE_MAX,		/* u64 */
413 	DEVLINK_ATTR_RESOURCE_SIZE_GRAN,        /* u64 */
414 	DEVLINK_ATTR_RESOURCE_UNIT,		/* u8 */
415 	DEVLINK_ATTR_RESOURCE_OCC,		/* u64 */
416 	DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_ID,	/* u64 */
417 	DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_UNITS,/* u64 */
418 
419 	DEVLINK_ATTR_PORT_FLAVOUR,		/* u16 */
420 	DEVLINK_ATTR_PORT_NUMBER,		/* u32 */
421 	DEVLINK_ATTR_PORT_SPLIT_SUBPORT_NUMBER,	/* u32 */
422 
423 	DEVLINK_ATTR_PARAM,			/* nested */
424 	DEVLINK_ATTR_PARAM_NAME,		/* string */
425 	DEVLINK_ATTR_PARAM_GENERIC,		/* flag */
426 	DEVLINK_ATTR_PARAM_TYPE,		/* u8 */
427 	DEVLINK_ATTR_PARAM_VALUES_LIST,		/* nested */
428 	DEVLINK_ATTR_PARAM_VALUE,		/* nested */
429 	DEVLINK_ATTR_PARAM_VALUE_DATA,		/* dynamic */
430 	DEVLINK_ATTR_PARAM_VALUE_CMODE,		/* u8 */
431 
432 	DEVLINK_ATTR_REGION_NAME,               /* string */
433 	DEVLINK_ATTR_REGION_SIZE,               /* u64 */
434 	DEVLINK_ATTR_REGION_SNAPSHOTS,          /* nested */
435 	DEVLINK_ATTR_REGION_SNAPSHOT,           /* nested */
436 	DEVLINK_ATTR_REGION_SNAPSHOT_ID,        /* u32 */
437 
438 	DEVLINK_ATTR_REGION_CHUNKS,             /* nested */
439 	DEVLINK_ATTR_REGION_CHUNK,              /* nested */
440 	DEVLINK_ATTR_REGION_CHUNK_DATA,         /* binary */
441 	DEVLINK_ATTR_REGION_CHUNK_ADDR,         /* u64 */
442 	DEVLINK_ATTR_REGION_CHUNK_LEN,          /* u64 */
443 
444 	DEVLINK_ATTR_INFO_DRIVER_NAME,		/* string */
445 	DEVLINK_ATTR_INFO_SERIAL_NUMBER,	/* string */
446 	DEVLINK_ATTR_INFO_VERSION_FIXED,	/* nested */
447 	DEVLINK_ATTR_INFO_VERSION_RUNNING,	/* nested */
448 	DEVLINK_ATTR_INFO_VERSION_STORED,	/* nested */
449 	DEVLINK_ATTR_INFO_VERSION_NAME,		/* string */
450 	DEVLINK_ATTR_INFO_VERSION_VALUE,	/* string */
451 
452 	DEVLINK_ATTR_SB_POOL_CELL_SIZE,		/* u32 */
453 
454 	DEVLINK_ATTR_FMSG,			/* nested */
455 	DEVLINK_ATTR_FMSG_OBJ_NEST_START,	/* flag */
456 	DEVLINK_ATTR_FMSG_PAIR_NEST_START,	/* flag */
457 	DEVLINK_ATTR_FMSG_ARR_NEST_START,	/* flag */
458 	DEVLINK_ATTR_FMSG_NEST_END,		/* flag */
459 	DEVLINK_ATTR_FMSG_OBJ_NAME,		/* string */
460 	DEVLINK_ATTR_FMSG_OBJ_VALUE_TYPE,	/* u8 */
461 	DEVLINK_ATTR_FMSG_OBJ_VALUE_DATA,	/* dynamic */
462 
463 	DEVLINK_ATTR_HEALTH_REPORTER,			/* nested */
464 	DEVLINK_ATTR_HEALTH_REPORTER_NAME,		/* string */
465 	DEVLINK_ATTR_HEALTH_REPORTER_STATE,		/* u8 */
466 	DEVLINK_ATTR_HEALTH_REPORTER_ERR_COUNT,		/* u64 */
467 	DEVLINK_ATTR_HEALTH_REPORTER_RECOVER_COUNT,	/* u64 */
468 	DEVLINK_ATTR_HEALTH_REPORTER_DUMP_TS,		/* u64 */
469 	DEVLINK_ATTR_HEALTH_REPORTER_GRACEFUL_PERIOD,	/* u64 */
470 	DEVLINK_ATTR_HEALTH_REPORTER_AUTO_RECOVER,	/* u8 */
471 
472 	DEVLINK_ATTR_FLASH_UPDATE_FILE_NAME,	/* string */
473 	DEVLINK_ATTR_FLASH_UPDATE_COMPONENT,	/* string */
474 	DEVLINK_ATTR_FLASH_UPDATE_STATUS_MSG,	/* string */
475 	DEVLINK_ATTR_FLASH_UPDATE_STATUS_DONE,	/* u64 */
476 	DEVLINK_ATTR_FLASH_UPDATE_STATUS_TOTAL,	/* u64 */
477 
478 	DEVLINK_ATTR_PORT_PCI_PF_NUMBER,	/* u16 */
479 	DEVLINK_ATTR_PORT_PCI_VF_NUMBER,	/* u16 */
480 
481 	DEVLINK_ATTR_STATS,				/* nested */
482 
483 	DEVLINK_ATTR_TRAP_NAME,				/* string */
484 	/* enum devlink_trap_action */
485 	DEVLINK_ATTR_TRAP_ACTION,			/* u8 */
486 	/* enum devlink_trap_type */
487 	DEVLINK_ATTR_TRAP_TYPE,				/* u8 */
488 	DEVLINK_ATTR_TRAP_GENERIC,			/* flag */
489 	DEVLINK_ATTR_TRAP_METADATA,			/* nested */
490 	DEVLINK_ATTR_TRAP_GROUP_NAME,			/* string */
491 
492 	DEVLINK_ATTR_RELOAD_FAILED,			/* u8 0 or 1 */
493 
494 	DEVLINK_ATTR_HEALTH_REPORTER_DUMP_TS_NS,	/* u64 */
495 
496 	DEVLINK_ATTR_NETNS_FD,			/* u32 */
497 	DEVLINK_ATTR_NETNS_PID,			/* u32 */
498 	DEVLINK_ATTR_NETNS_ID,			/* u32 */
499 
500 	DEVLINK_ATTR_HEALTH_REPORTER_AUTO_DUMP,	/* u8 */
501 
502 	DEVLINK_ATTR_TRAP_POLICER_ID,			/* u32 */
503 	DEVLINK_ATTR_TRAP_POLICER_RATE,			/* u64 */
504 	DEVLINK_ATTR_TRAP_POLICER_BURST,		/* u64 */
505 
506 	DEVLINK_ATTR_PORT_FUNCTION,			/* nested */
507 
508 	DEVLINK_ATTR_INFO_BOARD_SERIAL_NUMBER,	/* string */
509 
510 	DEVLINK_ATTR_PORT_LANES,			/* u32 */
511 	DEVLINK_ATTR_PORT_SPLITTABLE,			/* u8 */
512 
513 	DEVLINK_ATTR_PORT_EXTERNAL,		/* u8 */
514 	DEVLINK_ATTR_PORT_CONTROLLER_NUMBER,	/* u32 */
515 
516 	DEVLINK_ATTR_FLASH_UPDATE_STATUS_TIMEOUT,	/* u64 */
517 	DEVLINK_ATTR_FLASH_UPDATE_OVERWRITE_MASK,	/* bitfield32 */
518 
519 	DEVLINK_ATTR_RELOAD_ACTION,		/* u8 */
520 	DEVLINK_ATTR_RELOAD_ACTIONS_PERFORMED,	/* bitfield32 */
521 	DEVLINK_ATTR_RELOAD_LIMITS,		/* bitfield32 */
522 
523 	DEVLINK_ATTR_DEV_STATS,			/* nested */
524 	DEVLINK_ATTR_RELOAD_STATS,		/* nested */
525 	DEVLINK_ATTR_RELOAD_STATS_ENTRY,	/* nested */
526 	DEVLINK_ATTR_RELOAD_STATS_LIMIT,	/* u8 */
527 	DEVLINK_ATTR_RELOAD_STATS_VALUE,	/* u32 */
528 	DEVLINK_ATTR_REMOTE_RELOAD_STATS,	/* nested */
529 	DEVLINK_ATTR_RELOAD_ACTION_INFO,        /* nested */
530 	DEVLINK_ATTR_RELOAD_ACTION_STATS,       /* nested */
531 
532 	/* add new attributes above here, update the policy in devlink.c */
533 
534 	__DEVLINK_ATTR_MAX,
535 	DEVLINK_ATTR_MAX = __DEVLINK_ATTR_MAX - 1
536 };
537 
538 /* Mapping between internal resource described by the field and system
539  * structure
540  */
541 enum devlink_dpipe_field_mapping_type {
542 	DEVLINK_DPIPE_FIELD_MAPPING_TYPE_NONE,
543 	DEVLINK_DPIPE_FIELD_MAPPING_TYPE_IFINDEX,
544 };
545 
546 /* Match type - specify the type of the match */
547 enum devlink_dpipe_match_type {
548 	DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT,
549 };
550 
551 /* Action type - specify the action type */
552 enum devlink_dpipe_action_type {
553 	DEVLINK_DPIPE_ACTION_TYPE_FIELD_MODIFY,
554 };
555 
556 enum devlink_dpipe_field_ethernet_id {
557 	DEVLINK_DPIPE_FIELD_ETHERNET_DST_MAC,
558 };
559 
560 enum devlink_dpipe_field_ipv4_id {
561 	DEVLINK_DPIPE_FIELD_IPV4_DST_IP,
562 };
563 
564 enum devlink_dpipe_field_ipv6_id {
565 	DEVLINK_DPIPE_FIELD_IPV6_DST_IP,
566 };
567 
568 enum devlink_dpipe_header_id {
569 	DEVLINK_DPIPE_HEADER_ETHERNET,
570 	DEVLINK_DPIPE_HEADER_IPV4,
571 	DEVLINK_DPIPE_HEADER_IPV6,
572 };
573 
574 enum devlink_resource_unit {
575 	DEVLINK_RESOURCE_UNIT_ENTRY,
576 };
577 
578 enum devlink_port_function_attr {
579 	DEVLINK_PORT_FUNCTION_ATTR_UNSPEC,
580 	DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR,	/* binary */
581 
582 	__DEVLINK_PORT_FUNCTION_ATTR_MAX,
583 	DEVLINK_PORT_FUNCTION_ATTR_MAX = __DEVLINK_PORT_FUNCTION_ATTR_MAX - 1
584 };
585 
586 #endif /* _UAPI_LINUX_DEVLINK_H_ */
587