blob: 9686a1aa4ec90e382cb96dee62220ad320edd41f [file] [log] [blame]
Jiri Pirkobfcd3a42016-02-26 17:32:23 +01001/*
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>
19#include <net/net_namespace.h>
20#include <uapi/linux/devlink.h>
21
22struct devlink_ops;
23
24struct devlink {
25 struct list_head list;
26 struct list_head port_list;
Jiri Pirkobf797472016-04-14 18:19:13 +020027 struct list_head sb_list;
Arkadi Sharshevsky1555d202017-03-28 17:24:10 +020028 struct list_head dpipe_table_list;
Arkadi Sharshevskyd9f9b9a2018-01-15 08:59:03 +010029 struct list_head resource_list;
Arkadi Sharshevsky1555d202017-03-28 17:24:10 +020030 struct devlink_dpipe_headers *dpipe_headers;
Jiri Pirkobfcd3a42016-02-26 17:32:23 +010031 const struct devlink_ops *ops;
32 struct device *dev;
33 possible_net_t _net;
Arkadi Sharshevsky2406e7e2018-01-15 08:59:02 +010034 struct mutex lock;
Jiri Pirkobfcd3a42016-02-26 17:32:23 +010035 char priv[0] __aligned(NETDEV_ALIGN);
36};
37
Jiri Pirkob9ffcba2018-05-18 09:29:00 +020038struct devlink_port_attrs {
39 bool set;
Jiri Pirko5ec13802018-05-18 09:29:01 +020040 enum devlink_port_flavour flavour;
Jiri Pirkob9ffcba2018-05-18 09:29:00 +020041 u32 port_number; /* same value as "split group" */
42 bool split;
43 u32 split_subport_number;
44};
45
Jiri Pirkobfcd3a42016-02-26 17:32:23 +010046struct devlink_port {
47 struct list_head list;
48 struct devlink *devlink;
49 unsigned index;
50 bool registered;
51 enum devlink_port_type type;
52 enum devlink_port_type desired_type;
53 void *type_dev;
Jiri Pirkob9ffcba2018-05-18 09:29:00 +020054 struct devlink_port_attrs attrs;
Jiri Pirkobfcd3a42016-02-26 17:32:23 +010055};
56
Jiri Pirkobf797472016-04-14 18:19:13 +020057struct devlink_sb_pool_info {
58 enum devlink_sb_pool_type pool_type;
59 u32 size;
60 enum devlink_sb_threshold_type threshold_type;
61};
62
Arkadi Sharshevsky1555d202017-03-28 17:24:10 +020063/**
64 * struct devlink_dpipe_field - dpipe field object
65 * @name: field name
66 * @id: index inside the headers field array
67 * @bitwidth: bitwidth
68 * @mapping_type: mapping type
69 */
70struct devlink_dpipe_field {
71 const char *name;
72 unsigned int id;
73 unsigned int bitwidth;
74 enum devlink_dpipe_field_mapping_type mapping_type;
75};
76
77/**
78 * struct devlink_dpipe_header - dpipe header object
79 * @name: header name
80 * @id: index, global/local detrmined by global bit
81 * @fields: fields
82 * @fields_count: number of fields
83 * @global: indicates if header is shared like most protocol header
84 * or driver specific
85 */
86struct devlink_dpipe_header {
87 const char *name;
88 unsigned int id;
89 struct devlink_dpipe_field *fields;
90 unsigned int fields_count;
91 bool global;
92};
93
94/**
95 * struct devlink_dpipe_match - represents match operation
96 * @type: type of match
97 * @header_index: header index (packets can have several headers of same
98 * type like in case of tunnels)
99 * @header: header
100 * @fieled_id: field index
101 */
102struct devlink_dpipe_match {
103 enum devlink_dpipe_match_type type;
104 unsigned int header_index;
105 struct devlink_dpipe_header *header;
106 unsigned int field_id;
107};
108
109/**
110 * struct devlink_dpipe_action - represents action operation
111 * @type: type of action
112 * @header_index: header index (packets can have several headers of same
113 * type like in case of tunnels)
114 * @header: header
115 * @fieled_id: field index
116 */
117struct devlink_dpipe_action {
118 enum devlink_dpipe_action_type type;
119 unsigned int header_index;
120 struct devlink_dpipe_header *header;
121 unsigned int field_id;
122};
123
124/**
125 * struct devlink_dpipe_value - represents value of match/action
126 * @action: action
127 * @match: match
128 * @mapping_value: in case the field has some mapping this value
129 * specified the mapping value
130 * @mapping_valid: specify if mapping value is valid
131 * @value_size: value size
132 * @value: value
133 * @mask: bit mask
134 */
135struct devlink_dpipe_value {
136 union {
137 struct devlink_dpipe_action *action;
138 struct devlink_dpipe_match *match;
139 };
140 unsigned int mapping_value;
141 bool mapping_valid;
142 unsigned int value_size;
143 void *value;
144 void *mask;
145};
146
147/**
148 * struct devlink_dpipe_entry - table entry object
149 * @index: index of the entry in the table
150 * @match_values: match values
151 * @matche_values_count: count of matches tuples
152 * @action_values: actions values
153 * @action_values_count: count of actions values
154 * @counter: value of counter
155 * @counter_valid: Specify if value is valid from hardware
156 */
157struct devlink_dpipe_entry {
158 u64 index;
159 struct devlink_dpipe_value *match_values;
160 unsigned int match_values_count;
161 struct devlink_dpipe_value *action_values;
162 unsigned int action_values_count;
163 u64 counter;
164 bool counter_valid;
165};
166
167/**
168 * struct devlink_dpipe_dump_ctx - context provided to driver in order
169 * to dump
170 * @info: info
171 * @cmd: devlink command
172 * @skb: skb
173 * @nest: top attribute
174 * @hdr: hdr
175 */
176struct devlink_dpipe_dump_ctx {
177 struct genl_info *info;
178 enum devlink_command cmd;
179 struct sk_buff *skb;
180 struct nlattr *nest;
181 void *hdr;
182};
183
184struct devlink_dpipe_table_ops;
185
186/**
187 * struct devlink_dpipe_table - table object
188 * @priv: private
189 * @name: table name
Arkadi Sharshevsky1555d202017-03-28 17:24:10 +0200190 * @counters_enabled: indicates if counters are active
191 * @counter_control_extern: indicates if counter control is in dpipe or
192 * external tool
Arkadi Sharshevsky56dc7cd2018-01-15 08:59:05 +0100193 * @resource_valid: Indicate that the resource id is valid
194 * @resource_id: relative resource this table is related to
195 * @resource_units: number of resource's unit consumed per table's entry
Arkadi Sharshevsky1555d202017-03-28 17:24:10 +0200196 * @table_ops: table operations
197 * @rcu: rcu
198 */
199struct devlink_dpipe_table {
200 void *priv;
201 struct list_head list;
202 const char *name;
Arkadi Sharshevsky1555d202017-03-28 17:24:10 +0200203 bool counters_enabled;
204 bool counter_control_extern;
Arkadi Sharshevsky56dc7cd2018-01-15 08:59:05 +0100205 bool resource_valid;
206 u64 resource_id;
207 u64 resource_units;
Arkadi Sharshevsky1555d202017-03-28 17:24:10 +0200208 struct devlink_dpipe_table_ops *table_ops;
209 struct rcu_head rcu;
210};
211
212/**
213 * struct devlink_dpipe_table_ops - dpipe_table ops
214 * @actions_dump - dumps all tables actions
215 * @matches_dump - dumps all tables matches
216 * @entries_dump - dumps all active entries in the table
217 * @counters_set_update - when changing the counter status hardware sync
218 * maybe needed to allocate/free counter related
219 * resources
Arkadi Sharshevskyffd3cdc2017-08-24 08:40:02 +0200220 * @size_get - get size
Arkadi Sharshevsky1555d202017-03-28 17:24:10 +0200221 */
222struct devlink_dpipe_table_ops {
223 int (*actions_dump)(void *priv, struct sk_buff *skb);
224 int (*matches_dump)(void *priv, struct sk_buff *skb);
225 int (*entries_dump)(void *priv, bool counters_enabled,
226 struct devlink_dpipe_dump_ctx *dump_ctx);
227 int (*counters_set_update)(void *priv, bool enable);
Arkadi Sharshevskyffd3cdc2017-08-24 08:40:02 +0200228 u64 (*size_get)(void *priv);
Arkadi Sharshevsky1555d202017-03-28 17:24:10 +0200229};
230
231/**
232 * struct devlink_dpipe_headers - dpipe headers
233 * @headers - header array can be shared (global bit) or driver specific
234 * @headers_count - count of headers
235 */
236struct devlink_dpipe_headers {
237 struct devlink_dpipe_header **headers;
238 unsigned int headers_count;
239};
240
Arkadi Sharshevskyd9f9b9a2018-01-15 08:59:03 +0100241/**
Arkadi Sharshevskyd9f9b9a2018-01-15 08:59:03 +0100242 * struct devlink_resource_size_params - resource's size parameters
243 * @size_min: minimum size which can be set
244 * @size_max: maximum size which can be set
245 * @size_granularity: size granularity
246 * @size_unit: resource's basic unit
247 */
248struct devlink_resource_size_params {
249 u64 size_min;
250 u64 size_max;
251 u64 size_granularity;
252 enum devlink_resource_unit unit;
253};
254
Jiri Pirko77d27092018-02-28 13:12:09 +0100255static inline void
256devlink_resource_size_params_init(struct devlink_resource_size_params *size_params,
257 u64 size_min, u64 size_max,
258 u64 size_granularity,
259 enum devlink_resource_unit unit)
260{
261 size_params->size_min = size_min;
262 size_params->size_max = size_max;
263 size_params->size_granularity = size_granularity;
264 size_params->unit = unit;
265}
266
Jiri Pirkofc56be42018-04-05 22:13:21 +0200267typedef u64 devlink_resource_occ_get_t(void *priv);
268
Arkadi Sharshevskyd9f9b9a2018-01-15 08:59:03 +0100269/**
270 * struct devlink_resource - devlink resource
271 * @name: name of the resource
272 * @id: id, per devlink instance
273 * @size: size of the resource
274 * @size_new: updated size of the resource, reload is needed
275 * @size_valid: valid in case the total size of the resource is valid
276 * including its children
277 * @parent: parent resource
278 * @size_params: size parameters
279 * @list: parent list
280 * @resource_list: list of child resources
Arkadi Sharshevskyd9f9b9a2018-01-15 08:59:03 +0100281 */
282struct devlink_resource {
283 const char *name;
284 u64 id;
285 u64 size;
286 u64 size_new;
287 bool size_valid;
288 struct devlink_resource *parent;
Jiri Pirko77d27092018-02-28 13:12:09 +0100289 struct devlink_resource_size_params size_params;
Arkadi Sharshevskyd9f9b9a2018-01-15 08:59:03 +0100290 struct list_head list;
291 struct list_head resource_list;
Jiri Pirkofc56be42018-04-05 22:13:21 +0200292 devlink_resource_occ_get_t *occ_get;
293 void *occ_get_priv;
Arkadi Sharshevskyd9f9b9a2018-01-15 08:59:03 +0100294};
295
296#define DEVLINK_RESOURCE_ID_PARENT_TOP 0
297
Jiri Pirkobfcd3a42016-02-26 17:32:23 +0100298struct devlink_ops {
Arkadi Sharshevsky2d8dc5b2018-01-15 08:59:04 +0100299 int (*reload)(struct devlink *devlink);
Jiri Pirkobfcd3a42016-02-26 17:32:23 +0100300 int (*port_type_set)(struct devlink_port *devlink_port,
301 enum devlink_port_type port_type);
302 int (*port_split)(struct devlink *devlink, unsigned int port_index,
303 unsigned int count);
304 int (*port_unsplit)(struct devlink *devlink, unsigned int port_index);
Jiri Pirkobf797472016-04-14 18:19:13 +0200305 int (*sb_pool_get)(struct devlink *devlink, unsigned int sb_index,
306 u16 pool_index,
307 struct devlink_sb_pool_info *pool_info);
308 int (*sb_pool_set)(struct devlink *devlink, unsigned int sb_index,
309 u16 pool_index, u32 size,
310 enum devlink_sb_threshold_type threshold_type);
311 int (*sb_port_pool_get)(struct devlink_port *devlink_port,
312 unsigned int sb_index, u16 pool_index,
313 u32 *p_threshold);
314 int (*sb_port_pool_set)(struct devlink_port *devlink_port,
315 unsigned int sb_index, u16 pool_index,
316 u32 threshold);
317 int (*sb_tc_pool_bind_get)(struct devlink_port *devlink_port,
318 unsigned int sb_index,
319 u16 tc_index,
320 enum devlink_sb_pool_type pool_type,
321 u16 *p_pool_index, u32 *p_threshold);
322 int (*sb_tc_pool_bind_set)(struct devlink_port *devlink_port,
323 unsigned int sb_index,
324 u16 tc_index,
325 enum devlink_sb_pool_type pool_type,
326 u16 pool_index, u32 threshold);
Jiri Pirkodf38daf2016-04-14 18:19:14 +0200327 int (*sb_occ_snapshot)(struct devlink *devlink,
328 unsigned int sb_index);
329 int (*sb_occ_max_clear)(struct devlink *devlink,
330 unsigned int sb_index);
331 int (*sb_occ_port_pool_get)(struct devlink_port *devlink_port,
332 unsigned int sb_index, u16 pool_index,
333 u32 *p_cur, u32 *p_max);
334 int (*sb_occ_tc_port_bind_get)(struct devlink_port *devlink_port,
335 unsigned int sb_index,
336 u16 tc_index,
337 enum devlink_sb_pool_type pool_type,
338 u32 *p_cur, u32 *p_max);
Or Gerlitz08f4b592016-07-01 14:51:01 +0300339
340 int (*eswitch_mode_get)(struct devlink *devlink, u16 *p_mode);
341 int (*eswitch_mode_set)(struct devlink *devlink, u16 mode);
Roi Dayan59bfde02016-11-22 23:09:57 +0200342 int (*eswitch_inline_mode_get)(struct devlink *devlink, u8 *p_inline_mode);
343 int (*eswitch_inline_mode_set)(struct devlink *devlink, u8 inline_mode);
Roi Dayanf43e9b02016-09-25 13:52:44 +0300344 int (*eswitch_encap_mode_get)(struct devlink *devlink, u8 *p_encap_mode);
345 int (*eswitch_encap_mode_set)(struct devlink *devlink, u8 encap_mode);
Jiri Pirkobfcd3a42016-02-26 17:32:23 +0100346};
347
348static inline void *devlink_priv(struct devlink *devlink)
349{
350 BUG_ON(!devlink);
351 return &devlink->priv;
352}
353
354static inline struct devlink *priv_to_devlink(void *priv)
355{
356 BUG_ON(!priv);
357 return container_of(priv, struct devlink, priv);
358}
359
360struct ib_device;
361
362#if IS_ENABLED(CONFIG_NET_DEVLINK)
363
364struct devlink *devlink_alloc(const struct devlink_ops *ops, size_t priv_size);
365int devlink_register(struct devlink *devlink, struct device *dev);
366void devlink_unregister(struct devlink *devlink);
367void devlink_free(struct devlink *devlink);
368int devlink_port_register(struct devlink *devlink,
369 struct devlink_port *devlink_port,
370 unsigned int port_index);
371void devlink_port_unregister(struct devlink_port *devlink_port);
372void devlink_port_type_eth_set(struct devlink_port *devlink_port,
373 struct net_device *netdev);
374void devlink_port_type_ib_set(struct devlink_port *devlink_port,
375 struct ib_device *ibdev);
376void devlink_port_type_clear(struct devlink_port *devlink_port);
Jiri Pirkob9ffcba2018-05-18 09:29:00 +0200377void devlink_port_attrs_set(struct devlink_port *devlink_port,
Jiri Pirko5ec13802018-05-18 09:29:01 +0200378 enum devlink_port_flavour flavour,
Jiri Pirkob9ffcba2018-05-18 09:29:00 +0200379 u32 port_number, bool split,
380 u32 split_subport_number);
Jiri Pirko08474c12018-05-18 09:29:02 +0200381int devlink_port_get_phys_port_name(struct devlink_port *devlink_port,
382 char *name, size_t len);
Jiri Pirkobf797472016-04-14 18:19:13 +0200383int devlink_sb_register(struct devlink *devlink, unsigned int sb_index,
384 u32 size, u16 ingress_pools_count,
385 u16 egress_pools_count, u16 ingress_tc_count,
386 u16 egress_tc_count);
387void devlink_sb_unregister(struct devlink *devlink, unsigned int sb_index);
Arkadi Sharshevsky1555d202017-03-28 17:24:10 +0200388int devlink_dpipe_table_register(struct devlink *devlink,
389 const char *table_name,
390 struct devlink_dpipe_table_ops *table_ops,
Arkadi Sharshevskyffd3cdc2017-08-24 08:40:02 +0200391 void *priv, bool counter_control_extern);
Arkadi Sharshevsky1555d202017-03-28 17:24:10 +0200392void devlink_dpipe_table_unregister(struct devlink *devlink,
393 const char *table_name);
394int devlink_dpipe_headers_register(struct devlink *devlink,
395 struct devlink_dpipe_headers *dpipe_headers);
396void devlink_dpipe_headers_unregister(struct devlink *devlink);
397bool devlink_dpipe_table_counter_enabled(struct devlink *devlink,
398 const char *table_name);
399int devlink_dpipe_entry_ctx_prepare(struct devlink_dpipe_dump_ctx *dump_ctx);
400int devlink_dpipe_entry_ctx_append(struct devlink_dpipe_dump_ctx *dump_ctx,
401 struct devlink_dpipe_entry *entry);
402int devlink_dpipe_entry_ctx_close(struct devlink_dpipe_dump_ctx *dump_ctx);
Arkadi Sharshevsky35807322017-08-24 08:40:03 +0200403void devlink_dpipe_entry_clear(struct devlink_dpipe_entry *entry);
Arkadi Sharshevsky1555d202017-03-28 17:24:10 +0200404int devlink_dpipe_action_put(struct sk_buff *skb,
405 struct devlink_dpipe_action *action);
406int devlink_dpipe_match_put(struct sk_buff *skb,
407 struct devlink_dpipe_match *match);
Arkadi Sharshevsky11770092017-08-24 08:39:59 +0200408extern struct devlink_dpipe_header devlink_dpipe_header_ethernet;
Arkadi Sharshevsky3fb886e2017-08-24 08:40:00 +0200409extern struct devlink_dpipe_header devlink_dpipe_header_ipv4;
Arkadi Sharshevsky1797f5b2017-08-31 17:59:12 +0200410extern struct devlink_dpipe_header devlink_dpipe_header_ipv6;
Jiri Pirkobfcd3a42016-02-26 17:32:23 +0100411
Arkadi Sharshevskyd9f9b9a2018-01-15 08:59:03 +0100412int devlink_resource_register(struct devlink *devlink,
413 const char *resource_name,
Arkadi Sharshevskyd9f9b9a2018-01-15 08:59:03 +0100414 u64 resource_size,
415 u64 resource_id,
416 u64 parent_resource_id,
Jiri Pirkofc56be42018-04-05 22:13:21 +0200417 const struct devlink_resource_size_params *size_params);
Arkadi Sharshevskyd9f9b9a2018-01-15 08:59:03 +0100418void devlink_resources_unregister(struct devlink *devlink,
419 struct devlink_resource *resource);
420int devlink_resource_size_get(struct devlink *devlink,
421 u64 resource_id,
422 u64 *p_resource_size);
Arkadi Sharshevsky56dc7cd2018-01-15 08:59:05 +0100423int devlink_dpipe_table_resource_set(struct devlink *devlink,
424 const char *table_name, u64 resource_id,
425 u64 resource_units);
Jiri Pirkofc56be42018-04-05 22:13:21 +0200426void devlink_resource_occ_get_register(struct devlink *devlink,
427 u64 resource_id,
428 devlink_resource_occ_get_t *occ_get,
429 void *occ_get_priv);
430void devlink_resource_occ_get_unregister(struct devlink *devlink,
431 u64 resource_id);
Arkadi Sharshevskyd9f9b9a2018-01-15 08:59:03 +0100432
Jiri Pirkobfcd3a42016-02-26 17:32:23 +0100433#else
434
435static inline struct devlink *devlink_alloc(const struct devlink_ops *ops,
436 size_t priv_size)
437{
438 return kzalloc(sizeof(struct devlink) + priv_size, GFP_KERNEL);
439}
440
441static inline int devlink_register(struct devlink *devlink, struct device *dev)
442{
443 return 0;
444}
445
446static inline void devlink_unregister(struct devlink *devlink)
447{
448}
449
450static inline void devlink_free(struct devlink *devlink)
451{
452 kfree(devlink);
453}
454
455static inline int devlink_port_register(struct devlink *devlink,
456 struct devlink_port *devlink_port,
457 unsigned int port_index)
458{
459 return 0;
460}
461
462static inline void devlink_port_unregister(struct devlink_port *devlink_port)
463{
464}
465
466static inline void devlink_port_type_eth_set(struct devlink_port *devlink_port,
467 struct net_device *netdev)
468{
469}
470
471static inline void devlink_port_type_ib_set(struct devlink_port *devlink_port,
472 struct ib_device *ibdev)
473{
474}
475
476static inline void devlink_port_type_clear(struct devlink_port *devlink_port)
477{
478}
479
Jiri Pirkob9ffcba2018-05-18 09:29:00 +0200480static inline void devlink_port_attrs_set(struct devlink_port *devlink_port,
Jiri Pirko5ec13802018-05-18 09:29:01 +0200481 enum devlink_port_flavour flavour,
Jiri Pirkob9ffcba2018-05-18 09:29:00 +0200482 u32 port_number, bool split,
483 u32 split_subport_number)
Jiri Pirkobfcd3a42016-02-26 17:32:23 +0100484{
485}
486
Jiri Pirko08474c12018-05-18 09:29:02 +0200487static inline int
488devlink_port_get_phys_port_name(struct devlink_port *devlink_port,
489 char *name, size_t len)
490{
491 return -EOPNOTSUPP;
492}
493
Jiri Pirkobf797472016-04-14 18:19:13 +0200494static inline int devlink_sb_register(struct devlink *devlink,
495 unsigned int sb_index, u32 size,
496 u16 ingress_pools_count,
Jiri Pirkode33efd2016-04-15 09:17:08 +0200497 u16 egress_pools_count,
498 u16 ingress_tc_count,
499 u16 egress_tc_count)
Jiri Pirkobf797472016-04-14 18:19:13 +0200500{
501 return 0;
502}
503
504static inline void devlink_sb_unregister(struct devlink *devlink,
505 unsigned int sb_index)
506{
507}
508
Arkadi Sharshevsky1555d202017-03-28 17:24:10 +0200509static inline int
510devlink_dpipe_table_register(struct devlink *devlink,
511 const char *table_name,
512 struct devlink_dpipe_table_ops *table_ops,
David S. Miller790c6052017-08-24 18:10:46 -0700513 void *priv, bool counter_control_extern)
Arkadi Sharshevsky1555d202017-03-28 17:24:10 +0200514{
515 return 0;
516}
517
518static inline void devlink_dpipe_table_unregister(struct devlink *devlink,
519 const char *table_name)
520{
521}
522
523static inline int devlink_dpipe_headers_register(struct devlink *devlink,
524 struct devlink_dpipe_headers *
525 dpipe_headers)
526{
527 return 0;
528}
529
530static inline void devlink_dpipe_headers_unregister(struct devlink *devlink)
531{
532}
533
534static inline bool devlink_dpipe_table_counter_enabled(struct devlink *devlink,
535 const char *table_name)
536{
537 return false;
538}
539
540static inline int
541devlink_dpipe_entry_ctx_prepare(struct devlink_dpipe_dump_ctx *dump_ctx)
542{
543 return 0;
544}
545
546static inline int
547devlink_dpipe_entry_ctx_append(struct devlink_dpipe_dump_ctx *dump_ctx,
548 struct devlink_dpipe_entry *entry)
549{
550 return 0;
551}
552
553static inline int
554devlink_dpipe_entry_ctx_close(struct devlink_dpipe_dump_ctx *dump_ctx)
555{
556 return 0;
557}
558
Arkadi Sharshevsky35807322017-08-24 08:40:03 +0200559static inline void
560devlink_dpipe_entry_clear(struct devlink_dpipe_entry *entry)
561{
562}
563
Arkadi Sharshevsky1555d202017-03-28 17:24:10 +0200564static inline int
565devlink_dpipe_action_put(struct sk_buff *skb,
566 struct devlink_dpipe_action *action)
567{
568 return 0;
569}
570
571static inline int
572devlink_dpipe_match_put(struct sk_buff *skb,
573 struct devlink_dpipe_match *match)
574{
575 return 0;
576}
577
Arkadi Sharshevskyd9f9b9a2018-01-15 08:59:03 +0100578static inline int
579devlink_resource_register(struct devlink *devlink,
580 const char *resource_name,
Arkadi Sharshevskyd9f9b9a2018-01-15 08:59:03 +0100581 u64 resource_size,
582 u64 resource_id,
583 u64 parent_resource_id,
Jiri Pirkofc56be42018-04-05 22:13:21 +0200584 const struct devlink_resource_size_params *size_params)
Arkadi Sharshevskyd9f9b9a2018-01-15 08:59:03 +0100585{
586 return 0;
587}
588
589static inline void
590devlink_resources_unregister(struct devlink *devlink,
591 struct devlink_resource *resource)
592{
593}
594
595static inline int
596devlink_resource_size_get(struct devlink *devlink, u64 resource_id,
597 u64 *p_resource_size)
598{
599 return -EOPNOTSUPP;
600}
601
Arkadi Sharshevsky56dc7cd2018-01-15 08:59:05 +0100602static inline int
603devlink_dpipe_table_resource_set(struct devlink *devlink,
604 const char *table_name, u64 resource_id,
605 u64 resource_units)
606{
607 return -EOPNOTSUPP;
608}
609
Jiri Pirkofc56be42018-04-05 22:13:21 +0200610static inline void
611devlink_resource_occ_get_register(struct devlink *devlink,
612 u64 resource_id,
613 devlink_resource_occ_get_t *occ_get,
614 void *occ_get_priv)
615{
616}
617
618static inline void
619devlink_resource_occ_get_unregister(struct devlink *devlink,
620 u64 resource_id)
621{
622}
623
Jiri Pirkobfcd3a42016-02-26 17:32:23 +0100624#endif
625
626#endif /* _NET_DEVLINK_H_ */