devlink.h 19.5 KB
Newer Older
1
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
J
Jiri Pirko 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * include/uapi/linux/devlink.h - Network physical device Netlink interface
 * Copyright (c) 2016 Mellanox Technologies. All rights reserved.
 * Copyright (c) 2016 Jiri Pirko <jiri@mellanox.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

#ifndef _UAPI_LINUX_DEVLINK_H_
#define _UAPI_LINUX_DEVLINK_H_

16 17
#include <linux/const.h>

J
Jiri Pirko 已提交
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
#define DEVLINK_GENL_NAME "devlink"
#define DEVLINK_GENL_VERSION 0x1
#define DEVLINK_GENL_MCGRP_CONFIG_NAME "config"

enum devlink_command {
	/* don't change the order or add anything between, this is ABI! */
	DEVLINK_CMD_UNSPEC,

	DEVLINK_CMD_GET,		/* can dump */
	DEVLINK_CMD_SET,
	DEVLINK_CMD_NEW,
	DEVLINK_CMD_DEL,

	DEVLINK_CMD_PORT_GET,		/* can dump */
	DEVLINK_CMD_PORT_SET,
	DEVLINK_CMD_PORT_NEW,
	DEVLINK_CMD_PORT_DEL,

	DEVLINK_CMD_PORT_SPLIT,
	DEVLINK_CMD_PORT_UNSPLIT,

39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
	DEVLINK_CMD_SB_GET,		/* can dump */
	DEVLINK_CMD_SB_SET,
	DEVLINK_CMD_SB_NEW,
	DEVLINK_CMD_SB_DEL,

	DEVLINK_CMD_SB_POOL_GET,	/* can dump */
	DEVLINK_CMD_SB_POOL_SET,
	DEVLINK_CMD_SB_POOL_NEW,
	DEVLINK_CMD_SB_POOL_DEL,

	DEVLINK_CMD_SB_PORT_POOL_GET,	/* can dump */
	DEVLINK_CMD_SB_PORT_POOL_SET,
	DEVLINK_CMD_SB_PORT_POOL_NEW,
	DEVLINK_CMD_SB_PORT_POOL_DEL,

	DEVLINK_CMD_SB_TC_POOL_BIND_GET,	/* can dump */
	DEVLINK_CMD_SB_TC_POOL_BIND_SET,
	DEVLINK_CMD_SB_TC_POOL_BIND_NEW,
	DEVLINK_CMD_SB_TC_POOL_BIND_DEL,

59 60 61 62
	/* Shared buffer occupancy monitoring commands */
	DEVLINK_CMD_SB_OCC_SNAPSHOT,
	DEVLINK_CMD_SB_OCC_MAX_CLEAR,

63 64 65 66 67 68 69 70
	DEVLINK_CMD_ESWITCH_GET,
#define DEVLINK_CMD_ESWITCH_MODE_GET /* obsolete, never use this! */ \
	DEVLINK_CMD_ESWITCH_GET

	DEVLINK_CMD_ESWITCH_SET,
#define DEVLINK_CMD_ESWITCH_MODE_SET /* obsolete, never use this! */ \
	DEVLINK_CMD_ESWITCH_SET

71 72 73 74
	DEVLINK_CMD_DPIPE_TABLE_GET,
	DEVLINK_CMD_DPIPE_ENTRIES_GET,
	DEVLINK_CMD_DPIPE_HEADERS_GET,
	DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET,
75 76
	DEVLINK_CMD_RESOURCE_SET,
	DEVLINK_CMD_RESOURCE_DUMP,
J
Jiri Pirko 已提交
77

78 79 80 81 82
	/* Hot driver reload, makes configuration changes take place. The
	 * devlink instance is not released during the process.
	 */
	DEVLINK_CMD_RELOAD,

M
Moshe Shemesh 已提交
83
	DEVLINK_CMD_PARAM_GET,		/* can dump */
M
Moshe Shemesh 已提交
84
	DEVLINK_CMD_PARAM_SET,
85 86
	DEVLINK_CMD_PARAM_NEW,
	DEVLINK_CMD_PARAM_DEL,
M
Moshe Shemesh 已提交
87

88 89
	DEVLINK_CMD_REGION_GET,
	DEVLINK_CMD_REGION_SET,
90 91
	DEVLINK_CMD_REGION_NEW,
	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 97
	DEVLINK_CMD_PORT_PARAM_NEW,
	DEVLINK_CMD_PORT_PARAM_DEL,
98

99 100
	DEVLINK_CMD_INFO_GET,		/* can dump */

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 106
	DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET,
	DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR,
107

108
	DEVLINK_CMD_FLASH_UPDATE,
109 110
	DEVLINK_CMD_FLASH_UPDATE_END,		/* notification only */
	DEVLINK_CMD_FLASH_UPDATE_STATUS,	/* notification only */
111

112 113 114 115 116 117 118 119 120 121
	DEVLINK_CMD_TRAP_GET,		/* can dump */
	DEVLINK_CMD_TRAP_SET,
	DEVLINK_CMD_TRAP_NEW,
	DEVLINK_CMD_TRAP_DEL,

