2 * include/net/devlink.h - Network physical device Netlink interface
3 * Copyright (c) 2016 Mellanox Technologies. All rights reserved.
4 * Copyright (c) 2016 Jiri Pirko <jiri@mellanox.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 #ifndef _NET_DEVLINK_H_
12 #define _NET_DEVLINK_H_
14 #include <linux/device.h>
15 #include <linux/slab.h>
16 #include <linux/gfp.h>
17 #include <linux/list.h>
18 #include <linux/netdevice.h>
19 #include <net/net_namespace.h>
20 #include <uapi/linux/devlink.h>
25 struct list_head list;
26 struct list_head port_list;
27 struct list_head sb_list;
28 struct list_head dpipe_table_list;
29 struct list_head resource_list;
30 struct list_head param_list;
31 struct list_head region_list;
33 struct devlink_dpipe_headers *dpipe_headers;
34 const struct devlink_ops *ops;
38 char priv[0] __aligned(NETDEV_ALIGN);
41 struct devlink_port_attrs {
43 enum devlink_port_flavour flavour;
44 u32 port_number; /* same value as "split group" */
46 u32 split_subport_number;
50 struct list_head list;
51 struct list_head param_list;
52 struct devlink *devlink;
55 enum devlink_port_type type;
56 enum devlink_port_type desired_type;
58 struct devlink_port_attrs attrs;
61 struct devlink_sb_pool_info {
62 enum devlink_sb_pool_type pool_type;
64 enum devlink_sb_threshold_type threshold_type;
68 * struct devlink_dpipe_field - dpipe field object
70 * @id: index inside the headers field array
72 * @mapping_type: mapping type
74 struct devlink_dpipe_field {
77 unsigned int bitwidth;
78 enum devlink_dpipe_field_mapping_type mapping_type;
82 * struct devlink_dpipe_header - dpipe header object
84 * @id: index, global/local detrmined by global bit
86 * @fields_count: number of fields
87 * @global: indicates if header is shared like most protocol header
90 struct devlink_dpipe_header {
93 struct devlink_dpipe_field *fields;
94 unsigned int fields_count;
99 * struct devlink_dpipe_match - represents match operation
100 * @type: type of match
101 * @header_index: header index (packets can have several headers of same
102 * type like in case of tunnels)
104 * @fieled_id: field index
106 struct devlink_dpipe_match {
107 enum devlink_dpipe_match_type type;
108 unsigned int header_index;
109 struct devlink_dpipe_header *header;
110 unsigned int field_id;
114 * struct devlink_dpipe_action - represents action operation
115 * @type: type of action
116 * @header_index: header index (packets can have several headers of same
117 * type like in case of tunnels)
119 * @fieled_id: field index
121 struct devlink_dpipe_action {
122 enum devlink_dpipe_action_type type;
123 unsigned int header_index;
124 struct devlink_dpipe_header *header;
125 unsigned int field_id;
129 * struct devlink_dpipe_value - represents value of match/action
132 * @mapping_value: in case the field has some mapping this value
133 * specified the mapping value
134 * @mapping_valid: specify if mapping value is valid
135 * @value_size: value size
139 struct devlink_dpipe_value {
141 struct devlink_dpipe_action *action;
142 struct devlink_dpipe_match *match;
144 unsigned int mapping_value;
146 unsigned int value_size;
152 * struct devlink_dpipe_entry - table entry object
153 * @index: index of the entry in the table
154 * @match_values: match values
155 * @matche_values_count: count of matches tuples
156 * @action_values: actions values
157 * @action_values_count: count of actions values
158 * @counter: value of counter
159 * @counter_valid: Specify if value is valid from hardware
161 struct devlink_dpipe_entry {
163 struct devlink_dpipe_value *match_values;
164 unsigned int match_values_count;
165 struct devlink_dpipe_value *action_values;
166 unsigned int action_values_count;
172 * struct devlink_dpipe_dump_ctx - context provided to driver in order
175 * @cmd: devlink command
177 * @nest: top attribute
180 struct devlink_dpipe_dump_ctx {
181 struct genl_info *info;
182 enum devlink_command cmd;
188 struct devlink_dpipe_table_ops;
191 * struct devlink_dpipe_table - table object
194 * @counters_enabled: indicates if counters are active
195 * @counter_control_extern: indicates if counter control is in dpipe or
197 * @resource_valid: Indicate that the resource id is valid
198 * @resource_id: relative resource this table is related to
199 * @resource_units: number of resource's unit consumed per table's entry
200 * @table_ops: table operations
203 struct devlink_dpipe_table {
205 struct list_head list;
207 bool counters_enabled;
208 bool counter_control_extern;
212 struct devlink_dpipe_table_ops *table_ops;
217 * struct devlink_dpipe_table_ops - dpipe_table ops
218 * @actions_dump - dumps all tables actions
219 * @matches_dump - dumps all tables matches
220 * @entries_dump - dumps all active entries in the table
221 * @counters_set_update - when changing the counter status hardware sync
222 * maybe needed to allocate/free counter related
224 * @size_get - get size
226 struct devlink_dpipe_table_ops {
227 int (*actions_dump)(void *priv, struct sk_buff *skb);
228 int (*matches_dump)(void *priv, struct sk_buff *skb);
229 int (*entries_dump)(void *priv, bool counters_enabled,
230 struct devlink_dpipe_dump_ctx *dump_ctx);
231 int (*counters_set_update)(void *priv, bool enable);
232 u64 (*size_get)(void *priv);
236 * struct devlink_dpipe_headers - dpipe headers
237 * @headers - header array can be shared (global bit) or driver specific
238 * @headers_count - count of headers
240 struct devlink_dpipe_headers {
241 struct devlink_dpipe_header **headers;
242 unsigned int headers_count;
246 * struct devlink_resource_size_params - resource's size parameters
247 * @size_min: minimum size which can be set
248 * @size_max: maximum size which can be set
249 * @size_granularity: size granularity
250 * @size_unit: resource's basic unit
252 struct devlink_resource_size_params {
255 u64 size_granularity;
256 enum devlink_resource_unit unit;
260 devlink_resource_size_params_init(struct devlink_resource_size_params *size_params,
261 u64 size_min, u64 size_max,
262 u64 size_granularity,
263 enum devlink_resource_unit unit)
265 size_params->size_min = size_min;
266 size_params->size_max = size_max;
267 size_params->size_granularity = size_granularity;
268 size_params->unit = unit;
271 typedef u64 devlink_resource_occ_get_t(void *priv);
274 * struct devlink_resource - devlink resource
275 * @name: name of the resource
276 * @id: id, per devlink instance
277 * @size: size of the resource
278 * @size_new: updated size of the resource, reload is needed
279 * @size_valid: valid in case the total size of the resource is valid
280 * including its children
281 * @parent: parent resource
282 * @size_params: size parameters
284 * @resource_list: list of child resources
286 struct devlink_resource {
292 struct devlink_resource *parent;
293 struct devlink_resource_size_params size_params;
294 struct list_head list;
295 struct list_head resource_list;
296 devlink_resource_occ_get_t *occ_get;
300 #define DEVLINK_RESOURCE_ID_PARENT_TOP 0
302 #define __DEVLINK_PARAM_MAX_STRING_VALUE 32
303 enum devlink_param_type {
304 DEVLINK_PARAM_TYPE_U8,
305 DEVLINK_PARAM_TYPE_U16,
306 DEVLINK_PARAM_TYPE_U32,
307 DEVLINK_PARAM_TYPE_STRING,
308 DEVLINK_PARAM_TYPE_BOOL,
311 union devlink_param_value {
315 char vstr[__DEVLINK_PARAM_MAX_STRING_VALUE];
319 struct devlink_param_gset_ctx {
320 union devlink_param_value val;
321 enum devlink_param_cmode cmode;
325 * struct devlink_param - devlink configuration parameter data
326 * @name: name of the parameter
327 * @generic: indicates if the parameter is generic or driver specific
328 * @type: parameter type
329 * @supported_cmodes: bitmap of supported configuration modes
330 * @get: get parameter value, used for runtime and permanent
331 * configuration modes
332 * @set: set parameter value, used for runtime and permanent
333 * configuration modes
334 * @validate: validate input value is applicable (within value range, etc.)
336 * This struct should be used by the driver to fill the data for
337 * a parameter it registers.
339 struct devlink_param {
343 enum devlink_param_type type;
344 unsigned long supported_cmodes;
345 int (*get)(struct devlink *devlink, u32 id,
346 struct devlink_param_gset_ctx *ctx);
347 int (*set)(struct devlink *devlink, u32 id,
348 struct devlink_param_gset_ctx *ctx);
349 int (*validate)(struct devlink *devlink, u32 id,
350 union devlink_param_value val,
351 struct netlink_ext_ack *extack);
354 struct devlink_param_item {
355 struct list_head list;
356 const struct devlink_param *param;
357 union devlink_param_value driverinit_value;
358 bool driverinit_value_valid;
361 enum devlink_param_generic_id {
362 DEVLINK_PARAM_GENERIC_ID_INT_ERR_RESET,
363 DEVLINK_PARAM_GENERIC_ID_MAX_MACS,
364 DEVLINK_PARAM_GENERIC_ID_ENABLE_SRIOV,
365 DEVLINK_PARAM_GENERIC_ID_REGION_SNAPSHOT,
366 DEVLINK_PARAM_GENERIC_ID_IGNORE_ARI,
367 DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MAX,
368 DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MIN,
369 DEVLINK_PARAM_GENERIC_ID_FW_LOAD_POLICY,
370 DEVLINK_PARAM_GENERIC_ID_WOL,
372 /* add new param generic ids above here*/
373 __DEVLINK_PARAM_GENERIC_ID_MAX,
374 DEVLINK_PARAM_GENERIC_ID_MAX = __DEVLINK_PARAM_GENERIC_ID_MAX - 1,
377 enum devlink_param_wol_types {
378 DEVLINK_PARAM_WAKE_MAGIC = (1 << 0),
381 #define DEVLINK_PARAM_GENERIC_INT_ERR_RESET_NAME "internal_error_reset"
382 #define DEVLINK_PARAM_GENERIC_INT_ERR_RESET_TYPE DEVLINK_PARAM_TYPE_BOOL
384 #define DEVLINK_PARAM_GENERIC_MAX_MACS_NAME "max_macs"
385 #define DEVLINK_PARAM_GENERIC_MAX_MACS_TYPE DEVLINK_PARAM_TYPE_U32
387 #define DEVLINK_PARAM_GENERIC_ENABLE_SRIOV_NAME "enable_sriov"
388 #define DEVLINK_PARAM_GENERIC_ENABLE_SRIOV_TYPE DEVLINK_PARAM_TYPE_BOOL
390 #define DEVLINK_PARAM_GENERIC_REGION_SNAPSHOT_NAME "region_snapshot_enable"
391 #define DEVLINK_PARAM_GENERIC_REGION_SNAPSHOT_TYPE DEVLINK_PARAM_TYPE_BOOL
393 #define DEVLINK_PARAM_GENERIC_IGNORE_ARI_NAME "ignore_ari"
394 #define DEVLINK_PARAM_GENERIC_IGNORE_ARI_TYPE DEVLINK_PARAM_TYPE_BOOL
396 #define DEVLINK_PARAM_GENERIC_MSIX_VEC_PER_PF_MAX_NAME "msix_vec_per_pf_max"
397 #define DEVLINK_PARAM_GENERIC_MSIX_VEC_PER_PF_MAX_TYPE DEVLINK_PARAM_TYPE_U32
399 #define DEVLINK_PARAM_GENERIC_MSIX_VEC_PER_PF_MIN_NAME "msix_vec_per_pf_min"
400 #define DEVLINK_PARAM_GENERIC_MSIX_VEC_PER_PF_MIN_TYPE DEVLINK_PARAM_TYPE_U32
402 #define DEVLINK_PARAM_GENERIC_FW_LOAD_POLICY_NAME "fw_load_policy"
403 #define DEVLINK_PARAM_GENERIC_FW_LOAD_POLICY_TYPE DEVLINK_PARAM_TYPE_U8
405 #define DEVLINK_PARAM_GENERIC_WOL_NAME "wake_on_lan"
406 #define DEVLINK_PARAM_GENERIC_WOL_TYPE DEVLINK_PARAM_TYPE_U8
408 #define DEVLINK_PARAM_GENERIC(_id, _cmodes, _get, _set, _validate) \
410 .id = DEVLINK_PARAM_GENERIC_ID_##_id, \
411 .name = DEVLINK_PARAM_GENERIC_##_id##_NAME, \
412 .type = DEVLINK_PARAM_GENERIC_##_id##_TYPE, \
414 .supported_cmodes = _cmodes, \
417 .validate = _validate, \
420 #define DEVLINK_PARAM_DRIVER(_id, _name, _type, _cmodes, _get, _set, _validate) \
425 .supported_cmodes = _cmodes, \
428 .validate = _validate, \
431 /* Part number, identifier of board design */
432 #define DEVLINK_INFO_VERSION_GENERIC_BOARD_ID "board.id"
433 /* Revision of board design */
434 #define DEVLINK_INFO_VERSION_GENERIC_BOARD_REV "board.rev"
436 /* Control processor FW version */
437 #define DEVLINK_INFO_VERSION_GENERIC_FW_MGMT "fw.mgmt"
438 /* Data path microcode controlling high-speed packet processing */
439 #define DEVLINK_INFO_VERSION_GENERIC_FW_APP "fw.app"
440 /* UNDI software version */
441 #define DEVLINK_INFO_VERSION_GENERIC_FW_UNDI "fw.undi"
442 /* NCSI support/handler version */
443 #define DEVLINK_INFO_VERSION_GENERIC_FW_NCSI "fw.ncsi"
445 struct devlink_region;
446 struct devlink_info_req;
448 typedef void devlink_snapshot_data_dest_t(const void *data);
451 int (*reload)(struct devlink *devlink, struct netlink_ext_ack *extack);
452 int (*port_type_set)(struct devlink_port *devlink_port,
453 enum devlink_port_type port_type);
454 int (*port_split)(struct devlink *devlink, unsigned int port_index,
455 unsigned int count, struct netlink_ext_ack *extack);
456 int (*port_unsplit)(struct devlink *devlink, unsigned int port_index,
457 struct netlink_ext_ack *extack);
458 int (*sb_pool_get)(struct devlink *devlink, unsigned int sb_index,
460 struct devlink_sb_pool_info *pool_info);
461 int (*sb_pool_set)(struct devlink *devlink, unsigned int sb_index,
462 u16 pool_index, u32 size,
463 enum devlink_sb_threshold_type threshold_type);
464 int (*sb_port_pool_get)(struct devlink_port *devlink_port,
465 unsigned int sb_index, u16 pool_index,
467 int (*sb_port_pool_set)(struct devlink_port *devlink_port,
468 unsigned int sb_index, u16 pool_index,
470 int (*sb_tc_pool_bind_get)(struct devlink_port *devlink_port,
471 unsigned int sb_index,
473 enum devlink_sb_pool_type pool_type,
474 u16 *p_pool_index, u32 *p_threshold);
475 int (*sb_tc_pool_bind_set)(struct devlink_port *devlink_port,
476 unsigned int sb_index,
478 enum devlink_sb_pool_type pool_type,
479 u16 pool_index, u32 threshold);
480 int (*sb_occ_snapshot)(struct devlink *devlink,
481 unsigned int sb_index);
482 int (*sb_occ_max_clear)(struct devlink *devlink,
483 unsigned int sb_index);
484 int (*sb_occ_port_pool_get)(struct devlink_port *devlink_port,
485 unsigned int sb_index, u16 pool_index,
486 u32 *p_cur, u32 *p_max);
487 int (*sb_occ_tc_port_bind_get)(struct devlink_port *devlink_port,
488 unsigned int sb_index,
490 enum devlink_sb_pool_type pool_type,
491 u32 *p_cur, u32 *p_max);
493 int (*eswitch_mode_get)(struct devlink *devlink, u16 *p_mode);
494 int (*eswitch_mode_set)(struct devlink *devlink, u16 mode,
495 struct netlink_ext_ack *extack);
496 int (*eswitch_inline_mode_get)(struct devlink *devlink, u8 *p_inline_mode);
497 int (*eswitch_inline_mode_set)(struct devlink *devlink, u8 inline_mode,
498 struct netlink_ext_ack *extack);
499 int (*eswitch_encap_mode_get)(struct devlink *devlink, u8 *p_encap_mode);
500 int (*eswitch_encap_mode_set)(struct devlink *devlink, u8 encap_mode,
501 struct netlink_ext_ack *extack);
502 int (*info_get)(struct devlink *devlink, struct devlink_info_req *req,
503 struct netlink_ext_ack *extack);
506 static inline void *devlink_priv(struct devlink *devlink)
509 return &devlink->priv;
512 static inline struct devlink *priv_to_devlink(void *priv)
515 return container_of(priv, struct devlink, priv);
520 #if IS_ENABLED(CONFIG_NET_DEVLINK)
522 struct devlink *devlink_alloc(const struct devlink_ops *ops, size_t priv_size);
523 int devlink_register(struct devlink *devlink, struct device *dev);
524 void devlink_unregister(struct devlink *devlink);
525 void devlink_free(struct devlink *devlink);
526 int devlink_port_register(struct devlink *devlink,
527 struct devlink_port *devlink_port,
528 unsigned int port_index);
529 void devlink_port_unregister(struct devlink_port *devlink_port);
530 void devlink_port_type_eth_set(struct devlink_port *devlink_port,
531 struct net_device *netdev);
532 void devlink_port_type_ib_set(struct devlink_port *devlink_port,
533 struct ib_device *ibdev);
534 void devlink_port_type_clear(struct devlink_port *devlink_port);
535 void devlink_port_attrs_set(struct devlink_port *devlink_port,
536 enum devlink_port_flavour flavour,
537 u32 port_number, bool split,
538 u32 split_subport_number);
539 int devlink_port_get_phys_port_name(struct devlink_port *devlink_port,
540 char *name, size_t len);
541 int devlink_sb_register(struct devlink *devlink, unsigned int sb_index,
542 u32 size, u16 ingress_pools_count,
543 u16 egress_pools_count, u16 ingress_tc_count,
544 u16 egress_tc_count);
545 void devlink_sb_unregister(struct devlink *devlink, unsigned int sb_index);
546 int devlink_dpipe_table_register(struct devlink *devlink,
547 const char *table_name,
548 struct devlink_dpipe_table_ops *table_ops,
549 void *priv, bool counter_control_extern);
550 void devlink_dpipe_table_unregister(struct devlink *devlink,
551 const char *table_name);
552 int devlink_dpipe_headers_register(struct devlink *devlink,
553 struct devlink_dpipe_headers *dpipe_headers);
554 void devlink_dpipe_headers_unregister(struct devlink *devlink);
555 bool devlink_dpipe_table_counter_enabled(struct devlink *devlink,
556 const char *table_name);
557 int devlink_dpipe_entry_ctx_prepare(struct devlink_dpipe_dump_ctx *dump_ctx);
558 int devlink_dpipe_entry_ctx_append(struct devlink_dpipe_dump_ctx *dump_ctx,
559 struct devlink_dpipe_entry *entry);
560 int devlink_dpipe_entry_ctx_close(struct devlink_dpipe_dump_ctx *dump_ctx);
561 void devlink_dpipe_entry_clear(struct devlink_dpipe_entry *entry);
562 int devlink_dpipe_action_put(struct sk_buff *skb,
563 struct devlink_dpipe_action *action);
564 int devlink_dpipe_match_put(struct sk_buff *skb,
565 struct devlink_dpipe_match *match);
566 extern struct devlink_dpipe_header devlink_dpipe_header_ethernet;
567 extern struct devlink_dpipe_header devlink_dpipe_header_ipv4;
568 extern struct devlink_dpipe_header devlink_dpipe_header_ipv6;
570 int devlink_resource_register(struct devlink *devlink,
571 const char *resource_name,
574 u64 parent_resource_id,
575 const struct devlink_resource_size_params *size_params);
576 void devlink_resources_unregister(struct devlink *devlink,
577 struct devlink_resource *resource);
578 int devlink_resource_size_get(struct devlink *devlink,
580 u64 *p_resource_size);
581 int devlink_dpipe_table_resource_set(struct devlink *devlink,
582 const char *table_name, u64 resource_id,
584 void devlink_resource_occ_get_register(struct devlink *devlink,
586 devlink_resource_occ_get_t *occ_get,
588 void devlink_resource_occ_get_unregister(struct devlink *devlink,
590 int devlink_params_register(struct devlink *devlink,
591 const struct devlink_param *params,
592 size_t params_count);
593 void devlink_params_unregister(struct devlink *devlink,
594 const struct devlink_param *params,
595 size_t params_count);
596 int devlink_port_params_register(struct devlink_port *devlink_port,
597 const struct devlink_param *params,
598 size_t params_count);
599 void devlink_port_params_unregister(struct devlink_port *devlink_port,
600 const struct devlink_param *params,
601 size_t params_count);
602 int devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id,
603 union devlink_param_value *init_val);
604 int devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id,
605 union devlink_param_value init_val);
607 devlink_port_param_driverinit_value_get(struct devlink_port *devlink_port,
609 union devlink_param_value *init_val);
610 int devlink_port_param_driverinit_value_set(struct devlink_port *devlink_port,
612 union devlink_param_value init_val);
613 void devlink_param_value_changed(struct devlink *devlink, u32 param_id);
614 void devlink_port_param_value_changed(struct devlink_port *devlink_port,
616 void devlink_param_value_str_fill(union devlink_param_value *dst_val,
618 struct devlink_region *devlink_region_create(struct devlink *devlink,
619 const char *region_name,
620 u32 region_max_snapshots,
622 void devlink_region_destroy(struct devlink_region *region);
623 u32 devlink_region_shapshot_id_get(struct devlink *devlink);
624 int devlink_region_snapshot_create(struct devlink_region *region, u64 data_len,
625 u8 *data, u32 snapshot_id,
626 devlink_snapshot_data_dest_t *data_destructor);
627 int devlink_info_serial_number_put(struct devlink_info_req *req,
629 int devlink_info_driver_name_put(struct devlink_info_req *req,
631 int devlink_info_version_fixed_put(struct devlink_info_req *req,
632 const char *version_name,
633 const char *version_value);
634 int devlink_info_version_stored_put(struct devlink_info_req *req,
635 const char *version_name,
636 const char *version_value);
637 int devlink_info_version_running_put(struct devlink_info_req *req,
638 const char *version_name,
639 const char *version_value);
643 static inline struct devlink *devlink_alloc(const struct devlink_ops *ops,
646 return kzalloc(sizeof(struct devlink) + priv_size, GFP_KERNEL);
649 static inline int devlink_register(struct devlink *devlink, struct device *dev)
654 static inline void devlink_unregister(struct devlink *devlink)
658 static inline void devlink_free(struct devlink *devlink)
663 static inline int devlink_port_register(struct devlink *devlink,
664 struct devlink_port *devlink_port,
665 unsigned int port_index)
670 static inline void devlink_port_unregister(struct devlink_port *devlink_port)
674 static inline void devlink_port_type_eth_set(struct devlink_port *devlink_port,
675 struct net_device *netdev)
679 static inline void devlink_port_type_ib_set(struct devlink_port *devlink_port,
680 struct ib_device *ibdev)
684 static inline void devlink_port_type_clear(struct devlink_port *devlink_port)
688 static inline void devlink_port_attrs_set(struct devlink_port *devlink_port,
689 enum devlink_port_flavour flavour,
690 u32 port_number, bool split,
691 u32 split_subport_number)
696 devlink_port_get_phys_port_name(struct devlink_port *devlink_port,
697 char *name, size_t len)
702 static inline int devlink_sb_register(struct devlink *devlink,
703 unsigned int sb_index, u32 size,
704 u16 ingress_pools_count,
705 u16 egress_pools_count,
706 u16 ingress_tc_count,
712 static inline void devlink_sb_unregister(struct devlink *devlink,
713 unsigned int sb_index)
718 devlink_dpipe_table_register(struct devlink *devlink,
719 const char *table_name,
720 struct devlink_dpipe_table_ops *table_ops,
721 void *priv, bool counter_control_extern)
726 static inline void devlink_dpipe_table_unregister(struct devlink *devlink,
727 const char *table_name)
731 static inline int devlink_dpipe_headers_register(struct devlink *devlink,
732 struct devlink_dpipe_headers *
738 static inline void devlink_dpipe_headers_unregister(struct devlink *devlink)
742 static inline bool devlink_dpipe_table_counter_enabled(struct devlink *devlink,
743 const char *table_name)
749 devlink_dpipe_entry_ctx_prepare(struct devlink_dpipe_dump_ctx *dump_ctx)
755 devlink_dpipe_entry_ctx_append(struct devlink_dpipe_dump_ctx *dump_ctx,
756 struct devlink_dpipe_entry *entry)
762 devlink_dpipe_entry_ctx_close(struct devlink_dpipe_dump_ctx *dump_ctx)
768 devlink_dpipe_entry_clear(struct devlink_dpipe_entry *entry)
773 devlink_dpipe_action_put(struct sk_buff *skb,
774 struct devlink_dpipe_action *action)
780 devlink_dpipe_match_put(struct sk_buff *skb,
781 struct devlink_dpipe_match *match)
787 devlink_resource_register(struct devlink *devlink,
788 const char *resource_name,
791 u64 parent_resource_id,
792 const struct devlink_resource_size_params *size_params)
798 devlink_resources_unregister(struct devlink *devlink,
799 struct devlink_resource *resource)
804 devlink_resource_size_get(struct devlink *devlink, u64 resource_id,
805 u64 *p_resource_size)
811 devlink_dpipe_table_resource_set(struct devlink *devlink,
812 const char *table_name, u64 resource_id,
819 devlink_resource_occ_get_register(struct devlink *devlink,
821 devlink_resource_occ_get_t *occ_get,
827 devlink_resource_occ_get_unregister(struct devlink *devlink,
833 devlink_params_register(struct devlink *devlink,
834 const struct devlink_param *params,
841 devlink_params_unregister(struct devlink *devlink,
842 const struct devlink_param *params,
849 devlink_port_params_register(struct devlink_port *devlink_port,
850 const struct devlink_param *params,
857 devlink_port_params_unregister(struct devlink_port *devlink_port,
858 const struct devlink_param *params,
864 devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id,
865 union devlink_param_value *init_val)
871 devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id,
872 union devlink_param_value init_val)
878 devlink_port_param_driverinit_value_get(struct devlink_port *devlink_port,
880 union devlink_param_value *init_val)
886 devlink_port_param_driverinit_value_set(struct devlink_port *devlink_port,
888 union devlink_param_value init_val)
894 devlink_param_value_changed(struct devlink *devlink, u32 param_id)
899 devlink_port_param_value_changed(struct devlink_port *devlink_port,
905 devlink_param_value_str_fill(union devlink_param_value *dst_val,
910 static inline struct devlink_region *
911 devlink_region_create(struct devlink *devlink,
912 const char *region_name,
913 u32 region_max_snapshots,
920 devlink_region_destroy(struct devlink_region *region)
925 devlink_region_shapshot_id_get(struct devlink *devlink)
931 devlink_region_snapshot_create(struct devlink_region *region, u64 data_len,
932 u8 *data, u32 snapshot_id,
933 devlink_snapshot_data_dest_t *data_destructor)
939 devlink_info_driver_name_put(struct devlink_info_req *req, const char *name)
945 devlink_info_serial_number_put(struct devlink_info_req *req, const char *sn)
951 devlink_info_version_fixed_put(struct devlink_info_req *req,
952 const char *version_name,
953 const char *version_value)
959 devlink_info_version_stored_put(struct devlink_info_req *req,
960 const char *version_name,
961 const char *version_value)
967 devlink_info_version_running_put(struct devlink_info_req *req,
968 const char *version_name,
969 const char *version_value)
975 #endif /* _NET_DEVLINK_H_ */