blob: e336ea9c73df31df038f5905e5524e57d1652894 [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 {
David Ahernac0fc8a2018-06-05 08:14:09 -0700299 int (*reload)(struct devlink *devlink, struct netlink_ext_ack *extack);
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,
David Ahernac0fc8a2018-06-05 08:14:09 -0700303 unsigned int count, struct netlink_ext_ack *extack);
304 int (*port_unsplit)(struct devlink *devlink, unsigned int port_index,
305 struct netlink_ext_ack *extack);
Jiri Pirkobf797472016-04-14 18:19:13 +0200306 int (*sb_pool_get)(struct devlink *devlink, unsigned int sb_index,
307 u16 pool_index,
308 struct devlink_sb_pool_info *pool_info);
309 int (*sb_pool_set)(struct devlink *devlink, unsigned int sb_index,
310 u16 pool_index, u32 size,
311 enum devlink_sb_threshold_type threshold_type);
312 int (*sb_port_pool_get)(struct devlink_port *devlink_port,
313 unsigned int sb_index, u16 pool_index,
314 u32 *p_threshold);
315 int (*sb_port_pool_set)(struct devlink_port *devlink_port,
316 unsigned int sb_index, u16 pool_index,
317 u32 threshold);
318 int (*sb_tc_pool_bind_get)(struct devlink_port *devlink_port,
319 unsigned int sb_index,
320 u16 tc_index,
321 enum devlink_sb_pool_type pool_type,
322 u16 *p_pool_index, u32 *p_threshold);
323 int (*sb_tc_pool_bind_set)(struct devlink_port *devlink_port,
324 unsigned int sb_index,
325 u16 tc_index,
326 enum devlink_sb_pool_type pool_type,
327 u16 pool_index, u32 threshold);
Jiri Pirkodf38daf2016-04-14 18:19:14 +0200328 int (*sb_occ_snapshot)(struct devlink *devlink,
329 unsigned int sb_index);
330 int (*sb_occ_max_clear)(struct devlink *devlink,
331 unsigned int sb_index);
332 int (*sb_occ_port_pool_get)(struct devlink_port *devlink_port,
333 unsigned int sb_index, u16 pool_index,
334 u32 *p_cur, u32 *p_max);
335 int (*sb_occ_tc_port_bind_get)(struct devlink_port *devlink_port,
336 unsigned int sb_index,
337 u16 tc_index,
338 enum devlink_sb_pool_type pool_type,
339 u32 *p_cur, u32 *p_max);
Or Gerlitz08f4b592016-07-01 14:51:01 +0300340
341 int (*eswitch_mode_get)(struct devlink *devlink, u16 *p_mode);
342 int (*eswitch_mode_set)(struct devlink *devlink, u16 mode);
Roi Dayan59bfde02016-11-22 23:09:57 +0200343 int (*eswitch_inline_mode_get)(struct devlink *devlink, u8 *p_inline_mode);
344 int (*eswitch_inline_mode_set)(struct devlink *devlink, u8 inline_mode);
Roi Dayanf43e9b02016-09-25 13:52:44 +0300345 int (*eswitch_encap_mode_get)(struct devlink *devlink, u8 *p_encap_mode);
346 int (*eswitch_encap_mode_set)(struct devlink *devlink, u8 encap_mode);
Jiri Pirkobfcd3a42016-02-26 17:32:23 +0100347};
348
349static inline void *devlink_priv(struct devlink *devlink)
350{
351 BUG_ON(!devlink);
352 return &devlink->priv;
353}
354
355static inline struct devlink *priv_to_devlink(void *priv)
356{
357 BUG_ON(!priv);
358 return container_of(priv, struct devlink, priv);
359}
360
361struct ib_device;
362
363#if IS_ENABLED(CONFIG_NET_DEVLINK)
364
365struct devlink *devlink_alloc(const struct devlink_ops *ops, size_t priv_size);
366int devlink_register(struct devlink *devlink, struct device *dev);
367void devlink_unregister(struct devlink *devlink);
368void devlink_free(struct devlink *devlink);
369int devlink_port_register(struct devlink *devlink,
370 struct devlink_port *devlink_port,
371 unsigned int port_index);
372void devlink_port_unregister(struct devlink_port *devlink_port);
373void devlink_port_type_eth_set(struct devlink_port *devlink_port,
374 struct net_device *netdev);
375void devlink_port_type_ib_set(struct devlink_port *devlink_port,
376 struct ib_device *ibdev);
377void devlink_port_type_clear(struct devlink_port *devlink_port);
Jiri Pirkob9ffcba2018-05-18 09:29:00 +0200378void devlink_port_attrs_set(struct devlink_port *devlink_port,
Jiri Pirko5ec13802018-05-18 09:29:01 +0200379 enum devlink_port_flavour flavour,
Jiri Pirkob9ffcba2018-05-18 09:29:00 +0200380 u32 port_number, bool split,
381 u32 split_subport_number);
Jiri Pirko08474c12018-05-18 09:29:02 +0200382int devlink_port_get_phys_port_name(struct devlink_port *devlink_port,
383 char *name, size_t len);
Jiri Pirkobf797472016-04-14 18:19:13 +0200384int devlink_sb_register(struct devlink *devlink, unsigned int sb_index,
385 u32 size, u16 ingress_pools_count,
386 u16 egress_pools_count, u16 ingress_tc_count,
387 u16 egress_tc_count);
388void devlink_sb_unregister(struct devlink *devlink, unsigned int sb_index);
Arkadi Sharshevsky1555d202017-03-28 17:24:10 +0200389int devlink_dpipe_table_register(struct devlink *devlink,
390 const char *table_name,
391 struct devlink_dpipe_table_ops *table_ops,
Arkadi Sharshevskyffd3cdc2017-08-24 08:40:02 +0200392 void *priv, bool counter_control_extern);
Arkadi Sharshevsky1555d202017-03-28 17:24:10 +0200393void devlink_dpipe_table_unregister(struct devlink *devlink,
394 const char *table_name);
395int devlink_dpipe_headers_register(struct devlink *devlink,
396 struct devlink_dpipe_headers *dpipe_headers);
397void devlink_dpipe_headers_unregister(struct devlink *devlink);
398bool devlink_dpipe_table_counter_enabled(struct devlink *devlink,
399 const char *table_name);
400int devlink_dpipe_entry_ctx_prepare(struct devlink_dpipe_dump_ctx *dump_ctx);
401int devlink_dpipe_entry_ctx_append(struct devlink_dpipe_dump_ctx *dump_ctx,
402 struct devlink_dpipe_entry *entry);
403int devlink_dpipe_entry_ctx_close(struct devlink_dpipe_dump_ctx *dump_ctx);
Arkadi Sharshevsky35807322017-08-24 08:40:03 +0200404void devlink_dpipe_entry_clear(struct devlink_dpipe_entry *entry);
Arkadi Sharshevsky1555d202017-03-28 17:24:10 +0200405int devlink_dpipe_action_put(struct sk_buff *skb,
406 struct devlink_dpipe_action *action);
407int devlink_dpipe_match_put(struct sk_buff *skb,
408 struct devlink_dpipe_match *match);
Arkadi Sharshevsky11770092017-08-24 08:39:59 +0200409extern struct devlink_dpipe_header devlink_dpipe_header_ethernet;
Arkadi Sharshevsky3fb886e2017-08-24 08:40:00 +0200410extern struct devlink_dpipe_header devlink_dpipe_header_ipv4;
Arkadi Sharshevsky1797f5b2017-08-31 17:59:12 +0200411extern struct devlink_dpipe_header devlink_dpipe_header_ipv6;
Jiri Pirkobfcd3a42016-02-26 17:32:23 +0100412
Arkadi Sharshevskyd9f9b9a2018-01-15 08:59:03 +0100413int devlink_resource_register(struct devlink *devlink,
414 const char *resource_name,
Arkadi Sharshevskyd9f9b9a2018-01-15 08:59:03 +0100415 u64 resource_size,
416 u64 resource_id,
417 u64 parent_resource_id,
Jiri Pirkofc56be42018-04-05 22:13:21 +0200418 const struct devlink_resource_size_params *size_params);
Arkadi Sharshevskyd9f9b9a2018-01-15 08:59:03 +0100419void devlink_resources_unregister(struct devlink *devlink,
420 struct devlink_resource *resource);
421int devlink_resource_size_get(struct devlink *devlink,
422 u64 resource_id,
423 u64 *p_resource_size);
Arkadi Sharshevsky56dc7cd2018-01-15 08:59:05 +0100424int devlink_dpipe_table_resource_set(struct devlink *devlink,
425 const char *table_name, u64 resource_id,
426 u64 resource_units);
Jiri Pirkofc56be42018-04-05 22:13:21 +0200427void devlink_resource_occ_get_register(struct devlink *devlink,
428 u64 resource_id,
429 devlink_resource_occ_get_t *occ_get,
430 void *occ_get_priv);
431void devlink_resource_occ_get_unregister(struct devlink *devlink,
432 u64 resource_id);
Arkadi Sharshevskyd9f9b9a2018-01-15 08:59:03 +0100433
Jiri Pirkobfcd3a42016-02-26 17:32:23 +0100434#else
435
436static inline struct devlink *devlink_alloc(const struct devlink_ops *ops,
437 size_t priv_size)
438{
439 return kzalloc(sizeof(struct devlink) + priv_size, GFP_KERNEL);
440}
441
442static inline int devlink_register(struct devlink *devlink, struct device *dev)
443{
444 return 0;
445}
446
447static inline void devlink_unregister(struct devlink *devlink)
448{
449}
450
451static inline void devlink_free(struct devlink *devlink)
452{
453 kfree(devlink);
454}
455
456static inline int devlink_port_register(struct devlink *devlink,
457 struct devlink_port *devlink_port,
458 unsigned int port_index)
459{
460 return 0;
461}
462
463static inline void devlink_port_unregister(struct devlink_port *devlink_port)
464{
465}
466
467static inline void devlink_port_type_eth_set(struct devlink_port *devlink_port,
468 struct net_device *netdev)
469{
470}
471
472static inline void devlink_port_type_ib_set(struct devlink_port *devlink_port,
473 struct ib_device *ibdev)
474{
475}
476
477static inline void devlink_port_type_clear(struct devlink_port *devlink_port)
478{
479}
480
Jiri Pirkob9ffcba2018-05-18 09:29:00 +0200481static inline void devlink_port_attrs_set(struct devlink_port *devlink_port,
Jiri Pirko5ec13802018-05-18 09:29:01 +0200482 enum devlink_port_flavour flavour,
Jiri Pirkob9ffcba2018-05-18 09:29:00 +0200483 u32 port_number, bool split,
484 u32 split_subport_number)
Jiri Pirkobfcd3a42016-02-26 17:32:23 +0100485{
486}
487
Jiri Pirko08474c12018-05-18 09:29:02 +0200488static inline int
489devlink_port_get_phys_port_name(struct devlink_port *devlink_port,
490 char *name, size_t len)
491{
492 return -EOPNOTSUPP;
493}
494
Jiri Pirkobf797472016-04-14 18:19:13 +0200495static inline int devlink_sb_register(struct devlink *devlink,
496 unsigned int sb_index, u32 size,
497 u16 ingress_pools_count,
Jiri Pirkode33efd2016-04-15 09:17:08 +0200498 u16 egress_pools_count,
499 u16 ingress_tc_count,
500 u16 egress_tc_count)
Jiri Pirkobf797472016-04-14 18:19:13 +0200501{
502 return 0;
503}
504
505static inline void devlink_sb_unregister(struct devlink *devlink,
506 unsigned int sb_index)
507{
508}
509
Arkadi Sharshevsky1555d202017-03-28 17:24:10 +0200510static inline int
511devlink_dpipe_table_register(struct devlink *devlink,
512 const char *table_name,
513 struct devlink_dpipe_table_ops *table_ops,
David S. Miller790c6052017-08-24 18:10:46 -0700514 void *priv, bool counter_control_extern)
Arkadi Sharshevsky1555d202017-03-28 17:24:10 +0200515{
516 return 0;
517}
518
519static inline void devlink_dpipe_table_unregister(struct devlink *devlink,
520 const char *table_name)
521{
522}
523
524static inline int devlink_dpipe_headers_register(struct devlink *devlink,
525 struct devlink_dpipe_headers *
526 dpipe_headers)
527{
528 return 0;
529}
530
531static inline void devlink_dpipe_headers_unregister(struct devlink *devlink)
532{
533}
534
535static inline bool devlink_dpipe_table_counter_enabled(struct devlink *devlink,
536 const char *table_name)
537{
538 return false;
539}
540
541static inline int
542devlink_dpipe_entry_ctx_prepare(struct devlink_dpipe_dump_ctx *dump_ctx)
543{
544 return 0;
545}
546
547static inline int
548devlink_dpipe_entry_ctx_append(struct devlink_dpipe_dump_ctx *dump_ctx,
549 struct devlink_dpipe_entry *entry)
550{
551 return 0;
552}
553
554static inline int
555devlink_dpipe_entry_ctx_close(struct devlink_dpipe_dump_ctx *dump_ctx)
556{
557 return 0;
558}
559
Arkadi Sharshevsky35807322017-08-24 08:40:03 +0200560static inline void
561devlink_dpipe_entry_clear(struct devlink_dpipe_entry *entry)
562{
563}
564
Arkadi Sharshevsky1555d202017-03-28 17:24:10 +0200565static inline int
566devlink_dpipe_action_put(struct sk_buff *skb,
567 struct devlink_dpipe_action *action)
568{
569 return 0;
570}
571
572static inline int
573devlink_dpipe_match_put(struct sk_buff *skb,
574 struct devlink_dpipe_match *match)
575{
576 return 0;
577}
578
Arkadi Sharshevskyd9f9b9a2018-01-15 08:59:03 +0100579static inline int
580devlink_resource_register(struct devlink *devlink,
581 const char *resource_name,
Arkadi Sharshevskyd9f9b9a2018-01-15 08:59:03 +0100582 u64 resource_size,
583 u64 resource_id,
584 u64 parent_resource_id,
Jiri Pirkofc56be42018-04-05 22:13:21 +0200585 const struct devlink_resource_size_params *size_params)
Arkadi Sharshevskyd9f9b9a2018-01-15 08:59:03 +0100586{
587 return 0;
588}
589
590static inline void
591devlink_resources_unregister(struct devlink *devlink,
592 struct devlink_resource *resource)
593{
594}
595
596static inline int
597devlink_resource_size_get(struct devlink *devlink, u64 resource_id,
598 u64 *p_resource_size)
599{
600 return -EOPNOTSUPP;
601}
602
Arkadi Sharshevsky56dc7cd2018-01-15 08:59:05 +0100603static inline int
604devlink_dpipe_table_resource_set(struct devlink *devlink,
605 const char *table_name, u64 resource_id,
606 u64 resource_units)
607{
608 return -EOPNOTSUPP;
609}
610
Jiri Pirkofc56be42018-04-05 22:13:21 +0200611static inline void
612devlink_resource_occ_get_register(struct devlink *devlink,
613 u64 resource_id,
614 devlink_resource_occ_get_t *occ_get,
615 void *occ_get_priv)
616{
617}
618
619static inline void
620devlink_resource_occ_get_unregister(struct devlink *devlink,
621 u64 resource_id)
622{
623}
624
Jiri Pirkobfcd3a42016-02-26 17:32:23 +0100625#endif
626
627#endif /* _NET_DEVLINK_H_ */