	DEVLINK_CMD_TRAP_GROUP_GET,	/* can dump */
	DEVLINK_CMD_TRAP_GROUP_SET,
	DEVLINK_CMD_TRAP_GROUP_NEW,
	DEVLINK_CMD_TRAP_GROUP_DEL,

122 123 124 125 126
	DEVLINK_CMD_TRAP_POLICER_GET,	/* can dump */
	DEVLINK_CMD_TRAP_POLICER_SET,
	DEVLINK_CMD_TRAP_POLICER_NEW,
	DEVLINK_CMD_TRAP_POLICER_DEL,

127 128
	DEVLINK_CMD_HEALTH_REPORTER_TEST,

D
Dmytro Linkin 已提交
129 130 131 132 133
	DEVLINK_CMD_RATE_GET,		/* can dump */
	DEVLINK_CMD_RATE_SET,
	DEVLINK_CMD_RATE_NEW,
	DEVLINK_CMD_RATE_DEL,

134
	/* add new commands above here */
J
Jiri Pirko 已提交
135 136 137 138 139 140 141 142 143 144 145
	__DEVLINK_CMD_MAX,
	DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1
};

enum devlink_port_type {
	DEVLINK_PORT_TYPE_NOTSET,
	DEVLINK_PORT_TYPE_AUTO,
	DEVLINK_PORT_TYPE_ETH,
	DEVLINK_PORT_TYPE_IB,
};

146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
enum devlink_sb_pool_type {
	DEVLINK_SB_POOL_TYPE_INGRESS,
	DEVLINK_SB_POOL_TYPE_EGRESS,
};

/* static threshold - limiting the maximum number of bytes.
 * dynamic threshold - limiting the maximum number of bytes
 *   based on the currently available free space in the shared buffer pool.
 *   In this mode, the maximum quota is calculated based
 *   on the following formula:
 *     max_quota = alpha / (1 + alpha) * Free_Buffer
 *   While Free_Buffer is the amount of none-occupied buffer associated to
 *   the relevant pool.
 *   The value range which can be passed is 0-20 and serves
 *   for computation of alpha by following formula:
 *     alpha = 2 ^ (passed_value - 10)
 */

enum devlink_sb_threshold_type {
	DEVLINK_SB_THRESHOLD_TYPE_STATIC,
	DEVLINK_SB_THRESHOLD_TYPE_DYNAMIC,
};

#define DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX 20

171 172 173 174 175
enum devlink_eswitch_mode {
	DEVLINK_ESWITCH_MODE_LEGACY,
	DEVLINK_ESWITCH_MODE_SWITCHDEV,
};

176 177 178 179 180 181 182
enum devlink_eswitch_inline_mode {
	DEVLINK_ESWITCH_INLINE_MODE_NONE,
	DEVLINK_ESWITCH_INLINE_MODE_LINK,
	DEVLINK_ESWITCH_INLINE_MODE_NETWORK,
	DEVLINK_ESWITCH_INLINE_MODE_TRANSPORT,
};

183 184 185 186 187
enum devlink_eswitch_encap_mode {
	DEVLINK_ESWITCH_ENCAP_MODE_NONE,
	DEVLINK_ESWITCH_ENCAP_MODE_BASIC,
};

