| 1 |
|
| 2 | |
| 3 | * include/net/devlink.h - Network physical device Netlink interface
|
| 4 | * Copyright (c) 2016 Mellanox Technologies. All rights reserved.
|
| 5 | * Copyright (c) 2016 Jiri Pirko <[email protected]>
|
| 6 |
|
| 7 | #ifndef _NET_DEVLINK_H_
|
| 8 | #define _NET_DEVLINK_H_
|
| 9 |
|
| 10 | #include <linux/device.h>
|
| 11 | #include <linux/slab.h>
|
| 12 | #include <linux/gfp.h>
|
| 13 | #include <linux/list.h>
|
| 14 | #include <linux/netdevice.h>
|
| 15 | #include <linux/spinlock.h>
|
| 16 | #include <linux/workqueue.h>
|
| 17 | #include <linux/refcount.h>
|
| 18 | #include <net/net_namespace.h>
|
| 19 | #include <net/flow_offload.h>
|
| 20 | #include <uapi/linux/devlink.h>
|
| 21 | #include <linux/xarray.h>
|
| 22 | #include <linux/firmware.h>
|
| 23 |
|
| 24 | struct devlink;
|
| 25 | struct devlink_linecard;
|
| 26 |
|
| 27 | struct devlink_port_phys_attrs {
|
| 28 | u32 port_number; |
| 29 | * A physical port which is visible to the user
|
| 30 | * for a given port flavour.
|
| 31 |
|
| 32 | u32 split_subport_number;
|
| 33 | };
|
| 34 |
|
| 35 | |
| 36 | * struct devlink_port_pci_pf_attrs - devlink port's PCI PF attributes
|
| 37 | * @controller: Associated controller number
|
| 38 | * @pf: associated PCI function number for the devlink port instance
|
| 39 | * @external: when set, indicates if a port is for an external host controller.
|
| 40 |
|
| 41 | struct devlink_port_pci_pf_attrs {
|
| 42 | u32 controller;
|
| 43 | u16 pf;
|
| 44 | u8 external:1;
|
| 45 | };
|
| 46 |
|
| 47 | |
| 48 | * struct devlink_port_pci_vf_attrs - devlink port's PCI VF attributes
|
| 49 | * @controller: Associated controller number
|
| 50 | * @pf: associated PCI function number for the devlink port instance
|
| 51 | * @vf: associated PCI VF number of a PF for the devlink port instance;
|
| 52 | * VF number starts from 0 for the first PCI virtual function
|
| 53 | * @external: when set, indicates if a port is for an external host controller.
|
| 54 |
|
| 55 | struct devlink_port_pci_vf_attrs {
|
| 56 | u32 controller;
|
| 57 | u16 pf;
|
| 58 | u16 vf;
|
| 59 | u8 external:1;
|
| 60 | };
|
| 61 |
|
| 62 | |
| 63 | * struct devlink_port_pci_sf_attrs - devlink port's PCI SF attributes
|
| 64 | * @controller: Associated controller number
|
| 65 | * @sf: associated SF number of a PF for the devlink port instance
|
| 66 | * @pf: associated PCI function number for the devlink port instance
|
| 67 | * @external: when set, indicates if a port is for an external host controller.
|
| 68 |
|
| 69 | struct devlink_port_pci_sf_attrs {
|
| 70 | u32 controller;
|
| 71 | u32 sf;
|
| 72 | u16 pf;
|
| 73 | u8 external:1;
|
| 74 | };
|
| 75 |
|
| 76 | |
| 77 | * struct devlink_port_attrs - devlink port object
|
| 78 | * @flavour: flavour of the port
|
| 79 | * @split: indicates if this is split port
|
| 80 | * @splittable: indicates if the port can be split.
|
| 81 | * @no_phys_port_name: skip automatic phys_port_name generation; for
|
| 82 | * compatibility only, newly added driver/port instance
|
| 83 | * should never set this.
|
| 84 | * @lanes: maximum number of lanes the port supports. 0 value is not passed to netlink.
|
| 85 | * @switch_id: if the port is part of switch, this is buffer with ID, otherwise this is NULL
|
| 86 | * @phys: physical port attributes
|
| 87 | * @pci_pf: PCI PF port attributes
|
| 88 | * @pci_vf: PCI VF port attributes
|
| 89 | * @pci_sf: PCI SF port attributes
|
| 90 |
|
| 91 | struct devlink_port_attrs {
|
| 92 | u8 split:1,
|
| 93 | splittable:1,
|
| 94 | no_phys_port_name:1;
|
| 95 | u32 lanes;
|
| 96 | enum devlink_port_flavour flavour;
|
| 97 | struct netdev_phys_item_id switch_id;
|
| 98 | union {
|
| 99 | struct devlink_port_phys_attrs phys;
|
| 100 | struct devlink_port_pci_pf_attrs pci_pf;
|
| 101 | struct devlink_port_pci_vf_attrs pci_vf;
|
| 102 | struct devlink_port_pci_sf_attrs pci_sf;
|
| 103 | };
|
| 104 | };
|
| 105 |
|
| 106 | struct devlink_rate {
|
| 107 | struct list_head list;
|
| 108 | enum devlink_rate_type type;
|
| 109 | struct devlink *devlink;
|
| 110 | void *priv;
|
| 111 | u64 tx_share;
|
| 112 | u64 tx_max;
|
| 113 |
|
| 114 | struct devlink_rate *parent;
|
| 115 | union {
|
| 116 | struct devlink_port *devlink_port;
|
| 117 | struct {
|
| 118 | char *name;
|
| 119 | refcount_t refcnt;
|
| 120 | };
|
| 121 | };
|
| 122 |
|
| 123 | u32 tx_priority;
|
| 124 | u32 tx_weight;
|
| 125 |
|
| 126 | u32 tc_bw[DEVLINK_RATE_TCS_MAX];
|
| 127 | };
|
| 128 |
|
| 129 | struct devlink_port {
|
| 130 | struct list_head list;
|
| 131 | struct list_head region_list;
|
| 132 | struct list_head resource_list;
|
| 133 | struct devlink *devlink;
|
| 134 | const struct devlink_port_ops *ops;
|
| 135 | unsigned int index;
|
| 136 | spinlock_t type_lock; |
| 137 | * structures consistency.
|
| 138 |
|
| 139 | enum devlink_port_type type;
|
| 140 | enum devlink_port_type desired_type;
|
| 141 | union {
|
| 142 | struct {
|
| 143 | struct net_device *netdev;
|
| 144 | int ifindex;
|
| 145 | char ifname[IFNAMSIZ];
|
| 146 | } type_eth;
|
| 147 | struct {
|
| 148 | struct ib_device *ibdev;
|
| 149 | } type_ib;
|
| 150 | };
|
| 151 | struct devlink_port_attrs attrs;
|
| 152 | u8 attrs_set:1,
|
| 153 | switch_port:1,
|
| 154 | registered:1,
|
| 155 | initialized:1;
|
| 156 | struct delayed_work type_warn_dw;
|
| 157 | struct list_head reporter_list;
|
| 158 |
|
| 159 | struct devlink_rate *devlink_rate;
|
| 160 | struct devlink_linecard *linecard;
|
| 161 | u32 rel_index;
|
| 162 | };
|
| 163 |
|
| 164 | struct devlink_port_new_attrs {
|
| 165 | enum devlink_port_flavour flavour;
|
| 166 | unsigned int port_index;
|
| 167 | u32 controller;
|
| 168 | u32 sfnum;
|
| 169 | u16 pfnum;
|
| 170 | u8 port_index_valid:1,
|
| 171 | controller_valid:1,
|
| 172 | sfnum_valid:1;
|
| 173 | };
|
| 174 |
|
| 175 | |
| 176 | * struct devlink_linecard_ops - Linecard operations
|
| 177 | * @provision: callback to provision the linecard slot with certain
|
| 178 | * type of linecard. As a result of this operation,
|
| 179 | * driver is expected to eventually (could be after
|
| 180 | * the function call returns) call one of:
|
| 181 | * devlink_linecard_provision_set()
|
| 182 | * devlink_linecard_provision_fail()
|
| 183 | * @unprovision: callback to unprovision the linecard slot. As a result
|
| 184 | * of this operation, driver is expected to eventually
|
| 185 | * (could be after the function call returns) call
|
| 186 | * devlink_linecard_provision_clear()
|
| 187 | * devlink_linecard_provision_fail()
|
| 188 | * @same_provision: callback to ask the driver if linecard is already
|
| 189 | * provisioned in the same way user asks this linecard to be
|
| 190 | * provisioned.
|
| 191 | * @types_count: callback to get number of supported types
|
| 192 | * @types_get: callback to get next type in list
|
| 193 |
|
| 194 | struct devlink_linecard_ops {
|
| 195 | int (*provision)(struct devlink_linecard *linecard, void *priv,
|
| 196 | const char *type, const void *type_priv,
|
| 197 | struct netlink_ext_ack *extack);
|
| 198 | int (*unprovision)(struct devlink_linecard *linecard, void *priv,
|
| 199 | struct netlink_ext_ack *extack);
|
| 200 | bool (*same_provision)(struct devlink_linecard *linecard, void *priv,
|
| 201 | const char *type, const void *type_priv);
|
| 202 | unsigned int (*types_count)(struct devlink_linecard *linecard,
|
| 203 | void *priv);
|
| 204 | void (*types_get)(struct devlink_linecard *linecard,
|
| 205 | void *priv, unsigned int index, const char **type,
|
| 206 | const void **type_priv);
|
| 207 | };
|
| 208 |
|
| 209 | struct devlink_sb_pool_info {
|
| 210 | enum devlink_sb_pool_type pool_type;
|
| 211 | u32 size;
|
| 212 | enum devlink_sb_threshold_type threshold_type;
|
| 213 | u32 cell_size;
|
| 214 | };
|
| 215 |
|
| 216 | |
| 217 | * struct devlink_dpipe_field - dpipe field object
|
| 218 | * @name: field name
|
| 219 | * @id: index inside the headers field array
|
| 220 | * @bitwidth: bitwidth
|
| 221 | * @mapping_type: mapping type
|
| 222 |
|
| 223 | struct devlink_dpipe_field {
|
| 224 | const char *name;
|
| 225 | unsigned int id;
|
| 226 | unsigned int bitwidth;
|
| 227 | enum devlink_dpipe_field_mapping_type mapping_type;
|
| 228 | };
|
| 229 |
|
| 230 | |
| 231 | * struct devlink_dpipe_header - dpipe header object
|
| 232 | * @name: header name
|
| 233 | * @id: index, global/local determined by global bit
|
| 234 | * @fields: fields
|
| 235 | * @fields_count: number of fields
|
| 236 | * @global: indicates if header is shared like most protocol header
|
| 237 | * or driver specific
|
| 238 |
|
| 239 | struct devlink_dpipe_header {
|
| 240 | const char *name;
|
| 241 | unsigned int id;
|
| 242 | struct devlink_dpipe_field *fields;
|
| 243 | unsigned int fields_count;
|
| 244 | bool global;
|
| 245 | };
|
| 246 |
|
| 247 | |
| 248 | * struct devlink_dpipe_match - represents match operation
|
| 249 | * @type: type of match
|
| 250 | * @header_index: header index (packets can have several headers of same
|
| 251 | * type like in case of tunnels)
|
| 252 | * @header: header
|
| 253 | * @field_id: field index
|
| 254 |
|
| 255 | struct devlink_dpipe_match {
|
| 256 | enum devlink_dpipe_match_type type;
|
| 257 | unsigned int header_index;
|
| 258 | struct devlink_dpipe_header *header;
|
| 259 | unsigned int field_id;
|
| 260 | };
|
| 261 |
|
| 262 | |
| 263 | * struct devlink_dpipe_action - represents action operation
|
| 264 | * @type: type of action
|
| 265 | * @header_index: header index (packets can have several headers of same
|
| 266 | * type like in case of tunnels)
|
| 267 | * @header: header
|
| 268 | * @field_id: field index
|
| 269 |
|
| 270 | struct devlink_dpipe_action {
|
| 271 | enum devlink_dpipe_action_type type;
|
| 272 | unsigned int header_index;
|
| 273 | struct devlink_dpipe_header *header;
|
| 274 | unsigned int field_id;
|
| 275 | };
|
| 276 |
|
| 277 | |
| 278 | * struct devlink_dpipe_value - represents value of match/action
|
| 279 | * @action: action
|
| 280 | * @match: match
|
| 281 | * @mapping_value: in case the field has some mapping this value
|
| 282 | * specified the mapping value
|
| 283 | * @mapping_valid: specify if mapping value is valid
|
| 284 | * @value_size: value size
|
| 285 | * @value: value
|
| 286 | * @mask: bit mask
|
| 287 |
|
| 288 | struct devlink_dpipe_value {
|
| 289 | union {
|
| 290 | struct devlink_dpipe_action *action;
|
| 291 | struct devlink_dpipe_match *match;
|
| 292 | };
|
| 293 | unsigned int mapping_value;
|
| 294 | bool mapping_valid;
|
| 295 | unsigned int value_size;
|
| 296 | void *value;
|
| 297 | void *mask;
|
| 298 | };
|
| 299 |
|
| 300 | |
| 301 | * struct devlink_dpipe_entry - table entry object
|
| 302 | * @index: index of the entry in the table
|
| 303 | * @match_values: match values
|
| 304 | * @match_values_count: count of matches tuples
|
| 305 | * @action_values: actions values
|
| 306 | * @action_values_count: count of actions values
|
| 307 | * @counter: value of counter
|
| 308 | * @counter_valid: Specify if value is valid from hardware
|
| 309 |
|
| 310 | struct devlink_dpipe_entry {
|
| 311 | u64 index;
|
| 312 | struct devlink_dpipe_value *match_values;
|
| 313 | unsigned int match_values_count;
|
| 314 | struct devlink_dpipe_value *action_values;
|
| 315 | unsigned int action_values_count;
|
| 316 | u64 counter;
|
| 317 | bool counter_valid;
|
| 318 | };
|
| 319 |
|
| 320 | |
| 321 | * struct devlink_dpipe_dump_ctx - context provided to driver in order
|
| 322 | * to dump
|
| 323 | * @info: info
|
| 324 | * @cmd: devlink command
|
| 325 | * @skb: skb
|
| 326 | * @nest: top attribute
|
| 327 | * @hdr: hdr
|
| 328 |
|
| 329 | struct devlink_dpipe_dump_ctx {
|
| 330 | struct genl_info *info;
|
| 331 | enum devlink_command cmd;
|
| 332 | struct sk_buff *skb;
|
| 333 | struct nlattr *nest;
|
| 334 | void *hdr;
|
| 335 | };
|
| 336 |
|
| 337 | struct devlink_dpipe_table_ops;
|
| 338 |
|
| 339 | |
| 340 | * struct devlink_dpipe_table - table object
|
| 341 | * @priv: private
|
| 342 | * @name: table name
|
| 343 | * @counters_enabled: indicates if counters are active
|
| 344 | * @counter_control_extern: indicates if counter control is in dpipe or
|
| 345 | * external tool
|
| 346 | * @resource_valid: Indicate that the resource id is valid
|
| 347 | * @resource_id: relative resource this table is related to
|
| 348 | * @resource_units: number of resource's unit consumed per table's entry
|
| 349 | * @table_ops: table operations
|
| 350 | * @rcu: rcu
|
| 351 |
|
| 352 | struct devlink_dpipe_table {
|
| 353 | void *priv;
|
| 354 |
|
| 355 | struct list_head list;
|
| 356 |
|
| 357 | const char *name;
|
| 358 | bool counters_enabled;
|
| 359 | bool counter_control_extern;
|
| 360 | bool resource_valid;
|
| 361 | u64 resource_id;
|
| 362 | u64 resource_units;
|
| 363 | const struct devlink_dpipe_table_ops *table_ops;
|
| 364 | struct rcu_head rcu;
|
| 365 | };
|
| 366 |
|
| 367 | |
| 368 | * struct devlink_dpipe_table_ops - dpipe_table ops
|
| 369 | * @actions_dump: dumps all tables actions
|
| 370 | * @matches_dump: dumps all tables matches
|
| 371 | * @entries_dump: dumps all active entries in the table
|
| 372 | * @counters_set_update: when changing the counter status hardware sync
|
| 373 | * maybe needed to allocate/free counter related
|
| 374 | * resources
|
| 375 | * @size_get: get size
|
| 376 |
|
| 377 | struct devlink_dpipe_table_ops {
|
| 378 | int (*actions_dump)(void *priv, struct sk_buff *skb);
|
| 379 | int (*matches_dump)(void *priv, struct sk_buff *skb);
|
| 380 | int (*entries_dump)(void *priv, bool counters_enabled,
|
| 381 | struct devlink_dpipe_dump_ctx *dump_ctx);
|
| 382 | int (*counters_set_update)(void *priv, bool enable);
|
| 383 | u64 (*size_get)(void *priv);
|
| 384 | };
|
| 385 |
|
| 386 | |
| 387 | * struct devlink_dpipe_headers - dpipe headers
|
| 388 | * @headers: header array can be shared (global bit) or driver specific
|
| 389 | * @headers_count: count of headers
|
| 390 |
|
| 391 | struct devlink_dpipe_headers {
|
| 392 | struct devlink_dpipe_header **headers;
|
| 393 | unsigned int headers_count;
|
| 394 | };
|
| 395 |
|
| 396 | |
| 397 | * struct devlink_resource_size_params - resource's size parameters
|
| 398 | * @size_min: minimum size which can be set
|
| 399 | * @size_max: maximum size which can be set
|
| 400 | * @size_granularity: size granularity
|
| 401 | * @unit: resource's basic unit
|
| 402 |
|
| 403 | struct devlink_resource_size_params {
|
| 404 | u64 size_min;
|
| 405 | u64 size_max;
|
| 406 | u64 size_granularity;
|
| 407 | enum devlink_resource_unit unit;
|
| 408 | };
|
| 409 |
|
| 410 | static inline void
|
| 411 | devlink_resource_size_params_init(struct devlink_resource_size_params *size_params,
|
| 412 | u64 size_min, u64 size_max,
|
| 413 | u64 size_granularity,
|
| 414 | enum devlink_resource_unit unit)
|
| 415 | {
|
| 416 | size_params->size_min = size_min;
|
| 417 | size_params->size_max = size_max;
|
| 418 | size_params->size_granularity = size_granularity;
|
| 419 | size_params->unit = unit;
|
| 420 | }
|
| 421 |
|
| 422 | typedef u64 devlink_resource_occ_get_t(void *priv);
|
| 423 |
|
| 424 | #define DEVLINK_RESOURCE_ID_PARENT_TOP 0
|
| 425 |
|
| 426 | #define DEVLINK_RESOURCE_GENERIC_NAME_PORTS "physical_ports"
|
| 427 |
|
| 428 | #define __DEVLINK_PARAM_MAX_STRING_VALUE 32
|
| 429 | enum devlink_param_type {
|
| 430 | DEVLINK_PARAM_TYPE_U8 = DEVLINK_VAR_ATTR_TYPE_U8,
|
| 431 | DEVLINK_PARAM_TYPE_U16 = DEVLINK_VAR_ATTR_TYPE_U16,
|
| 432 | DEVLINK_PARAM_TYPE_U32 = DEVLINK_VAR_ATTR_TYPE_U32,
|
| 433 | DEVLINK_PARAM_TYPE_U64 = DEVLINK_VAR_ATTR_TYPE_U64,
|
| 434 | DEVLINK_PARAM_TYPE_STRING = DEVLINK_VAR_ATTR_TYPE_STRING,
|
| 435 | DEVLINK_PARAM_TYPE_BOOL = DEVLINK_VAR_ATTR_TYPE_FLAG,
|
| 436 | DEVLINK_PARAM_TYPE_U64_ARRAY = DEVLINK_VAR_ATTR_TYPE_U64_ARRAY,
|
| 437 | };
|
| 438 |
|
| 439 | #define __DEVLINK_PARAM_MAX_ARRAY_SIZE 32
|
| 440 | struct devlink_param_u64_array {
|
| 441 | u64 size;
|
| 442 | u64 val[__DEVLINK_PARAM_MAX_ARRAY_SIZE];
|
| 443 | };
|
| 444 |
|
| 445 | union devlink_param_value {
|
| 446 | u8 vu8;
|
| 447 | u16 vu16;
|
| 448 | u32 vu32;
|
| 449 | u64 vu64;
|
| 450 | char vstr[__DEVLINK_PARAM_MAX_STRING_VALUE];
|
| 451 | bool vbool;
|
| 452 | struct devlink_param_u64_array u64arr;
|
| 453 | };
|
| 454 |
|
| 455 | struct devlink_param_gset_ctx {
|
| 456 | union devlink_param_value val;
|
| 457 | enum devlink_param_cmode cmode;
|
| 458 | };
|
| 459 |
|
| 460 | |
| 461 | * struct devlink_flash_notify - devlink dev flash notify data
|
| 462 | * @status_msg: current status string
|
| 463 | * @component: firmware component being updated
|
| 464 | * @done: amount of work completed of total amount
|
| 465 | * @total: amount of work expected to be done
|
| 466 | * @timeout: expected max timeout in seconds
|
| 467 | *
|
| 468 | * These are values to be given to userland to be displayed in order
|
| 469 | * to show current activity in a firmware update process.
|
| 470 |
|
| 471 | struct devlink_flash_notify {
|
| 472 | const char *status_msg;
|
| 473 | const char *component;
|
| 474 | unsigned long done;
|
| 475 | unsigned long total;
|
| 476 | unsigned long timeout;
|
| 477 | };
|
| 478 |
|
| 479 | |
| 480 | * struct devlink_param - devlink configuration parameter data
|
| 481 | * @id: devlink parameter id number
|
| 482 | * @name: name of the parameter
|
| 483 | * @generic: indicates if the parameter is generic or driver specific
|
| 484 | * @type: parameter type
|
| 485 | * @supported_cmodes: bitmap of supported configuration modes
|
| 486 | * @get: get parameter value, used for runtime and permanent
|
| 487 | * configuration modes
|
| 488 | * @set: set parameter value, used for runtime and permanent
|
| 489 | * configuration modes
|
| 490 | * @validate: validate input value is applicable (within value range, etc.)
|
| 491 | * @get_default: get parameter default value, used for runtime and permanent
|
| 492 | * configuration modes
|
| 493 | * @reset_default: reset parameter to default value, used for runtime and permanent
|
| 494 | * configuration modes
|
| 495 | *
|
| 496 | * This struct should be used by the driver to fill the data for
|
| 497 | * a parameter it registers.
|
| 498 |
|
| 499 | struct devlink_param {
|
| 500 | u32 id;
|
| 501 | const char *name;
|
| 502 | bool generic;
|
| 503 | enum devlink_param_type type;
|
| 504 | unsigned long supported_cmodes;
|
| 505 | int (*get)(struct devlink *devlink, u32 id,
|
| 506 | struct devlink_param_gset_ctx *ctx,
|
| 507 | struct netlink_ext_ack *extack);
|
| 508 | int (*set)(struct devlink *devlink, u32 id,
|
| 509 | struct devlink_param_gset_ctx *ctx,
|
| 510 | struct netlink_ext_ack *extack);
|
| 511 | int (*validate)(struct devlink *devlink, u32 id,
|
| 512 | union devlink_param_value *val,
|
| 513 | struct netlink_ext_ack *extack);
|
| 514 | int (*get_default)(struct devlink *devlink, u32 id,
|
| 515 | struct devlink_param_gset_ctx *ctx,
|
| 516 | struct netlink_ext_ack *extack);
|
| 517 | int (*reset_default)(struct devlink *devlink, u32 id,
|
| 518 | enum devlink_param_cmode cmode,
|
| 519 | struct netlink_ext_ack *extack);
|
| 520 | };
|
| 521 |
|
| 522 | struct devlink_param_item {
|
| 523 | struct list_head list;
|
| 524 | const struct devlink_param *param;
|
| 525 | union devlink_param_value driverinit_value;
|
| 526 | bool driverinit_value_valid;
|
| 527 | union devlink_param_value driverinit_value_new; |
| 528 | * until reload.
|
| 529 |
|
| 530 | bool driverinit_value_new_valid;
|
| 531 | union devlink_param_value driverinit_default;
|
| 532 | };
|
| 533 |
|
| 534 | enum devlink_param_generic_id {
|
| 535 | DEVLINK_PARAM_GENERIC_ID_INT_ERR_RESET,
|
| 536 | DEVLINK_PARAM_GENERIC_ID_MAX_MACS,
|
| 537 | DEVLINK_PARAM_GENERIC_ID_ENABLE_SRIOV,
|
| 538 | DEVLINK_PARAM_GENERIC_ID_REGION_SNAPSHOT,
|
| 539 | DEVLINK_PARAM_GENERIC_ID_IGNORE_ARI,
|
| 540 | DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MAX,
|
| 541 | DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MIN,
|
| 542 | DEVLINK_PARAM_GENERIC_ID_FW_LOAD_POLICY,
|
| 543 | DEVLINK_PARAM_GENERIC_ID_RESET_DEV_ON_DRV_PROBE,
|
| 544 | DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE,
|
| 545 | DEVLINK_PARAM_GENERIC_ID_ENABLE_REMOTE_DEV_RESET,
|
| 546 | DEVLINK_PARAM_GENERIC_ID_ENABLE_ETH,
|
| 547 | DEVLINK_PARAM_GENERIC_ID_ENABLE_RDMA,
|
| 548 | DEVLINK_PARAM_GENERIC_ID_ENABLE_VNET,
|
| 549 | DEVLINK_PARAM_GENERIC_ID_ENABLE_IWARP,
|
| 550 | DEVLINK_PARAM_GENERIC_ID_IO_EQ_SIZE,
|
| 551 | DEVLINK_PARAM_GENERIC_ID_EVENT_EQ_SIZE,
|
| 552 | DEVLINK_PARAM_GENERIC_ID_ENABLE_PHC,
|
| 553 | DEVLINK_PARAM_GENERIC_ID_CLOCK_ID,
|
| 554 | DEVLINK_PARAM_GENERIC_ID_TOTAL_VFS,
|
| 555 | DEVLINK_PARAM_GENERIC_ID_NUM_DOORBELLS,
|
| 556 | DEVLINK_PARAM_GENERIC_ID_MAX_MAC_PER_VF,
|
| 557 | DEVLINK_PARAM_GENERIC_ID_MAX_SFS,
|
| 558 |
|
| 559 |
|
| 560 | __DEVLINK_PARAM_GENERIC_ID_MAX,
|
| 561 | DEVLINK_PARAM_GENERIC_ID_MAX = __DEVLINK_PARAM_GENERIC_ID_MAX - 1,
|
| 562 | };
|
| 563 |
|
| 564 | #define DEVLINK_PARAM_GENERIC_INT_ERR_RESET_NAME "internal_error_reset"
|
| 565 | #define DEVLINK_PARAM_GENERIC_INT_ERR_RESET_TYPE DEVLINK_PARAM_TYPE_BOOL
|
| 566 |
|
| 567 | #define DEVLINK_PARAM_GENERIC_MAX_MACS_NAME "max_macs"
|
| 568 | #define DEVLINK_PARAM_GENERIC_MAX_MACS_TYPE DEVLINK_PARAM_TYPE_U32
|
| 569 |
|
| 570 | #define DEVLINK_PARAM_GENERIC_ENABLE_SRIOV_NAME "enable_sriov"
|
| 571 | #define DEVLINK_PARAM_GENERIC_ENABLE_SRIOV_TYPE DEVLINK_PARAM_TYPE_BOOL
|
| 572 |
|
| 573 | #define DEVLINK_PARAM_GENERIC_REGION_SNAPSHOT_NAME "region_snapshot_enable"
|
| 574 | #define DEVLINK_PARAM_GENERIC_REGION_SNAPSHOT_TYPE DEVLINK_PARAM_TYPE_BOOL
|
| 575 |
|
| 576 | #define DEVLINK_PARAM_GENERIC_IGNORE_ARI_NAME "ignore_ari"
|
| 577 | #define DEVLINK_PARAM_GENERIC_IGNORE_ARI_TYPE DEVLINK_PARAM_TYPE_BOOL
|
| 578 |
|
| 579 | #define DEVLINK_PARAM_GENERIC_MSIX_VEC_PER_PF_MAX_NAME "msix_vec_per_pf_max"
|
| 580 | #define DEVLINK_PARAM_GENERIC_MSIX_VEC_PER_PF_MAX_TYPE DEVLINK_PARAM_TYPE_U32
|
| 581 |
|
| 582 | #define DEVLINK_PARAM_GENERIC_MSIX_VEC_PER_PF_MIN_NAME "msix_vec_per_pf_min"
|
| 583 | #define DEVLINK_PARAM_GENERIC_MSIX_VEC_PER_PF_MIN_TYPE DEVLINK_PARAM_TYPE_U32
|
| 584 |
|
| 585 | #define DEVLINK_PARAM_GENERIC_FW_LOAD_POLICY_NAME "fw_load_policy"
|
| 586 | #define DEVLINK_PARAM_GENERIC_FW_LOAD_POLICY_TYPE DEVLINK_PARAM_TYPE_U8
|
| 587 |
|
| 588 | #define DEVLINK_PARAM_GENERIC_RESET_DEV_ON_DRV_PROBE_NAME \
|
| 589 | "reset_dev_on_drv_probe"
|
| 590 | #define DEVLINK_PARAM_GENERIC_RESET_DEV_ON_DRV_PROBE_TYPE DEVLINK_PARAM_TYPE_U8
|
| 591 |
|
| 592 | #define DEVLINK_PARAM_GENERIC_ENABLE_ROCE_NAME "enable_roce"
|
| 593 | #define DEVLINK_PARAM_GENERIC_ENABLE_ROCE_TYPE DEVLINK_PARAM_TYPE_BOOL
|
| 594 |
|
| 595 | #define DEVLINK_PARAM_GENERIC_ENABLE_REMOTE_DEV_RESET_NAME "enable_remote_dev_reset"
|
| 596 | #define DEVLINK_PARAM_GENERIC_ENABLE_REMOTE_DEV_RESET_TYPE DEVLINK_PARAM_TYPE_BOOL
|
| 597 |
|
| 598 | #define DEVLINK_PARAM_GENERIC_ENABLE_ETH_NAME "enable_eth"
|
| 599 | #define DEVLINK_PARAM_GENERIC_ENABLE_ETH_TYPE DEVLINK_PARAM_TYPE_BOOL
|
| 600 |
|
| 601 | #define DEVLINK_PARAM_GENERIC_ENABLE_RDMA_NAME "enable_rdma"
|
| 602 | #define DEVLINK_PARAM_GENERIC_ENABLE_RDMA_TYPE DEVLINK_PARAM_TYPE_BOOL
|
| 603 |
|
| 604 | #define DEVLINK_PARAM_GENERIC_ENABLE_VNET_NAME "enable_vnet"
|
| 605 | #define DEVLINK_PARAM_GENERIC_ENABLE_VNET_TYPE DEVLINK_PARAM_TYPE_BOOL
|
| 606 |
|
| 607 | #define DEVLINK_PARAM_GENERIC_ENABLE_IWARP_NAME "enable_iwarp"
|
| 608 | #define DEVLINK_PARAM_GENERIC_ENABLE_IWARP_TYPE DEVLINK_PARAM_TYPE_BOOL
|
| 609 |
|
| 610 | #define DEVLINK_PARAM_GENERIC_IO_EQ_SIZE_NAME "io_eq_size"
|
| 611 | #define DEVLINK_PARAM_GENERIC_IO_EQ_SIZE_TYPE DEVLINK_PARAM_TYPE_U32
|
| 612 |
|
| 613 | #define DEVLINK_PARAM_GENERIC_EVENT_EQ_SIZE_NAME "event_eq_size"
|
| 614 | #define DEVLINK_PARAM_GENERIC_EVENT_EQ_SIZE_TYPE DEVLINK_PARAM_TYPE_U32
|
| 615 |
|
| 616 | #define DEVLINK_PARAM_GENERIC_ENABLE_PHC_NAME "enable_phc"
|
| 617 | #define DEVLINK_PARAM_GENERIC_ENABLE_PHC_TYPE DEVLINK_PARAM_TYPE_BOOL
|
| 618 |
|
| 619 | #define DEVLINK_PARAM_GENERIC_CLOCK_ID_NAME "clock_id"
|
| 620 | #define DEVLINK_PARAM_GENERIC_CLOCK_ID_TYPE DEVLINK_PARAM_TYPE_U64
|
| 621 |
|
| 622 | #define DEVLINK_PARAM_GENERIC_TOTAL_VFS_NAME "total_vfs"
|
| 623 | #define DEVLINK_PARAM_GENERIC_TOTAL_VFS_TYPE DEVLINK_PARAM_TYPE_U32
|
| 624 |
|
| 625 | #define DEVLINK_PARAM_GENERIC_NUM_DOORBELLS_NAME "num_doorbells"
|
| 626 | #define DEVLINK_PARAM_GENERIC_NUM_DOORBELLS_TYPE DEVLINK_PARAM_TYPE_U32
|
| 627 |
|
| 628 | #define DEVLINK_PARAM_GENERIC_MAX_MAC_PER_VF_NAME "max_mac_per_vf"
|
| 629 | #define DEVLINK_PARAM_GENERIC_MAX_MAC_PER_VF_TYPE DEVLINK_PARAM_TYPE_U32
|
| 630 |
|
| 631 | #define DEVLINK_PARAM_GENERIC_MAX_SFS_NAME "max_sfs"
|
| 632 | #define DEVLINK_PARAM_GENERIC_MAX_SFS_TYPE DEVLINK_PARAM_TYPE_U32
|
| 633 |
|
| 634 | #define DEVLINK_PARAM_GENERIC(_id, _cmodes, _get, _set, _validate) \
|
| 635 | { \
|
| 636 | .id = DEVLINK_PARAM_GENERIC_ID_##_id, \
|
| 637 | .name = DEVLINK_PARAM_GENERIC_##_id##_NAME, \
|
| 638 | .type = DEVLINK_PARAM_GENERIC_##_id##_TYPE, \
|
| 639 | .generic = true, \
|
| 640 | .supported_cmodes = _cmodes, \
|
| 641 | .get = _get, \
|
| 642 | .set = _set, \
|
| 643 | .validate = _validate, \
|
| 644 | }
|
| 645 |
|
| 646 | #define DEVLINK_PARAM_DRIVER(_id, _name, _type, _cmodes, _get, _set, _validate) \
|
| 647 | { \
|
| 648 | .id = _id, \
|
| 649 | .name = _name, \
|
| 650 | .type = _type, \
|
| 651 | .supported_cmodes = _cmodes, \
|
| 652 | .get = _get, \
|
| 653 | .set = _set, \
|
| 654 | .validate = _validate, \
|
| 655 | }
|
| 656 |
|
| 657 | #define DEVLINK_PARAM_GENERIC_WITH_DEFAULTS(_id, _cmodes, _get, _set, \
|
| 658 | _validate, _get_default, \
|
| 659 | _reset_default) \
|
| 660 | { \
|
| 661 | .id = DEVLINK_PARAM_GENERIC_ID_##_id, \
|
| 662 | .name = DEVLINK_PARAM_GENERIC_##_id##_NAME, \
|
| 663 | .type = DEVLINK_PARAM_GENERIC_##_id##_TYPE, \
|
| 664 | .generic = true, \
|
| 665 | .supported_cmodes = _cmodes, \
|
| 666 | .get = _get, \
|
| 667 | .set = _set, \
|
| 668 | .validate = _validate, \
|
| 669 | .get_default = _get_default, \
|
| 670 | .reset_default = _reset_default, \
|
| 671 | }
|
| 672 |
|
| 673 | #define DEVLINK_PARAM_DRIVER_WITH_DEFAULTS(_id, _name, _type, _cmodes, \
|
| 674 | _get, _set, _validate, \
|
| 675 | _get_default, _reset_default) \
|
| 676 | { \
|
| 677 | .id = _id, \
|
| 678 | .name = _name, \
|
| 679 | .type = _type, \
|
| 680 | .supported_cmodes = _cmodes, \
|
| 681 | .get = _get, \
|
| 682 | .set = _set, \
|
| 683 | .validate = _validate, \
|
| 684 | .get_default = _get_default, \
|
| 685 | .reset_default = _reset_default, \
|
| 686 | }
|
| 687 |
|
| 688 |
|
| 689 | #define DEVLINK_INFO_VERSION_GENERIC_BOARD_ID "board.id"
|
| 690 |
|
| 691 | #define DEVLINK_INFO_VERSION_GENERIC_BOARD_REV "board.rev"
|
| 692 |
|
| 693 | #define DEVLINK_INFO_VERSION_GENERIC_BOARD_MANUFACTURE "board.manufacture"
|
| 694 |
|
| 695 | #define DEVLINK_INFO_VERSION_GENERIC_BOARD_PART_NUMBER "board.part_number"
|
| 696 |
|
| 697 |
|
| 698 | #define DEVLINK_INFO_VERSION_GENERIC_ASIC_ID "asic.id"
|
| 699 |
|
| 700 | #define DEVLINK_INFO_VERSION_GENERIC_ASIC_REV "asic.rev"
|
| 701 |
|
| 702 |
|
| 703 | #define DEVLINK_INFO_VERSION_GENERIC_FW "fw"
|
| 704 |
|
| 705 | #define DEVLINK_INFO_VERSION_GENERIC_FW_MGMT "fw.mgmt"
|
| 706 |
|
| 707 | #define DEVLINK_INFO_VERSION_GENERIC_FW_MGMT_API "fw.mgmt.api"
|
| 708 |
|
| 709 | #define DEVLINK_INFO_VERSION_GENERIC_FW_APP "fw.app"
|
| 710 |
|
| 711 | #define DEVLINK_INFO_VERSION_GENERIC_FW_UNDI "fw.undi"
|
| 712 |
|
| 713 | #define DEVLINK_INFO_VERSION_GENERIC_FW_NCSI "fw.ncsi"
|
| 714 |
|
| 715 | #define DEVLINK_INFO_VERSION_GENERIC_FW_PSID "fw.psid"
|
| 716 |
|
| 717 | #define DEVLINK_INFO_VERSION_GENERIC_FW_ROCE "fw.roce"
|
| 718 |
|
| 719 | #define DEVLINK_INFO_VERSION_GENERIC_FW_BUNDLE_ID "fw.bundle_id"
|
| 720 |
|
| 721 | #define DEVLINK_INFO_VERSION_GENERIC_FW_BOOTLOADER "fw.bootloader"
|
| 722 |
|
| 723 | |
| 724 | * struct devlink_flash_update_params - Flash Update parameters
|
| 725 | * @fw: pointer to the firmware data to update from
|
| 726 | * @component: the flash component to update
|
| 727 | * @overwrite_mask: which types of flash update are supported (may be %0)
|
| 728 | *
|
| 729 | * With the exception of fw, drivers must opt-in to parameters by
|
| 730 | * setting the appropriate bit in the supported_flash_update_params field in
|
| 731 | * their devlink_ops structure.
|
| 732 |
|
| 733 | struct devlink_flash_update_params {
|
| 734 | const struct firmware *fw;
|
| 735 | const char *component;
|
| 736 | u32 overwrite_mask;
|
| 737 | };
|
| 738 |
|
| 739 | #define DEVLINK_SUPPORT_FLASH_UPDATE_OVERWRITE_MASK BIT(0)
|
| 740 |
|
| 741 | struct devlink_region;
|
| 742 | struct devlink_info_req;
|
| 743 |
|
| 744 | |
| 745 | * struct devlink_region_ops - Region operations
|
| 746 | * @name: region name
|
| 747 | * @destructor: callback used to free snapshot memory when deleting
|
| 748 | * @snapshot: callback to request an immediate snapshot. On success,
|
| 749 | * the data variable must be updated to point to the snapshot data.
|
| 750 | * The function will be called while the devlink instance lock is
|
| 751 | * held.
|
| 752 | * @read: callback to directly read a portion of the region. On success,
|
| 753 | * the data pointer will be updated with the contents of the
|
| 754 | * requested portion of the region. The function will be called
|
| 755 | * while the devlink instance lock is held.
|
| 756 | * @priv: Pointer to driver private data for the region operation
|
| 757 |
|
| 758 | struct devlink_region_ops {
|
| 759 | const char *name;
|
| 760 | void (*destructor)(const void *data);
|
| 761 | int (*snapshot)(struct devlink *devlink,
|
| 762 | const struct devlink_region_ops *ops,
|
| 763 | struct netlink_ext_ack *extack,
|
| 764 | u8 **data);
|
| 765 | int (*read)(struct devlink *devlink,
|
| 766 | const struct devlink_region_ops *ops,
|
| 767 | struct netlink_ext_ack *extack,
|
| 768 | u64 offset, u32 size, u8 *data);
|
| 769 | void *priv;
|
| 770 | };
|
| 771 |
|
| 772 | |
| 773 | * struct devlink_port_region_ops - Region operations for a port
|
| 774 | * @name: region name
|
| 775 | * @destructor: callback used to free snapshot memory when deleting
|
| 776 | * @snapshot: callback to request an immediate snapshot. On success,
|
| 777 | * the data variable must be updated to point to the snapshot data.
|
| 778 | * The function will be called while the devlink instance lock is
|
| 779 | * held.
|
| 780 | * @read: callback to directly read a portion of the region. On success,
|
| 781 | * the data pointer will be updated with the contents of the
|
| 782 | * requested portion of the region. The function will be called
|
| 783 | * while the devlink instance lock is held.
|
| 784 | * @priv: Pointer to driver private data for the region operation
|
| 785 |
|
| 786 | struct devlink_port_region_ops {
|
| 787 | const char *name;
|
| 788 | void (*destructor)(const void *data);
|
| 789 | int (*snapshot)(struct devlink_port *port,
|
| 790 | const struct devlink_port_region_ops *ops,
|
| 791 | struct netlink_ext_ack *extack,
|
| 792 | u8 **data);
|
| 793 | int (*read)(struct devlink_port *port,
|
| 794 | const struct devlink_port_region_ops *ops,
|
| 795 | struct netlink_ext_ack *extack,
|
| 796 | u64 offset, u32 size, u8 *data);
|
| 797 | void *priv;
|
| 798 | };
|
| 799 |
|
| 800 | struct devlink_fmsg;
|
| 801 | struct devlink_health_reporter;
|
| 802 |
|
| 803 | enum devlink_health_reporter_state {
|
| 804 | DEVLINK_HEALTH_REPORTER_STATE_HEALTHY,
|
| 805 | DEVLINK_HEALTH_REPORTER_STATE_ERROR,
|
| 806 | };
|
| 807 |
|
| 808 | |
| 809 | * struct devlink_health_reporter_ops - Reporter operations
|
| 810 | * @name: reporter name
|
| 811 | * @recover: callback to recover from reported error
|
| 812 | * if priv_ctx is NULL, run a full recover
|
| 813 | * @dump: callback to dump an object
|
| 814 | * if priv_ctx is NULL, run a full dump
|
| 815 | * @diagnose: callback to diagnose the current status
|
| 816 | * @test: callback to trigger a test event
|
| 817 | * @default_graceful_period: default min time (in msec)
|
| 818 | * between recovery attempts
|
| 819 | * @default_burst_period: default time (in msec) for
|
| 820 | * error recoveries before starting the grace period
|
| 821 |
|
| 822 |
|
| 823 | struct devlink_health_reporter_ops {
|
| 824 | char *name;
|
| 825 | int (*recover)(struct devlink_health_reporter *reporter,
|
| 826 | void *priv_ctx, struct netlink_ext_ack *extack);
|
| 827 | int (*dump)(struct devlink_health_reporter *reporter,
|
| 828 | struct devlink_fmsg *fmsg, void *priv_ctx,
|
| 829 | struct netlink_ext_ack *extack);
|
| 830 | int (*diagnose)(struct devlink_health_reporter *reporter,
|
| 831 | struct devlink_fmsg *fmsg,
|
| 832 | struct netlink_ext_ack *extack);
|
| 833 | int (*test)(struct devlink_health_reporter *reporter,
|
| 834 | struct netlink_ext_ack *extack);
|
| 835 | u64 default_graceful_period;
|
| 836 | u64 default_burst_period;
|
| 837 | };
|
| 838 |
|
| 839 | |
| 840 | * struct devlink_trap_metadata - Packet trap metadata.
|
| 841 | * @trap_name: Trap name.
|
| 842 | * @trap_group_name: Trap group name.
|
| 843 | * @input_dev: Input netdevice.
|
| 844 | * @dev_tracker: refcount tracker for @input_dev.
|
| 845 | * @fa_cookie: Flow action user cookie.
|
| 846 | * @trap_type: Trap type.
|
| 847 |
|
| 848 | struct devlink_trap_metadata {
|
| 849 | const char *trap_name;
|
| 850 | const char *trap_group_name;
|
| 851 |
|
| 852 | struct net_device *input_dev;
|
| 853 | netdevice_tracker dev_tracker;
|
| 854 |
|
| 855 | const struct flow_action_cookie *fa_cookie;
|
| 856 | enum devlink_trap_type trap_type;
|
| 857 | };
|
| 858 |
|
| 859 | |
| 860 | * struct devlink_trap_policer - Immutable packet trap policer attributes.
|
| 861 | * @id: Policer identifier.
|
| 862 | * @init_rate: Initial rate in packets / sec.
|
| 863 | * @init_burst: Initial burst size in packets.
|
| 864 | * @max_rate: Maximum rate.
|
| 865 | * @min_rate: Minimum rate.
|
| 866 | * @max_burst: Maximum burst size.
|
| 867 | * @min_burst: Minimum burst size.
|
| 868 | *
|
| 869 | * Describes immutable attributes of packet trap policers that drivers register
|
| 870 | * with devlink.
|
| 871 |
|
| 872 | struct devlink_trap_policer {
|
| 873 | u32 id;
|
| 874 | u64 init_rate;
|
| 875 | u64 init_burst;
|
| 876 | u64 max_rate;
|
| 877 | u64 min_rate;
|
| 878 | u64 max_burst;
|
| 879 | u64 min_burst;
|
| 880 | };
|
| 881 |
|
| 882 | |
| 883 | * struct devlink_trap_group - Immutable packet trap group attributes.
|
| 884 | * @name: Trap group name.
|
| 885 | * @id: Trap group identifier.
|
| 886 | * @generic: Whether the trap group is generic or not.
|
| 887 | * @init_policer_id: Initial policer identifier.
|
| 888 | *
|
| 889 | * Describes immutable attributes of packet trap groups that drivers register
|
| 890 | * with devlink.
|
| 891 |
|
| 892 | struct devlink_trap_group {
|
| 893 | const char *name;
|
| 894 | u16 id;
|
| 895 | bool generic;
|
| 896 | u32 init_policer_id;
|
| 897 | };
|
| 898 |
|
| 899 | #define DEVLINK_TRAP_METADATA_TYPE_F_IN_PORT BIT(0)
|
| 900 | #define DEVLINK_TRAP_METADATA_TYPE_F_FA_COOKIE BIT(1)
|
| 901 |
|
| 902 | |
| 903 | * struct devlink_trap - Immutable packet trap attributes.
|
| 904 | * @type: Trap type.
|
| 905 | * @init_action: Initial trap action.
|
| 906 | * @generic: Whether the trap is generic or not.
|
| 907 | * @id: Trap identifier.
|
| 908 | * @name: Trap name.
|
| 909 | * @init_group_id: Initial group identifier.
|
| 910 | * @metadata_cap: Metadata types that can be provided by the trap.
|
| 911 | *
|
| 912 | * Describes immutable attributes of packet traps that drivers register with
|
| 913 | * devlink.
|
| 914 |
|
| 915 | struct devlink_trap {
|
| 916 | enum devlink_trap_type type;
|
| 917 | enum devlink_trap_action init_action;
|
| 918 | bool generic;
|
| 919 | u16 id;
|
| 920 | const char *name;
|
| 921 | u16 init_group_id;
|
| 922 | u32 metadata_cap;
|
| 923 | };
|
| 924 |
|
| 925 | |
| 926 | * Documentation/networking/devlink/devlink-trap.rst
|
| 927 |
|
| 928 | enum devlink_trap_generic_id {
|
| 929 | DEVLINK_TRAP_GENERIC_ID_SMAC_MC,
|
| 930 | DEVLINK_TRAP_GENERIC_ID_VLAN_TAG_MISMATCH,
|
| 931 | DEVLINK_TRAP_GENERIC_ID_INGRESS_VLAN_FILTER,
|
| 932 | DEVLINK_TRAP_GENERIC_ID_INGRESS_STP_FILTER,
|
| 933 | DEVLINK_TRAP_GENERIC_ID_EMPTY_TX_LIST,
|
| 934 | DEVLINK_TRAP_GENERIC_ID_PORT_LOOPBACK_FILTER,
|
| 935 | DEVLINK_TRAP_GENERIC_ID_BLACKHOLE_ROUTE,
|
| 936 | DEVLINK_TRAP_GENERIC_ID_TTL_ERROR,
|
| 937 | DEVLINK_TRAP_GENERIC_ID_TAIL_DROP,
|
| 938 | DEVLINK_TRAP_GENERIC_ID_NON_IP_PACKET,
|
| 939 | DEVLINK_TRAP_GENERIC_ID_UC_DIP_MC_DMAC,
|
| 940 | DEVLINK_TRAP_GENERIC_ID_DIP_LB,
|
| 941 | DEVLINK_TRAP_GENERIC_ID_SIP_MC,
|
| 942 | DEVLINK_TRAP_GENERIC_ID_SIP_LB,
|
| 943 | DEVLINK_TRAP_GENERIC_ID_CORRUPTED_IP_HDR,
|
| 944 | DEVLINK_TRAP_GENERIC_ID_IPV4_SIP_BC,
|
| 945 | DEVLINK_TRAP_GENERIC_ID_IPV6_MC_DIP_RESERVED_SCOPE,
|
| 946 | DEVLINK_TRAP_GENERIC_ID_IPV6_MC_DIP_INTERFACE_LOCAL_SCOPE,
|
| 947 | DEVLINK_TRAP_GENERIC_ID_MTU_ERROR,
|
| 948 | DEVLINK_TRAP_GENERIC_ID_UNRESOLVED_NEIGH,
|
| 949 | DEVLINK_TRAP_GENERIC_ID_RPF,
|
| 950 | DEVLINK_TRAP_GENERIC_ID_REJECT_ROUTE,
|
| 951 | DEVLINK_TRAP_GENERIC_ID_IPV4_LPM_UNICAST_MISS,
|
| 952 | DEVLINK_TRAP_GENERIC_ID_IPV6_LPM_UNICAST_MISS,
|
| 953 | DEVLINK_TRAP_GENERIC_ID_NON_ROUTABLE,
|
| 954 | DEVLINK_TRAP_GENERIC_ID_DECAP_ERROR,
|
| 955 | DEVLINK_TRAP_GENERIC_ID_OVERLAY_SMAC_MC,
|
| 956 | DEVLINK_TRAP_GENERIC_ID_INGRESS_FLOW_ACTION_DROP,
|
| 957 | DEVLINK_TRAP_GENERIC_ID_EGRESS_FLOW_ACTION_DROP,
|
| 958 | DEVLINK_TRAP_GENERIC_ID_STP,
|
| 959 | DEVLINK_TRAP_GENERIC_ID_LACP,
|
| 960 | DEVLINK_TRAP_GENERIC_ID_LLDP,
|
| 961 | DEVLINK_TRAP_GENERIC_ID_IGMP_QUERY,
|
| 962 | DEVLINK_TRAP_GENERIC_ID_IGMP_V1_REPORT,
|
| 963 | DEVLINK_TRAP_GENERIC_ID_IGMP_V2_REPORT,
|
| 964 | DEVLINK_TRAP_GENERIC_ID_IGMP_V3_REPORT,
|
| 965 | DEVLINK_TRAP_GENERIC_ID_IGMP_V2_LEAVE,
|
| 966 | DEVLINK_TRAP_GENERIC_ID_MLD_QUERY,
|
| 967 | DEVLINK_TRAP_GENERIC_ID_MLD_V1_REPORT,
|
| 968 | DEVLINK_TRAP_GENERIC_ID_MLD_V2_REPORT,
|
| 969 | DEVLINK_TRAP_GENERIC_ID_MLD_V1_DONE,
|
| 970 | DEVLINK_TRAP_GENERIC_ID_IPV4_DHCP,
|
| 971 | DEVLINK_TRAP_GENERIC_ID_IPV6_DHCP,
|
| 972 | DEVLINK_TRAP_GENERIC_ID_ARP_REQUEST,
|
| 973 | DEVLINK_TRAP_GENERIC_ID_ARP_RESPONSE,
|
| 974 | DEVLINK_TRAP_GENERIC_ID_ARP_OVERLAY,
|
| 975 | DEVLINK_TRAP_GENERIC_ID_IPV6_NEIGH_SOLICIT,
|
| 976 | DEVLINK_TRAP_GENERIC_ID_IPV6_NEIGH_ADVERT,
|
| 977 | DEVLINK_TRAP_GENERIC_ID_IPV4_BFD,
|
| 978 | DEVLINK_TRAP_GENERIC_ID_IPV6_BFD,
|
| 979 | DEVLINK_TRAP_GENERIC_ID_IPV4_OSPF,
|
| 980 | DEVLINK_TRAP_GENERIC_ID_IPV6_OSPF,
|
| 981 | DEVLINK_TRAP_GENERIC_ID_IPV4_BGP,
|
| 982 | DEVLINK_TRAP_GENERIC_ID_IPV6_BGP,
|
| 983 | DEVLINK_TRAP_GENERIC_ID_IPV4_VRRP,
|
| 984 | DEVLINK_TRAP_GENERIC_ID_IPV6_VRRP,
|
| 985 | DEVLINK_TRAP_GENERIC_ID_IPV4_PIM,
|
| 986 | DEVLINK_TRAP_GENERIC_ID_IPV6_PIM,
|
| 987 | DEVLINK_TRAP_GENERIC_ID_UC_LB,
|
| 988 | DEVLINK_TRAP_GENERIC_ID_LOCAL_ROUTE,
|
| 989 | DEVLINK_TRAP_GENERIC_ID_EXTERNAL_ROUTE,
|
| 990 | DEVLINK_TRAP_GENERIC_ID_IPV6_UC_DIP_LINK_LOCAL_SCOPE,
|
| 991 | DEVLINK_TRAP_GENERIC_ID_IPV6_DIP_ALL_NODES,
|
| 992 | DEVLINK_TRAP_GENERIC_ID_IPV6_DIP_ALL_ROUTERS,
|
| 993 | DEVLINK_TRAP_GENERIC_ID_IPV6_ROUTER_SOLICIT,
|
| 994 | DEVLINK_TRAP_GENERIC_ID_IPV6_ROUTER_ADVERT,
|
| 995 | DEVLINK_TRAP_GENERIC_ID_IPV6_REDIRECT,
|
| 996 | DEVLINK_TRAP_GENERIC_ID_IPV4_ROUTER_ALERT,
|
| 997 | DEVLINK_TRAP_GENERIC_ID_IPV6_ROUTER_ALERT,
|
| 998 | DEVLINK_TRAP_GENERIC_ID_PTP_EVENT,
|
| 999 | DEVLINK_TRAP_GENERIC_ID_PTP_GENERAL,
|
| 1000 | DEVLINK_TRAP_GENERIC_ID_FLOW_ACTION_SAMPLE,
|
| 1001 | DEVLINK_TRAP_GENERIC_ID_FLOW_ACTION_TRAP,
|
| 1002 | DEVLINK_TRAP_GENERIC_ID_EARLY_DROP,
|
| 1003 | DEVLINK_TRAP_GENERIC_ID_VXLAN_PARSING,
|
| 1004 | DEVLINK_TRAP_GENERIC_ID_LLC_SNAP_PARSING,
|
| 1005 | DEVLINK_TRAP_GENERIC_ID_VLAN_PARSING,
|
| 1006 | DEVLINK_TRAP_GENERIC_ID_PPPOE_PPP_PARSING,
|
| 1007 | DEVLINK_TRAP_GENERIC_ID_MPLS_PARSING,
|
| 1008 | DEVLINK_TRAP_GENERIC_ID_ARP_PARSING,
|
| 1009 | DEVLINK_TRAP_GENERIC_ID_IP_1_PARSING,
|
| 1010 | DEVLINK_TRAP_GENERIC_ID_IP_N_PARSING,
|
| 1011 | DEVLINK_TRAP_GENERIC_ID_GRE_PARSING,
|
| 1012 | DEVLINK_TRAP_GENERIC_ID_UDP_PARSING,
|
| 1013 | DEVLINK_TRAP_GENERIC_ID_TCP_PARSING,
|
| 1014 | DEVLINK_TRAP_GENERIC_ID_IPSEC_PARSING,
|
| 1015 | DEVLINK_TRAP_GENERIC_ID_SCTP_PARSING,
|
| 1016 | DEVLINK_TRAP_GENERIC_ID_DCCP_PARSING,
|
| 1017 | DEVLINK_TRAP_GENERIC_ID_GTP_PARSING,
|
| 1018 | DEVLINK_TRAP_GENERIC_ID_ESP_PARSING,
|
| 1019 | DEVLINK_TRAP_GENERIC_ID_BLACKHOLE_NEXTHOP,
|
| 1020 | DEVLINK_TRAP_GENERIC_ID_DMAC_FILTER,
|
| 1021 | DEVLINK_TRAP_GENERIC_ID_EAPOL,
|
| 1022 | DEVLINK_TRAP_GENERIC_ID_LOCKED_PORT,
|
| 1023 |
|
| 1024 |
|
| 1025 | __DEVLINK_TRAP_GENERIC_ID_MAX,
|
| 1026 | DEVLINK_TRAP_GENERIC_ID_MAX = __DEVLINK_TRAP_GENERIC_ID_MAX - 1,
|
| 1027 | };
|
| 1028 |
|
| 1029 | |
| 1030 | * Documentation/networking/devlink/devlink-trap.rst
|
| 1031 |
|
| 1032 | enum devlink_trap_group_generic_id {
|
| 1033 | DEVLINK_TRAP_GROUP_GENERIC_ID_L2_DROPS,
|
| 1034 | DEVLINK_TRAP_GROUP_GENERIC_ID_L3_DROPS,
|
| 1035 | DEVLINK_TRAP_GROUP_GENERIC_ID_L3_EXCEPTIONS,
|
| 1036 | DEVLINK_TRAP_GROUP_GENERIC_ID_BUFFER_DROPS,
|
| 1037 | DEVLINK_TRAP_GROUP_GENERIC_ID_TUNNEL_DROPS,
|
| 1038 | DEVLINK_TRAP_GROUP_GENERIC_ID_ACL_DROPS,
|
| 1039 | DEVLINK_TRAP_GROUP_GENERIC_ID_STP,
|
| 1040 | DEVLINK_TRAP_GROUP_GENERIC_ID_LACP,
|
| 1041 | DEVLINK_TRAP_GROUP_GENERIC_ID_LLDP,
|
| 1042 | DEVLINK_TRAP_GROUP_GENERIC_ID_MC_SNOOPING,
|
| 1043 | DEVLINK_TRAP_GROUP_GENERIC_ID_DHCP,
|
| 1044 | DEVLINK_TRAP_GROUP_GENERIC_ID_NEIGH_DISCOVERY,
|
| 1045 | DEVLINK_TRAP_GROUP_GENERIC_ID_BFD,
|
| 1046 | DEVLINK_TRAP_GROUP_GENERIC_ID_OSPF,
|
| 1047 | DEVLINK_TRAP_GROUP_GENERIC_ID_BGP,
|
| 1048 | DEVLINK_TRAP_GROUP_GENERIC_ID_VRRP,
|
| 1049 | DEVLINK_TRAP_GROUP_GENERIC_ID_PIM,
|
| 1050 | DEVLINK_TRAP_GROUP_GENERIC_ID_UC_LB,
|
| 1051 | DEVLINK_TRAP_GROUP_GENERIC_ID_LOCAL_DELIVERY,
|
| 1052 | DEVLINK_TRAP_GROUP_GENERIC_ID_EXTERNAL_DELIVERY,
|
| 1053 | DEVLINK_TRAP_GROUP_GENERIC_ID_IPV6,
|
| 1054 | DEVLINK_TRAP_GROUP_GENERIC_ID_PTP_EVENT,
|
| 1055 | DEVLINK_TRAP_GROUP_GENERIC_ID_PTP_GENERAL,
|
| 1056 | DEVLINK_TRAP_GROUP_GENERIC_ID_ACL_SAMPLE,
|
| 1057 | DEVLINK_TRAP_GROUP_GENERIC_ID_ACL_TRAP,
|
| 1058 | DEVLINK_TRAP_GROUP_GENERIC_ID_PARSER_ERROR_DROPS,
|
| 1059 | DEVLINK_TRAP_GROUP_GENERIC_ID_EAPOL,
|
| 1060 |
|
| 1061 |
|
| 1062 | __DEVLINK_TRAP_GROUP_GENERIC_ID_MAX,
|
| 1063 | DEVLINK_TRAP_GROUP_GENERIC_ID_MAX =
|
| 1064 | __DEVLINK_TRAP_GROUP_GENERIC_ID_MAX - 1,
|
| 1065 | };
|
| 1066 |
|
| 1067 | #define DEVLINK_TRAP_GENERIC_NAME_SMAC_MC \
|
| 1068 | "source_mac_is_multicast"
|
| 1069 | #define DEVLINK_TRAP_GENERIC_NAME_VLAN_TAG_MISMATCH \
|
| 1070 | "vlan_tag_mismatch"
|
| 1071 | #define DEVLINK_TRAP_GENERIC_NAME_INGRESS_VLAN_FILTER \
|
| 1072 | "ingress_vlan_filter"
|
| 1073 | #define DEVLINK_TRAP_GENERIC_NAME_INGRESS_STP_FILTER \
|
| 1074 | "ingress_spanning_tree_filter"
|
| 1075 | #define DEVLINK_TRAP_GENERIC_NAME_EMPTY_TX_LIST \
|
| 1076 | "port_list_is_empty"
|
| 1077 | #define DEVLINK_TRAP_GENERIC_NAME_PORT_LOOPBACK_FILTER \
|
| 1078 | "port_loopback_filter"
|
| 1079 | #define DEVLINK_TRAP_GENERIC_NAME_BLACKHOLE_ROUTE \
|
| 1080 | "blackhole_route"
|
| 1081 | #define DEVLINK_TRAP_GENERIC_NAME_TTL_ERROR \
|
| 1082 | "ttl_value_is_too_small"
|
| 1083 | #define DEVLINK_TRAP_GENERIC_NAME_TAIL_DROP \
|
| 1084 | "tail_drop"
|
| 1085 | #define DEVLINK_TRAP_GENERIC_NAME_NON_IP_PACKET \
|
| 1086 | "non_ip"
|
| 1087 | #define DEVLINK_TRAP_GENERIC_NAME_UC_DIP_MC_DMAC \
|
| 1088 | "uc_dip_over_mc_dmac"
|
| 1089 | #define DEVLINK_TRAP_GENERIC_NAME_DIP_LB \
|
| 1090 | "dip_is_loopback_address"
|
| 1091 | #define DEVLINK_TRAP_GENERIC_NAME_SIP_MC \
|
| 1092 | "sip_is_mc"
|
| 1093 | #define DEVLINK_TRAP_GENERIC_NAME_SIP_LB \
|
| 1094 | "sip_is_loopback_address"
|
| 1095 | #define DEVLINK_TRAP_GENERIC_NAME_CORRUPTED_IP_HDR \
|
| 1096 | "ip_header_corrupted"
|
| 1097 | #define DEVLINK_TRAP_GENERIC_NAME_IPV4_SIP_BC \
|
| 1098 | "ipv4_sip_is_limited_bc"
|
| 1099 | #define DEVLINK_TRAP_GENERIC_NAME_IPV6_MC_DIP_RESERVED_SCOPE \
|
| 1100 | "ipv6_mc_dip_reserved_scope"
|
| 1101 | #define DEVLINK_TRAP_GENERIC_NAME_IPV6_MC_DIP_INTERFACE_LOCAL_SCOPE \
|
| 1102 | "ipv6_mc_dip_interface_local_scope"
|
| 1103 | #define DEVLINK_TRAP_GENERIC_NAME_MTU_ERROR \
|
| 1104 | "mtu_value_is_too_small"
|
| 1105 | #define DEVLINK_TRAP_GENERIC_NAME_UNRESOLVED_NEIGH \
|
| 1106 | "unresolved_neigh"
|
| 1107 | #define DEVLINK_TRAP_GENERIC_NAME_RPF \
|
| 1108 | "mc_reverse_path_forwarding"
|
| 1109 | #define DEVLINK_TRAP_GENERIC_NAME_REJECT_ROUTE \
|
| 1110 | "reject_route"
|
| 1111 | #define DEVLINK_TRAP_GENERIC_NAME_IPV4_LPM_UNICAST_MISS \
|
| 1112 | "ipv4_lpm_miss"
|
| 1113 | #define DEVLINK_TRAP_GENERIC_NAME_IPV6_LPM_UNICAST_MISS \
|
| 1114 | "ipv6_lpm_miss"
|
| 1115 | #define DEVLINK_TRAP_GENERIC_NAME_NON_ROUTABLE \
|
| 1116 | "non_routable_packet"
|
| 1117 | #define DEVLINK_TRAP_GENERIC_NAME_DECAP_ERROR \
|
| 1118 | "decap_error"
|
| 1119 | #define DEVLINK_TRAP_GENERIC_NAME_OVERLAY_SMAC_MC \
|
| 1120 | "overlay_smac_is_mc"
|
| 1121 | #define DEVLINK_TRAP_GENERIC_NAME_INGRESS_FLOW_ACTION_DROP \
|
| 1122 | "ingress_flow_action_drop"
|
| 1123 | #define DEVLINK_TRAP_GENERIC_NAME_EGRESS_FLOW_ACTION_DROP \
|
| 1124 | "egress_flow_action_drop"
|
| 1125 | #define DEVLINK_TRAP_GENERIC_NAME_STP \
|
| 1126 | "stp"
|
| 1127 | #define DEVLINK_TRAP_GENERIC_NAME_LACP \
|
| 1128 | "lacp"
|
| 1129 | #define DEVLINK_TRAP_GENERIC_NAME_LLDP \
|
| 1130 | "lldp"
|
| 1131 | #define DEVLINK_TRAP_GENERIC_NAME_IGMP_QUERY \
|
| 1132 | "igmp_query"
|
| 1133 | #define DEVLINK_TRAP_GENERIC_NAME_IGMP_V1_REPORT \
|
| 1134 | "igmp_v1_report"
|
| 1135 | #define DEVLINK_TRAP_GENERIC_NAME_IGMP_V2_REPORT \
|
| 1136 | "igmp_v2_report"
|
| 1137 | #define DEVLINK_TRAP_GENERIC_NAME_IGMP_V3_REPORT \
|
| 1138 | "igmp_v3_report"
|
| 1139 | #define DEVLINK_TRAP_GENERIC_NAME_IGMP_V2_LEAVE \
|
| 1140 | "igmp_v2_leave"
|
| 1141 | #define DEVLINK_TRAP_GENERIC_NAME_MLD_QUERY \
|
| 1142 | "mld_query"
|
| 1143 | #define DEVLINK_TRAP_GENERIC_NAME_MLD_V1_REPORT \
|
| 1144 | "mld_v1_report"
|
| 1145 | #define DEVLINK_TRAP_GENERIC_NAME_MLD_V2_REPORT \
|
| 1146 | "mld_v2_report"
|
| 1147 | #define DEVLINK_TRAP_GENERIC_NAME_MLD_V1_DONE \
|
| 1148 | "mld_v1_done"
|
| 1149 | #define DEVLINK_TRAP_GENERIC_NAME_IPV4_DHCP \
|
| 1150 | "ipv4_dhcp"
|
| 1151 | #define DEVLINK_TRAP_GENERIC_NAME_IPV6_DHCP \
|
| 1152 | "ipv6_dhcp"
|
| 1153 | #define DEVLINK_TRAP_GENERIC_NAME_ARP_REQUEST \
|
| 1154 | "arp_request"
|
| 1155 | #define DEVLINK_TRAP_GENERIC_NAME_ARP_RESPONSE \
|
| 1156 | "arp_response"
|
| 1157 | #define DEVLINK_TRAP_GENERIC_NAME_ARP_OVERLAY \
|
| 1158 | "arp_overlay"
|
| 1159 | #define DEVLINK_TRAP_GENERIC_NAME_IPV6_NEIGH_SOLICIT \
|
| 1160 | "ipv6_neigh_solicit"
|
| 1161 | #define DEVLINK_TRAP_GENERIC_NAME_IPV6_NEIGH_ADVERT \
|
| 1162 | "ipv6_neigh_advert"
|
| 1163 | #define DEVLINK_TRAP_GENERIC_NAME_IPV4_BFD \
|
| 1164 | "ipv4_bfd"
|
| 1165 | #define DEVLINK_TRAP_GENERIC_NAME_IPV6_BFD \
|
| 1166 | "ipv6_bfd"
|
| 1167 | #define DEVLINK_TRAP_GENERIC_NAME_IPV4_OSPF \
|
| 1168 | "ipv4_ospf"
|
| 1169 | #define DEVLINK_TRAP_GENERIC_NAME_IPV6_OSPF \
|
| 1170 | "ipv6_ospf"
|
| 1171 | #define DEVLINK_TRAP_GENERIC_NAME_IPV4_BGP \
|
| 1172 | "ipv4_bgp"
|
| 1173 | #define DEVLINK_TRAP_GENERIC_NAME_IPV6_BGP \
|
| 1174 | "ipv6_bgp"
|
| 1175 | #define DEVLINK_TRAP_GENERIC_NAME_IPV4_VRRP \
|
| 1176 | "ipv4_vrrp"
|
| 1177 | #define DEVLINK_TRAP_GENERIC_NAME_IPV6_VRRP \
|
| 1178 | "ipv6_vrrp"
|
| 1179 | #define DEVLINK_TRAP_GENERIC_NAME_IPV4_PIM \
|
| 1180 | "ipv4_pim"
|
| 1181 | #define DEVLINK_TRAP_GENERIC_NAME_IPV6_PIM \
|
| 1182 | "ipv6_pim"
|
| 1183 | #define DEVLINK_TRAP_GENERIC_NAME_UC_LB \
|
| 1184 | "uc_loopback"
|
| 1185 | #define DEVLINK_TRAP_GENERIC_NAME_LOCAL_ROUTE \
|
| 1186 | "local_route"
|
| 1187 | #define DEVLINK_TRAP_GENERIC_NAME_EXTERNAL_ROUTE \
|
| 1188 | "external_route"
|
| 1189 | #define DEVLINK_TRAP_GENERIC_NAME_IPV6_UC_DIP_LINK_LOCAL_SCOPE \
|
| 1190 | "ipv6_uc_dip_link_local_scope"
|
| 1191 | #define DEVLINK_TRAP_GENERIC_NAME_IPV6_DIP_ALL_NODES \
|
| 1192 | "ipv6_dip_all_nodes"
|
| 1193 | #define DEVLINK_TRAP_GENERIC_NAME_IPV6_DIP_ALL_ROUTERS \
|
| 1194 | "ipv6_dip_all_routers"
|
| 1195 | #define DEVLINK_TRAP_GENERIC_NAME_IPV6_ROUTER_SOLICIT \
|
| 1196 | "ipv6_router_solicit"
|
| 1197 | #define DEVLINK_TRAP_GENERIC_NAME_IPV6_ROUTER_ADVERT \
|
| 1198 | "ipv6_router_advert"
|
| 1199 | #define DEVLINK_TRAP_GENERIC_NAME_IPV6_REDIRECT \
|
| 1200 | "ipv6_redirect"
|
| 1201 | #define DEVLINK_TRAP_GENERIC_NAME_IPV4_ROUTER_ALERT \
|
| 1202 | "ipv4_router_alert"
|
| 1203 | #define DEVLINK_TRAP_GENERIC_NAME_IPV6_ROUTER_ALERT \
|
| 1204 | "ipv6_router_alert"
|
| 1205 | #define DEVLINK_TRAP_GENERIC_NAME_PTP_EVENT \
|
| 1206 | "ptp_event"
|
| 1207 | #define DEVLINK_TRAP_GENERIC_NAME_PTP_GENERAL \
|
| 1208 | "ptp_general"
|
| 1209 | #define DEVLINK_TRAP_GENERIC_NAME_FLOW_ACTION_SAMPLE \
|
| 1210 | "flow_action_sample"
|
| 1211 | #define DEVLINK_TRAP_GENERIC_NAME_FLOW_ACTION_TRAP \
|
| 1212 | "flow_action_trap"
|
| 1213 | #define DEVLINK_TRAP_GENERIC_NAME_EARLY_DROP \
|
| 1214 | "early_drop"
|
| 1215 | #define DEVLINK_TRAP_GENERIC_NAME_VXLAN_PARSING \
|
| 1216 | "vxlan_parsing"
|
| 1217 | #define DEVLINK_TRAP_GENERIC_NAME_LLC_SNAP_PARSING \
|
| 1218 | "llc_snap_parsing"
|
| 1219 | #define DEVLINK_TRAP_GENERIC_NAME_VLAN_PARSING \
|
| 1220 | "vlan_parsing"
|
| 1221 | #define DEVLINK_TRAP_GENERIC_NAME_PPPOE_PPP_PARSING \
|
| 1222 | "pppoe_ppp_parsing"
|
| 1223 | #define DEVLINK_TRAP_GENERIC_NAME_MPLS_PARSING \
|
| 1224 | "mpls_parsing"
|
| 1225 | #define DEVLINK_TRAP_GENERIC_NAME_ARP_PARSING \
|
| 1226 | "arp_parsing"
|
| 1227 | #define DEVLINK_TRAP_GENERIC_NAME_IP_1_PARSING \
|
| 1228 | "ip_1_parsing"
|
| 1229 | #define DEVLINK_TRAP_GENERIC_NAME_IP_N_PARSING \
|
| 1230 | "ip_n_parsing"
|
| 1231 | #define DEVLINK_TRAP_GENERIC_NAME_GRE_PARSING \
|
| 1232 | "gre_parsing"
|
| 1233 | #define DEVLINK_TRAP_GENERIC_NAME_UDP_PARSING \
|
| 1234 | "udp_parsing"
|
| 1235 | #define DEVLINK_TRAP_GENERIC_NAME_TCP_PARSING \
|
| 1236 | "tcp_parsing"
|
| 1237 | #define DEVLINK_TRAP_GENERIC_NAME_IPSEC_PARSING \
|
| 1238 | "ipsec_parsing"
|
| 1239 | #define DEVLINK_TRAP_GENERIC_NAME_SCTP_PARSING \
|
| 1240 | "sctp_parsing"
|
| 1241 | #define DEVLINK_TRAP_GENERIC_NAME_DCCP_PARSING \
|
| 1242 | "dccp_parsing"
|
| 1243 | #define DEVLINK_TRAP_GENERIC_NAME_GTP_PARSING \
|
| 1244 | "gtp_parsing"
|
| 1245 | #define DEVLINK_TRAP_GENERIC_NAME_ESP_PARSING \
|
| 1246 | "esp_parsing"
|
| 1247 | #define DEVLINK_TRAP_GENERIC_NAME_BLACKHOLE_NEXTHOP \
|
| 1248 | "blackhole_nexthop"
|
| 1249 | #define DEVLINK_TRAP_GENERIC_NAME_DMAC_FILTER \
|
| 1250 | "dmac_filter"
|
| 1251 | #define DEVLINK_TRAP_GENERIC_NAME_EAPOL \
|
| 1252 | "eapol"
|
| 1253 | #define DEVLINK_TRAP_GENERIC_NAME_LOCKED_PORT \
|
| 1254 | "locked_port"
|
| 1255 |
|
| 1256 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_L2_DROPS \
|
| 1257 | "l2_drops"
|
| 1258 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_L3_DROPS \
|
| 1259 | "l3_drops"
|
| 1260 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_L3_EXCEPTIONS \
|
| 1261 | "l3_exceptions"
|
| 1262 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_BUFFER_DROPS \
|
| 1263 | "buffer_drops"
|
| 1264 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_TUNNEL_DROPS \
|
| 1265 | "tunnel_drops"
|
| 1266 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_ACL_DROPS \
|
| 1267 | "acl_drops"
|
| 1268 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_STP \
|
| 1269 | "stp"
|
| 1270 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_LACP \
|
| 1271 | "lacp"
|
| 1272 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_LLDP \
|
| 1273 | "lldp"
|
| 1274 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_MC_SNOOPING \
|
| 1275 | "mc_snooping"
|
| 1276 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_DHCP \
|
| 1277 | "dhcp"
|
| 1278 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_NEIGH_DISCOVERY \
|
| 1279 | "neigh_discovery"
|
| 1280 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_BFD \
|
| 1281 | "bfd"
|
| 1282 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_OSPF \
|
| 1283 | "ospf"
|
| 1284 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_BGP \
|
| 1285 | "bgp"
|
| 1286 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_VRRP \
|
| 1287 | "vrrp"
|
| 1288 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_PIM \
|
| 1289 | "pim"
|
| 1290 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_UC_LB \
|
| 1291 | "uc_loopback"
|
| 1292 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_LOCAL_DELIVERY \
|
| 1293 | "local_delivery"
|
| 1294 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_EXTERNAL_DELIVERY \
|
| 1295 | "external_delivery"
|
| 1296 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_IPV6 \
|
| 1297 | "ipv6"
|
| 1298 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_PTP_EVENT \
|
| 1299 | "ptp_event"
|
| 1300 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_PTP_GENERAL \
|
| 1301 | "ptp_general"
|
| 1302 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_ACL_SAMPLE \
|
| 1303 | "acl_sample"
|
| 1304 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_ACL_TRAP \
|
| 1305 | "acl_trap"
|
| 1306 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_PARSER_ERROR_DROPS \
|
| 1307 | "parser_error_drops"
|
| 1308 | #define DEVLINK_TRAP_GROUP_GENERIC_NAME_EAPOL \
|
| 1309 | "eapol"
|
| 1310 |
|
| 1311 | #define DEVLINK_TRAP_GENERIC(_type, _init_action, _id, _group_id, \
|
| 1312 | _metadata_cap) \
|
| 1313 | { \
|
| 1314 | .type = DEVLINK_TRAP_TYPE_##_type, \
|
| 1315 | .init_action = DEVLINK_TRAP_ACTION_##_init_action, \
|
| 1316 | .generic = true, \
|
| 1317 | .id = DEVLINK_TRAP_GENERIC_ID_##_id, \
|
| 1318 | .name = DEVLINK_TRAP_GENERIC_NAME_##_id, \
|
| 1319 | .init_group_id = _group_id, \
|
| 1320 | .metadata_cap = _metadata_cap, \
|
| 1321 | }
|
| 1322 |
|
| 1323 | #define DEVLINK_TRAP_DRIVER(_type, _init_action, _id, _name, _group_id, \
|
| 1324 | _metadata_cap) \
|
| 1325 | { \
|
| 1326 | .type = DEVLINK_TRAP_TYPE_##_type, \
|
| 1327 | .init_action = DEVLINK_TRAP_ACTION_##_init_action, \
|
| 1328 | .generic = false, \
|
| 1329 | .id = _id, \
|
| 1330 | .name = _name, \
|
| 1331 | .init_group_id = _group_id, \
|
| 1332 | .metadata_cap = _metadata_cap, \
|
| 1333 | }
|
| 1334 |
|
| 1335 | #define DEVLINK_TRAP_GROUP_GENERIC(_id, _policer_id) \
|
| 1336 | { \
|
| 1337 | .name = DEVLINK_TRAP_GROUP_GENERIC_NAME_##_id, \
|
| 1338 | .id = DEVLINK_TRAP_GROUP_GENERIC_ID_##_id, \
|
| 1339 | .generic = true, \
|
| 1340 | .init_policer_id = _policer_id, \
|
| 1341 | }
|
| 1342 |
|
| 1343 | #define DEVLINK_TRAP_POLICER(_id, _rate, _burst, _max_rate, _min_rate, \
|
| 1344 | _max_burst, _min_burst) \
|
| 1345 | { \
|
| 1346 | .id = _id, \
|
| 1347 | .init_rate = _rate, \
|
| 1348 | .init_burst = _burst, \
|
| 1349 | .max_rate = _max_rate, \
|
| 1350 | .min_rate = _min_rate, \
|
| 1351 | .max_burst = _max_burst, \
|
| 1352 | .min_burst = _min_burst, \
|
| 1353 | }
|
| 1354 |
|
| 1355 | #define devlink_fmsg_put(fmsg, name, value) ( \
|
| 1356 | _Generic((value), \
|
| 1357 | bool : devlink_fmsg_bool_pair_put, \
|
| 1358 | u8 : devlink_fmsg_u8_pair_put, \
|
| 1359 | u16 : devlink_fmsg_u32_pair_put, \
|
| 1360 | u32 : devlink_fmsg_u32_pair_put, \
|
| 1361 | u64 : devlink_fmsg_u64_pair_put, \
|
| 1362 | int : devlink_fmsg_u32_pair_put, \
|
| 1363 | char * : devlink_fmsg_string_pair_put, \
|
| 1364 | const char * : devlink_fmsg_string_pair_put) \
|
| 1365 | (fmsg, name, (value)))
|
| 1366 |
|
| 1367 | enum {
|
| 1368 |
|
| 1369 | DEVLINK_F_RELOAD = 1UL << 0,
|
| 1370 | };
|
| 1371 |
|
| 1372 | struct devlink_ops {
|
| 1373 | |
| 1374 | * @supported_flash_update_params:
|
| 1375 | * mask of parameters supported by the driver's .flash_update
|
| 1376 | * implementation.
|
| 1377 |
|
| 1378 | u32 supported_flash_update_params;
|
| 1379 | unsigned long reload_actions;
|
| 1380 | unsigned long reload_limits;
|
| 1381 | int (*reload_down)(struct devlink *devlink, bool netns_change,
|
| 1382 | enum devlink_reload_action action,
|
| 1383 | enum devlink_reload_limit limit,
|
| 1384 | struct netlink_ext_ack *extack);
|
| 1385 | int (*reload_up)(struct devlink *devlink, enum devlink_reload_action action,
|
| 1386 | enum devlink_reload_limit limit, u32 *actions_performed,
|
| 1387 | struct netlink_ext_ack *extack);
|
| 1388 | int (*sb_pool_get)(struct devlink *devlink, unsigned int sb_index,
|
| 1389 | u16 pool_index,
|
| 1390 | struct devlink_sb_pool_info *pool_info);
|
| 1391 | int (*sb_pool_set)(struct devlink *devlink, unsigned int sb_index,
|
| 1392 | u16 pool_index, u32 size,
|
| 1393 | enum devlink_sb_threshold_type threshold_type,
|
| 1394 | struct netlink_ext_ack *extack);
|
| 1395 | int (*sb_port_pool_get)(struct devlink_port *devlink_port,
|
| 1396 | unsigned int sb_index, u16 pool_index,
|
| 1397 | u32 *p_threshold);
|
| 1398 | int (*sb_port_pool_set)(struct devlink_port *devlink_port,
|
| 1399 | unsigned int sb_index, u16 pool_index,
|
| 1400 | u32 threshold, struct netlink_ext_ack *extack);
|
| 1401 | int (*sb_tc_pool_bind_get)(struct devlink_port *devlink_port,
|
| 1402 | unsigned int sb_index,
|
| 1403 | u16 tc_index,
|
| 1404 | enum devlink_sb_pool_type pool_type,
|
| 1405 | u16 *p_pool_index, u32 *p_threshold);
|
| 1406 | int (*sb_tc_pool_bind_set)(struct devlink_port *devlink_port,
|
| 1407 | unsigned int sb_index,
|
| 1408 | u16 tc_index,
|
| 1409 | enum devlink_sb_pool_type pool_type,
|
| 1410 | u16 pool_index, u32 threshold,
|
| 1411 | struct netlink_ext_ack *extack);
|
| 1412 | int (*sb_occ_snapshot)(struct devlink *devlink,
|
| 1413 | unsigned int sb_index);
|
| 1414 | int (*sb_occ_max_clear)(struct devlink *devlink,
|
| 1415 | unsigned int sb_index);
|
| 1416 | int (*sb_occ_port_pool_get)(struct devlink_port *devlink_port,
|
| 1417 | unsigned int sb_index, u16 pool_index,
|
| 1418 | u32 *p_cur, u32 *p_max);
|
| 1419 | int (*sb_occ_tc_port_bind_get)(struct devlink_port *devlink_port,
|
| 1420 | unsigned int sb_index,
|
| 1421 | u16 tc_index,
|
| 1422 | enum devlink_sb_pool_type pool_type,
|
| 1423 | u32 *p_cur, u32 *p_max);
|
| 1424 |
|
| 1425 | int (*eswitch_mode_get)(struct devlink *devlink, u16 *p_mode);
|
| 1426 | int (*eswitch_mode_set)(struct devlink *devlink, u16 mode,
|
| 1427 | struct netlink_ext_ack *extack);
|
| 1428 | int (*eswitch_inline_mode_get)(struct devlink *devlink, u8 *p_inline_mode);
|
| 1429 | int (*eswitch_inline_mode_set)(struct devlink *devlink, u8 inline_mode,
|
| 1430 | struct netlink_ext_ack *extack);
|
| 1431 | int (*eswitch_encap_mode_get)(struct devlink *devlink,
|
| 1432 | enum devlink_eswitch_encap_mode *p_encap_mode);
|
| 1433 | int (*eswitch_encap_mode_set)(struct devlink *devlink,
|
| 1434 | enum devlink_eswitch_encap_mode encap_mode,
|
| 1435 | struct netlink_ext_ack *extack);
|
| 1436 | int (*info_get)(struct devlink *devlink, struct devlink_info_req *req,
|
| 1437 | struct netlink_ext_ack *extack);
|
| 1438 | |
| 1439 | * @flash_update: Device flash update function
|
| 1440 | *
|
| 1441 | * Used to perform a flash update for the device. The set of
|
| 1442 | * parameters supported by the driver should be set in
|
| 1443 | * supported_flash_update_params.
|
| 1444 |
|
| 1445 | int (*flash_update)(struct devlink *devlink,
|
| 1446 | struct devlink_flash_update_params *params,
|
| 1447 | struct netlink_ext_ack *extack);
|
| 1448 | |
| 1449 | * @trap_init: Trap initialization function.
|
| 1450 | *
|
| 1451 | * Should be used by device drivers to initialize the trap in the
|
| 1452 | * underlying device. Drivers should also store the provided trap
|
| 1453 | * context, so that they could efficiently pass it to
|
| 1454 | * devlink_trap_report() when the trap is triggered.
|
| 1455 |
|
| 1456 | int (*trap_init)(struct devlink *devlink,
|
| 1457 | const struct devlink_trap *trap, void *trap_ctx);
|
| 1458 | |
| 1459 | * @trap_fini: Trap de-initialization function.
|
| 1460 | *
|
| 1461 | * Should be used by device drivers to de-initialize the trap in the
|
| 1462 | * underlying device.
|
| 1463 |
|
| 1464 | void (*trap_fini)(struct devlink *devlink,
|
| 1465 | const struct devlink_trap *trap, void *trap_ctx);
|
| 1466 | |
| 1467 | * @trap_action_set: Trap action set function.
|
| 1468 |
|
| 1469 | int (*trap_action_set)(struct devlink *devlink,
|
| 1470 | const struct devlink_trap *trap,
|
| 1471 | enum devlink_trap_action action,
|
| 1472 | struct netlink_ext_ack *extack);
|
| 1473 | |
| 1474 | * @trap_group_init: Trap group initialization function.
|
| 1475 | *
|
| 1476 | * Should be used by device drivers to initialize the trap group in the
|
| 1477 | * underlying device.
|
| 1478 |
|
| 1479 | int (*trap_group_init)(struct devlink *devlink,
|
| 1480 | const struct devlink_trap_group *group);
|
| 1481 | |
| 1482 | * @trap_group_set: Trap group parameters set function.
|
| 1483 | *
|
| 1484 | * Note: @policer can be NULL when a policer is being unbound from
|
| 1485 | * @group.
|
| 1486 |
|
| 1487 | int (*trap_group_set)(struct devlink *devlink,
|
| 1488 | const struct devlink_trap_group *group,
|
| 1489 | const struct devlink_trap_policer *policer,
|
| 1490 | struct netlink_ext_ack *extack);
|
| 1491 | |
| 1492 | * @trap_group_action_set: Trap group action set function.
|
| 1493 | *
|
| 1494 | * If this callback is populated, it will take precedence over looping
|
| 1495 | * over all traps in a group and calling .trap_action_set().
|
| 1496 |
|
| 1497 | int (*trap_group_action_set)(struct devlink *devlink,
|
| 1498 | const struct devlink_trap_group *group,
|
| 1499 | enum devlink_trap_action action,
|
| 1500 | struct netlink_ext_ack *extack);
|
| 1501 | |
| 1502 | * @trap_drop_counter_get: Trap drop counter get function.
|
| 1503 | *
|
| 1504 | * Should be used by device drivers to report number of packets
|
| 1505 | * that have been dropped, and cannot be passed to the devlink
|
| 1506 | * subsystem by the underlying device.
|
| 1507 |
|
| 1508 | int (*trap_drop_counter_get)(struct devlink *devlink,
|
| 1509 | const struct devlink_trap *trap,
|
| 1510 | u64 *p_drops);
|
| 1511 | |
| 1512 | * @trap_policer_init: Trap policer initialization function.
|
| 1513 | *
|
| 1514 | * Should be used by device drivers to initialize the trap policer in
|
| 1515 | * the underlying device.
|
| 1516 |
|
| 1517 | int (*trap_policer_init)(struct devlink *devlink,
|
| 1518 | const struct devlink_trap_policer *policer);
|
| 1519 | |
| 1520 | * @trap_policer_fini: Trap policer de-initialization function.
|
| 1521 | *
|
| 1522 | * Should be used by device drivers to de-initialize the trap policer
|
| 1523 | * in the underlying device.
|
| 1524 |
|
| 1525 | void (*trap_policer_fini)(struct devlink *devlink,
|
| 1526 | const struct devlink_trap_policer *policer);
|
| 1527 | |
| 1528 | * @trap_policer_set: Trap policer parameters set function.
|
| 1529 |
|
| 1530 | int (*trap_policer_set)(struct devlink *devlink,
|
| 1531 | const struct devlink_trap_policer *policer,
|
| 1532 | u64 rate, u64 burst,
|
| 1533 | struct netlink_ext_ack *extack);
|
| 1534 | |
| 1535 | * @trap_policer_counter_get: Trap policer counter get function.
|
| 1536 | *
|
| 1537 | * Should be used by device drivers to report number of packets dropped
|
| 1538 | * by the policer.
|
| 1539 |
|
| 1540 | int (*trap_policer_counter_get)(struct devlink *devlink,
|
| 1541 | const struct devlink_trap_policer *policer,
|
| 1542 | u64 *p_drops);
|
| 1543 | |
| 1544 | * port_new() - Add a new port function of a specified flavor
|
| 1545 | * @devlink: Devlink instance
|
| 1546 | * @attrs: attributes of the new port
|
| 1547 | * @extack: extack for reporting error messages
|
| 1548 | * @devlink_port: pointer to store new devlink port pointer
|
| 1549 | *
|
| 1550 | * Devlink core will call this device driver function upon user request
|
| 1551 | * to create a new port function of a specified flavor and optional
|
| 1552 | * attributes
|
| 1553 | *
|
| 1554 | * Notes:
|
| 1555 | * - On success, drivers must register a port with devlink core
|
| 1556 | *
|
| 1557 | * Return: 0 on success, negative value otherwise.
|
| 1558 |
|
| 1559 | int (*port_new)(struct devlink *devlink,
|
| 1560 | const struct devlink_port_new_attrs *attrs,
|
| 1561 | struct netlink_ext_ack *extack,
|
| 1562 | struct devlink_port **devlink_port);
|
| 1563 |
|
| 1564 | |
| 1565 | * Rate control callbacks.
|
| 1566 |
|
| 1567 | int (*rate_leaf_tx_share_set)(struct devlink_rate *devlink_rate, void *priv,
|
| 1568 | u64 tx_share, struct netlink_ext_ack *extack);
|
| 1569 | int (*rate_leaf_tx_max_set)(struct devlink_rate *devlink_rate, void *priv,
|
| 1570 | u64 tx_max, struct netlink_ext_ack *extack);
|
| 1571 | int (*rate_leaf_tx_priority_set)(struct devlink_rate *devlink_rate, void *priv,
|
| 1572 | u32 tx_priority, struct netlink_ext_ack *extack);
|
| 1573 | int (*rate_leaf_tx_weight_set)(struct devlink_rate *devlink_rate, void *priv,
|
| 1574 | u32 tx_weight, struct netlink_ext_ack *extack);
|
| 1575 | int (*rate_leaf_tc_bw_set)(struct devlink_rate *devlink_rate,
|
| 1576 | void *priv, u32 *tc_bw,
|
| 1577 | struct netlink_ext_ack *extack);
|
| 1578 | int (*rate_node_tx_share_set)(struct devlink_rate *devlink_rate, void *priv,
|
| 1579 | u64 tx_share, struct netlink_ext_ack *extack);
|
| 1580 | int (*rate_node_tx_max_set)(struct devlink_rate *devlink_rate, void *priv,
|
| 1581 | u64 tx_max, struct netlink_ext_ack *extack);
|
| 1582 | int (*rate_node_tx_priority_set)(struct devlink_rate *devlink_rate, void *priv,
|
| 1583 | u32 tx_priority, struct netlink_ext_ack *extack);
|
| 1584 | int (*rate_node_tx_weight_set)(struct devlink_rate *devlink_rate, void *priv,
|
| 1585 | u32 tx_weight, struct netlink_ext_ack *extack);
|
| 1586 | int (*rate_node_tc_bw_set)(struct devlink_rate *devlink_rate,
|
| 1587 | void *priv, u32 *tc_bw,
|
| 1588 | struct netlink_ext_ack *extack);
|
| 1589 | int (*rate_node_new)(struct devlink_rate *rate_node, void **priv,
|
| 1590 | struct netlink_ext_ack *extack);
|
| 1591 | int (*rate_node_del)(struct devlink_rate *rate_node, void *priv,
|
| 1592 | struct netlink_ext_ack *extack);
|
| 1593 | int (*rate_leaf_parent_set)(struct devlink_rate *child,
|
| 1594 | struct devlink_rate *parent,
|
| 1595 | void *priv_child, void *priv_parent,
|
| 1596 | struct netlink_ext_ack *extack);
|
| 1597 | int (*rate_node_parent_set)(struct devlink_rate *child,
|
| 1598 | struct devlink_rate *parent,
|
| 1599 | void *priv_child, void *priv_parent,
|
| 1600 | struct netlink_ext_ack *extack);
|
| 1601 | |
| 1602 | * This also requires a shared common ancestor object all devices that
|
| 1603 | * could share rate nodes are nested in.
|
| 1604 | * If enabled, rate operations may be called on an instance with only
|
| 1605 | * the common ancestor lock held and *without that instance lock held*.
|
| 1606 | * It is the driver's responsibility to ensure proper serialization
|
| 1607 | * with other operations.
|
| 1608 |
|
| 1609 | bool supported_cross_device_rate_nodes;
|
| 1610 | |
| 1611 | * selftests_check() - queries if selftest is supported
|
| 1612 | * @devlink: devlink instance
|
| 1613 | * @id: test index
|
| 1614 | * @extack: extack for reporting error messages
|
| 1615 | *
|
| 1616 | * Return: true if test is supported by the driver
|
| 1617 |
|
| 1618 | bool (*selftest_check)(struct devlink *devlink, unsigned int id,
|
| 1619 | struct netlink_ext_ack *extack);
|
| 1620 | |
| 1621 | * selftest_run() - Runs a selftest
|
| 1622 | * @devlink: devlink instance
|
| 1623 | * @id: test index
|
| 1624 | * @extack: extack for reporting error messages
|
| 1625 | *
|
| 1626 | * Return: status of the test
|
| 1627 |
|
| 1628 | enum devlink_selftest_status
|
| 1629 | (*selftest_run)(struct devlink *devlink, unsigned int id,
|
| 1630 | struct netlink_ext_ack *extack);
|
| 1631 | };
|
| 1632 |
|
| 1633 | void *devlink_priv(struct devlink *devlink);
|
| 1634 | struct devlink *priv_to_devlink(void *priv);
|
| 1635 | struct device *devlink_to_dev(const struct devlink *devlink);
|
| 1636 | const char *devlink_bus_name(const struct devlink *devlink);
|
| 1637 | const char *devlink_dev_name(const struct devlink *devlink);
|
| 1638 | const char *devlink_dev_driver_name(const struct devlink *devlink);
|
| 1639 |
|
| 1640 |
|
| 1641 | void devl_lock(struct devlink *devlink);
|
| 1642 | int devl_trylock(struct devlink *devlink);
|
| 1643 | void devl_unlock(struct devlink *devlink);
|
| 1644 | void devl_assert_locked(struct devlink *devlink);
|
| 1645 | bool devl_lock_is_held(struct devlink *devlink);
|
| 1646 | DEFINE_GUARD(devl, struct devlink *, devl_lock(_T), devl_unlock(_T));
|
| 1647 |
|
| 1648 | struct ib_device;
|
| 1649 |
|
| 1650 | struct net *devlink_net(const struct devlink *devlink);
|
| 1651 | |
| 1652 | * devlink instances in other namespaces than init_net.
|
| 1653 | *
|
| 1654 | * Drivers that operate on real HW must use devlink_alloc() instead.
|
| 1655 |
|
| 1656 | struct devlink *devlink_alloc_ns(const struct devlink_ops *ops,
|
| 1657 | size_t priv_size, struct net *net,
|
| 1658 | struct device *dev);
|
| 1659 | static inline struct devlink *devlink_alloc(const struct devlink_ops *ops,
|
| 1660 | size_t priv_size,
|
| 1661 | struct device *dev)
|
| 1662 | {
|
| 1663 | return devlink_alloc_ns(ops, priv_size, &init_net, dev);
|
| 1664 | }
|
| 1665 |
|
| 1666 | int devl_register(struct devlink *devlink);
|
| 1667 | void devl_unregister(struct devlink *devlink);
|
| 1668 | void devlink_register(struct devlink *devlink);
|
| 1669 | void devlink_unregister(struct devlink *devlink);
|
| 1670 | void devlink_free(struct devlink *devlink);
|
| 1671 |
|
| 1672 | struct devlink *devlink_shd_get(const char *id,
|
| 1673 | const struct devlink_ops *ops,
|
| 1674 | size_t priv_size,
|
| 1675 | const struct device_driver *driver);
|
| 1676 | void devlink_shd_put(struct devlink *devlink);
|
| 1677 | void *devlink_shd_get_priv(struct devlink *devlink);
|
| 1678 |
|
| 1679 | |
| 1680 | * struct devlink_port_ops - Port operations
|
| 1681 | * @port_split: Callback used to split the port into multiple ones.
|
| 1682 | * @port_unsplit: Callback used to unsplit the port group back into
|
| 1683 | * a single port.
|
| 1684 | * @port_type_set: Callback used to set a type of a port.
|
| 1685 | * @port_del: Callback used to delete selected port along with related function.
|
| 1686 | * Devlink core calls this upon user request to delete
|
| 1687 | * a port previously created by devlink_ops->port_new().
|
| 1688 | * @port_fn_hw_addr_get: Callback used to set port function's hardware address.
|
| 1689 | * Should be used by device drivers to report
|
| 1690 | * the hardware address of a function managed
|
| 1691 | * by the devlink port.
|
| 1692 | * @port_fn_hw_addr_set: Callback used to set port function's hardware address.
|
| 1693 | * Should be used by device drivers to set the hardware
|
| 1694 | * address of a function managed by the devlink port.
|
| 1695 | * @port_fn_roce_get: Callback used to get port function's RoCE capability.
|
| 1696 | * Should be used by device drivers to report
|
| 1697 | * the current state of RoCE capability of a function
|
| 1698 | * managed by the devlink port.
|
| 1699 | * @port_fn_roce_set: Callback used to set port function's RoCE capability.
|
| 1700 | * Should be used by device drivers to enable/disable
|
| 1701 | * RoCE capability of a function managed
|
| 1702 | * by the devlink port.
|
| 1703 | * @port_fn_migratable_get: Callback used to get port function's migratable
|
| 1704 | * capability. Should be used by device drivers
|
| 1705 | * to report the current state of migratable capability
|
| 1706 | * of a function managed by the devlink port.
|
| 1707 | * @port_fn_migratable_set: Callback used to set port function's migratable
|
| 1708 | * capability. Should be used by device drivers
|
| 1709 | * to enable/disable migratable capability of
|
| 1710 | * a function managed by the devlink port.
|
| 1711 | * @port_fn_state_get: Callback used to get port function's state.
|
| 1712 | * Should be used by device drivers to report
|
| 1713 | * the current admin and operational state of a
|
| 1714 | * function managed by the devlink port.
|
| 1715 | * @port_fn_state_set: Callback used to get port function's state.
|
| 1716 | * Should be used by device drivers set
|
| 1717 | * the admin state of a function managed
|
| 1718 | * by the devlink port.
|
| 1719 | * @port_fn_ipsec_crypto_get: Callback used to get port function's ipsec_crypto
|
| 1720 | * capability. Should be used by device drivers
|
| 1721 | * to report the current state of ipsec_crypto
|
| 1722 | * capability of a function managed by the devlink
|
| 1723 | * port.
|
| 1724 | * @port_fn_ipsec_crypto_set: Callback used to set port function's ipsec_crypto
|
| 1725 | * capability. Should be used by device drivers to
|
| 1726 | * enable/disable ipsec_crypto capability of a
|
| 1727 | * function managed by the devlink port.
|
| 1728 | * @port_fn_ipsec_packet_get: Callback used to get port function's ipsec_packet
|
| 1729 | * capability. Should be used by device drivers
|
| 1730 | * to report the current state of ipsec_packet
|
| 1731 | * capability of a function managed by the devlink
|
| 1732 | * port.
|
| 1733 | * @port_fn_ipsec_packet_set: Callback used to set port function's ipsec_packet
|
| 1734 | * capability. Should be used by device drivers to
|
| 1735 | * enable/disable ipsec_packet capability of a
|
| 1736 | * function managed by the devlink port.
|
| 1737 | * @port_fn_max_io_eqs_get: Callback used to get port function's maximum number
|
| 1738 | * of event queues. Should be used by device drivers to
|
| 1739 | * report the maximum event queues of a function
|
| 1740 | * managed by the devlink port.
|
| 1741 | * @port_fn_max_io_eqs_set: Callback used to set port function's maximum number
|
| 1742 | * of event queues. Should be used by device drivers to
|
| 1743 | * configure maximum number of event queues
|
| 1744 | * of a function managed by the devlink port.
|
| 1745 | *
|
| 1746 | * Note: Driver should return -EOPNOTSUPP if it doesn't support
|
| 1747 | * port function (@port_fn_*) handling for a particular port.
|
| 1748 |
|
| 1749 | struct devlink_port_ops {
|
| 1750 | int (*port_split)(struct devlink *devlink, struct devlink_port *port,
|
| 1751 | unsigned int count, struct netlink_ext_ack *extack);
|
| 1752 | int (*port_unsplit)(struct devlink *devlink, struct devlink_port *port,
|
| 1753 | struct netlink_ext_ack *extack);
|
| 1754 | int (*port_type_set)(struct devlink_port *devlink_port,
|
| 1755 | enum devlink_port_type port_type);
|
| 1756 | int (*port_del)(struct devlink *devlink, struct devlink_port *port,
|
| 1757 | struct netlink_ext_ack *extack);
|
| 1758 | int (*port_fn_hw_addr_get)(struct devlink_port *port, u8 *hw_addr,
|
| 1759 | int *hw_addr_len,
|
| 1760 | struct netlink_ext_ack *extack);
|
| 1761 | int (*port_fn_hw_addr_set)(struct devlink_port *port,
|
| 1762 | const u8 *hw_addr, int hw_addr_len,
|
| 1763 | struct netlink_ext_ack *extack);
|
| 1764 | int (*port_fn_roce_get)(struct devlink_port *devlink_port,
|
| 1765 | bool *is_enable,
|
| 1766 | struct netlink_ext_ack *extack);
|
| 1767 | int (*port_fn_roce_set)(struct devlink_port *devlink_port,
|
| 1768 | bool enable, struct netlink_ext_ack *extack);
|
| 1769 | int (*port_fn_migratable_get)(struct devlink_port *devlink_port,
|
| 1770 | bool *is_enable,
|
| 1771 | struct netlink_ext_ack *extack);
|
| 1772 | int (*port_fn_migratable_set)(struct devlink_port *devlink_port,
|
| 1773 | bool enable,
|
| 1774 | struct netlink_ext_ack *extack);
|
| 1775 | int (*port_fn_state_get)(struct devlink_port *port,
|
| 1776 | enum devlink_port_fn_state *state,
|
| 1777 | enum devlink_port_fn_opstate *opstate,
|
| 1778 | struct netlink_ext_ack *extack);
|
| 1779 | int (*port_fn_state_set)(struct devlink_port *port,
|
| 1780 | enum devlink_port_fn_state state,
|
| 1781 | struct netlink_ext_ack *extack);
|
| 1782 | int (*port_fn_ipsec_crypto_get)(struct devlink_port *devlink_port,
|
| 1783 | bool *is_enable,
|
| 1784 | struct netlink_ext_ack *extack);
|
| 1785 | int (*port_fn_ipsec_crypto_set)(struct devlink_port *devlink_port,
|
| 1786 | bool enable,
|
| 1787 | struct netlink_ext_ack *extack);
|
| 1788 | int (*port_fn_ipsec_packet_get)(struct devlink_port *devlink_port,
|
| 1789 | bool *is_enable,
|
| 1790 | struct netlink_ext_ack *extack);
|
| 1791 | int (*port_fn_ipsec_packet_set)(struct devlink_port *devlink_port,
|
| 1792 | bool enable,
|
| 1793 | struct netlink_ext_ack *extack);
|
| 1794 | int (*port_fn_max_io_eqs_get)(struct devlink_port *devlink_port,
|
| 1795 | u32 *max_eqs,
|
| 1796 | struct netlink_ext_ack *extack);
|
| 1797 | int (*port_fn_max_io_eqs_set)(struct devlink_port *devlink_port,
|
| 1798 | u32 max_eqs,
|
| 1799 | struct netlink_ext_ack *extack);
|
| 1800 | };
|
| 1801 |
|
| 1802 | void devlink_port_init(struct devlink *devlink,
|
| 1803 | struct devlink_port *devlink_port);
|
| 1804 | void devlink_port_fini(struct devlink_port *devlink_port);
|
| 1805 |
|
| 1806 | int devl_port_register_with_ops(struct devlink *devlink,
|
| 1807 | struct devlink_port *devlink_port,
|
| 1808 | unsigned int port_index,
|
| 1809 | const struct devlink_port_ops *ops);
|
| 1810 |
|
| 1811 | static inline int devl_port_register(struct devlink *devlink,
|
| 1812 | struct devlink_port *devlink_port,
|
| 1813 | unsigned int port_index)
|
| 1814 | {
|
| 1815 | return devl_port_register_with_ops(devlink, devlink_port,
|
| 1816 | port_index, NULL);
|
| 1817 | }
|
| 1818 |
|
| 1819 | int devlink_port_register_with_ops(struct devlink *devlink,
|
| 1820 | struct devlink_port *devlink_port,
|
| 1821 | unsigned int port_index,
|
| 1822 | const struct devlink_port_ops *ops);
|
| 1823 |
|
| 1824 | static inline int devlink_port_register(struct devlink *devlink,
|
| 1825 | struct devlink_port *devlink_port,
|
| 1826 | unsigned int port_index)
|
| 1827 | {
|
| 1828 | return devlink_port_register_with_ops(devlink, devlink_port,
|
| 1829 | port_index, NULL);
|
| 1830 | }
|
| 1831 |
|
| 1832 | void devl_port_unregister(struct devlink_port *devlink_port);
|
| 1833 | void devlink_port_unregister(struct devlink_port *devlink_port);
|
| 1834 | void devlink_port_type_eth_set(struct devlink_port *devlink_port);
|
| 1835 | void devlink_port_type_ib_set(struct devlink_port *devlink_port,
|
| 1836 | struct ib_device *ibdev);
|
| 1837 | void devlink_port_type_clear(struct devlink_port *devlink_port);
|
| 1838 | void devlink_port_attrs_set(struct devlink_port *devlink_port,
|
| 1839 | const struct devlink_port_attrs *attrs);
|
| 1840 | void devlink_port_attrs_pci_pf_set(struct devlink_port *devlink_port, u32 controller,
|
| 1841 | u16 pf, bool external);
|
| 1842 | void devlink_port_attrs_pci_vf_set(struct devlink_port *devlink_port, u32 controller,
|
| 1843 | u16 pf, u16 vf, bool external);
|
| 1844 | void devlink_port_attrs_pci_sf_set(struct devlink_port *devlink_port,
|
| 1845 | u32 controller, u16 pf, u32 sf,
|
| 1846 | bool external);
|
| 1847 | int devl_port_fn_devlink_set(struct devlink_port *devlink_port,
|
| 1848 | struct devlink *fn_devlink);
|
| 1849 | struct devlink_rate *
|
| 1850 | devl_rate_node_create(struct devlink *devlink, void *priv, char *node_name,
|
| 1851 | struct devlink_rate *parent);
|
| 1852 | int
|
| 1853 | devl_rate_leaf_create(struct devlink_port *devlink_port, void *priv,
|
| 1854 | struct devlink_rate *parent);
|
| 1855 | void devl_rate_leaf_destroy(struct devlink_port *devlink_port);
|
| 1856 | void devl_rate_nodes_destroy(struct devlink *devlink);
|
| 1857 | void devlink_port_linecard_set(struct devlink_port *devlink_port,
|
| 1858 | struct devlink_linecard *linecard);
|
| 1859 | struct devlink_linecard *
|
| 1860 | devl_linecard_create(struct devlink *devlink, unsigned int linecard_index,
|
| 1861 | const struct devlink_linecard_ops *ops, void *priv);
|
| 1862 | void devl_linecard_destroy(struct devlink_linecard *linecard);
|
| 1863 | void devlink_linecard_provision_set(struct devlink_linecard *linecard,
|
| 1864 | const char *type);
|
| 1865 | void devlink_linecard_provision_clear(struct devlink_linecard *linecard);
|
| 1866 | void devlink_linecard_provision_fail(struct devlink_linecard *linecard);
|
| 1867 | void devlink_linecard_activate(struct devlink_linecard *linecard);
|
| 1868 | void devlink_linecard_deactivate(struct devlink_linecard *linecard);
|
| 1869 | int devlink_linecard_nested_dl_set(struct devlink_linecard *linecard,
|
| 1870 | struct devlink *nested_devlink);
|
| 1871 | int devl_sb_register(struct devlink *devlink, unsigned int sb_index,
|
| 1872 | u32 size, u16 ingress_pools_count,
|
| 1873 | u16 egress_pools_count, u16 ingress_tc_count,
|
| 1874 | u16 egress_tc_count);
|
| 1875 | int devlink_sb_register(struct devlink *devlink, unsigned int sb_index,
|
| 1876 | u32 size, u16 ingress_pools_count,
|
| 1877 | u16 egress_pools_count, u16 ingress_tc_count,
|
| 1878 | u16 egress_tc_count);
|
| 1879 | void devl_sb_unregister(struct devlink *devlink, unsigned int sb_index);
|
| 1880 | void devlink_sb_unregister(struct devlink *devlink, unsigned int sb_index);
|
| 1881 | int devl_dpipe_table_register(struct devlink *devlink,
|
| 1882 | const char *table_name,
|
| 1883 | const struct devlink_dpipe_table_ops *table_ops,
|
| 1884 | void *priv, bool counter_control_extern);
|
| 1885 | void devl_dpipe_table_unregister(struct devlink *devlink,
|
| 1886 | const char *table_name);
|
| 1887 | void devl_dpipe_headers_register(struct devlink *devlink,
|
| 1888 | struct devlink_dpipe_headers *dpipe_headers);
|
| 1889 | void devl_dpipe_headers_unregister(struct devlink *devlink);
|
| 1890 | bool devlink_dpipe_table_counter_enabled(struct devlink *devlink,
|
| 1891 | const char *table_name);
|
| 1892 | int devlink_dpipe_entry_ctx_prepare(struct devlink_dpipe_dump_ctx *dump_ctx);
|
| 1893 | int devlink_dpipe_entry_ctx_append(struct devlink_dpipe_dump_ctx *dump_ctx,
|
| 1894 | struct devlink_dpipe_entry *entry);
|
| 1895 | int devlink_dpipe_entry_ctx_close(struct devlink_dpipe_dump_ctx *dump_ctx);
|
| 1896 | void devlink_dpipe_entry_clear(struct devlink_dpipe_entry *entry);
|
| 1897 | int devlink_dpipe_action_put(struct sk_buff *skb,
|
| 1898 | struct devlink_dpipe_action *action);
|
| 1899 | int devlink_dpipe_match_put(struct sk_buff *skb,
|
| 1900 | struct devlink_dpipe_match *match);
|
| 1901 | extern struct devlink_dpipe_header devlink_dpipe_header_ethernet;
|
| 1902 | extern struct devlink_dpipe_header devlink_dpipe_header_ipv4;
|
| 1903 | extern struct devlink_dpipe_header devlink_dpipe_header_ipv6;
|
| 1904 |
|
| 1905 | int devl_resource_register(struct devlink *devlink,
|
| 1906 | const char *resource_name,
|
| 1907 | u64 resource_size,
|
| 1908 | u64 resource_id,
|
| 1909 | u64 parent_resource_id,
|
| 1910 | const struct devlink_resource_size_params *params);
|
| 1911 | void devl_resources_unregister(struct devlink *devlink);
|
| 1912 | void devlink_resources_unregister(struct devlink *devlink);
|
| 1913 | int devl_resource_size_get(struct devlink *devlink,
|
| 1914 | u64 resource_id,
|
| 1915 | u64 *p_resource_size);
|
| 1916 | int
|
| 1917 | devl_port_resource_register(struct devlink_port *devlink_port,
|
| 1918 | const char *resource_name,
|
| 1919 | u64 resource_size, u64 resource_id,
|
| 1920 | u64 parent_resource_id,
|
| 1921 | const struct devlink_resource_size_params *params);
|
| 1922 | void devl_port_resources_unregister(struct devlink_port *devlink_port);
|
| 1923 | int devl_dpipe_table_resource_set(struct devlink *devlink,
|
| 1924 | const char *table_name, u64 resource_id,
|
| 1925 | u64 resource_units);
|
| 1926 | void devl_resource_occ_get_register(struct devlink *devlink,
|
| 1927 | u64 resource_id,
|
| 1928 | devlink_resource_occ_get_t *occ_get,
|
| 1929 | void *occ_get_priv);
|
| 1930 | void devl_resource_occ_get_unregister(struct devlink *devlink,
|
| 1931 | u64 resource_id);
|
| 1932 | int devl_params_register(struct devlink *devlink,
|
| 1933 | const struct devlink_param *params,
|
| 1934 | size_t params_count);
|
| 1935 | int devlink_params_register(struct devlink *devlink,
|
| 1936 | const struct devlink_param *params,
|
| 1937 | size_t params_count);
|
| 1938 | void devl_params_unregister(struct devlink *devlink,
|
| 1939 | const struct devlink_param *params,
|
| 1940 | size_t params_count);
|
| 1941 | void devlink_params_unregister(struct devlink *devlink,
|
| 1942 | const struct devlink_param *params,
|
| 1943 | size_t params_count);
|
| 1944 | int devl_param_driverinit_value_get(struct devlink *devlink, u32 param_id,
|
| 1945 | union devlink_param_value *val);
|
| 1946 | void devl_param_driverinit_value_set(struct devlink *devlink, u32 param_id,
|
| 1947 | union devlink_param_value *init_val);
|
| 1948 | void devl_param_value_changed(struct devlink *devlink, u32 param_id);
|
| 1949 | struct devlink_region *devl_region_create(struct devlink *devlink,
|
| 1950 | const struct devlink_region_ops *ops,
|
| 1951 | u32 region_max_snapshots,
|
| 1952 | u64 region_size);
|
| 1953 | struct devlink_region *
|
| 1954 | devlink_region_create(struct devlink *devlink,
|
| 1955 | const struct devlink_region_ops *ops,
|
| 1956 | u32 region_max_snapshots, u64 region_size);
|
| 1957 | struct devlink_region *
|
| 1958 | devlink_port_region_create(struct devlink_port *port,
|
| 1959 | const struct devlink_port_region_ops *ops,
|
| 1960 | u32 region_max_snapshots, u64 region_size);
|
| 1961 | void devl_region_destroy(struct devlink_region *region);
|
| 1962 | void devlink_region_destroy(struct devlink_region *region);
|
| 1963 | int devlink_region_snapshot_id_get(struct devlink *devlink, u32 *id);
|
| 1964 | void devlink_region_snapshot_id_put(struct devlink *devlink, u32 id);
|
| 1965 | int devlink_region_snapshot_create(struct devlink_region *region,
|
| 1966 | u8 *data, u32 snapshot_id);
|
| 1967 | int devlink_info_serial_number_put(struct devlink_info_req *req,
|
| 1968 | const char *sn);
|
| 1969 | int devlink_info_board_serial_number_put(struct devlink_info_req *req,
|
| 1970 | const char *bsn);
|
| 1971 |
|
| 1972 | enum devlink_info_version_type {
|
| 1973 | DEVLINK_INFO_VERSION_TYPE_NONE,
|
| 1974 | DEVLINK_INFO_VERSION_TYPE_COMPONENT, |
| 1975 | * component by name.
|
| 1976 |
|
| 1977 | };
|
| 1978 |
|
| 1979 | int devlink_info_version_fixed_put(struct devlink_info_req *req,
|
| 1980 | const char *version_name,
|
| 1981 | const char *version_value);
|
| 1982 | int devlink_info_version_stored_put(struct devlink_info_req *req,
|
| 1983 | const char *version_name,
|
| 1984 | const char *version_value);
|
| 1985 | int devlink_info_version_stored_put_ext(struct devlink_info_req *req,
|
| 1986 | const char *version_name,
|
| 1987 | const char *version_value,
|
| 1988 | enum devlink_info_version_type version_type);
|
| 1989 | int devlink_info_version_running_put(struct devlink_info_req *req,
|
| 1990 | const char *version_name,
|
| 1991 | const char *version_value);
|
| 1992 | int devlink_info_version_running_put_ext(struct devlink_info_req *req,
|
| 1993 | const char *version_name,
|
| 1994 | const char *version_value,
|
| 1995 | enum devlink_info_version_type version_type);
|
| 1996 |
|
| 1997 | void devlink_fmsg_obj_nest_start(struct devlink_fmsg *fmsg);
|
| 1998 | void devlink_fmsg_obj_nest_end(struct devlink_fmsg *fmsg);
|
| 1999 |
|
| 2000 | void devlink_fmsg_pair_nest_start(struct devlink_fmsg *fmsg, const char *name);
|
| 2001 | void devlink_fmsg_pair_nest_end(struct devlink_fmsg *fmsg);
|
| 2002 |
|
| 2003 | void devlink_fmsg_arr_pair_nest_start(struct devlink_fmsg *fmsg,
|
| 2004 | const char *name);
|
| 2005 | void devlink_fmsg_arr_pair_nest_end(struct devlink_fmsg *fmsg);
|
| 2006 | void devlink_fmsg_binary_pair_nest_start(struct devlink_fmsg *fmsg,
|
| 2007 | const char *name);
|
| 2008 | void devlink_fmsg_binary_pair_nest_end(struct devlink_fmsg *fmsg);
|
| 2009 |
|
| 2010 | void devlink_fmsg_u32_put(struct devlink_fmsg *fmsg, u32 value);
|
| 2011 | void devlink_fmsg_string_put(struct devlink_fmsg *fmsg, const char *value);
|
| 2012 | void devlink_fmsg_binary_put(struct devlink_fmsg *fmsg, const void *value,
|
| 2013 | u16 value_len);
|
| 2014 |
|
| 2015 | void devlink_fmsg_bool_pair_put(struct devlink_fmsg *fmsg, const char *name,
|
| 2016 | bool value);
|
| 2017 | void devlink_fmsg_u8_pair_put(struct devlink_fmsg *fmsg, const char *name,
|
| 2018 | u8 value);
|
| 2019 | void devlink_fmsg_u32_pair_put(struct devlink_fmsg *fmsg, const char *name,
|
| 2020 | u32 value);
|
| 2021 | void devlink_fmsg_u64_pair_put(struct devlink_fmsg *fmsg, const char *name,
|
| 2022 | u64 value);
|
| 2023 | void devlink_fmsg_string_pair_put(struct devlink_fmsg *fmsg, const char *name,
|
| 2024 | const char *value);
|
| 2025 | void devlink_fmsg_binary_pair_put(struct devlink_fmsg *fmsg, const char *name,
|
| 2026 | const void *value, u32 value_len);
|
| 2027 |
|
| 2028 | struct devlink_health_reporter *
|
| 2029 | devl_port_health_reporter_create(struct devlink_port *port,
|
| 2030 | const struct devlink_health_reporter_ops *ops,
|
| 2031 | void *priv);
|
| 2032 |
|
| 2033 | struct devlink_health_reporter *
|
| 2034 | devlink_port_health_reporter_create(struct devlink_port *port,
|
| 2035 | const struct devlink_health_reporter_ops *ops,
|
| 2036 | void *priv);
|
| 2037 |
|
| 2038 | struct devlink_health_reporter *
|
| 2039 | devl_health_reporter_create(struct devlink *devlink,
|
| 2040 | const struct devlink_health_reporter_ops *ops,
|
| 2041 | void *priv);
|
| 2042 |
|
| 2043 | struct devlink_health_reporter *
|
| 2044 | devlink_health_reporter_create(struct devlink *devlink,
|
| 2045 | const struct devlink_health_reporter_ops *ops,
|
| 2046 | void *priv);
|
| 2047 |
|
| 2048 | void
|
| 2049 | devl_health_reporter_destroy(struct devlink_health_reporter *reporter);
|
| 2050 |
|
| 2051 | void
|
| 2052 | devlink_health_reporter_destroy(struct devlink_health_reporter *reporter);
|
| 2053 |
|
| 2054 | void *
|
| 2055 | devlink_health_reporter_priv(struct devlink_health_reporter *reporter);
|
| 2056 | int devlink_health_report(struct devlink_health_reporter *reporter,
|
| 2057 | const char *msg, void *priv_ctx);
|
| 2058 | void
|
| 2059 | devlink_health_reporter_state_update(struct devlink_health_reporter *reporter,
|
| 2060 | enum devlink_health_reporter_state state);
|
| 2061 | void
|
| 2062 | devlink_health_reporter_recovery_done(struct devlink_health_reporter *reporter);
|
| 2063 |
|
| 2064 | int devl_nested_devlink_set(struct devlink *devlink,
|
| 2065 | struct devlink *nested_devlink);
|
| 2066 | bool devlink_is_reload_failed(const struct devlink *devlink);
|
| 2067 | void devlink_remote_reload_actions_performed(struct devlink *devlink,
|
| 2068 | enum devlink_reload_limit limit,
|
| 2069 | u32 actions_performed);
|
| 2070 |
|
| 2071 | void devlink_flash_update_status_notify(struct devlink *devlink,
|
| 2072 | const char *status_msg,
|
| 2073 | const char *component,
|
| 2074 | unsigned long done,
|
| 2075 | unsigned long total);
|
| 2076 | void devlink_flash_update_timeout_notify(struct devlink *devlink,
|
| 2077 | const char *status_msg,
|
| 2078 | const char *component,
|
| 2079 | unsigned long timeout);
|
| 2080 |
|
| 2081 | int devl_traps_register(struct devlink *devlink,
|
| 2082 | const struct devlink_trap *traps,
|
| 2083 | size_t traps_count, void *priv);
|
| 2084 | int devlink_traps_register(struct devlink *devlink,
|
| 2085 | const struct devlink_trap *traps,
|
| 2086 | size_t traps_count, void *priv);
|
| 2087 | void devl_traps_unregister(struct devlink *devlink,
|
| 2088 | const struct devlink_trap *traps,
|
| 2089 | size_t traps_count);
|
| 2090 | void devlink_traps_unregister(struct devlink *devlink,
|
| 2091 | const struct devlink_trap *traps,
|
| 2092 | size_t traps_count);
|
| 2093 | void devlink_trap_report(struct devlink *devlink, struct sk_buff *skb,
|
| 2094 | void *trap_ctx, struct devlink_port *in_devlink_port,
|
| 2095 | const struct flow_action_cookie *fa_cookie);
|
| 2096 | void *devlink_trap_ctx_priv(void *trap_ctx);
|
| 2097 | int devl_trap_groups_register(struct devlink *devlink,
|
| 2098 | const struct devlink_trap_group *groups,
|
| 2099 | size_t groups_count);
|
| 2100 | int devlink_trap_groups_register(struct devlink *devlink,
|
| 2101 | const struct devlink_trap_group *groups,
|
| 2102 | size_t groups_count);
|
| 2103 | void devl_trap_groups_unregister(struct devlink *devlink,
|
| 2104 | const struct devlink_trap_group *groups,
|
| 2105 | size_t groups_count);
|
| 2106 | void devlink_trap_groups_unregister(struct devlink *devlink,
|
| 2107 | const struct devlink_trap_group *groups,
|
| 2108 | size_t groups_count);
|
| 2109 | int
|
| 2110 | devl_trap_policers_register(struct devlink *devlink,
|
| 2111 | const struct devlink_trap_policer *policers,
|
| 2112 | size_t policers_count);
|
| 2113 | void
|
| 2114 | devl_trap_policers_unregister(struct devlink *devlink,
|
| 2115 | const struct devlink_trap_policer *policers,
|
| 2116 | size_t policers_count);
|
| 2117 |
|
| 2118 | #if IS_ENABLED(CONFIG_NET_DEVLINK)
|
| 2119 |
|
| 2120 | struct devlink *__must_check devlink_try_get(struct devlink *devlink);
|
| 2121 | void devlink_put(struct devlink *devlink);
|
| 2122 |
|
| 2123 | void devlink_compat_running_version(struct devlink *devlink,
|
| 2124 | char *buf, size_t len);
|
| 2125 | int devlink_compat_flash_update(struct devlink *devlink, const char *file_name);
|
| 2126 | int devlink_compat_phys_port_name_get(struct net_device *dev,
|
| 2127 | char *name, size_t len);
|
| 2128 | int devlink_compat_switch_id_get(struct net_device *dev,
|
| 2129 | struct netdev_phys_item_id *ppid);
|
| 2130 |
|
| 2131 | int devlink_nl_port_handle_fill(struct sk_buff *msg, struct devlink_port *devlink_port);
|
| 2132 | size_t devlink_nl_port_handle_size(struct devlink_port *devlink_port);
|
| 2133 | void devlink_fmsg_dump_skb(struct devlink_fmsg *fmsg, const struct sk_buff *skb);
|
| 2134 |
|
| 2135 | #else
|
| 2136 |
|
| 2137 | static inline struct devlink *devlink_try_get(struct devlink *devlink)
|
| 2138 | {
|
| 2139 | return NULL;
|
| 2140 | }
|
| 2141 |
|
| 2142 | static inline void devlink_put(struct devlink *devlink)
|
| 2143 | {
|
| 2144 | }
|
| 2145 |
|
| 2146 | static inline void
|
| 2147 | devlink_compat_running_version(struct devlink *devlink, char *buf, size_t len)
|
| 2148 | {
|
| 2149 | }
|
| 2150 |
|
| 2151 | static inline int
|
| 2152 | devlink_compat_flash_update(struct devlink *devlink, const char *file_name)
|
| 2153 | {
|
| 2154 | return -EOPNOTSUPP;
|
| 2155 | }
|
| 2156 |
|
| 2157 | static inline int
|
| 2158 | devlink_compat_phys_port_name_get(struct net_device *dev,
|
| 2159 | char *name, size_t len)
|
| 2160 | {
|
| 2161 | return -EOPNOTSUPP;
|
| 2162 | }
|
| 2163 |
|
| 2164 | static inline int
|
| 2165 | devlink_compat_switch_id_get(struct net_device *dev,
|
| 2166 | struct netdev_phys_item_id *ppid)
|
| 2167 | {
|
| 2168 | return -EOPNOTSUPP;
|
| 2169 | }
|
| 2170 |
|
| 2171 | static inline int
|
| 2172 | devlink_nl_port_handle_fill(struct sk_buff *msg, struct devlink_port *devlink_port)
|
| 2173 | {
|
| 2174 | return 0;
|
| 2175 | }
|
| 2176 |
|
| 2177 | static inline size_t devlink_nl_port_handle_size(struct devlink_port *devlink_port)
|
| 2178 | {
|
| 2179 | return 0;
|
| 2180 | }
|
| 2181 |
|
| 2182 | #endif
|
| 2183 |
|
| 2184 | #endif
|