Jiri Pirko | bfcd3a4 | 2016-02-26 17:32:23 +0100 | [diff] [blame] | 1 | /* |
| 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> |
| 5 | * |
| 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. |
| 10 | */ |
| 11 | #ifndef _NET_DEVLINK_H_ |
| 12 | #define _NET_DEVLINK_H_ |
| 13 | |
| 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> |
Jiri Pirko | b8f9755 | 2019-03-24 11:14:37 +0100 | [diff] [blame^] | 19 | #include <linux/spinlock.h> |
Jiri Pirko | bfcd3a4 | 2016-02-26 17:32:23 +0100 | [diff] [blame] | 20 | #include <net/net_namespace.h> |
| 21 | #include <uapi/linux/devlink.h> |
| 22 | |
| 23 | struct devlink_ops; |
| 24 | |
| 25 | struct devlink { |
| 26 | struct list_head list; |
| 27 | struct list_head port_list; |
Jiri Pirko | bf79747 | 2016-04-14 18:19:13 +0200 | [diff] [blame] | 28 | struct list_head sb_list; |
Arkadi Sharshevsky | 1555d20 | 2017-03-28 17:24:10 +0200 | [diff] [blame] | 29 | struct list_head dpipe_table_list; |
Arkadi Sharshevsky | d9f9b9a | 2018-01-15 08:59:03 +0100 | [diff] [blame] | 30 | struct list_head resource_list; |
Moshe Shemesh | eabaef1 | 2018-07-04 14:30:28 +0300 | [diff] [blame] | 31 | struct list_head param_list; |
Alex Vesker | b16ebe9 | 2018-07-12 15:13:08 +0300 | [diff] [blame] | 32 | struct list_head region_list; |
Alex Vesker | ccadfa4 | 2018-07-12 15:13:09 +0300 | [diff] [blame] | 33 | u32 snapshot_id; |
Eran Ben Elisha | a0bdcc5 | 2019-02-07 11:36:33 +0200 | [diff] [blame] | 34 | struct list_head reporter_list; |
Arkadi Sharshevsky | 1555d20 | 2017-03-28 17:24:10 +0200 | [diff] [blame] | 35 | struct devlink_dpipe_headers *dpipe_headers; |
Jiri Pirko | bfcd3a4 | 2016-02-26 17:32:23 +0100 | [diff] [blame] | 36 | const struct devlink_ops *ops; |
| 37 | struct device *dev; |
| 38 | possible_net_t _net; |
Arkadi Sharshevsky | 2406e7e | 2018-01-15 08:59:02 +0100 | [diff] [blame] | 39 | struct mutex lock; |
Jiri Pirko | bfcd3a4 | 2016-02-26 17:32:23 +0100 | [diff] [blame] | 40 | char priv[0] __aligned(NETDEV_ALIGN); |
| 41 | }; |
| 42 | |
Jiri Pirko | b9ffcba | 2018-05-18 09:29:00 +0200 | [diff] [blame] | 43 | struct devlink_port_attrs { |
| 44 | bool set; |
Jiri Pirko | 5ec1380 | 2018-05-18 09:29:01 +0200 | [diff] [blame] | 45 | enum devlink_port_flavour flavour; |
Jiri Pirko | b9ffcba | 2018-05-18 09:29:00 +0200 | [diff] [blame] | 46 | u32 port_number; /* same value as "split group" */ |
| 47 | bool split; |
| 48 | u32 split_subport_number; |
| 49 | }; |
| 50 | |
Jiri Pirko | bfcd3a4 | 2016-02-26 17:32:23 +0100 | [diff] [blame] | 51 | struct devlink_port { |
| 52 | struct list_head list; |
Vasundhara Volam | 39e6160 | 2019-01-28 18:00:20 +0530 | [diff] [blame] | 53 | struct list_head param_list; |
Jiri Pirko | bfcd3a4 | 2016-02-26 17:32:23 +0100 | [diff] [blame] | 54 | struct devlink *devlink; |
| 55 | unsigned index; |
| 56 | bool registered; |
Jiri Pirko | b8f9755 | 2019-03-24 11:14:37 +0100 | [diff] [blame^] | 57 | spinlock_t type_lock; /* Protects type and type_dev |
| 58 | * pointer consistency. |
| 59 | */ |
Jiri Pirko | bfcd3a4 | 2016-02-26 17:32:23 +0100 | [diff] [blame] | 60 | enum devlink_port_type type; |
| 61 | enum devlink_port_type desired_type; |
| 62 | void *type_dev; |
Jiri Pirko | b9ffcba | 2018-05-18 09:29:00 +0200 | [diff] [blame] | 63 | struct devlink_port_attrs attrs; |
Jiri Pirko | bfcd3a4 | 2016-02-26 17:32:23 +0100 | [diff] [blame] | 64 | }; |
| 65 | |
Jiri Pirko | bf79747 | 2016-04-14 18:19:13 +0200 | [diff] [blame] | 66 | struct devlink_sb_pool_info { |
| 67 | enum devlink_sb_pool_type pool_type; |
| 68 | u32 size; |
| 69 | enum devlink_sb_threshold_type threshold_type; |
Jakub Kicinski | bff5731 | 2019-02-01 17:56:28 -0800 | [diff] [blame] | 70 | u32 cell_size; |
Jiri Pirko | bf79747 | 2016-04-14 18:19:13 +0200 | [diff] [blame] | 71 | }; |
| 72 | |
Arkadi Sharshevsky | 1555d20 | 2017-03-28 17:24:10 +0200 | [diff] [blame] | 73 | /** |
| 74 | * struct devlink_dpipe_field - dpipe field object |
| 75 | * @name: field name |
| 76 | * @id: index inside the headers field array |
| 77 | * @bitwidth: bitwidth |
| 78 | * @mapping_type: mapping type |
| 79 | */ |
| 80 | struct devlink_dpipe_field { |
| 81 | const char *name; |
| 82 | unsigned int id; |
| 83 | unsigned int bitwidth; |
| 84 | enum devlink_dpipe_field_mapping_type mapping_type; |
| 85 | }; |
| 86 | |
| 87 | /** |
| 88 | * struct devlink_dpipe_header - dpipe header object |
| 89 | * @name: header name |
| 90 | * @id: index, global/local detrmined by global bit |
| 91 | * @fields: fields |
| 92 | * @fields_count: number of fields |
| 93 | * @global: indicates if header is shared like most protocol header |
| 94 | * or driver specific |
| 95 | */ |
| 96 | struct devlink_dpipe_header { |
| 97 | const char *name; |
| 98 | unsigned int id; |
| 99 | struct devlink_dpipe_field *fields; |
| 100 | unsigned int fields_count; |
| 101 | bool global; |
| 102 | }; |
| 103 | |
| 104 | /** |
| 105 | * struct devlink_dpipe_match - represents match operation |
| 106 | * @type: type of match |
| 107 | * @header_index: header index (packets can have several headers of same |
| 108 | * type like in case of tunnels) |
| 109 | * @header: header |
| 110 | * @fieled_id: field index |
| 111 | */ |
| 112 | struct devlink_dpipe_match { |
| 113 | enum devlink_dpipe_match_type type; |
| 114 | unsigned int header_index; |
| 115 | struct devlink_dpipe_header *header; |
| 116 | unsigned int field_id; |
| 117 | }; |
| 118 | |
| 119 | /** |
| 120 | * struct devlink_dpipe_action - represents action operation |
| 121 | * @type: type of action |
| 122 | * @header_index: header index (packets can have several headers of same |
| 123 | * type like in case of tunnels) |
| 124 | * @header: header |
| 125 | * @fieled_id: field index |
| 126 | */ |
| 127 | struct devlink_dpipe_action { |
| 128 | enum devlink_dpipe_action_type type; |
| 129 | unsigned int header_index; |
| 130 | struct devlink_dpipe_header *header; |
| 131 | unsigned int field_id; |
| 132 | }; |
| 133 | |
| 134 | /** |
| 135 | * struct devlink_dpipe_value - represents value of match/action |
| 136 | * @action: action |
| 137 | * @match: match |
| 138 | * @mapping_value: in case the field has some mapping this value |
| 139 | * specified the mapping value |
| 140 | * @mapping_valid: specify if mapping value is valid |
| 141 | * @value_size: value size |
| 142 | * @value: value |
| 143 | * @mask: bit mask |
| 144 | */ |
| 145 | struct devlink_dpipe_value { |
| 146 | union { |
| 147 | struct devlink_dpipe_action *action; |
| 148 | struct devlink_dpipe_match *match; |
| 149 | }; |
| 150 | unsigned int mapping_value; |
| 151 | bool mapping_valid; |
| 152 | unsigned int value_size; |
| 153 | void *value; |
| 154 | void *mask; |
| 155 | }; |
| 156 | |
| 157 | /** |
| 158 | * struct devlink_dpipe_entry - table entry object |
| 159 | * @index: index of the entry in the table |
| 160 | * @match_values: match values |
| 161 | * @matche_values_count: count of matches tuples |
| 162 | * @action_values: actions values |
| 163 | * @action_values_count: count of actions values |
| 164 | * @counter: value of counter |
| 165 | * @counter_valid: Specify if value is valid from hardware |
| 166 | */ |
| 167 | struct devlink_dpipe_entry { |
| 168 | u64 index; |
| 169 | struct devlink_dpipe_value *match_values; |
| 170 | unsigned int match_values_count; |
| 171 | struct devlink_dpipe_value *action_values; |
| 172 | unsigned int action_values_count; |
| 173 | u64 counter; |
| 174 | bool counter_valid; |
| 175 | }; |
| 176 | |
| 177 | /** |
| 178 | * struct devlink_dpipe_dump_ctx - context provided to driver in order |
| 179 | * to dump |
| 180 | * @info: info |
| 181 | * @cmd: devlink command |
| 182 | * @skb: skb |
| 183 | * @nest: top attribute |
| 184 | * @hdr: hdr |
| 185 | */ |
| 186 | struct devlink_dpipe_dump_ctx { |
| 187 | struct genl_info *info; |
| 188 | enum devlink_command cmd; |
| 189 | struct sk_buff *skb; |
| 190 | struct nlattr *nest; |
| 191 | void *hdr; |
| 192 | }; |
| 193 | |
| 194 | struct devlink_dpipe_table_ops; |
| 195 | |
| 196 | /** |
| 197 | * struct devlink_dpipe_table - table object |
| 198 | * @priv: private |
| 199 | * @name: table name |
Arkadi Sharshevsky | 1555d20 | 2017-03-28 17:24:10 +0200 | [diff] [blame] | 200 | * @counters_enabled: indicates if counters are active |
| 201 | * @counter_control_extern: indicates if counter control is in dpipe or |
| 202 | * external tool |
Arkadi Sharshevsky | 56dc7cd | 2018-01-15 08:59:05 +0100 | [diff] [blame] | 203 | * @resource_valid: Indicate that the resource id is valid |
| 204 | * @resource_id: relative resource this table is related to |
| 205 | * @resource_units: number of resource's unit consumed per table's entry |
Arkadi Sharshevsky | 1555d20 | 2017-03-28 17:24:10 +0200 | [diff] [blame] | 206 | * @table_ops: table operations |
| 207 | * @rcu: rcu |
| 208 | */ |
| 209 | struct devlink_dpipe_table { |
| 210 | void *priv; |
| 211 | struct list_head list; |
| 212 | const char *name; |
Arkadi Sharshevsky | 1555d20 | 2017-03-28 17:24:10 +0200 | [diff] [blame] | 213 | bool counters_enabled; |
| 214 | bool counter_control_extern; |
Arkadi Sharshevsky | 56dc7cd | 2018-01-15 08:59:05 +0100 | [diff] [blame] | 215 | bool resource_valid; |
| 216 | u64 resource_id; |
| 217 | u64 resource_units; |
Arkadi Sharshevsky | 1555d20 | 2017-03-28 17:24:10 +0200 | [diff] [blame] | 218 | struct devlink_dpipe_table_ops *table_ops; |
| 219 | struct rcu_head rcu; |
| 220 | }; |
| 221 | |
| 222 | /** |
| 223 | * struct devlink_dpipe_table_ops - dpipe_table ops |
| 224 | * @actions_dump - dumps all tables actions |
| 225 | * @matches_dump - dumps all tables matches |
| 226 | * @entries_dump - dumps all active entries in the table |
| 227 | * @counters_set_update - when changing the counter status hardware sync |
| 228 | * maybe needed to allocate/free counter related |
| 229 | * resources |
Arkadi Sharshevsky | ffd3cdc | 2017-08-24 08:40:02 +0200 | [diff] [blame] | 230 | * @size_get - get size |
Arkadi Sharshevsky | 1555d20 | 2017-03-28 17:24:10 +0200 | [diff] [blame] | 231 | */ |
| 232 | struct devlink_dpipe_table_ops { |
| 233 | int (*actions_dump)(void *priv, struct sk_buff *skb); |
| 234 | int (*matches_dump)(void *priv, struct sk_buff *skb); |
| 235 | int (*entries_dump)(void *priv, bool counters_enabled, |
| 236 | struct devlink_dpipe_dump_ctx *dump_ctx); |
| 237 | int (*counters_set_update)(void *priv, bool enable); |
Arkadi Sharshevsky | ffd3cdc | 2017-08-24 08:40:02 +0200 | [diff] [blame] | 238 | u64 (*size_get)(void *priv); |
Arkadi Sharshevsky | 1555d20 | 2017-03-28 17:24:10 +0200 | [diff] [blame] | 239 | }; |
| 240 | |
| 241 | /** |
| 242 | * struct devlink_dpipe_headers - dpipe headers |
| 243 | * @headers - header array can be shared (global bit) or driver specific |
| 244 | * @headers_count - count of headers |
| 245 | */ |
| 246 | struct devlink_dpipe_headers { |
| 247 | struct devlink_dpipe_header **headers; |
| 248 | unsigned int headers_count; |
| 249 | }; |
| 250 | |
Arkadi Sharshevsky | d9f9b9a | 2018-01-15 08:59:03 +0100 | [diff] [blame] | 251 | /** |
Arkadi Sharshevsky | d9f9b9a | 2018-01-15 08:59:03 +0100 | [diff] [blame] | 252 | * struct devlink_resource_size_params - resource's size parameters |
| 253 | * @size_min: minimum size which can be set |
| 254 | * @size_max: maximum size which can be set |
| 255 | * @size_granularity: size granularity |
| 256 | * @size_unit: resource's basic unit |
| 257 | */ |
| 258 | struct devlink_resource_size_params { |
| 259 | u64 size_min; |
| 260 | u64 size_max; |
| 261 | u64 size_granularity; |
| 262 | enum devlink_resource_unit unit; |
| 263 | }; |
| 264 | |
Jiri Pirko | 77d2709 | 2018-02-28 13:12:09 +0100 | [diff] [blame] | 265 | static inline void |
| 266 | devlink_resource_size_params_init(struct devlink_resource_size_params *size_params, |
| 267 | u64 size_min, u64 size_max, |
| 268 | u64 size_granularity, |
| 269 | enum devlink_resource_unit unit) |
| 270 | { |
| 271 | size_params->size_min = size_min; |
| 272 | size_params->size_max = size_max; |
| 273 | size_params->size_granularity = size_granularity; |
| 274 | size_params->unit = unit; |
| 275 | } |
| 276 | |
Jiri Pirko | fc56be4 | 2018-04-05 22:13:21 +0200 | [diff] [blame] | 277 | typedef u64 devlink_resource_occ_get_t(void *priv); |
| 278 | |
Arkadi Sharshevsky | d9f9b9a | 2018-01-15 08:59:03 +0100 | [diff] [blame] | 279 | /** |
| 280 | * struct devlink_resource - devlink resource |
| 281 | * @name: name of the resource |
| 282 | * @id: id, per devlink instance |
| 283 | * @size: size of the resource |
| 284 | * @size_new: updated size of the resource, reload is needed |
| 285 | * @size_valid: valid in case the total size of the resource is valid |
| 286 | * including its children |
| 287 | * @parent: parent resource |
| 288 | * @size_params: size parameters |
| 289 | * @list: parent list |
| 290 | * @resource_list: list of child resources |
Arkadi Sharshevsky | d9f9b9a | 2018-01-15 08:59:03 +0100 | [diff] [blame] | 291 | */ |
| 292 | struct devlink_resource { |
| 293 | const char *name; |
| 294 | u64 id; |
| 295 | u64 size; |
| 296 | u64 size_new; |
| 297 | bool size_valid; |
| 298 | struct devlink_resource *parent; |
Jiri Pirko | 77d2709 | 2018-02-28 13:12:09 +0100 | [diff] [blame] | 299 | struct devlink_resource_size_params size_params; |
Arkadi Sharshevsky | d9f9b9a | 2018-01-15 08:59:03 +0100 | [diff] [blame] | 300 | struct list_head list; |
| 301 | struct list_head resource_list; |
Jiri Pirko | fc56be4 | 2018-04-05 22:13:21 +0200 | [diff] [blame] | 302 | devlink_resource_occ_get_t *occ_get; |
| 303 | void *occ_get_priv; |
Arkadi Sharshevsky | d9f9b9a | 2018-01-15 08:59:03 +0100 | [diff] [blame] | 304 | }; |
| 305 | |
| 306 | #define DEVLINK_RESOURCE_ID_PARENT_TOP 0 |
| 307 | |
Moshe Shemesh | bde74ad1 | 2018-10-10 16:09:27 +0300 | [diff] [blame] | 308 | #define __DEVLINK_PARAM_MAX_STRING_VALUE 32 |
Moshe Shemesh | eabaef1 | 2018-07-04 14:30:28 +0300 | [diff] [blame] | 309 | enum devlink_param_type { |
| 310 | DEVLINK_PARAM_TYPE_U8, |
| 311 | DEVLINK_PARAM_TYPE_U16, |
| 312 | DEVLINK_PARAM_TYPE_U32, |
| 313 | DEVLINK_PARAM_TYPE_STRING, |
| 314 | DEVLINK_PARAM_TYPE_BOOL, |
| 315 | }; |
| 316 | |
| 317 | union devlink_param_value { |
| 318 | u8 vu8; |
| 319 | u16 vu16; |
| 320 | u32 vu32; |
Moshe Shemesh | bde74ad1 | 2018-10-10 16:09:27 +0300 | [diff] [blame] | 321 | char vstr[__DEVLINK_PARAM_MAX_STRING_VALUE]; |
Moshe Shemesh | eabaef1 | 2018-07-04 14:30:28 +0300 | [diff] [blame] | 322 | bool vbool; |
| 323 | }; |
| 324 | |
| 325 | struct devlink_param_gset_ctx { |
| 326 | union devlink_param_value val; |
| 327 | enum devlink_param_cmode cmode; |
| 328 | }; |
| 329 | |
| 330 | /** |
| 331 | * struct devlink_param - devlink configuration parameter data |
| 332 | * @name: name of the parameter |
| 333 | * @generic: indicates if the parameter is generic or driver specific |
| 334 | * @type: parameter type |
| 335 | * @supported_cmodes: bitmap of supported configuration modes |
| 336 | * @get: get parameter value, used for runtime and permanent |
| 337 | * configuration modes |
| 338 | * @set: set parameter value, used for runtime and permanent |
| 339 | * configuration modes |
Moshe Shemesh | e3b7ca1 | 2018-07-04 14:30:30 +0300 | [diff] [blame] | 340 | * @validate: validate input value is applicable (within value range, etc.) |
Moshe Shemesh | eabaef1 | 2018-07-04 14:30:28 +0300 | [diff] [blame] | 341 | * |
| 342 | * This struct should be used by the driver to fill the data for |
| 343 | * a parameter it registers. |
| 344 | */ |
| 345 | struct devlink_param { |
| 346 | u32 id; |
| 347 | const char *name; |
| 348 | bool generic; |
| 349 | enum devlink_param_type type; |
| 350 | unsigned long supported_cmodes; |
| 351 | int (*get)(struct devlink *devlink, u32 id, |
| 352 | struct devlink_param_gset_ctx *ctx); |
| 353 | int (*set)(struct devlink *devlink, u32 id, |
| 354 | struct devlink_param_gset_ctx *ctx); |
Moshe Shemesh | e3b7ca1 | 2018-07-04 14:30:30 +0300 | [diff] [blame] | 355 | int (*validate)(struct devlink *devlink, u32 id, |
| 356 | union devlink_param_value val, |
| 357 | struct netlink_ext_ack *extack); |
Moshe Shemesh | eabaef1 | 2018-07-04 14:30:28 +0300 | [diff] [blame] | 358 | }; |
| 359 | |
| 360 | struct devlink_param_item { |
| 361 | struct list_head list; |
| 362 | const struct devlink_param *param; |
| 363 | union devlink_param_value driverinit_value; |
| 364 | bool driverinit_value_valid; |
Jiri Pirko | 7c62cfb | 2019-02-07 11:22:45 +0000 | [diff] [blame] | 365 | bool published; |
Moshe Shemesh | eabaef1 | 2018-07-04 14:30:28 +0300 | [diff] [blame] | 366 | }; |
| 367 | |
| 368 | enum devlink_param_generic_id { |
Moshe Shemesh | 036467c | 2018-07-04 14:30:33 +0300 | [diff] [blame] | 369 | DEVLINK_PARAM_GENERIC_ID_INT_ERR_RESET, |
| 370 | DEVLINK_PARAM_GENERIC_ID_MAX_MACS, |
Vasundhara Volam | f567bcd | 2018-07-04 14:30:36 +0300 | [diff] [blame] | 371 | DEVLINK_PARAM_GENERIC_ID_ENABLE_SRIOV, |
Alex Vesker | f6a69885 | 2018-07-12 15:13:17 +0300 | [diff] [blame] | 372 | DEVLINK_PARAM_GENERIC_ID_REGION_SNAPSHOT, |
Vasundhara Volam | e3b5106 | 2018-10-04 11:13:44 +0530 | [diff] [blame] | 373 | DEVLINK_PARAM_GENERIC_ID_IGNORE_ARI, |
Vasundhara Volam | f61cba4 | 2018-10-04 11:13:45 +0530 | [diff] [blame] | 374 | DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MAX, |
Vasundhara Volam | 1651178 | 2018-10-04 11:13:46 +0530 | [diff] [blame] | 375 | DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MIN, |
Shalom Toledo | 846e980 | 2018-12-03 07:58:59 +0000 | [diff] [blame] | 376 | DEVLINK_PARAM_GENERIC_ID_FW_LOAD_POLICY, |
Moshe Shemesh | eabaef1 | 2018-07-04 14:30:28 +0300 | [diff] [blame] | 377 | |
| 378 | /* add new param generic ids above here*/ |
| 379 | __DEVLINK_PARAM_GENERIC_ID_MAX, |
| 380 | DEVLINK_PARAM_GENERIC_ID_MAX = __DEVLINK_PARAM_GENERIC_ID_MAX - 1, |
| 381 | }; |
| 382 | |
Moshe Shemesh | 036467c | 2018-07-04 14:30:33 +0300 | [diff] [blame] | 383 | #define DEVLINK_PARAM_GENERIC_INT_ERR_RESET_NAME "internal_error_reset" |
| 384 | #define DEVLINK_PARAM_GENERIC_INT_ERR_RESET_TYPE DEVLINK_PARAM_TYPE_BOOL |
| 385 | |
| 386 | #define DEVLINK_PARAM_GENERIC_MAX_MACS_NAME "max_macs" |
| 387 | #define DEVLINK_PARAM_GENERIC_MAX_MACS_TYPE DEVLINK_PARAM_TYPE_U32 |
| 388 | |
Vasundhara Volam | f567bcd | 2018-07-04 14:30:36 +0300 | [diff] [blame] | 389 | #define DEVLINK_PARAM_GENERIC_ENABLE_SRIOV_NAME "enable_sriov" |
| 390 | #define DEVLINK_PARAM_GENERIC_ENABLE_SRIOV_TYPE DEVLINK_PARAM_TYPE_BOOL |
| 391 | |
Alex Vesker | f6a69885 | 2018-07-12 15:13:17 +0300 | [diff] [blame] | 392 | #define DEVLINK_PARAM_GENERIC_REGION_SNAPSHOT_NAME "region_snapshot_enable" |
| 393 | #define DEVLINK_PARAM_GENERIC_REGION_SNAPSHOT_TYPE DEVLINK_PARAM_TYPE_BOOL |
| 394 | |
Vasundhara Volam | e3b5106 | 2018-10-04 11:13:44 +0530 | [diff] [blame] | 395 | #define DEVLINK_PARAM_GENERIC_IGNORE_ARI_NAME "ignore_ari" |
| 396 | #define DEVLINK_PARAM_GENERIC_IGNORE_ARI_TYPE DEVLINK_PARAM_TYPE_BOOL |
| 397 | |
Vasundhara Volam | f61cba4 | 2018-10-04 11:13:45 +0530 | [diff] [blame] | 398 | #define DEVLINK_PARAM_GENERIC_MSIX_VEC_PER_PF_MAX_NAME "msix_vec_per_pf_max" |
| 399 | #define DEVLINK_PARAM_GENERIC_MSIX_VEC_PER_PF_MAX_TYPE DEVLINK_PARAM_TYPE_U32 |
| 400 | |
Vasundhara Volam | 1651178 | 2018-10-04 11:13:46 +0530 | [diff] [blame] | 401 | #define DEVLINK_PARAM_GENERIC_MSIX_VEC_PER_PF_MIN_NAME "msix_vec_per_pf_min" |
| 402 | #define DEVLINK_PARAM_GENERIC_MSIX_VEC_PER_PF_MIN_TYPE DEVLINK_PARAM_TYPE_U32 |
| 403 | |
Shalom Toledo | 846e980 | 2018-12-03 07:58:59 +0000 | [diff] [blame] | 404 | #define DEVLINK_PARAM_GENERIC_FW_LOAD_POLICY_NAME "fw_load_policy" |
| 405 | #define DEVLINK_PARAM_GENERIC_FW_LOAD_POLICY_TYPE DEVLINK_PARAM_TYPE_U8 |
| 406 | |
Moshe Shemesh | 036467c | 2018-07-04 14:30:33 +0300 | [diff] [blame] | 407 | #define DEVLINK_PARAM_GENERIC(_id, _cmodes, _get, _set, _validate) \ |
| 408 | { \ |
| 409 | .id = DEVLINK_PARAM_GENERIC_ID_##_id, \ |
| 410 | .name = DEVLINK_PARAM_GENERIC_##_id##_NAME, \ |
| 411 | .type = DEVLINK_PARAM_GENERIC_##_id##_TYPE, \ |
| 412 | .generic = true, \ |
| 413 | .supported_cmodes = _cmodes, \ |
| 414 | .get = _get, \ |
| 415 | .set = _set, \ |
| 416 | .validate = _validate, \ |
| 417 | } |
| 418 | |
| 419 | #define DEVLINK_PARAM_DRIVER(_id, _name, _type, _cmodes, _get, _set, _validate) \ |
| 420 | { \ |
| 421 | .id = _id, \ |
| 422 | .name = _name, \ |
| 423 | .type = _type, \ |
| 424 | .supported_cmodes = _cmodes, \ |
| 425 | .get = _get, \ |
| 426 | .set = _set, \ |
| 427 | .validate = _validate, \ |
| 428 | } |
| 429 | |
Jakub Kicinski | 785bd55 | 2019-01-31 10:50:42 -0800 | [diff] [blame] | 430 | /* Part number, identifier of board design */ |
| 431 | #define DEVLINK_INFO_VERSION_GENERIC_BOARD_ID "board.id" |
| 432 | /* Revision of board design */ |
| 433 | #define DEVLINK_INFO_VERSION_GENERIC_BOARD_REV "board.rev" |
Jakub Kicinski | 14fd190 | 2019-02-10 19:35:29 -0800 | [diff] [blame] | 434 | /* Maker of the board */ |
| 435 | #define DEVLINK_INFO_VERSION_GENERIC_BOARD_MANUFACTURE "board.manufacture" |
Jakub Kicinski | 785bd55 | 2019-01-31 10:50:42 -0800 | [diff] [blame] | 436 | |
| 437 | /* Control processor FW version */ |
| 438 | #define DEVLINK_INFO_VERSION_GENERIC_FW_MGMT "fw.mgmt" |
| 439 | /* Data path microcode controlling high-speed packet processing */ |
| 440 | #define DEVLINK_INFO_VERSION_GENERIC_FW_APP "fw.app" |
| 441 | /* UNDI software version */ |
| 442 | #define DEVLINK_INFO_VERSION_GENERIC_FW_UNDI "fw.undi" |
| 443 | /* NCSI support/handler version */ |
| 444 | #define DEVLINK_INFO_VERSION_GENERIC_FW_NCSI "fw.ncsi" |
| 445 | |
Alex Vesker | b16ebe9 | 2018-07-12 15:13:08 +0300 | [diff] [blame] | 446 | struct devlink_region; |
Jakub Kicinski | f9cf228 | 2019-01-31 10:50:40 -0800 | [diff] [blame] | 447 | struct devlink_info_req; |
Alex Vesker | b16ebe9 | 2018-07-12 15:13:08 +0300 | [diff] [blame] | 448 | |
Alex Vesker | d7e5272 | 2018-07-12 15:13:10 +0300 | [diff] [blame] | 449 | typedef void devlink_snapshot_data_dest_t(const void *data); |
| 450 | |
Eran Ben Elisha | 1db64e8 | 2019-02-07 11:36:32 +0200 | [diff] [blame] | 451 | struct devlink_fmsg; |
Eran Ben Elisha | a0bdcc5 | 2019-02-07 11:36:33 +0200 | [diff] [blame] | 452 | struct devlink_health_reporter; |
| 453 | |
Eran Ben Elisha | 3167b27 | 2019-03-03 10:57:30 +0200 | [diff] [blame] | 454 | enum devlink_health_reporter_state { |
| 455 | DEVLINK_HEALTH_REPORTER_STATE_HEALTHY, |
| 456 | DEVLINK_HEALTH_REPORTER_STATE_ERROR, |
| 457 | }; |
| 458 | |
Eran Ben Elisha | a0bdcc5 | 2019-02-07 11:36:33 +0200 | [diff] [blame] | 459 | /** |
| 460 | * struct devlink_health_reporter_ops - Reporter operations |
| 461 | * @name: reporter name |
| 462 | * @recover: callback to recover from reported error |
| 463 | * if priv_ctx is NULL, run a full recover |
| 464 | * @dump: callback to dump an object |
| 465 | * if priv_ctx is NULL, run a full dump |
| 466 | * @diagnose: callback to diagnose the current status |
| 467 | */ |
| 468 | |
| 469 | struct devlink_health_reporter_ops { |
| 470 | char *name; |
| 471 | int (*recover)(struct devlink_health_reporter *reporter, |
| 472 | void *priv_ctx); |
| 473 | int (*dump)(struct devlink_health_reporter *reporter, |
| 474 | struct devlink_fmsg *fmsg, void *priv_ctx); |
| 475 | int (*diagnose)(struct devlink_health_reporter *reporter, |
| 476 | struct devlink_fmsg *fmsg); |
| 477 | }; |
Eran Ben Elisha | 1db64e8 | 2019-02-07 11:36:32 +0200 | [diff] [blame] | 478 | |
Jiri Pirko | bfcd3a4 | 2016-02-26 17:32:23 +0100 | [diff] [blame] | 479 | struct devlink_ops { |
David Ahern | ac0fc8a | 2018-06-05 08:14:09 -0700 | [diff] [blame] | 480 | int (*reload)(struct devlink *devlink, struct netlink_ext_ack *extack); |
Jiri Pirko | bfcd3a4 | 2016-02-26 17:32:23 +0100 | [diff] [blame] | 481 | int (*port_type_set)(struct devlink_port *devlink_port, |
| 482 | enum devlink_port_type port_type); |
| 483 | int (*port_split)(struct devlink *devlink, unsigned int port_index, |
David Ahern | ac0fc8a | 2018-06-05 08:14:09 -0700 | [diff] [blame] | 484 | unsigned int count, struct netlink_ext_ack *extack); |
| 485 | int (*port_unsplit)(struct devlink *devlink, unsigned int port_index, |
| 486 | struct netlink_ext_ack *extack); |
Jiri Pirko | bf79747 | 2016-04-14 18:19:13 +0200 | [diff] [blame] | 487 | int (*sb_pool_get)(struct devlink *devlink, unsigned int sb_index, |
| 488 | u16 pool_index, |
| 489 | struct devlink_sb_pool_info *pool_info); |
| 490 | int (*sb_pool_set)(struct devlink *devlink, unsigned int sb_index, |
| 491 | u16 pool_index, u32 size, |
| 492 | enum devlink_sb_threshold_type threshold_type); |
| 493 | int (*sb_port_pool_get)(struct devlink_port *devlink_port, |
| 494 | unsigned int sb_index, u16 pool_index, |
| 495 | u32 *p_threshold); |
| 496 | int (*sb_port_pool_set)(struct devlink_port *devlink_port, |
| 497 | unsigned int sb_index, u16 pool_index, |
| 498 | u32 threshold); |
| 499 | int (*sb_tc_pool_bind_get)(struct devlink_port *devlink_port, |
| 500 | unsigned int sb_index, |
| 501 | u16 tc_index, |
| 502 | enum devlink_sb_pool_type pool_type, |
| 503 | u16 *p_pool_index, u32 *p_threshold); |
| 504 | int (*sb_tc_pool_bind_set)(struct devlink_port *devlink_port, |
| 505 | unsigned int sb_index, |
| 506 | u16 tc_index, |
| 507 | enum devlink_sb_pool_type pool_type, |
| 508 | u16 pool_index, u32 threshold); |
Jiri Pirko | df38daf | 2016-04-14 18:19:14 +0200 | [diff] [blame] | 509 | int (*sb_occ_snapshot)(struct devlink *devlink, |
| 510 | unsigned int sb_index); |
| 511 | int (*sb_occ_max_clear)(struct devlink *devlink, |
| 512 | unsigned int sb_index); |
| 513 | int (*sb_occ_port_pool_get)(struct devlink_port *devlink_port, |
| 514 | unsigned int sb_index, u16 pool_index, |
| 515 | u32 *p_cur, u32 *p_max); |
| 516 | int (*sb_occ_tc_port_bind_get)(struct devlink_port *devlink_port, |
| 517 | unsigned int sb_index, |
| 518 | u16 tc_index, |
| 519 | enum devlink_sb_pool_type pool_type, |
| 520 | u32 *p_cur, u32 *p_max); |
Or Gerlitz | 08f4b59 | 2016-07-01 14:51:01 +0300 | [diff] [blame] | 521 | |
| 522 | int (*eswitch_mode_get)(struct devlink *devlink, u16 *p_mode); |
Eli Britstein | db7ff19 | 2018-08-15 16:02:18 +0300 | [diff] [blame] | 523 | int (*eswitch_mode_set)(struct devlink *devlink, u16 mode, |
| 524 | struct netlink_ext_ack *extack); |
Roi Dayan | 59bfde0 | 2016-11-22 23:09:57 +0200 | [diff] [blame] | 525 | int (*eswitch_inline_mode_get)(struct devlink *devlink, u8 *p_inline_mode); |
Eli Britstein | db7ff19 | 2018-08-15 16:02:18 +0300 | [diff] [blame] | 526 | int (*eswitch_inline_mode_set)(struct devlink *devlink, u8 inline_mode, |
| 527 | struct netlink_ext_ack *extack); |
Roi Dayan | f43e9b0 | 2016-09-25 13:52:44 +0300 | [diff] [blame] | 528 | int (*eswitch_encap_mode_get)(struct devlink *devlink, u8 *p_encap_mode); |
Eli Britstein | db7ff19 | 2018-08-15 16:02:18 +0300 | [diff] [blame] | 529 | int (*eswitch_encap_mode_set)(struct devlink *devlink, u8 encap_mode, |
| 530 | struct netlink_ext_ack *extack); |
Jakub Kicinski | f9cf228 | 2019-01-31 10:50:40 -0800 | [diff] [blame] | 531 | int (*info_get)(struct devlink *devlink, struct devlink_info_req *req, |
| 532 | struct netlink_ext_ack *extack); |
Jakub Kicinski | 76726cc | 2019-02-14 13:40:44 -0800 | [diff] [blame] | 533 | int (*flash_update)(struct devlink *devlink, const char *file_name, |
| 534 | const char *component, |
| 535 | struct netlink_ext_ack *extack); |
Jiri Pirko | bfcd3a4 | 2016-02-26 17:32:23 +0100 | [diff] [blame] | 536 | }; |
| 537 | |
| 538 | static inline void *devlink_priv(struct devlink *devlink) |
| 539 | { |
| 540 | BUG_ON(!devlink); |
| 541 | return &devlink->priv; |
| 542 | } |
| 543 | |
| 544 | static inline struct devlink *priv_to_devlink(void *priv) |
| 545 | { |
| 546 | BUG_ON(!priv); |
| 547 | return container_of(priv, struct devlink, priv); |
| 548 | } |
| 549 | |
Jakub Kicinski | b473b0d | 2019-02-25 19:34:03 -0800 | [diff] [blame] | 550 | static inline struct devlink *netdev_to_devlink(struct net_device *dev) |
| 551 | { |
| 552 | #if IS_ENABLED(CONFIG_NET_DEVLINK) |
| 553 | if (dev->netdev_ops->ndo_get_devlink) |
| 554 | return dev->netdev_ops->ndo_get_devlink(dev); |
| 555 | #endif |
| 556 | return NULL; |
| 557 | } |
| 558 | |
Jiri Pirko | bfcd3a4 | 2016-02-26 17:32:23 +0100 | [diff] [blame] | 559 | struct ib_device; |
| 560 | |
| 561 | #if IS_ENABLED(CONFIG_NET_DEVLINK) |
| 562 | |
| 563 | struct devlink *devlink_alloc(const struct devlink_ops *ops, size_t priv_size); |
| 564 | int devlink_register(struct devlink *devlink, struct device *dev); |
| 565 | void devlink_unregister(struct devlink *devlink); |
| 566 | void devlink_free(struct devlink *devlink); |
| 567 | int devlink_port_register(struct devlink *devlink, |
| 568 | struct devlink_port *devlink_port, |
| 569 | unsigned int port_index); |
| 570 | void devlink_port_unregister(struct devlink_port *devlink_port); |
| 571 | void devlink_port_type_eth_set(struct devlink_port *devlink_port, |
| 572 | struct net_device *netdev); |
| 573 | void devlink_port_type_ib_set(struct devlink_port *devlink_port, |
| 574 | struct ib_device *ibdev); |
| 575 | void devlink_port_type_clear(struct devlink_port *devlink_port); |
Jiri Pirko | b9ffcba | 2018-05-18 09:29:00 +0200 | [diff] [blame] | 576 | void devlink_port_attrs_set(struct devlink_port *devlink_port, |
Jiri Pirko | 5ec1380 | 2018-05-18 09:29:01 +0200 | [diff] [blame] | 577 | enum devlink_port_flavour flavour, |
Jiri Pirko | b9ffcba | 2018-05-18 09:29:00 +0200 | [diff] [blame] | 578 | u32 port_number, bool split, |
| 579 | u32 split_subport_number); |
Jiri Pirko | 08474c1 | 2018-05-18 09:29:02 +0200 | [diff] [blame] | 580 | int devlink_port_get_phys_port_name(struct devlink_port *devlink_port, |
| 581 | char *name, size_t len); |
Jiri Pirko | bf79747 | 2016-04-14 18:19:13 +0200 | [diff] [blame] | 582 | int devlink_sb_register(struct devlink *devlink, unsigned int sb_index, |
| 583 | u32 size, u16 ingress_pools_count, |
| 584 | u16 egress_pools_count, u16 ingress_tc_count, |
| 585 | u16 egress_tc_count); |
| 586 | void devlink_sb_unregister(struct devlink *devlink, unsigned int sb_index); |
Arkadi Sharshevsky | 1555d20 | 2017-03-28 17:24:10 +0200 | [diff] [blame] | 587 | int devlink_dpipe_table_register(struct devlink *devlink, |
| 588 | const char *table_name, |
| 589 | struct devlink_dpipe_table_ops *table_ops, |
Arkadi Sharshevsky | ffd3cdc | 2017-08-24 08:40:02 +0200 | [diff] [blame] | 590 | void *priv, bool counter_control_extern); |
Arkadi Sharshevsky | 1555d20 | 2017-03-28 17:24:10 +0200 | [diff] [blame] | 591 | void devlink_dpipe_table_unregister(struct devlink *devlink, |
| 592 | const char *table_name); |
| 593 | int devlink_dpipe_headers_register(struct devlink *devlink, |
| 594 | struct devlink_dpipe_headers *dpipe_headers); |
| 595 | void devlink_dpipe_headers_unregister(struct devlink *devlink); |
| 596 | bool devlink_dpipe_table_counter_enabled(struct devlink *devlink, |
| 597 | const char *table_name); |
| 598 | int devlink_dpipe_entry_ctx_prepare(struct devlink_dpipe_dump_ctx *dump_ctx); |
| 599 | int devlink_dpipe_entry_ctx_append(struct devlink_dpipe_dump_ctx *dump_ctx, |
| 600 | struct devlink_dpipe_entry *entry); |
| 601 | int devlink_dpipe_entry_ctx_close(struct devlink_dpipe_dump_ctx *dump_ctx); |
Arkadi Sharshevsky | 3580732 | 2017-08-24 08:40:03 +0200 | [diff] [blame] | 602 | void devlink_dpipe_entry_clear(struct devlink_dpipe_entry *entry); |
Arkadi Sharshevsky | 1555d20 | 2017-03-28 17:24:10 +0200 | [diff] [blame] | 603 | int devlink_dpipe_action_put(struct sk_buff *skb, |
| 604 | struct devlink_dpipe_action *action); |
| 605 | int devlink_dpipe_match_put(struct sk_buff *skb, |
| 606 | struct devlink_dpipe_match *match); |
Arkadi Sharshevsky | 1177009 | 2017-08-24 08:39:59 +0200 | [diff] [blame] | 607 | extern struct devlink_dpipe_header devlink_dpipe_header_ethernet; |
Arkadi Sharshevsky | 3fb886e | 2017-08-24 08:40:00 +0200 | [diff] [blame] | 608 | extern struct devlink_dpipe_header devlink_dpipe_header_ipv4; |
Arkadi Sharshevsky | 1797f5b | 2017-08-31 17:59:12 +0200 | [diff] [blame] | 609 | extern struct devlink_dpipe_header devlink_dpipe_header_ipv6; |
Jiri Pirko | bfcd3a4 | 2016-02-26 17:32:23 +0100 | [diff] [blame] | 610 | |
Arkadi Sharshevsky | d9f9b9a | 2018-01-15 08:59:03 +0100 | [diff] [blame] | 611 | int devlink_resource_register(struct devlink *devlink, |
| 612 | const char *resource_name, |
Arkadi Sharshevsky | d9f9b9a | 2018-01-15 08:59:03 +0100 | [diff] [blame] | 613 | u64 resource_size, |
| 614 | u64 resource_id, |
| 615 | u64 parent_resource_id, |
Jiri Pirko | fc56be4 | 2018-04-05 22:13:21 +0200 | [diff] [blame] | 616 | const struct devlink_resource_size_params *size_params); |
Arkadi Sharshevsky | d9f9b9a | 2018-01-15 08:59:03 +0100 | [diff] [blame] | 617 | void devlink_resources_unregister(struct devlink *devlink, |
| 618 | struct devlink_resource *resource); |
| 619 | int devlink_resource_size_get(struct devlink *devlink, |
| 620 | u64 resource_id, |
| 621 | u64 *p_resource_size); |
Arkadi Sharshevsky | 56dc7cd | 2018-01-15 08:59:05 +0100 | [diff] [blame] | 622 | int devlink_dpipe_table_resource_set(struct devlink *devlink, |
| 623 | const char *table_name, u64 resource_id, |
| 624 | u64 resource_units); |
Jiri Pirko | fc56be4 | 2018-04-05 22:13:21 +0200 | [diff] [blame] | 625 | void devlink_resource_occ_get_register(struct devlink *devlink, |
| 626 | u64 resource_id, |
| 627 | devlink_resource_occ_get_t *occ_get, |
| 628 | void *occ_get_priv); |
| 629 | void devlink_resource_occ_get_unregister(struct devlink *devlink, |
| 630 | u64 resource_id); |
Moshe Shemesh | eabaef1 | 2018-07-04 14:30:28 +0300 | [diff] [blame] | 631 | int devlink_params_register(struct devlink *devlink, |
| 632 | const struct devlink_param *params, |
| 633 | size_t params_count); |
| 634 | void devlink_params_unregister(struct devlink *devlink, |
| 635 | const struct devlink_param *params, |
| 636 | size_t params_count); |
Jiri Pirko | 7c62cfb | 2019-02-07 11:22:45 +0000 | [diff] [blame] | 637 | void devlink_params_publish(struct devlink *devlink); |
| 638 | void devlink_params_unpublish(struct devlink *devlink); |
Vasundhara Volam | 39e6160 | 2019-01-28 18:00:20 +0530 | [diff] [blame] | 639 | int devlink_port_params_register(struct devlink_port *devlink_port, |
| 640 | const struct devlink_param *params, |
| 641 | size_t params_count); |
| 642 | void devlink_port_params_unregister(struct devlink_port *devlink_port, |
| 643 | const struct devlink_param *params, |
| 644 | size_t params_count); |
Moshe Shemesh | ec01aeb | 2018-07-04 14:30:31 +0300 | [diff] [blame] | 645 | int devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id, |
| 646 | union devlink_param_value *init_val); |
| 647 | int devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id, |
| 648 | union devlink_param_value init_val); |
Vasundhara Volam | ffd19b9 | 2019-01-28 18:00:23 +0530 | [diff] [blame] | 649 | int |
| 650 | devlink_port_param_driverinit_value_get(struct devlink_port *devlink_port, |
| 651 | u32 param_id, |
| 652 | union devlink_param_value *init_val); |
Vasundhara Volam | 5473a7b | 2019-01-28 18:00:24 +0530 | [diff] [blame] | 653 | int devlink_port_param_driverinit_value_set(struct devlink_port *devlink_port, |
| 654 | u32 param_id, |
| 655 | union devlink_param_value init_val); |
Moshe Shemesh | ea601e1 | 2018-07-04 14:30:32 +0300 | [diff] [blame] | 656 | void devlink_param_value_changed(struct devlink *devlink, u32 param_id); |
Vasundhara Volam | c1e5786d | 2019-01-28 18:00:25 +0530 | [diff] [blame] | 657 | void devlink_port_param_value_changed(struct devlink_port *devlink_port, |
| 658 | u32 param_id); |
Moshe Shemesh | bde74ad1 | 2018-10-10 16:09:27 +0300 | [diff] [blame] | 659 | void devlink_param_value_str_fill(union devlink_param_value *dst_val, |
| 660 | const char *src); |
Alex Vesker | b16ebe9 | 2018-07-12 15:13:08 +0300 | [diff] [blame] | 661 | struct devlink_region *devlink_region_create(struct devlink *devlink, |
| 662 | const char *region_name, |
| 663 | u32 region_max_snapshots, |
| 664 | u64 region_size); |
| 665 | void devlink_region_destroy(struct devlink_region *region); |
Alex Vesker | ccadfa4 | 2018-07-12 15:13:09 +0300 | [diff] [blame] | 666 | u32 devlink_region_shapshot_id_get(struct devlink *devlink); |
Alex Vesker | d7e5272 | 2018-07-12 15:13:10 +0300 | [diff] [blame] | 667 | int devlink_region_snapshot_create(struct devlink_region *region, u64 data_len, |
| 668 | u8 *data, u32 snapshot_id, |
| 669 | devlink_snapshot_data_dest_t *data_destructor); |
Jakub Kicinski | f9cf228 | 2019-01-31 10:50:40 -0800 | [diff] [blame] | 670 | int devlink_info_serial_number_put(struct devlink_info_req *req, |
| 671 | const char *sn); |
| 672 | int devlink_info_driver_name_put(struct devlink_info_req *req, |
| 673 | const char *name); |
Jakub Kicinski | fc6fae7 | 2019-01-31 10:50:41 -0800 | [diff] [blame] | 674 | int devlink_info_version_fixed_put(struct devlink_info_req *req, |
| 675 | const char *version_name, |
| 676 | const char *version_value); |
| 677 | int devlink_info_version_stored_put(struct devlink_info_req *req, |
| 678 | const char *version_name, |
| 679 | const char *version_value); |
| 680 | int devlink_info_version_running_put(struct devlink_info_req *req, |
| 681 | const char *version_name, |
| 682 | const char *version_value); |
Arkadi Sharshevsky | d9f9b9a | 2018-01-15 08:59:03 +0100 | [diff] [blame] | 683 | |
Eran Ben Elisha | 1db64e8 | 2019-02-07 11:36:32 +0200 | [diff] [blame] | 684 | int devlink_fmsg_obj_nest_start(struct devlink_fmsg *fmsg); |
| 685 | int devlink_fmsg_obj_nest_end(struct devlink_fmsg *fmsg); |
| 686 | |
| 687 | int devlink_fmsg_pair_nest_start(struct devlink_fmsg *fmsg, const char *name); |
| 688 | int devlink_fmsg_pair_nest_end(struct devlink_fmsg *fmsg); |
| 689 | |
| 690 | int devlink_fmsg_arr_pair_nest_start(struct devlink_fmsg *fmsg, |
| 691 | const char *name); |
| 692 | int devlink_fmsg_arr_pair_nest_end(struct devlink_fmsg *fmsg); |
| 693 | |
| 694 | int devlink_fmsg_bool_put(struct devlink_fmsg *fmsg, bool value); |
| 695 | int devlink_fmsg_u8_put(struct devlink_fmsg *fmsg, u8 value); |
| 696 | int devlink_fmsg_u32_put(struct devlink_fmsg *fmsg, u32 value); |
| 697 | int devlink_fmsg_u64_put(struct devlink_fmsg *fmsg, u64 value); |
| 698 | int devlink_fmsg_string_put(struct devlink_fmsg *fmsg, const char *value); |
| 699 | int devlink_fmsg_binary_put(struct devlink_fmsg *fmsg, const void *value, |
| 700 | u16 value_len); |
| 701 | |
| 702 | int devlink_fmsg_bool_pair_put(struct devlink_fmsg *fmsg, const char *name, |
| 703 | bool value); |
| 704 | int devlink_fmsg_u8_pair_put(struct devlink_fmsg *fmsg, const char *name, |
| 705 | u8 value); |
| 706 | int devlink_fmsg_u32_pair_put(struct devlink_fmsg *fmsg, const char *name, |
| 707 | u32 value); |
| 708 | int devlink_fmsg_u64_pair_put(struct devlink_fmsg *fmsg, const char *name, |
| 709 | u64 value); |
| 710 | int devlink_fmsg_string_pair_put(struct devlink_fmsg *fmsg, const char *name, |
| 711 | const char *value); |
| 712 | int devlink_fmsg_binary_pair_put(struct devlink_fmsg *fmsg, const char *name, |
| 713 | const void *value, u16 value_len); |
| 714 | |
Eran Ben Elisha | a0bdcc5 | 2019-02-07 11:36:33 +0200 | [diff] [blame] | 715 | struct devlink_health_reporter * |
| 716 | devlink_health_reporter_create(struct devlink *devlink, |
| 717 | const struct devlink_health_reporter_ops *ops, |
| 718 | u64 graceful_period, bool auto_recover, |
| 719 | void *priv); |
| 720 | void |
| 721 | devlink_health_reporter_destroy(struct devlink_health_reporter *reporter); |
| 722 | |
| 723 | void * |
| 724 | devlink_health_reporter_priv(struct devlink_health_reporter *reporter); |
Eran Ben Elisha | c8e1da0 | 2019-02-07 11:36:34 +0200 | [diff] [blame] | 725 | int devlink_health_report(struct devlink_health_reporter *reporter, |
| 726 | const char *msg, void *priv_ctx); |
Eran Ben Elisha | 3167b27 | 2019-03-03 10:57:30 +0200 | [diff] [blame] | 727 | void |
| 728 | devlink_health_reporter_state_update(struct devlink_health_reporter *reporter, |
| 729 | enum devlink_health_reporter_state state); |
Eran Ben Elisha | a0bdcc5 | 2019-02-07 11:36:33 +0200 | [diff] [blame] | 730 | |
Jakub Kicinski | f4b6bcc | 2019-02-25 19:34:02 -0800 | [diff] [blame] | 731 | void devlink_compat_running_version(struct net_device *dev, |
| 732 | char *buf, size_t len); |
| 733 | int devlink_compat_flash_update(struct net_device *dev, const char *file_name); |
| 734 | |
Jiri Pirko | bfcd3a4 | 2016-02-26 17:32:23 +0100 | [diff] [blame] | 735 | #else |
| 736 | |
| 737 | static inline struct devlink *devlink_alloc(const struct devlink_ops *ops, |
| 738 | size_t priv_size) |
| 739 | { |
| 740 | return kzalloc(sizeof(struct devlink) + priv_size, GFP_KERNEL); |
| 741 | } |
| 742 | |
| 743 | static inline int devlink_register(struct devlink *devlink, struct device *dev) |
| 744 | { |
| 745 | return 0; |
| 746 | } |
| 747 | |
| 748 | static inline void devlink_unregister(struct devlink *devlink) |
| 749 | { |
| 750 | } |
| 751 | |
Jiri Pirko | 7c62cfb | 2019-02-07 11:22:45 +0000 | [diff] [blame] | 752 | static inline void devlink_params_publish(struct devlink *devlink) |
| 753 | { |
| 754 | } |
| 755 | |
| 756 | static inline void devlink_params_unpublish(struct devlink *devlink) |
| 757 | { |
| 758 | } |
| 759 | |
Jiri Pirko | bfcd3a4 | 2016-02-26 17:32:23 +0100 | [diff] [blame] | 760 | static inline void devlink_free(struct devlink *devlink) |
| 761 | { |
| 762 | kfree(devlink); |
| 763 | } |
| 764 | |
| 765 | static inline int devlink_port_register(struct devlink *devlink, |
| 766 | struct devlink_port *devlink_port, |
| 767 | unsigned int port_index) |
| 768 | { |
| 769 | return 0; |
| 770 | } |
| 771 | |
| 772 | static inline void devlink_port_unregister(struct devlink_port *devlink_port) |
| 773 | { |
| 774 | } |
| 775 | |
| 776 | static inline void devlink_port_type_eth_set(struct devlink_port *devlink_port, |
| 777 | struct net_device *netdev) |
| 778 | { |
| 779 | } |
| 780 | |
| 781 | static inline void devlink_port_type_ib_set(struct devlink_port *devlink_port, |
| 782 | struct ib_device *ibdev) |
| 783 | { |
| 784 | } |
| 785 | |
| 786 | static inline void devlink_port_type_clear(struct devlink_port *devlink_port) |
| 787 | { |
| 788 | } |
| 789 | |
Jiri Pirko | b9ffcba | 2018-05-18 09:29:00 +0200 | [diff] [blame] | 790 | static inline void devlink_port_attrs_set(struct devlink_port *devlink_port, |
Jiri Pirko | 5ec1380 | 2018-05-18 09:29:01 +0200 | [diff] [blame] | 791 | enum devlink_port_flavour flavour, |
Jiri Pirko | b9ffcba | 2018-05-18 09:29:00 +0200 | [diff] [blame] | 792 | u32 port_number, bool split, |
| 793 | u32 split_subport_number) |
Jiri Pirko | bfcd3a4 | 2016-02-26 17:32:23 +0100 | [diff] [blame] | 794 | { |
| 795 | } |
| 796 | |
Jiri Pirko | 08474c1 | 2018-05-18 09:29:02 +0200 | [diff] [blame] | 797 | static inline int |
| 798 | devlink_port_get_phys_port_name(struct devlink_port *devlink_port, |
| 799 | char *name, size_t len) |
| 800 | { |
| 801 | return -EOPNOTSUPP; |
| 802 | } |
| 803 | |
Jiri Pirko | bf79747 | 2016-04-14 18:19:13 +0200 | [diff] [blame] | 804 | static inline int devlink_sb_register(struct devlink *devlink, |
| 805 | unsigned int sb_index, u32 size, |
| 806 | u16 ingress_pools_count, |
Jiri Pirko | de33efd | 2016-04-15 09:17:08 +0200 | [diff] [blame] | 807 | u16 egress_pools_count, |
| 808 | u16 ingress_tc_count, |
| 809 | u16 egress_tc_count) |
Jiri Pirko | bf79747 | 2016-04-14 18:19:13 +0200 | [diff] [blame] | 810 | { |
| 811 | return 0; |
| 812 | } |
| 813 | |
| 814 | static inline void devlink_sb_unregister(struct devlink *devlink, |
| 815 | unsigned int sb_index) |
| 816 | { |
| 817 | } |
| 818 | |
Arkadi Sharshevsky | 1555d20 | 2017-03-28 17:24:10 +0200 | [diff] [blame] | 819 | static inline int |
| 820 | devlink_dpipe_table_register(struct devlink *devlink, |
| 821 | const char *table_name, |
| 822 | struct devlink_dpipe_table_ops *table_ops, |
David S. Miller | 790c605 | 2017-08-24 18:10:46 -0700 | [diff] [blame] | 823 | void *priv, bool counter_control_extern) |
Arkadi Sharshevsky | 1555d20 | 2017-03-28 17:24:10 +0200 | [diff] [blame] | 824 | { |
| 825 | return 0; |
| 826 | } |
| 827 | |
| 828 | static inline void devlink_dpipe_table_unregister(struct devlink *devlink, |
| 829 | const char *table_name) |
| 830 | { |
| 831 | } |
| 832 | |
| 833 | static inline int devlink_dpipe_headers_register(struct devlink *devlink, |
| 834 | struct devlink_dpipe_headers * |
| 835 | dpipe_headers) |
| 836 | { |
| 837 | return 0; |
| 838 | } |
| 839 | |
| 840 | static inline void devlink_dpipe_headers_unregister(struct devlink *devlink) |
| 841 | { |
| 842 | } |
| 843 | |
| 844 | static inline bool devlink_dpipe_table_counter_enabled(struct devlink *devlink, |
| 845 | const char *table_name) |
| 846 | { |
| 847 | return false; |
| 848 | } |
| 849 | |
| 850 | static inline int |
| 851 | devlink_dpipe_entry_ctx_prepare(struct devlink_dpipe_dump_ctx *dump_ctx) |
| 852 | { |
| 853 | return 0; |
| 854 | } |
| 855 | |
| 856 | static inline int |
| 857 | devlink_dpipe_entry_ctx_append(struct devlink_dpipe_dump_ctx *dump_ctx, |
| 858 | struct devlink_dpipe_entry *entry) |
| 859 | { |
| 860 | return 0; |
| 861 | } |
| 862 | |
| 863 | static inline int |
| 864 | devlink_dpipe_entry_ctx_close(struct devlink_dpipe_dump_ctx *dump_ctx) |
| 865 | { |
| 866 | return 0; |
| 867 | } |
| 868 | |
Arkadi Sharshevsky | 3580732 | 2017-08-24 08:40:03 +0200 | [diff] [blame] | 869 | static inline void |
| 870 | devlink_dpipe_entry_clear(struct devlink_dpipe_entry *entry) |
| 871 | { |
| 872 | } |
| 873 | |
Arkadi Sharshevsky | 1555d20 | 2017-03-28 17:24:10 +0200 | [diff] [blame] | 874 | static inline int |
| 875 | devlink_dpipe_action_put(struct sk_buff *skb, |
| 876 | struct devlink_dpipe_action *action) |
| 877 | { |
| 878 | return 0; |
| 879 | } |
| 880 | |
| 881 | static inline int |
| 882 | devlink_dpipe_match_put(struct sk_buff *skb, |
| 883 | struct devlink_dpipe_match *match) |
| 884 | { |
| 885 | return 0; |
| 886 | } |
| 887 | |
Arkadi Sharshevsky | d9f9b9a | 2018-01-15 08:59:03 +0100 | [diff] [blame] | 888 | static inline int |
| 889 | devlink_resource_register(struct devlink *devlink, |
| 890 | const char *resource_name, |
Arkadi Sharshevsky | d9f9b9a | 2018-01-15 08:59:03 +0100 | [diff] [blame] | 891 | u64 resource_size, |
| 892 | u64 resource_id, |
| 893 | u64 parent_resource_id, |
Jiri Pirko | fc56be4 | 2018-04-05 22:13:21 +0200 | [diff] [blame] | 894 | const struct devlink_resource_size_params *size_params) |
Arkadi Sharshevsky | d9f9b9a | 2018-01-15 08:59:03 +0100 | [diff] [blame] | 895 | { |
| 896 | return 0; |
| 897 | } |
| 898 | |
| 899 | static inline void |
| 900 | devlink_resources_unregister(struct devlink *devlink, |
| 901 | struct devlink_resource *resource) |
| 902 | { |
| 903 | } |
| 904 | |
| 905 | static inline int |
| 906 | devlink_resource_size_get(struct devlink *devlink, u64 resource_id, |
| 907 | u64 *p_resource_size) |
| 908 | { |
| 909 | return -EOPNOTSUPP; |
| 910 | } |
| 911 | |
Arkadi Sharshevsky | 56dc7cd | 2018-01-15 08:59:05 +0100 | [diff] [blame] | 912 | static inline int |
| 913 | devlink_dpipe_table_resource_set(struct devlink *devlink, |
| 914 | const char *table_name, u64 resource_id, |
| 915 | u64 resource_units) |
| 916 | { |
| 917 | return -EOPNOTSUPP; |
| 918 | } |
| 919 | |
Jiri Pirko | fc56be4 | 2018-04-05 22:13:21 +0200 | [diff] [blame] | 920 | static inline void |
| 921 | devlink_resource_occ_get_register(struct devlink *devlink, |
| 922 | u64 resource_id, |
| 923 | devlink_resource_occ_get_t *occ_get, |
| 924 | void *occ_get_priv) |
| 925 | { |
| 926 | } |
| 927 | |
| 928 | static inline void |
| 929 | devlink_resource_occ_get_unregister(struct devlink *devlink, |
| 930 | u64 resource_id) |
| 931 | { |
| 932 | } |
| 933 | |
Moshe Shemesh | eabaef1 | 2018-07-04 14:30:28 +0300 | [diff] [blame] | 934 | static inline int |
| 935 | devlink_params_register(struct devlink *devlink, |
| 936 | const struct devlink_param *params, |
| 937 | size_t params_count) |
| 938 | { |
| 939 | return 0; |
| 940 | } |
| 941 | |
| 942 | static inline void |
| 943 | devlink_params_unregister(struct devlink *devlink, |
| 944 | const struct devlink_param *params, |
| 945 | size_t params_count) |
| 946 | { |
| 947 | |
| 948 | } |
| 949 | |
Moshe Shemesh | ec01aeb | 2018-07-04 14:30:31 +0300 | [diff] [blame] | 950 | static inline int |
Vasundhara Volam | 39e6160 | 2019-01-28 18:00:20 +0530 | [diff] [blame] | 951 | devlink_port_params_register(struct devlink_port *devlink_port, |
| 952 | const struct devlink_param *params, |
| 953 | size_t params_count) |
| 954 | { |
| 955 | return 0; |
| 956 | } |
| 957 | |
| 958 | static inline void |
| 959 | devlink_port_params_unregister(struct devlink_port *devlink_port, |
| 960 | const struct devlink_param *params, |
| 961 | size_t params_count) |
| 962 | { |
| 963 | } |
| 964 | |
| 965 | static inline int |
Moshe Shemesh | ec01aeb | 2018-07-04 14:30:31 +0300 | [diff] [blame] | 966 | devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id, |
| 967 | union devlink_param_value *init_val) |
| 968 | { |
| 969 | return -EOPNOTSUPP; |
| 970 | } |
| 971 | |
| 972 | static inline int |
| 973 | devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id, |
| 974 | union devlink_param_value init_val) |
| 975 | { |
| 976 | return -EOPNOTSUPP; |
| 977 | } |
| 978 | |
Vasundhara Volam | ffd19b9 | 2019-01-28 18:00:23 +0530 | [diff] [blame] | 979 | static inline int |
| 980 | devlink_port_param_driverinit_value_get(struct devlink_port *devlink_port, |
| 981 | u32 param_id, |
| 982 | union devlink_param_value *init_val) |
| 983 | { |
| 984 | return -EOPNOTSUPP; |
| 985 | } |
| 986 | |
Vasundhara Volam | 5473a7b | 2019-01-28 18:00:24 +0530 | [diff] [blame] | 987 | static inline int |
| 988 | devlink_port_param_driverinit_value_set(struct devlink_port *devlink_port, |
| 989 | u32 param_id, |
| 990 | union devlink_param_value init_val) |
| 991 | { |
| 992 | return -EOPNOTSUPP; |
| 993 | } |
| 994 | |
Moshe Shemesh | ea601e1 | 2018-07-04 14:30:32 +0300 | [diff] [blame] | 995 | static inline void |
| 996 | devlink_param_value_changed(struct devlink *devlink, u32 param_id) |
| 997 | { |
Moshe Shemesh | ea601e1 | 2018-07-04 14:30:32 +0300 | [diff] [blame] | 998 | } |
| 999 | |
Moshe Shemesh | bde74ad1 | 2018-10-10 16:09:27 +0300 | [diff] [blame] | 1000 | static inline void |
Vasundhara Volam | c1e5786d | 2019-01-28 18:00:25 +0530 | [diff] [blame] | 1001 | devlink_port_param_value_changed(struct devlink_port *devlink_port, |
| 1002 | u32 param_id) |
| 1003 | { |
| 1004 | } |
| 1005 | |
| 1006 | static inline void |
Moshe Shemesh | bde74ad1 | 2018-10-10 16:09:27 +0300 | [diff] [blame] | 1007 | devlink_param_value_str_fill(union devlink_param_value *dst_val, |
| 1008 | const char *src) |
| 1009 | { |
| 1010 | } |
| 1011 | |
Alex Vesker | b16ebe9 | 2018-07-12 15:13:08 +0300 | [diff] [blame] | 1012 | static inline struct devlink_region * |
| 1013 | devlink_region_create(struct devlink *devlink, |
| 1014 | const char *region_name, |
| 1015 | u32 region_max_snapshots, |
| 1016 | u64 region_size) |
| 1017 | { |
| 1018 | return NULL; |
| 1019 | } |
| 1020 | |
| 1021 | static inline void |
| 1022 | devlink_region_destroy(struct devlink_region *region) |
| 1023 | { |
| 1024 | } |
| 1025 | |
Alex Vesker | ccadfa4 | 2018-07-12 15:13:09 +0300 | [diff] [blame] | 1026 | static inline u32 |
| 1027 | devlink_region_shapshot_id_get(struct devlink *devlink) |
| 1028 | { |
| 1029 | return 0; |
| 1030 | } |
| 1031 | |
Alex Vesker | d7e5272 | 2018-07-12 15:13:10 +0300 | [diff] [blame] | 1032 | static inline int |
| 1033 | devlink_region_snapshot_create(struct devlink_region *region, u64 data_len, |
| 1034 | u8 *data, u32 snapshot_id, |
| 1035 | devlink_snapshot_data_dest_t *data_destructor) |
| 1036 | { |
| 1037 | return 0; |
| 1038 | } |
| 1039 | |
Jakub Kicinski | f9cf228 | 2019-01-31 10:50:40 -0800 | [diff] [blame] | 1040 | static inline int |
| 1041 | devlink_info_driver_name_put(struct devlink_info_req *req, const char *name) |
| 1042 | { |
| 1043 | return 0; |
| 1044 | } |
| 1045 | |
| 1046 | static inline int |
| 1047 | devlink_info_serial_number_put(struct devlink_info_req *req, const char *sn) |
| 1048 | { |
| 1049 | return 0; |
| 1050 | } |
Jakub Kicinski | fc6fae7 | 2019-01-31 10:50:41 -0800 | [diff] [blame] | 1051 | |
| 1052 | static inline int |
| 1053 | devlink_info_version_fixed_put(struct devlink_info_req *req, |
| 1054 | const char *version_name, |
| 1055 | const char *version_value) |
| 1056 | { |
| 1057 | return 0; |
| 1058 | } |
| 1059 | |
| 1060 | static inline int |
| 1061 | devlink_info_version_stored_put(struct devlink_info_req *req, |
| 1062 | const char *version_name, |
| 1063 | const char *version_value) |
| 1064 | { |
| 1065 | return 0; |
| 1066 | } |
| 1067 | |
| 1068 | static inline int |
| 1069 | devlink_info_version_running_put(struct devlink_info_req *req, |
| 1070 | const char *version_name, |
| 1071 | const char *version_value) |
| 1072 | { |
| 1073 | return 0; |
| 1074 | } |
Eran Ben Elisha | 1db64e8 | 2019-02-07 11:36:32 +0200 | [diff] [blame] | 1075 | |
| 1076 | static inline int |
| 1077 | devlink_fmsg_obj_nest_start(struct devlink_fmsg *fmsg) |
| 1078 | { |
| 1079 | return 0; |
| 1080 | } |
| 1081 | |
| 1082 | static inline int |
| 1083 | devlink_fmsg_obj_nest_end(struct devlink_fmsg *fmsg) |
| 1084 | { |
| 1085 | return 0; |
| 1086 | } |
| 1087 | |
| 1088 | static inline int |
| 1089 | devlink_fmsg_pair_nest_start(struct devlink_fmsg *fmsg, const char *name) |
| 1090 | { |
| 1091 | return 0; |
| 1092 | } |
| 1093 | |
| 1094 | static inline int |
| 1095 | devlink_fmsg_pair_nest_end(struct devlink_fmsg *fmsg) |
| 1096 | { |
| 1097 | return 0; |
| 1098 | } |
| 1099 | |
| 1100 | static inline int |
| 1101 | devlink_fmsg_arr_pair_nest_start(struct devlink_fmsg *fmsg, |
| 1102 | const char *name) |
| 1103 | { |
| 1104 | return 0; |
| 1105 | } |
| 1106 | |
| 1107 | static inline int |
| 1108 | devlink_fmsg_arr_pair_nest_end(struct devlink_fmsg *fmsg) |
| 1109 | { |
| 1110 | return 0; |
| 1111 | } |
| 1112 | |
| 1113 | static inline int |
| 1114 | devlink_fmsg_bool_put(struct devlink_fmsg *fmsg, bool value) |
| 1115 | { |
| 1116 | return 0; |
| 1117 | } |
| 1118 | |
| 1119 | static inline int |
| 1120 | devlink_fmsg_u8_put(struct devlink_fmsg *fmsg, u8 value) |
| 1121 | { |
| 1122 | return 0; |
| 1123 | } |
| 1124 | |
| 1125 | static inline int |
| 1126 | devlink_fmsg_u32_put(struct devlink_fmsg *fmsg, u32 value) |
| 1127 | { |
| 1128 | return 0; |
| 1129 | } |
| 1130 | |
| 1131 | static inline int |
| 1132 | devlink_fmsg_u64_put(struct devlink_fmsg *fmsg, u64 value) |
| 1133 | { |
| 1134 | return 0; |
| 1135 | } |
| 1136 | |
| 1137 | static inline int |
| 1138 | devlink_fmsg_string_put(struct devlink_fmsg *fmsg, const char *value) |
| 1139 | { |
| 1140 | return 0; |
| 1141 | } |
| 1142 | |
| 1143 | static inline int |
| 1144 | devlink_fmsg_binary_put(struct devlink_fmsg *fmsg, const void *value, |
| 1145 | u16 value_len) |
| 1146 | { |
| 1147 | return 0; |
| 1148 | } |
| 1149 | |
| 1150 | static inline int |
| 1151 | devlink_fmsg_bool_pair_put(struct devlink_fmsg *fmsg, const char *name, |
| 1152 | bool value) |
| 1153 | { |
| 1154 | return 0; |
| 1155 | } |
| 1156 | |
| 1157 | static inline int |
| 1158 | devlink_fmsg_u8_pair_put(struct devlink_fmsg *fmsg, const char *name, |
| 1159 | u8 value) |
| 1160 | { |
| 1161 | return 0; |
| 1162 | } |
| 1163 | |
| 1164 | static inline int |
| 1165 | devlink_fmsg_u32_pair_put(struct devlink_fmsg *fmsg, const char *name, |
| 1166 | u32 value) |
| 1167 | { |
| 1168 | return 0; |
| 1169 | } |
| 1170 | |
| 1171 | static inline int |
| 1172 | devlink_fmsg_u64_pair_put(struct devlink_fmsg *fmsg, const char *name, |
| 1173 | u64 value) |
| 1174 | { |
| 1175 | return 0; |
| 1176 | } |
| 1177 | |
| 1178 | static inline int |
| 1179 | devlink_fmsg_string_pair_put(struct devlink_fmsg *fmsg, const char *name, |
| 1180 | const char *value) |
| 1181 | { |
| 1182 | return 0; |
| 1183 | } |
| 1184 | |
| 1185 | static inline int |
| 1186 | devlink_fmsg_binary_pair_put(struct devlink_fmsg *fmsg, const char *name, |
| 1187 | const void *value, u16 value_len) |
| 1188 | { |
| 1189 | return 0; |
| 1190 | } |
Eran Ben Elisha | a0bdcc5 | 2019-02-07 11:36:33 +0200 | [diff] [blame] | 1191 | |
| 1192 | static inline struct devlink_health_reporter * |
| 1193 | devlink_health_reporter_create(struct devlink *devlink, |
| 1194 | const struct devlink_health_reporter_ops *ops, |
| 1195 | u64 graceful_period, bool auto_recover, |
| 1196 | void *priv) |
| 1197 | { |
| 1198 | return NULL; |
| 1199 | } |
| 1200 | |
| 1201 | static inline void |
| 1202 | devlink_health_reporter_destroy(struct devlink_health_reporter *reporter) |
| 1203 | { |
| 1204 | } |
| 1205 | |
| 1206 | static inline void * |
| 1207 | devlink_health_reporter_priv(struct devlink_health_reporter *reporter) |
| 1208 | { |
| 1209 | return NULL; |
| 1210 | } |
Eran Ben Elisha | c8e1da0 | 2019-02-07 11:36:34 +0200 | [diff] [blame] | 1211 | |
| 1212 | static inline int |
| 1213 | devlink_health_report(struct devlink_health_reporter *reporter, |
| 1214 | const char *msg, void *priv_ctx) |
| 1215 | { |
| 1216 | return 0; |
| 1217 | } |
Jiri Pirko | bfcd3a4 | 2016-02-26 17:32:23 +0100 | [diff] [blame] | 1218 | |
Jakub Kicinski | ddb6e99 | 2019-01-31 10:50:47 -0800 | [diff] [blame] | 1219 | static inline void |
Eran Ben Elisha | 3167b27 | 2019-03-03 10:57:30 +0200 | [diff] [blame] | 1220 | devlink_health_reporter_state_update(struct devlink_health_reporter *reporter, |
| 1221 | enum devlink_health_reporter_state state) |
| 1222 | { |
| 1223 | } |
| 1224 | |
| 1225 | static inline void |
Jakub Kicinski | ddb6e99 | 2019-01-31 10:50:47 -0800 | [diff] [blame] | 1226 | devlink_compat_running_version(struct net_device *dev, char *buf, size_t len) |
| 1227 | { |
| 1228 | } |
Jakub Kicinski | 4eceba1 | 2019-02-14 13:40:45 -0800 | [diff] [blame] | 1229 | |
| 1230 | static inline int |
| 1231 | devlink_compat_flash_update(struct net_device *dev, const char *file_name) |
| 1232 | { |
| 1233 | return -EOPNOTSUPP; |
| 1234 | } |
Jakub Kicinski | ddb6e99 | 2019-01-31 10:50:47 -0800 | [diff] [blame] | 1235 | #endif |
| 1236 | |
Jiri Pirko | bfcd3a4 | 2016-02-26 17:32:23 +0100 | [diff] [blame] | 1237 | #endif /* _NET_DEVLINK_H_ */ |