188 189 190 191 192 193 194 195
enum devlink_port_flavour {
	DEVLINK_PORT_FLAVOUR_PHYSICAL, /* Any kind of a port physically
					* facing the user.
					*/
	DEVLINK_PORT_FLAVOUR_CPU, /* CPU port */
	DEVLINK_PORT_FLAVOUR_DSA, /* Distributed switch architecture
				   * interconnect port.
				   */
196 197 198 199
	DEVLINK_PORT_FLAVOUR_PCI_PF, /* Represents eswitch port for
				      * the PCI PF. It is an internal
				      * port that faces the PCI PF.
				      */
200 201 202 203
	DEVLINK_PORT_FLAVOUR_PCI_VF, /* Represents eswitch port
				      * for the PCI VF. It is an internal
				      * port that faces the PCI VF.
				      */
204
	DEVLINK_PORT_FLAVOUR_VIRTUAL, /* Any virtual port facing the user. */
205 206 207
	DEVLINK_PORT_FLAVOUR_UNUSED, /* Port which exists in the switch, but
				      * is not used in any way.
				      */
208 209 210 211
	DEVLINK_PORT_FLAVOUR_PCI_SF, /* Represents eswitch port
				      * for the PCI SF. It is an internal
				      * port that faces the PCI SF.
				      */
212 213
};

D
Dmytro Linkin 已提交
214 215 216 217
enum devlink_rate_type {
	DEVLINK_RATE_TYPE_LEAF,
};

218 219 220 221 222 223 224 225 226 227
enum devlink_param_cmode {
	DEVLINK_PARAM_CMODE_RUNTIME,
	DEVLINK_PARAM_CMODE_DRIVERINIT,
	DEVLINK_PARAM_CMODE_PERMANENT,

	/* Add new configuration modes above */
	__DEVLINK_PARAM_CMODE_MAX,
	DEVLINK_PARAM_CMODE_MAX = __DEVLINK_PARAM_CMODE_MAX - 1
};

228 229 230
enum devlink_param_fw_load_policy_value {
	DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_DRIVER,
	DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_FLASH,
231
	DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_DISK,
232
	DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_UNKNOWN,
233 234
};

235 236 237 238 239 240 241
enum devlink_param_reset_dev_on_drv_probe_value {
	DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_UNKNOWN,
	DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_ALWAYS,
	DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_NEVER,
	DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_DISK,
};

242 243 244
enum {
	DEVLINK_ATTR_STATS_RX_PACKETS,		/* u64 */
	DEVLINK_ATTR_STATS_RX_BYTES,		/* u64 */
245
	DEVLINK_ATTR_STATS_RX_DROPPED,		/* u64 */
246 247 248 249 250

	__DEVLINK_ATTR_STATS_MAX,
	DEVLINK_ATTR_STATS_MAX = __DEVLINK_ATTR_STATS_MAX - 1
};

251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
/* Specify what sections of a flash component can be overwritten when
 * performing an update. Overwriting of firmware binary sections is always
 * implicitly assumed to be allowed.
 *
 * Each section must be documented in
 * Documentation/networking/devlink/devlink-flash.rst
 *
 */
enum {
	DEVLINK_FLASH_OVERWRITE_SETTINGS_BIT,
	DEVLINK_FLASH_OVERWRITE_IDENTIFIERS_BIT,

	__DEVLINK_FLASH_OVERWRITE_MAX_BIT,
	DEVLINK_FLASH_OVERWRITE_MAX_BIT = __DEVLINK_FLASH_OVERWRITE_MAX_BIT - 1
};

#define DEVLINK_FLASH_OVERWRITE_SETTINGS _BITUL(DEVLINK_FLASH_OVERWRITE_SETTINGS_BIT)
#define DEVLINK_FLASH_OVERWRITE_IDENTIFIERS _BITUL(DEVLINK_FLASH_OVERWRITE_IDENTIFIERS_BIT)

#define DEVLINK_SUPPORTED_FLASH_OVERWRITE_SECTIONS \
	(_BITUL(__DEVLINK_FLASH_OVERWRITE_MAX_BIT) - 1)

273 274 275 276 277
/**
 * enum devlink_trap_action - Packet trap action.
 * @DEVLINK_TRAP_ACTION_DROP: Packet is dropped by the device and a copy is not
 *                            sent to the CPU.
 * @DEVLINK_TRAP_ACTION_TRAP: The sole copy of the packet is sent to the CPU.
I
Ido Schimmel 已提交
278 279
 * @DEVLINK_TRAP_ACTION_MIRROR: Packet is forwarded by the device and a copy is
 *                              sent to the CPU.
280 281 282 283
 */
