xref: /linux/include/net/devlink.h (revision f86fd32d)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
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 <jiri@mellanox.com>
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 <uapi/linux/devlink.h>
20 
21 struct devlink_ops;
22 
23 struct devlink {
24 	struct list_head list;
25 	struct list_head port_list;
26 	struct list_head sb_list;
27 	struct list_head dpipe_table_list;
28 	struct list_head resource_list;
29 	struct list_head param_list;
30 	struct list_head region_list;
31 	u32 snapshot_id;
32 	struct list_head reporter_list;
33 	struct mutex reporters_lock; /* protects reporter_list */
34 	struct devlink_dpipe_headers *dpipe_headers;
35 	struct list_head trap_list;
36 	struct list_head trap_group_list;
37 	const struct devlink_ops *ops;
38 	struct device *dev;
39 	possible_net_t _net;
40 	struct mutex lock;
41 	u8 reload_failed:1,
42 	   reload_enabled:1,
43 	   registered:1;
44 	char priv[0] __aligned(NETDEV_ALIGN);
45 };
46 
47 struct devlink_port_phys_attrs {
48 	u32 port_number; /* Same value as "split group".
49 			  * A physical port which is visible to the user
50 			  * for a given port flavour.
51 			  */
52 	u32 split_subport_number;
53 };
54 
55 struct devlink_port_pci_pf_attrs {
56 	u16 pf;	/* Associated PCI PF for this port. */
57 };
58 
59 struct devlink_port_pci_vf_attrs {
60 	u16 pf;	/* Associated PCI PF for this port. */
61 	u16 vf;	/* Associated PCI VF for of the PCI PF for this port. */
62 };
63 
64 struct devlink_port_attrs {
65 	u8 set:1,
66 	   split:1,
67 	   switch_port:1;
68 	enum devlink_port_flavour flavour;
69 	struct netdev_phys_item_id switch_id;
70 	union {
71 		struct devlink_port_phys_attrs phys;
72 		struct devlink_port_pci_pf_attrs pci_pf;
73 		struct devlink_port_pci_vf_attrs pci_vf;
74 	};
75 };
76 
77 struct devlink_port {
78 	struct list_head list;
79 	struct list_head param_list;
80 	struct devlink *devlink;
81 	unsigned int index;
82 	bool registered;
83 	spinlock_t type_lock; /* Protects type and type_dev
84 			       * pointer consistency.
85 			       */
86 	enum devlink_port_type type;
87 	enum devlink_port_type desired_type;
88 	void *type_dev;
89 	struct devlink_port_attrs attrs;
90 	struct delayed_work type_warn_dw;
91 };
92 
93 struct devlink_sb_pool_info {
94 	enum devlink_sb_pool_type pool_type;
95 	u32 size;
96 	enum devlink_sb_threshold_type threshold_type;
97 	u32 cell_size;
98 };
99 
100 /**
101  * struct devlink_dpipe_field - dpipe field object
102  * @name: field name
103  * @id: index inside the headers field array
104  * @bitwidth: bitwidth
105  * @mapping_type: mapping type
106  */
107 struct devlink_dpipe_field {
108 	const char *name;
109 	unsigned int id;
110 	unsigned int bitwidth;
111 	enum devlink_dpipe_field_mapping_type mapping_type;
112 };
113 
114 /**
115  * struct devlink_dpipe_header - dpipe header object
116  * @name: header name
117  * @id: index, global/local detrmined by global bit
118  * @fields: fields
119  * @fields_count: number of fields
120  * @global: indicates if header is shared like most protocol header
121  *	    or driver specific
122  */
123 struct devlink_dpipe_header {
124 	const char *name;
125 	unsigned int id;
126 	struct devlink_dpipe_field *fields;
127 	unsigned int fields_count;
128 	bool global;
129 };
130 
131 /**
132  * struct devlink_dpipe_match - represents match operation
133  * @type: type of match
134  * @header_index: header index (packets can have several headers of same
135  *		  type like in case of tunnels)
136  * @header: header
137  * @fieled_id: field index
138  */
139 struct devlink_dpipe_match {
140 	enum devlink_dpipe_match_type type;
141 	unsigned int header_index;
142 	struct devlink_dpipe_header *header;
143 	unsigned int field_id;
144 };
145 
146 /**
147  * struct devlink_dpipe_action - represents action operation
148  * @type: type of action
149  * @header_index: header index (packets can have several headers of same
150  *		  type like in case of tunnels)
151  * @header: header
152  * @fieled_id: field index
153  */
154 struct devlink_dpipe_action {
155 	enum devlink_dpipe_action_type type;
156 	unsigned int header_index;
157 	struct devlink_dpipe_header *header;
158 	unsigned int field_id;
159 };
160 
161 /**
162  * struct devlink_dpipe_value - represents value of match/action
163  * @action: action
164  * @match: match
165  * @mapping_value: in case the field has some mapping this value
166  *                 specified the mapping value
167  * @mapping_valid: specify if mapping value is valid
168  * @value_size: value size
169  * @value: value
170  * @mask: bit mask
171  */
172 struct devlink_dpipe_value {
173 	union {
174 		struct devlink_dpipe_action *action;
175 		struct devlink_dpipe_match *match;
176 	};
177 	unsigned int mapping_value;
178 	bool mapping_valid;
179 	unsigned int value_size;
180 	void *value;
181 	void *mask;
182 };
183 
184 /**
185  * struct devlink_dpipe_entry - table entry object
186  * @index: index of the entry in the table
187  * @match_values: match values
188  * @matche_values_count: count of matches tuples
189  * @action_values: actions values
190  * @action_values_count: count of actions values
191  * @counter: value of counter
192  * @counter_valid: Specify if value is valid from hardware
193  */
194 struct devlink_dpipe_entry {
195 	u64 index;
196 	struct devlink_dpipe_value *match_values;
197 	unsigned int match_values_count;
198 	struct devlink_dpipe_value *action_values;
199 	unsigned int action_values_count;
200 	u64 counter;
201 	bool counter_valid;
202 };
203 
204 /**
205  * struct devlink_dpipe_dump_ctx - context provided to driver in order
206  *				   to dump
207  * @info: info
208  * @cmd: devlink command
209  * @skb: skb
210  * @nest: top attribute
211  * @hdr: hdr
212  */
213 struct devlink_dpipe_dump_ctx {
214 	struct genl_info *info;
215 	enum devlink_command cmd;
216 	struct sk_buff *skb;
217 	struct nlattr *nest;
218 	void *hdr;
219 };
220 
221 struct devlink_dpipe_table_ops;
222 
223 /**
224  * struct devlink_dpipe_table - table object
225  * @priv: private
226  * @name: table name
227  * @counters_enabled: indicates if counters are active
228  * @counter_control_extern: indicates if counter control is in dpipe or
229  *			    external tool
230  * @resource_valid: Indicate that the resource id is valid
231  * @resource_id: relative resource this table is related to
232  * @resource_units: number of resource's unit consumed per table's entry
233  * @table_ops: table operations
234  * @rcu: rcu
235  */
236 struct devlink_dpipe_table {
237 	void *priv;
238 	struct list_head list;
239 	const char *name;
240 	bool counters_enabled;
241 	bool counter_control_extern;
242 	bool resource_valid;
243 	u64 resource_id;
244 	u64 resource_units;
245 	struct devlink_dpipe_table_ops *table_ops;
246 	struct rcu_head rcu;
247 };
248 
249 /**
250  * struct devlink_dpipe_table_ops - dpipe_table ops
251  * @actions_dump - dumps all tables actions
252  * @matches_dump - dumps all tables matches
253  * @entries_dump - dumps all active entries in the table
254  * @counters_set_update - when changing the counter status hardware sync
255  *			  maybe needed to allocate/free counter related
256  *			  resources
257  * @size_get - get size
258  */
259 struct devlink_dpipe_table_ops {
260 	int (*actions_dump)(void *priv, struct sk_buff *skb);
261 	int (*matches_dump)(void *priv, struct sk_buff *skb);
262 	int (*entries_dump)(void *priv, bool counters_enabled,
263 			    struct devlink_dpipe_dump_ctx *dump_ctx);
264 	int (*counters_set_update)(void *priv, bool enable);
265 	u64 (*size_get)(void *priv);
266 };
267 
268 /**
269  * struct devlink_dpipe_headers - dpipe headers
270  * @headers - header array can be shared (global bit) or driver specific
271  * @headers_count - count of headers
272  */
273 struct devlink_dpipe_headers {
274 	struct devlink_dpipe_header **headers;
275 	unsigned int headers_count;
276 };
277 
278 /**
279  * struct devlink_resource_size_params - resource's size parameters
280  * @size_min: minimum size which can be set
281  * @size_max: maximum size which can be set
282  * @size_granularity: size granularity
283  * @size_unit: resource's basic unit
284  */
285 struct devlink_resource_size_params {
286 	u64 size_min;
287 	u64 size_max;
288 	u64 size_granularity;
289 	enum devlink_resource_unit unit;
290 };
291 
292 static inline void
293 devlink_resource_size_params_init(struct devlink_resource_size_params *size_params,
294 				  u64 size_min, u64 size_max,
295 				  u64 size_granularity,
296 				  enum devlink_resource_unit unit)
297 {
298 	size_params->size_min = size_min;
299 	size_params->size_max = size_max;
300 	size_params->size_granularity = size_granularity;
301 	size_params->unit = unit;
302 }
303 
304 typedef u64 devlink_resource_occ_get_t(void *priv);
305 
306 /**
307  * struct devlink_resource - devlink resource
308  * @name: name of the resource
309  * @id: id, per devlink instance
310  * @size: size of the resource
311  * @size_new: updated size of the resource, reload is needed
312  * @size_valid: valid in case the total size of the resource is valid
313  *              including its children
314  * @parent: parent resource
315  * @size_params: size parameters
316  * @list: parent list
317  * @resource_list: list of child resources
318  */
319 struct devlink_resource {
320 	const char *name;
321 	u64 id;
322 	u64 size;
323 	u64 size_new;
324 	bool size_valid;
325 	struct devlink_resource *parent;
326 	struct devlink_resource_size_params size_params;
327 	struct list_head list;
328 	struct list_head resource_list;
329 	devlink_resource_occ_get_t *occ_get;
330 	void *occ_get_priv;
331 };
332 
333 #define DEVLINK_RESOURCE_ID_PARENT_TOP 0
334 
335 #define __DEVLINK_PARAM_MAX_STRING_VALUE 32
336 enum devlink_param_type {
337 	DEVLINK_PARAM_TYPE_U8,
338 	DEVLINK_PARAM_TYPE_U16,
339 	DEVLINK_PARAM_TYPE_U32,
340 	DEVLINK_PARAM_TYPE_STRING,
341 	DEVLINK_PARAM_TYPE_BOOL,
342 };
343 
344 union devlink_param_value {
345 	u8 vu8;
346 	u16 vu16;
347 	u32 vu32;
348 	char vstr[__DEVLINK_PARAM_MAX_STRING_VALUE];
349 	bool vbool;
350 };
351 
352 struct devlink_param_gset_ctx {
353 	union devlink_param_value val;
354 	enum devlink_param_cmode cmode;
355 };
356 
357 /**
358  * struct devlink_param - devlink configuration parameter data
359  * @name: name of the parameter
360  * @generic: indicates if the parameter is generic or driver specific
361  * @type: parameter type
362  * @supported_cmodes: bitmap of supported configuration modes
363  * @get: get parameter value, used for runtime and permanent
364  *       configuration modes
365  * @set: set parameter value, used for runtime and permanent
366  *       configuration modes
367  * @validate: validate input value is applicable (within value range, etc.)
368  *
369  * This struct should be used by the driver to fill the data for
370  * a parameter it registers.
371  */
372 struct devlink_param {
373 	u32 id;
374 	const char *name;
375 	bool generic;
376 	enum devlink_param_type type;
377 	unsigned long supported_cmodes;
378 	int (*get)(struct devlink *devlink, u32 id,
379 		   struct devlink_param_gset_ctx *ctx);
380 	int (*set)(struct devlink *devlink, u32 id,
381 		   struct devlink_param_gset_ctx *ctx);
382 	int (*validate)(struct devlink *devlink, u32 id,
383 			union devlink_param_value val,
384 			struct netlink_ext_ack *extack);
385 };
386 
387 struct devlink_param_item {
388 	struct list_head list;
389 	const struct devlink_param *param;
390 	union devlink_param_value driverinit_value;
391 	bool driverinit_value_valid;
392 	bool published;
393 };
394 
395 enum devlink_param_generic_id {
396 	DEVLINK_PARAM_GENERIC_ID_INT_ERR_RESET,
397 	DEVLINK_PARAM_GENERIC_ID_MAX_MACS,
398 	DEVLINK_PARAM_GENERIC_ID_ENABLE_SRIOV,
399 	DEVLINK_PARAM_GENERIC_ID_REGION_SNAPSHOT,
400 	DEVLINK_PARAM_GENERIC_ID_IGNORE_ARI,
401 	DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MAX,
402 	DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MIN,
403 	DEVLINK_PARAM_GENERIC_ID_FW_LOAD_POLICY,
404 	DEVLINK_PARAM_GENERIC_ID_RESET_DEV_ON_DRV_PROBE,
405 	DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE,
406 
407 	/* add new param generic ids above here*/
408 	__DEVLINK_PARAM_GENERIC_ID_MAX,
409 	DEVLINK_PARAM_GENERIC_ID_MAX = __DEVLINK_PARAM_GENERIC_ID_MAX - 1,
410 };
411 
412 #define DEVLINK_PARAM_GENERIC_INT_ERR_RESET_NAME "internal_error_reset"
413 #define DEVLINK_PARAM_GENERIC_INT_ERR_RESET_TYPE DEVLINK_PARAM_TYPE_BOOL
414 
415 #define DEVLINK_PARAM_GENERIC_MAX_MACS_NAME "max_macs"
416 #define DEVLINK_PARAM_GENERIC_MAX_MACS_TYPE DEVLINK_PARAM_TYPE_U32
417 
418 #define DEVLINK_PARAM_GENERIC_ENABLE_SRIOV_NAME "enable_sriov"
419 #define DEVLINK_PARAM_GENERIC_ENABLE_SRIOV_TYPE DEVLINK_PARAM_TYPE_BOOL
420 
421 #define DEVLINK_PARAM_GENERIC_REGION_SNAPSHOT_NAME "region_snapshot_enable"
422 #define DEVLINK_PARAM_GENERIC_REGION_SNAPSHOT_TYPE DEVLINK_PARAM_TYPE_BOOL
423 
424 #define DEVLINK_PARAM_GENERIC_IGNORE_ARI_NAME "ignore_ari"
425 #define DEVLINK_PARAM_GENERIC_IGNORE_ARI_TYPE DEVLINK_PARAM_TYPE_BOOL
426 
427 #define DEVLINK_PARAM_GENERIC_MSIX_VEC_PER_PF_MAX_NAME "msix_vec_per_pf_max"
428 #define DEVLINK_PARAM_GENERIC_MSIX_VEC_PER_PF_MAX_TYPE DEVLINK_PARAM_TYPE_U32
429 
430 #define DEVLINK_PARAM_GENERIC_MSIX_VEC_PER_PF_MIN_NAME "msix_vec_per_pf_min"
431 #define DEVLINK_PARAM_GENERIC_MSIX_VEC_PER_PF_MIN_TYPE DEVLINK_PARAM_TYPE_U32
432 
433 #define DEVLINK_PARAM_GENERIC_FW_LOAD_POLICY_NAME "fw_load_policy"
434 #define DEVLINK_PARAM_GENERIC_FW_LOAD_POLICY_TYPE DEVLINK_PARAM_TYPE_U8
435 
436 #define DEVLINK_PARAM_GENERIC_RESET_DEV_ON_DRV_PROBE_NAME \
437 	"reset_dev_on_drv_probe"
438 #define DEVLINK_PARAM_GENERIC_RESET_DEV_ON_DRV_PROBE_TYPE DEVLINK_PARAM_TYPE_U8
439 
440 #define DEVLINK_PARAM_GENERIC_ENABLE_ROCE_NAME "enable_roce"
441 #define DEVLINK_PARAM_GENERIC_ENABLE_ROCE_TYPE DEVLINK_PARAM_TYPE_BOOL
442 
443 #define DEVLINK_PARAM_GENERIC(_id, _cmodes, _get, _set, _validate)	\
444 {									\
445 	.id = DEVLINK_PARAM_GENERIC_ID_##_id,				\
446 	.name = DEVLINK_PARAM_GENERIC_##_id##_NAME,			\
447 	.type = DEVLINK_PARAM_GENERIC_##_id##_TYPE,			\
448 	.generic = true,						\
449 	.supported_cmodes = _cmodes,					\
450 	.get = _get,							\
451 	.set = _set,							\
452 	.validate = _validate,						\
453 }
454 
455 #define DEVLINK_PARAM_DRIVER(_id, _name, _type, _cmodes, _get, _set, _validate)	\
456 {									\
457 	.id = _id,							\
458 	.name = _name,							\
459 	.type = _type,							\
460 	.supported_cmodes = _cmodes,					\
461 	.get = _get,							\
462 	.set = _set,							\
463 	.validate = _validate,						\
464 }
465 
466 /* Part number, identifier of board design */
467 #define DEVLINK_INFO_VERSION_GENERIC_BOARD_ID	"board.id"
468 /* Revision of board design */
469 #define DEVLINK_INFO_VERSION_GENERIC_BOARD_REV	"board.rev"
470 /* Maker of the board */
471 #define DEVLINK_INFO_VERSION_GENERIC_BOARD_MANUFACTURE	"board.manufacture"
472 
473 /* Part number, identifier of asic design */
474 #define DEVLINK_INFO_VERSION_GENERIC_ASIC_ID	"asic.id"
475 /* Revision of asic design */
476 #define DEVLINK_INFO_VERSION_GENERIC_ASIC_REV	"asic.rev"
477 
478 /* Overall FW version */
479 #define DEVLINK_INFO_VERSION_GENERIC_FW		"fw"
480 /* Control processor FW version */
481 #define DEVLINK_INFO_VERSION_GENERIC_FW_MGMT	"fw.mgmt"
482 /* Data path microcode controlling high-speed packet processing */
483 #define DEVLINK_INFO_VERSION_GENERIC_FW_APP	"fw.app"
484 /* UNDI software version */
485 #define DEVLINK_INFO_VERSION_GENERIC_FW_UNDI	"fw.undi"
486 /* NCSI support/handler version */
487 #define DEVLINK_INFO_VERSION_GENERIC_FW_NCSI	"fw.ncsi"
488 /* FW parameter set id */
489 #define DEVLINK_INFO_VERSION_GENERIC_FW_PSID	"fw.psid"
490 /* RoCE FW version */
491 #define DEVLINK_INFO_VERSION_GENERIC_FW_ROCE	"fw.roce"
492 
493 struct devlink_region;
494 struct devlink_info_req;
495 
496 typedef void devlink_snapshot_data_dest_t(const void *data);
497 
498 struct devlink_fmsg;
499 struct devlink_health_reporter;
500 
501 enum devlink_health_reporter_state {
502 	DEVLINK_HEALTH_REPORTER_STATE_HEALTHY,
503 	DEVLINK_HEALTH_REPORTER_STATE_ERROR,
504 };
505 
506 /**
507  * struct devlink_health_reporter_ops - Reporter operations
508  * @name: reporter name
509  * @recover: callback to recover from reported error
510  *           if priv_ctx is NULL, run a full recover
511  * @dump: callback to dump an object
512  *        if priv_ctx is NULL, run a full dump
513  * @diagnose: callback to diagnose the current status
514  */
515 
516 struct devlink_health_reporter_ops {
517 	char *name;
518 	int (*recover)(struct devlink_health_reporter *reporter,
519 		       void *priv_ctx, struct netlink_ext_ack *extack);
520 	int (*dump)(struct devlink_health_reporter *reporter,
521 		    struct devlink_fmsg *fmsg, void *priv_ctx,
522 		    struct netlink_ext_ack *extack);
523 	int (*diagnose)(struct devlink_health_reporter *reporter,
524 			struct devlink_fmsg *fmsg,
525 			struct netlink_ext_ack *extack);
526 };
527 
528 /**
529  * struct devlink_trap_group - Immutable packet trap group attributes.
530  * @name: Trap group name.
531  * @id: Trap group identifier.
532  * @generic: Whether the trap group is generic or not.
533  *
534  * Describes immutable attributes of packet trap groups that drivers register
535  * with devlink.
536  */
537 struct devlink_trap_group {
538 	const char *name;
539 	u16 id;
540 	bool generic;
541 };
542 
543 #define DEVLINK_TRAP_METADATA_TYPE_F_IN_PORT	BIT(0)
544 
545 /**
546  * struct devlink_trap - Immutable packet trap attributes.
547  * @type: Trap type.
548  * @init_action: Initial trap action.
549  * @generic: Whether the trap is generic or not.
550  * @id: Trap identifier.
551  * @name: Trap name.
552  * @group: Immutable packet trap group attributes.
553  * @metadata_cap: Metadata types that can be provided by the trap.
554  *
555  * Describes immutable attributes of packet traps that drivers register with
556  * devlink.
557  */
558 struct devlink_trap {
559 	enum devlink_trap_type type;
560 	enum devlink_trap_action init_action;
561 	bool generic;
562 	u16 id;
563 	const char *name;
564 	struct devlink_trap_group group;
565 	u32 metadata_cap;
566 };
567 
568 /* All traps must be documented in
569  * Documentation/networking/devlink/devlink-trap.rst
570  */
571 enum devlink_trap_generic_id {
572 	DEVLINK_TRAP_GENERIC_ID_SMAC_MC,
573 	DEVLINK_TRAP_GENERIC_ID_VLAN_TAG_MISMATCH,
574 	DEVLINK_TRAP_GENERIC_ID_INGRESS_VLAN_FILTER,
575 	DEVLINK_TRAP_GENERIC_ID_INGRESS_STP_FILTER,
576 	DEVLINK_TRAP_GENERIC_ID_EMPTY_TX_LIST,
577 	DEVLINK_TRAP_GENERIC_ID_PORT_LOOPBACK_FILTER,
578 	DEVLINK_TRAP_GENERIC_ID_BLACKHOLE_ROUTE,
579 	DEVLINK_TRAP_GENERIC_ID_TTL_ERROR,
580 	DEVLINK_TRAP_GENERIC_ID_TAIL_DROP,
581 	DEVLINK_TRAP_GENERIC_ID_NON_IP_PACKET,
582 	DEVLINK_TRAP_GENERIC_ID_UC_DIP_MC_DMAC,
583 	DEVLINK_TRAP_GENERIC_ID_DIP_LB,
584 	DEVLINK_TRAP_GENERIC_ID_SIP_MC,
585 	DEVLINK_TRAP_GENERIC_ID_SIP_LB,
586 	DEVLINK_TRAP_GENERIC_ID_CORRUPTED_IP_HDR,
587 	DEVLINK_TRAP_GENERIC_ID_IPV4_SIP_BC,
588 	DEVLINK_TRAP_GENERIC_ID_IPV6_MC_DIP_RESERVED_SCOPE,
589 	DEVLINK_TRAP_GENERIC_ID_IPV6_MC_DIP_INTERFACE_LOCAL_SCOPE,
590 	DEVLINK_TRAP_GENERIC_ID_MTU_ERROR,
591 	DEVLINK_TRAP_GENERIC_ID_UNRESOLVED_NEIGH,
592 	DEVLINK_TRAP_GENERIC_ID_RPF,
593 	DEVLINK_TRAP_GENERIC_ID_REJECT_ROUTE,
594 	DEVLINK_TRAP_GENERIC_ID_IPV4_LPM_UNICAST_MISS,
595 	DEVLINK_TRAP_GENERIC_ID_IPV6_LPM_UNICAST_MISS,
596 	DEVLINK_TRAP_GENERIC_ID_NON_ROUTABLE,
597 	DEVLINK_TRAP_GENERIC_ID_DECAP_ERROR,
598 	DEVLINK_TRAP_GENERIC_ID_OVERLAY_SMAC_MC,
599 
600 	/* Add new generic trap IDs above */
601 	__DEVLINK_TRAP_GENERIC_ID_MAX,
602 	DEVLINK_TRAP_GENERIC_ID_MAX = __DEVLINK_TRAP_GENERIC_ID_MAX - 1,
603 };
604 
605 /* All trap groups must be documented in
606  * Documentation/networking/devlink/devlink-trap.rst
607  */
608 enum devlink_trap_group_generic_id {
609 	DEVLINK_TRAP_GROUP_GENERIC_ID_L2_DROPS,
610 	DEVLINK_TRAP_GROUP_GENERIC_ID_L3_DROPS,
611 	DEVLINK_TRAP_GROUP_GENERIC_ID_BUFFER_DROPS,
612 	DEVLINK_TRAP_GROUP_GENERIC_ID_TUNNEL_DROPS,
613 
614 	/* Add new generic trap group IDs above */
615 	__DEVLINK_TRAP_GROUP_GENERIC_ID_MAX,
616 	DEVLINK_TRAP_GROUP_GENERIC_ID_MAX =
617 		__DEVLINK_TRAP_GROUP_GENERIC_ID_MAX - 1,
618 };
619 
620 #define DEVLINK_TRAP_GENERIC_NAME_SMAC_MC \
621 	"source_mac_is_multicast"
622 #define DEVLINK_TRAP_GENERIC_NAME_VLAN_TAG_MISMATCH \
623 	"vlan_tag_mismatch"
624 #define DEVLINK_TRAP_GENERIC_NAME_INGRESS_VLAN_FILTER \
625 	"ingress_vlan_filter"
626 #define DEVLINK_TRAP_GENERIC_NAME_INGRESS_STP_FILTER \
627 	"ingress_spanning_tree_filter"
628 #define DEVLINK_TRAP_GENERIC_NAME_EMPTY_TX_LIST \
629 	"port_list_is_empty"
630 #define DEVLINK_TRAP_GENERIC_NAME_PORT_LOOPBACK_FILTER \
631 	"port_loopback_filter"
632 #define DEVLINK_TRAP_GENERIC_NAME_BLACKHOLE_ROUTE \
633 	"blackhole_route"
634 #define DEVLINK_TRAP_GENERIC_NAME_TTL_ERROR \
635 	"ttl_value_is_too_small"
636 #define DEVLINK_TRAP_GENERIC_NAME_TAIL_DROP \
637 	"tail_drop"
638 #define DEVLINK_TRAP_GENERIC_NAME_NON_IP_PACKET \
639 	"non_ip"
640 #define DEVLINK_TRAP_GENERIC_NAME_UC_DIP_MC_DMAC \
641 	"uc_dip_over_mc_dmac"
642 #define DEVLINK_TRAP_GENERIC_NAME_DIP_LB \
643 	"dip_is_loopback_address"
644 #define DEVLINK_TRAP_GENERIC_NAME_SIP_MC \
645 	"sip_is_mc"
646 #define DEVLINK_TRAP_GENERIC_NAME_SIP_LB \
647 	"sip_is_loopback_address"
648 #define DEVLINK_TRAP_GENERIC_NAME_CORRUPTED_IP_HDR \
649 	"ip_header_corrupted"
650 #define DEVLINK_TRAP_GENERIC_NAME_IPV4_SIP_BC \
651 	"ipv4_sip_is_limited_bc"
652 #define DEVLINK_TRAP_GENERIC_NAME_IPV6_MC_DIP_RESERVED_SCOPE \
653 	"ipv6_mc_dip_reserved_scope"
654 #define DEVLINK_TRAP_GENERIC_NAME_IPV6_MC_DIP_INTERFACE_LOCAL_SCOPE \
655 	"ipv6_mc_dip_interface_local_scope"
656 #define DEVLINK_TRAP_GENERIC_NAME_MTU_ERROR \
657 	"mtu_value_is_too_small"
658 #define DEVLINK_TRAP_GENERIC_NAME_UNRESOLVED_NEIGH \
659 	"unresolved_neigh"
660 #define DEVLINK_TRAP_GENERIC_NAME_RPF \
661 	"mc_reverse_path_forwarding"
662 #define DEVLINK_TRAP_GENERIC_NAME_REJECT_ROUTE \
663 	"reject_route"
664 #define DEVLINK_TRAP_GENERIC_NAME_IPV4_LPM_UNICAST_MISS \
665 	"ipv4_lpm_miss"
666 #define DEVLINK_TRAP_GENERIC_NAME_IPV6_LPM_UNICAST_MISS \
667 	"ipv6_lpm_miss"
668 #define DEVLINK_TRAP_GENERIC_NAME_NON_ROUTABLE \
669 	"non_routable_packet"
670 #define DEVLINK_TRAP_GENERIC_NAME_DECAP_ERROR \
671 	"decap_error"
672 #define DEVLINK_TRAP_GENERIC_NAME_OVERLAY_SMAC_MC \
673 	"overlay_smac_is_mc"
674 
675 #define DEVLINK_TRAP_GROUP_GENERIC_NAME_L2_DROPS \
676 	"l2_drops"
677 #define DEVLINK_TRAP_GROUP_GENERIC_NAME_L3_DROPS \
678 	"l3_drops"
679 #define DEVLINK_TRAP_GROUP_GENERIC_NAME_BUFFER_DROPS \
680 	"buffer_drops"
681 #define DEVLINK_TRAP_GROUP_GENERIC_NAME_TUNNEL_DROPS \
682 	"tunnel_drops"
683 
684 #define DEVLINK_TRAP_GENERIC(_type, _init_action, _id, _group, _metadata_cap) \
685 	{								      \
686 		.type = DEVLINK_TRAP_TYPE_##_type,			      \
687 		.init_action = DEVLINK_TRAP_ACTION_##_init_action,	      \
688 		.generic = true,					      \
689 		.id = DEVLINK_TRAP_GENERIC_ID_##_id,			      \
690 		.name = DEVLINK_TRAP_GENERIC_NAME_##_id,		      \
691 		.group = _group,					      \
692 		.metadata_cap = _metadata_cap,				      \
693 	}
694 
695 #define DEVLINK_TRAP_DRIVER(_type, _init_action, _id, _name, _group,	      \
696 			    _metadata_cap)				      \
697 	{								      \
698 		.type = DEVLINK_TRAP_TYPE_##_type,			      \
699 		.init_action = DEVLINK_TRAP_ACTION_##_init_action,	      \
700 		.generic = false,					      \
701 		.id = _id,						      \
702 		.name = _name,						      \
703 		.group = _group,					      \
704 		.metadata_cap = _metadata_cap,				      \
705 	}
706 
707 #define DEVLINK_TRAP_GROUP_GENERIC(_id)					      \
708 	{								      \
709 		.name = DEVLINK_TRAP_GROUP_GENERIC_NAME_##_id,		      \
710 		.id = DEVLINK_TRAP_GROUP_GENERIC_ID_##_id,		      \
711 		.generic = true,					      \
712 	}
713 
714 struct devlink_ops {
715 	int (*reload_down)(struct devlink *devlink, bool netns_change,
716 			   struct netlink_ext_ack *extack);
717 	int (*reload_up)(struct devlink *devlink,
718 			 struct netlink_ext_ack *extack);
719 	int (*port_type_set)(struct devlink_port *devlink_port,
720 			     enum devlink_port_type port_type);
721 	int (*port_split)(struct devlink *devlink, unsigned int port_index,
722 			  unsigned int count, struct netlink_ext_ack *extack);
723 	int (*port_unsplit)(struct devlink *devlink, unsigned int port_index,
724 			    struct netlink_ext_ack *extack);
725 	int (*sb_pool_get)(struct devlink *devlink, unsigned int sb_index,
726 			   u16 pool_index,
727 			   struct devlink_sb_pool_info *pool_info);
728 	int (*sb_pool_set)(struct devlink *devlink, unsigned int sb_index,
729 			   u16 pool_index, u32 size,
730 			   enum devlink_sb_threshold_type threshold_type,
731 			   struct netlink_ext_ack *extack);
732 	int (*sb_port_pool_get)(struct devlink_port *devlink_port,
733 				unsigned int sb_index, u16 pool_index,
734 				u32 *p_threshold);
735 	int (*sb_port_pool_set)(struct devlink_port *devlink_port,
736 				unsigned int sb_index, u16 pool_index,
737 				u32 threshold, struct netlink_ext_ack *extack);
738 	int (*sb_tc_pool_bind_get)(struct devlink_port *devlink_port,
739 				   unsigned int sb_index,
740 				   u16 tc_index,
741 				   enum devlink_sb_pool_type pool_type,
742 				   u16 *p_pool_index, u32 *p_threshold);
743 	int (*sb_tc_pool_bind_set)(struct devlink_port *devlink_port,
744 				   unsigned int sb_index,
745 				   u16 tc_index,
746 				   enum devlink_sb_pool_type pool_type,
747 				   u16 pool_index, u32 threshold,
748 				   struct netlink_ext_ack *extack);
749 	int (*sb_occ_snapshot)(struct devlink *devlink,
750 			       unsigned int sb_index);
751 	int (*sb_occ_max_clear)(struct devlink *devlink,
752 				unsigned int sb_index);
753 	int (*sb_occ_port_pool_get)(struct devlink_port *devlink_port,
754 				    unsigned int sb_index, u16 pool_index,
755 				    u32 *p_cur, u32 *p_max);
756 	int (*sb_occ_tc_port_bind_get)(struct devlink_port *devlink_port,
757 				       unsigned int sb_index,
758 				       u16 tc_index,
759 				       enum devlink_sb_pool_type pool_type,
760 				       u32 *p_cur, u32 *p_max);
761 
762 	int (*eswitch_mode_get)(struct devlink *devlink, u16 *p_mode);
763 	int (*eswitch_mode_set)(struct devlink *devlink, u16 mode,
764 				struct netlink_ext_ack *extack);
765 	int (*eswitch_inline_mode_get)(struct devlink *devlink, u8 *p_inline_mode);
766 	int (*eswitch_inline_mode_set)(struct devlink *devlink, u8 inline_mode,
767 				       struct netlink_ext_ack *extack);
768 	int (*eswitch_encap_mode_get)(struct devlink *devlink,
769 				      enum devlink_eswitch_encap_mode *p_encap_mode);
770 	int (*eswitch_encap_mode_set)(struct devlink *devlink,
771 				      enum devlink_eswitch_encap_mode encap_mode,
772 				      struct netlink_ext_ack *extack);
773 	int (*info_get)(struct devlink *devlink, struct devlink_info_req *req,
774 			struct netlink_ext_ack *extack);
775 	int (*flash_update)(struct devlink *devlink, const char *file_name,
776 			    const char *component,
777 			    struct netlink_ext_ack *extack);
778 	/**
779 	 * @trap_init: Trap initialization function.
780 	 *
781 	 * Should be used by device drivers to initialize the trap in the
782 	 * underlying device. Drivers should also store the provided trap
783 	 * context, so that they could efficiently pass it to
784 	 * devlink_trap_report() when the trap is triggered.
785 	 */
786 	int (*trap_init)(struct devlink *devlink,
787 			 const struct devlink_trap *trap, void *trap_ctx);
788 	/**
789 	 * @trap_fini: Trap de-initialization function.
790 	 *
791 	 * Should be used by device drivers to de-initialize the trap in the
792 	 * underlying device.
793 	 */
794 	void (*trap_fini)(struct devlink *devlink,
795 			  const struct devlink_trap *trap, void *trap_ctx);
796 	/**
797 	 * @trap_action_set: Trap action set function.
798 	 */
799 	int (*trap_action_set)(struct devlink *devlink,
800 			       const struct devlink_trap *trap,
801 			       enum devlink_trap_action action);
802 	/**
803 	 * @trap_group_init: Trap group initialization function.
804 	 *
805 	 * Should be used by device drivers to initialize the trap group in the
806 	 * underlying device.
807 	 */
808 	int (*trap_group_init)(struct devlink *devlink,
809 			       const struct devlink_trap_group *group);
810 };
811 
812 static inline void *devlink_priv(struct devlink *devlink)
813 {
814 	BUG_ON(!devlink);
815 	return &devlink->priv;
816 }
817 
818 static inline struct devlink *priv_to_devlink(void *priv)
819 {
820 	BUG_ON(!priv);
821 	return container_of(priv, struct devlink, priv);
822 }
823 
824 static inline struct devlink_port *
825 netdev_to_devlink_port(struct net_device *dev)
826 {
827 	if (dev->netdev_ops->ndo_get_devlink_port)
828 		return dev->netdev_ops->ndo_get_devlink_port(dev);
829 	return NULL;
830 }
831 
832 static inline struct devlink *netdev_to_devlink(struct net_device *dev)
833 {
834 	struct devlink_port *devlink_port = netdev_to_devlink_port(dev);
835 
836 	if (devlink_port)
837 		return devlink_port->devlink;
838 	return NULL;
839 }
840 
841 struct ib_device;
842 
843 struct net *devlink_net(const struct devlink *devlink);
844 void devlink_net_set(struct devlink *devlink, struct net *net);
845 struct devlink *devlink_alloc(const struct devlink_ops *ops, size_t priv_size);
846 int devlink_register(struct devlink *devlink, struct device *dev);
847 void devlink_unregister(struct devlink *devlink);
848 void devlink_reload_enable(struct devlink *devlink);
849 void devlink_reload_disable(struct devlink *devlink);
850 void devlink_free(struct devlink *devlink);
851 int devlink_port_register(struct devlink *devlink,
852 			  struct devlink_port *devlink_port,
853 			  unsigned int port_index);
854 void devlink_port_unregister(struct devlink_port *devlink_port);
855 void devlink_port_type_eth_set(struct devlink_port *devlink_port,
856 			       struct net_device *netdev);
857 void devlink_port_type_ib_set(struct devlink_port *devlink_port,
858 			      struct ib_device *ibdev);
859 void devlink_port_type_clear(struct devlink_port *devlink_port);
860 void devlink_port_attrs_set(struct devlink_port *devlink_port,
861 			    enum devlink_port_flavour flavour,
862 			    u32 port_number, bool split,
863 			    u32 split_subport_number,
864 			    const unsigned char *switch_id,
865 			    unsigned char switch_id_len);
866 void devlink_port_attrs_pci_pf_set(struct devlink_port *devlink_port,
867 				   const unsigned char *switch_id,
868 				   unsigned char switch_id_len, u16 pf);
869 void devlink_port_attrs_pci_vf_set(struct devlink_port *devlink_port,
870 				   const unsigned char *switch_id,
871 				   unsigned char switch_id_len,
872 				   u16 pf, u16 vf);
873 int devlink_sb_register(struct devlink *devlink, unsigned int sb_index,
874 			u32 size, u16 ingress_pools_count,
875 			u16 egress_pools_count, u16 ingress_tc_count,
876 			u16 egress_tc_count);
877 void devlink_sb_unregister(struct devlink *devlink, unsigned int sb_index);
878 int devlink_dpipe_table_register(struct devlink *devlink,
879 				 const char *table_name,
880 				 struct devlink_dpipe_table_ops *table_ops,
881 				 void *priv, bool counter_control_extern);
882 void devlink_dpipe_table_unregister(struct devlink *devlink,
883 				    const char *table_name);
884 int devlink_dpipe_headers_register(struct devlink *devlink,
885 				   struct devlink_dpipe_headers *dpipe_headers);
886 void devlink_dpipe_headers_unregister(struct devlink *devlink);
887 bool devlink_dpipe_table_counter_enabled(struct devlink *devlink,
888 					 const char *table_name);
889 int devlink_dpipe_entry_ctx_prepare(struct devlink_dpipe_dump_ctx *dump_ctx);
890 int devlink_dpipe_entry_ctx_append(struct devlink_dpipe_dump_ctx *dump_ctx,
891 				   struct devlink_dpipe_entry *entry);
892 int devlink_dpipe_entry_ctx_close(struct devlink_dpipe_dump_ctx *dump_ctx);
893 void devlink_dpipe_entry_clear(struct devlink_dpipe_entry *entry);
894 int devlink_dpipe_action_put(struct sk_buff *skb,
895 			     struct devlink_dpipe_action *action);
896 int devlink_dpipe_match_put(struct sk_buff *skb,
897 			    struct devlink_dpipe_match *match);
898 extern struct devlink_dpipe_header devlink_dpipe_header_ethernet;
899 extern struct devlink_dpipe_header devlink_dpipe_header_ipv4;
900 extern struct devlink_dpipe_header devlink_dpipe_header_ipv6;
901 
902 int devlink_resource_register(struct devlink *devlink,
903 			      const char *resource_name,
904 			      u64 resource_size,
905 			      u64 resource_id,
906 			      u64 parent_resource_id,
907 			      const struct devlink_resource_size_params *size_params);
908 void devlink_resources_unregister(struct devlink *devlink,
909 				  struct devlink_resource *resource);
910 int devlink_resource_size_get(struct devlink *devlink,
911 			      u64 resource_id,
912 			      u64 *p_resource_size);
913 int devlink_dpipe_table_resource_set(struct devlink *devlink,
914 				     const char *table_name, u64 resource_id,
915 				     u64 resource_units);
916 void devlink_resource_occ_get_register(struct devlink *devlink,
917 				       u64 resource_id,
918 				       devlink_resource_occ_get_t *occ_get,
919 				       void *occ_get_priv);
920 void devlink_resource_occ_get_unregister(struct devlink *devlink,
921 					 u64 resource_id);
922 int devlink_params_register(struct devlink *devlink,
923 			    const struct devlink_param *params,
924 			    size_t params_count);
925 void devlink_params_unregister(struct devlink *devlink,
926 			       const struct devlink_param *params,
927 			       size_t params_count);
928 void devlink_params_publish(struct devlink *devlink);
929 void devlink_params_unpublish(struct devlink *devlink);
930 int devlink_port_params_register(struct devlink_port *devlink_port,
931 				 const struct devlink_param *params,
932 				 size_t params_count);
933 void devlink_port_params_unregister(struct devlink_port *devlink_port,
934 				    const struct devlink_param *params,
935 				    size_t params_count);
936 int devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id,
937 				       union devlink_param_value *init_val);
938 int devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id,
939 				       union devlink_param_value init_val);
940 int
941 devlink_port_param_driverinit_value_get(struct devlink_port *devlink_port,
942 					u32 param_id,
943 					union devlink_param_value *init_val);
944 int devlink_port_param_driverinit_value_set(struct devlink_port *devlink_port,
945 					    u32 param_id,
946 					    union devlink_param_value init_val);
947 void devlink_param_value_changed(struct devlink *devlink, u32 param_id);
948 void devlink_port_param_value_changed(struct devlink_port *devlink_port,
949 				      u32 param_id);
950 void devlink_param_value_str_fill(union devlink_param_value *dst_val,
951 				  const char *src);
952 struct devlink_region *devlink_region_create(struct devlink *devlink,
953 					     const char *region_name,
954 					     u32 region_max_snapshots,
955 					     u64 region_size);
956 void devlink_region_destroy(struct devlink_region *region);
957 u32 devlink_region_snapshot_id_get(struct devlink *devlink);
958 int devlink_region_snapshot_create(struct devlink_region *region,
959 				   u8 *data, u32 snapshot_id,
960 				   devlink_snapshot_data_dest_t *data_destructor);
961 int devlink_info_serial_number_put(struct devlink_info_req *req,
962 				   const char *sn);
963 int devlink_info_driver_name_put(struct devlink_info_req *req,
964 				 const char *name);
965 int devlink_info_version_fixed_put(struct devlink_info_req *req,
966 				   const char *version_name,
967 				   const char *version_value);
968 int devlink_info_version_stored_put(struct devlink_info_req *req,
969 				    const char *version_name,
970 				    const char *version_value);
971 int devlink_info_version_running_put(struct devlink_info_req *req,
972 				     const char *version_name,
973 				     const char *version_value);
974 
975 int devlink_fmsg_obj_nest_start(struct devlink_fmsg *fmsg);
976 int devlink_fmsg_obj_nest_end(struct devlink_fmsg *fmsg);
977 
978 int devlink_fmsg_pair_nest_start(struct devlink_fmsg *fmsg, const char *name);
979 int devlink_fmsg_pair_nest_end(struct devlink_fmsg *fmsg);
980 
981 int devlink_fmsg_arr_pair_nest_start(struct devlink_fmsg *fmsg,
982 				     const char *name);
983 int devlink_fmsg_arr_pair_nest_end(struct devlink_fmsg *fmsg);
984 
985 int devlink_fmsg_bool_put(struct devlink_fmsg *fmsg, bool value);
986 int devlink_fmsg_u8_put(struct devlink_fmsg *fmsg, u8 value);
987 int devlink_fmsg_u32_put(struct devlink_fmsg *fmsg, u32 value);
988 int devlink_fmsg_u64_put(struct devlink_fmsg *fmsg, u64 value);
989 int devlink_fmsg_string_put(struct devlink_fmsg *fmsg, const char *value);
990 
991 int devlink_fmsg_bool_pair_put(struct devlink_fmsg *fmsg, const char *name,
992 			       bool value);
993 int devlink_fmsg_u8_pair_put(struct devlink_fmsg *fmsg, const char *name,
994 			     u8 value);
995 int devlink_fmsg_u32_pair_put(struct devlink_fmsg *fmsg, const char *name,
996 			      u32 value);
997 int devlink_fmsg_u64_pair_put(struct devlink_fmsg *fmsg, const char *name,
998 			      u64 value);
999 int devlink_fmsg_string_pair_put(struct devlink_fmsg *fmsg, const char *name,
1000 				 const char *value);
1001 int devlink_fmsg_binary_pair_put(struct devlink_fmsg *fmsg, const char *name,
1002 				 const void *value, u32 value_len);
1003 
1004 struct devlink_health_reporter *
1005 devlink_health_reporter_create(struct devlink *devlink,
1006 			       const struct devlink_health_reporter_ops *ops,
1007 			       u64 graceful_period, bool auto_recover,
1008 			       void *priv);
1009 void
1010 devlink_health_reporter_destroy(struct devlink_health_reporter *reporter);
1011 
1012 void *
1013 devlink_health_reporter_priv(struct devlink_health_reporter *reporter);
1014 int devlink_health_report(struct devlink_health_reporter *reporter,
1015 			  const char *msg, void *priv_ctx);
1016 void
1017 devlink_health_reporter_state_update(struct devlink_health_reporter *reporter,
1018 				     enum devlink_health_reporter_state state);
1019 void
1020 devlink_health_reporter_recovery_done(struct devlink_health_reporter *reporter);
1021 
1022 bool devlink_is_reload_failed(const struct devlink *devlink);
1023 
1024 void devlink_flash_update_begin_notify(struct devlink *devlink);
1025 void devlink_flash_update_end_notify(struct devlink *devlink);
1026 void devlink_flash_update_status_notify(struct devlink *devlink,
1027 					const char *status_msg,
1028 					const char *component,
1029 					unsigned long done,
1030 					unsigned long total);
1031 
1032 int devlink_traps_register(struct devlink *devlink,
1033 			   const struct devlink_trap *traps,
1034 			   size_t traps_count, void *priv);
1035 void devlink_traps_unregister(struct devlink *devlink,
1036 			      const struct devlink_trap *traps,
1037 			      size_t traps_count);
1038 void devlink_trap_report(struct devlink *devlink,
1039 			 struct sk_buff *skb, void *trap_ctx,
1040 			 struct devlink_port *in_devlink_port);
1041 void *devlink_trap_ctx_priv(void *trap_ctx);
1042 
1043 #if IS_ENABLED(CONFIG_NET_DEVLINK)
1044 
1045 void devlink_compat_running_version(struct net_device *dev,
1046 				    char *buf, size_t len);
1047 int devlink_compat_flash_update(struct net_device *dev, const char *file_name);
1048 int devlink_compat_phys_port_name_get(struct net_device *dev,
1049 				      char *name, size_t len);
1050 int devlink_compat_switch_id_get(struct net_device *dev,
1051 				 struct netdev_phys_item_id *ppid);
1052 
1053 #else
1054 
1055 static inline void
1056 devlink_compat_running_version(struct net_device *dev, char *buf, size_t len)
1057 {
1058 }
1059 
1060 static inline int
1061 devlink_compat_flash_update(struct net_device *dev, const char *file_name)
1062 {
1063 	return -EOPNOTSUPP;
1064 }
1065 
1066 static inline int
1067 devlink_compat_phys_port_name_get(struct net_device *dev,
1068 				  char *name, size_t len)
1069 {
1070 	return -EOPNOTSUPP;
1071 }
1072 
1073 static inline int
1074 devlink_compat_switch_id_get(struct net_device *dev,
1075 			     struct netdev_phys_item_id *ppid)
1076 {
1077 	return -EOPNOTSUPP;
1078 }
1079 
1080 #endif
1081 
1082 #endif /* _NET_DEVLINK_H_ */
1083