enum devlink_trap_action {
	DEVLINK_TRAP_ACTION_DROP,
	DEVLINK_TRAP_ACTION_TRAP,
I
Ido Schimmel 已提交
284
	DEVLINK_TRAP_ACTION_MIRROR,
285 286 287 288 289 290 291 292 293 294 295 296 297
};

/**
 * enum devlink_trap_type - Packet trap type.
 * @DEVLINK_TRAP_TYPE_DROP: Trap reason is a drop. Trapped packets are only
 *                          processed by devlink and not injected to the
 *                          kernel's Rx path.
 * @DEVLINK_TRAP_TYPE_EXCEPTION: Trap reason is an exception. Packet was not
 *                               forwarded as intended due to an exception
 *                               (e.g., missing neighbour entry) and trapped to
 *                               control plane for resolution. Trapped packets
 *                               are processed by devlink and injected to
 *                               the kernel's Rx path.
I
Ido Schimmel 已提交
298 299 300 301 302
 * @DEVLINK_TRAP_TYPE_CONTROL: Packet was trapped because it is required for
 *                             the correct functioning of the control plane.
 *                             For example, an ARP request packet. Trapped
 *                             packets are injected to the kernel's Rx path,
 *                             but not reported to drop monitor.
303 304 305 306
 */
enum devlink_trap_type {
	DEVLINK_TRAP_TYPE_DROP,
	DEVLINK_TRAP_TYPE_EXCEPTION,
I
Ido Schimmel 已提交
307
	DEVLINK_TRAP_TYPE_CONTROL,
308 309 310 311 312
};

enum {
	/* Trap can report input port as metadata */
	DEVLINK_ATTR_TRAP_METADATA_TYPE_IN_PORT,
313 314
	/* Trap can report flow action cookie as metadata */
	DEVLINK_ATTR_TRAP_METADATA_TYPE_FA_COOKIE,
315 316
};

317 318 319 320 321 322 323 324 325 326
enum devlink_reload_action {
	DEVLINK_RELOAD_ACTION_UNSPEC,
	DEVLINK_RELOAD_ACTION_DRIVER_REINIT,	/* Driver entities re-instantiation */
	DEVLINK_RELOAD_ACTION_FW_ACTIVATE,	/* FW activate */

	/* Add new reload actions above */
	__DEVLINK_RELOAD_ACTION_MAX,
	DEVLINK_RELOAD_ACTION_MAX = __DEVLINK_RELOAD_ACTION_MAX - 1
};

327 328 329 330 331 332 333 334 335 336 337
enum devlink_reload_limit {
	DEVLINK_RELOAD_LIMIT_UNSPEC,	/* unspecified, no constraints */
	DEVLINK_RELOAD_LIMIT_NO_RESET,	/* No reset allowed, no down time allowed,
					 * no link flap and no configuration is lost.
					 */

	/* Add new reload limit above */
	__DEVLINK_RELOAD_LIMIT_MAX,
	DEVLINK_RELOAD_LIMIT_MAX = __DEVLINK_RELOAD_LIMIT_MAX - 1
};

338
#define DEVLINK_RELOAD_LIMITS_VALID_MASK (_BITUL(__DEVLINK_RELOAD_LIMIT_MAX) - 1)
339

J
Jiri Pirko 已提交
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355
enum devlink_attr {
	/* don't change the order or add anything between, this is ABI! */
	DEVLINK_ATTR_UNSPEC,

	/* bus name + dev name together are a handle for devlink entity */
	DEVLINK_ATTR_BUS_NAME,			/* string */
	DEVLINK_ATTR_DEV_NAME,			/* string */

	DEVLINK_ATTR_PORT_INDEX,		/* u32 */
	DEVLINK_ATTR_PORT_TYPE,			/* u16 */
	DEVLINK_ATTR_PORT_DESIRED_TYPE,		/* u16 */
	DEVLINK_ATTR_PORT_NETDEV_IFINDEX,	/* u32 */
	DEVLINK_ATTR_PORT_NETDEV_NAME,		/* string */
	DEVLINK_ATTR_PORT_IBDEV_NAME,		/* string */
	DEVLINK_ATTR_PORT_SPLIT_COUNT,		/* u32 */
	DEVLINK_ATTR_PORT_SPLIT_GROUP,		/* u32 */
356 357 358 359 360 361 362 363 364 365 366 367
	DEVLINK_ATTR_SB_INDEX,			/* u32 */
	DEVLINK_ATTR_SB_SIZE,			/* u32 */
	DEVLINK_ATTR_SB_INGRESS_POOL_COUNT,	/* u16 */
	DEVLINK_ATTR_SB_EGRESS_POOL_COUNT,	/* u16 */
	DEVLINK_ATTR_SB_INGRESS_TC_COUNT,	/* u16 */
	DEVLINK_ATTR_SB_EGRESS_TC_COUNT,	/* u16 */
	DEVLINK_ATTR_SB_POOL_INDEX,		/* u16 */
	DEVLINK_ATTR_SB_POOL_TYPE,		/* u8 */
	DEVLINK_ATTR_SB_POOL_SIZE,		/* u32 */
	DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE,	/* u8 */
	DEVLINK_ATTR_SB_THRESHOLD,		/* u32 */
	DEVLINK_ATTR_SB_TC_INDEX,		/* u16 */
368 369
	DEVLINK_ATTR_SB_OCC_CUR,		/* u32 */
	DEVLINK_ATTR_SB_OCC_MAX,		/* u32 */
370
	DEVLINK_ATTR_ESWITCH_MODE,		/* u16 */
371
	DEVLINK_ATTR_ESWITCH_INLINE_MODE,	/* u8 */
J
Jiri Pirko 已提交
372

373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415
	DEVLINK_ATTR_DPIPE_TABLES,		/* nested */
	DEVLINK_ATTR_DPIPE_TABLE,		/* nested */
	DEVLINK_ATTR_DPIPE_TABLE_NAME,		/* string */
	DEVLINK_ATTR_DPIPE_TABLE_SIZE,		/* u64 */
	DEVLINK_ATTR_DPIPE_TABLE_MATCHES,	/* nested */
	DEVLINK_ATTR_DPIPE_TABLE_ACTIONS,	/* nested */
	DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED,	/* u8 */

	DEVLINK_ATTR_DPIPE_ENTRIES,		/* nested */
	DEVLINK_ATTR_DPIPE_ENTRY,		/* nested */
	DEVLINK_ATTR_DPIPE_ENTRY_INDEX,		/* u64 */
	DEVLINK_ATTR_DPIPE_ENTRY_MATCH_VALUES,	/* nested */
	DEVLINK_ATTR_DPIPE_ENTRY_ACTION_VALUES,	/* nested */
	DEVLINK_ATTR_DPIPE_ENTRY_COUNTER,	/* u64 */

	DEVLINK_ATTR_DPIPE_MATCH,		/* nested */
	DEVLINK_ATTR_DPIPE_MATCH_VALUE,		/* nested */
	DEVLINK_ATTR_DPIPE_MATCH_TYPE,		/* u32 */

	DEVLINK_ATTR_DPIPE_ACTION,		/* nested */
	DEVLINK_ATTR_DPIPE_ACTION_VALUE,	/* nested */
	DEVLINK_ATTR_DPIPE_ACTION_TYPE,		/* u32 */

	DEVLINK_ATTR_DPIPE_VALUE,
	DEVLINK_ATTR_DPIPE_VALUE_MASK,
	DEVLINK_ATTR_DPIPE_VALUE_MAPPING,	/* u32 */

	DEVLINK_ATTR_DPIPE_HEADERS,		/* nested */
	DEVLINK_ATTR_DPIPE_HEADER,		/* nested */
	DEVLINK_ATTR_DPIPE_HEADER_NAME,		/* string */
	DEVLINK_ATTR_DPIPE_HEADER_ID,		/* u32 */
	DEVLINK_ATTR_DPIPE_HEADER_FIELDS,	/* nested */
	DEVLINK_ATTR_DPIPE_HEADER_GLOBAL,	/* u8 */
	DEVLINK_ATTR_DPIPE_HEADER_INDEX,	/* u32 */

	DEVLINK_ATTR_DPIPE_FIELD,		/* nested */
	DEVLINK_ATTR_DPIPE_FIELD_NAME,		/* string */
	DEVLINK_ATTR_DPIPE_FIELD_ID,		/* u32 */
	DEVLINK_ATTR_DPIPE_FIELD_BITWIDTH,	/* u32 */
	DEVLINK_ATTR_DPIPE_FIELD_MAPPING_TYPE,	/* u32 */

	DEVLINK_ATTR_PAD,

416
	DEVLINK_ATTR_ESWITCH_ENCAP_MODE,	/* u8 */
417 418 419 420 421 422 423 424 425 426 427 428
	DEVLINK_ATTR_RESOURCE_LIST,		/* nested */
	DEVLINK_ATTR_RESOURCE,			/* nested */
	DEVLINK_ATTR_RESOURCE_NAME,		/* string */
	DEVLINK_ATTR_RESOURCE_ID,		/* u64 */
	DEVLINK_ATTR_RESOURCE_SIZE,		/* u64 */
	DEVLINK_ATTR_RESOURCE_SIZE_NEW,		/* u64 */
	DEVLINK_ATTR_RESOURCE_SIZE_VALID,	/* u8 */
	DEVLINK_ATTR_RESOURCE_SIZE_MIN,		/* u64 */
	DEVLINK_ATTR_RESOURCE_SIZE_MAX,		/* u64 */
	DEVLINK_ATTR_RESOURCE_SIZE_GRAN,        /* u64 */
	DEVLINK_ATTR_RESOURCE_UNIT,		/* u8 */
	DEVLINK_ATTR_RESOURCE_OCC,		/* u64 */
429 430
	DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_ID,	/* u64 */
	DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_UNITS,/* u64 */
431

432
	DEVLINK_ATTR_PORT_FLAVOUR,		/* u16 */
433 434 435
	DEVLINK_ATTR_PORT_NUMBER,		/* u32 */
	DEVLINK_ATTR_PORT_SPLIT_SUBPORT_NUMBER,	/* u32 */

M
Moshe Shemesh 已提交
436 437 438 439 440 441 442 443 444
	DEVLINK_ATTR_PARAM,			/* nested */
	DEVLINK_ATTR_PARAM_NAME,		/* string */
	DEVLINK_ATTR_PARAM_GENERIC,		/* flag */
	DEVLINK_ATTR_PARAM_TYPE,		/* u8 */
	DEVLINK_ATTR_PARAM_VALUES_LIST,		/* nested */
	DEVLINK_ATTR_PARAM_VALUE,		/* nested */
	DEVLINK_ATTR_PARAM_VALUE_DATA,		/* dynamic */
	DEVLINK_ATTR_PARAM_VALUE_CMODE,		/* u8 */

445 446
	DEVLINK_ATTR_REGION_NAME,               /* string */
	DEVLINK_ATTR_REGION_SIZE,               /* u64 */
447 448 449
	DEVLINK_ATTR_REGION_SNAPSHOTS,          /* nested */
	DEVLINK_ATTR_REGION_SNAPSHOT,           /* nested */
	DEVLINK_ATTR_REGION_SNAPSHOT_ID,        /* u32 */
450

451 452 453 454 455 456
	DEVLINK_ATTR_REGION_CHUNKS,             /* nested */
	DEVLINK_ATTR_REGION_CHUNK,              /* nested */
	DEVLINK_ATTR_REGION_CHUNK_DATA,         /* binary */
	DEVLINK_ATTR_REGION_CHUNK_ADDR,         /* u64 */
	DEVLINK_ATTR_REGION_CHUNK_LEN,          /* u64 */

457 458
	DEVLINK_ATTR_INFO_DRIVER_NAME,		/* string */
	DEVLINK_ATTR_INFO_SERIAL_NUMBER,	/* string */
459 460 461 462 463
	DEVLINK_ATTR_INFO_VERSION_FIXED,	/* nested */
	DEVLINK_ATTR_INFO_VERSION_RUNNING,	/* nested */
	DEVLINK_ATTR_INFO_VERSION_STORED,	/* nested */
	DEVLINK_ATTR_INFO_VERSION_NAME,		/* string */
	DEVLINK_ATTR_INFO_VERSION_VALUE,	/* string */
464

465 466
	DEVLINK_ATTR_SB_POOL_CELL_SIZE,		/* u32 */

467 468 469 470 471 472 473 474
	DEVLINK_ATTR_FMSG,			/* nested */
	DEVLINK_ATTR_FMSG_OBJ_NEST_START,	/* flag */
	DEVLINK_ATTR_FMSG_PAIR_NEST_START,	/* flag */
	DEVLINK_ATTR_FMSG_ARR_NEST_START,	/* flag */
	DEVLINK_ATTR_FMSG_NEST_END,		/* flag */
	DEVLINK_ATTR_FMSG_OBJ_NAME,		/* string */
	DEVLINK_ATTR_FMSG_OBJ_VALUE_TYPE,	/* u8 */
	DEVLINK_ATTR_FMSG_OBJ_VALUE_DATA,	/* dynamic */
475 476 477 478

	DEVLINK_ATTR_HEALTH_REPORTER,			/* nested */
	DEVLINK_ATTR_HEALTH_REPORTER_NAME,		/* string */
	DEVLINK_ATTR_HEALTH_REPORTER_STATE,		/* u8 */
479 480
	DEVLINK_ATTR_HEALTH_REPORTER_ERR_COUNT,		/* u64 */
	DEVLINK_ATTR_HEALTH_REPORTER_RECOVER_COUNT,	/* u64 */
481 482 483
	DEVLINK_ATTR_HEALTH_REPORTER_DUMP_TS,		/* u64 */
	DEVLINK_ATTR_HEALTH_REPORTER_GRACEFUL_PERIOD,	/* u64 */
	DEVLINK_ATTR_HEALTH_REPORTER_AUTO_RECOVER,	/* u8 */
484 485 486

	DEVLINK_ATTR_FLASH_UPDATE_FILE_NAME,	/* string */
	DEVLINK_ATTR_FLASH_UPDATE_COMPONENT,	/* string */
487 488 489
	DEVLINK_ATTR_FLASH_UPDATE_STATUS_MSG,	/* string */
	DEVLINK_ATTR_FLASH_UPDATE_STATUS_DONE,	/* u64 */
	DEVLINK_ATTR_FLASH_UPDATE_STATUS_TOTAL,	/* u64 */
490

491
	DEVLINK_ATTR_PORT_PCI_PF_NUMBER,	/* u16 */
492 493
	DEVLINK_ATTR_PORT_PCI_VF_NUMBER,	/* u16 */

494 495 496 497 498 499 500 501 502 503 504
	DEVLINK_ATTR_STATS,				/* nested */

	DEVLINK_ATTR_TRAP_NAME,				/* string */
	/* enum devlink_trap_action */
	DEVLINK_ATTR_TRAP_ACTION,			/* u8 */
	/* enum devlink_trap_type */
	DEVLINK_ATTR_TRAP_TYPE,				/* u8 */
	DEVLINK_ATTR_TRAP_GENERIC,			/* flag */
	DEVLINK_ATTR_TRAP_METADATA,			/* nested */
	DEVLINK_ATTR_TRAP_GROUP_NAME,			/* string */

505 506
	DEVLINK_ATTR_RELOAD_FAILED,			/* u8 0 or 1 */

507
	DEVLINK_ATTR_HEALTH_REPORTER_DUMP_TS_NS,	/* u64 */
508

509 510 511
	DEVLINK_ATTR_NETNS_FD,			/* u32 */
	DEVLINK_ATTR_NETNS_PID,			/* u32 */
	DEVLINK_ATTR_NETNS_ID,			/* u32 */
512 513

	DEVLINK_ATTR_HEALTH_REPORTER_AUTO_DUMP,	/* u8 */
514 515 516 517 518

	DEVLINK_ATTR_TRAP_POLICER_ID,			/* u32 */
	DEVLINK_ATTR_TRAP_POLICER_RATE,			/* u64 */
	DEVLINK_ATTR_TRAP_POLICER_BURST,		/* u64 */

519 520
	DEVLINK_ATTR_PORT_FUNCTION,			/* nested */

521 522
	DEVLINK_ATTR_INFO_BOARD_SERIAL_NUMBER,	/* string */

523
	DEVLINK_ATTR_PORT_LANES,			/* u32 */
524
	DEVLINK_ATTR_PORT_SPLITTABLE,			/* u8 */
525

526
	DEVLINK_ATTR_PORT_EXTERNAL,		/* u8 */
527
	DEVLINK_ATTR_PORT_CONTROLLER_NUMBER,	/* u32 */
528 529

	DEVLINK_ATTR_FLASH_UPDATE_STATUS_TIMEOUT,	/* u64 */
530
	DEVLINK_ATTR_FLASH_UPDATE_OVERWRITE_MASK,	/* bitfield32 */
531

532 533
	DEVLINK_ATTR_RELOAD_ACTION,		/* u8 */
	DEVLINK_ATTR_RELOAD_ACTIONS_PERFORMED,	/* bitfield32 */
534
	DEVLINK_ATTR_RELOAD_LIMITS,		/* bitfield32 */
535

M
Moshe Shemesh 已提交
536 537 538 539 540
	DEVLINK_ATTR_DEV_STATS,			/* nested */
	DEVLINK_ATTR_RELOAD_STATS,		/* nested */
	DEVLINK_ATTR_RELOAD_STATS_ENTRY,	/* nested */
	DEVLINK_ATTR_RELOAD_STATS_LIMIT,	/* u8 */
	DEVLINK_ATTR_RELOAD_STATS_VALUE,	/* u32 */
M
Moshe Shemesh 已提交
541
	DEVLINK_ATTR_REMOTE_RELOAD_STATS,	/* nested */
542 543
	DEVLINK_ATTR_RELOAD_ACTION_INFO,        /* nested */
	DEVLINK_ATTR_RELOAD_ACTION_STATS,       /* nested */
M
Moshe Shemesh 已提交
544

545
	DEVLINK_ATTR_PORT_PCI_SF_NUMBER,	/* u32 */
D
Dmytro Linkin 已提交
546 547

	DEVLINK_ATTR_RATE_TYPE,			/* u16 */
J
Jiri Pirko 已提交
548 549 550 551 552 553
	/* add new attributes above here, update the policy in devlink.c */

	__DEVLINK_ATTR_MAX,
	DEVLINK_ATTR_MAX = __DEVLINK_ATTR_MAX - 1
};

554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571
/* Mapping between internal resource described by the field and system
 * structure
 */
enum devlink_dpipe_field_mapping_type {
	DEVLINK_DPIPE_FIELD_MAPPING_TYPE_NONE,
	DEVLINK_DPIPE_FIELD_MAPPING_TYPE_IFINDEX,
};

/* Match type - specify the type of the match */
enum devlink_dpipe_match_type {
	DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT,
};

/* Action type - specify the action type */
enum devlink_dpipe_action_type {
	DEVLINK_DPIPE_ACTION_TYPE_FIELD_MODIFY,
};

572 573 574 575
enum devlink_dpipe_field_ethernet_id {
	DEVLINK_DPIPE_FIELD_ETHERNET_DST_MAC,
};

576 577 578 579
enum devlink_dpipe_field_ipv4_id {
	DEVLINK_DPIPE_FIELD_IPV4_DST_IP,
};

580 581 582 583
enum devlink_dpipe_field_ipv6_id {
	DEVLINK_DPIPE_FIELD_IPV6_DST_IP,
};

584 585
enum devlink_dpipe_header_id {
	DEVLINK_DPIPE_HEADER_ETHERNET,
586
	DEVLINK_DPIPE_HEADER_IPV4,
587
	DEVLINK_DPIPE_HEADER_IPV6,
588 589
};

590 591 592 593
enum devlink_resource_unit {
	DEVLINK_RESOURCE_UNIT_ENTRY,
};

594 595 596
enum devlink_port_function_attr {
	DEVLINK_PORT_FUNCTION_ATTR_UNSPEC,
	DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR,	/* binary */
597 598
	DEVLINK_PORT_FN_ATTR_STATE,	/* u8 */
	DEVLINK_PORT_FN_ATTR_OPSTATE,	/* u8 */
599 600 601 602 603

	__DEVLINK_PORT_FUNCTION_ATTR_MAX,
	DEVLINK_PORT_FUNCTION_ATTR_MAX = __DEVLINK_PORT_FUNCTION_ATTR_MAX - 1
};

604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621
enum devlink_port_fn_state {
	DEVLINK_PORT_FN_STATE_INACTIVE,
	DEVLINK_PORT_FN_STATE_ACTIVE,
};

/**
 * enum devlink_port_fn_opstate - indicates operational state of the function
 * @DEVLINK_PORT_FN_OPSTATE_ATTACHED: Driver is attached to the function.
 * For graceful tear down of the function, after inactivation of the
 * function, user should wait for operational state to turn DETACHED.
 * @DEVLINK_PORT_FN_OPSTATE_DETACHED: Driver is detached from the function.
 * It is safe to delete the port.
 */
enum devlink_port_fn_opstate {
	DEVLINK_PORT_FN_OPSTATE_DETACHED,
	DEVLINK_PORT_FN_OPSTATE_ATTACHED,
};

J
Jiri Pirko 已提交
622
#endif /* _UAPI_LINUX_DEVLINK_H_ */