]> Git Repo - linux.git/blame - include/uapi/linux/devlink.h
devlink: add shared buffer configuration
[linux.git] / include / uapi / linux / devlink.h
CommitLineData
bfcd3a46
JP
1/*
2 * include/uapi/linux/devlink.h - Network physical device Netlink interface
3 * Copyright (c) 2016 Mellanox Technologies. All rights reserved.
4 * Copyright (c) 2016 Jiri Pirko <[email protected]>
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
12#ifndef _UAPI_LINUX_DEVLINK_H_
13#define _UAPI_LINUX_DEVLINK_H_
14
15#define DEVLINK_GENL_NAME "devlink"
16#define DEVLINK_GENL_VERSION 0x1
17#define DEVLINK_GENL_MCGRP_CONFIG_NAME "config"
18
19enum devlink_command {
20 /* don't change the order or add anything between, this is ABI! */
21 DEVLINK_CMD_UNSPEC,
22
23 DEVLINK_CMD_GET, /* can dump */
24 DEVLINK_CMD_SET,
25 DEVLINK_CMD_NEW,
26 DEVLINK_CMD_DEL,
27
28 DEVLINK_CMD_PORT_GET, /* can dump */
29 DEVLINK_CMD_PORT_SET,
30 DEVLINK_CMD_PORT_NEW,
31 DEVLINK_CMD_PORT_DEL,
32
33 DEVLINK_CMD_PORT_SPLIT,
34 DEVLINK_CMD_PORT_UNSPLIT,
35
bf797471
JP
36 DEVLINK_CMD_SB_GET, /* can dump */
37 DEVLINK_CMD_SB_SET,
38 DEVLINK_CMD_SB_NEW,
39 DEVLINK_CMD_SB_DEL,
40
41 DEVLINK_CMD_SB_POOL_GET, /* can dump */
42 DEVLINK_CMD_SB_POOL_SET,
43 DEVLINK_CMD_SB_POOL_NEW,
44 DEVLINK_CMD_SB_POOL_DEL,
45
46 DEVLINK_CMD_SB_PORT_POOL_GET, /* can dump */
47 DEVLINK_CMD_SB_PORT_POOL_SET,
48 DEVLINK_CMD_SB_PORT_POOL_NEW,
49 DEVLINK_CMD_SB_PORT_POOL_DEL,
50
51 DEVLINK_CMD_SB_TC_POOL_BIND_GET, /* can dump */
52 DEVLINK_CMD_SB_TC_POOL_BIND_SET,
53 DEVLINK_CMD_SB_TC_POOL_BIND_NEW,
54 DEVLINK_CMD_SB_TC_POOL_BIND_DEL,
55
bfcd3a46
JP
56 /* add new commands above here */
57
58 __DEVLINK_CMD_MAX,
59 DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1
60};
61
62enum devlink_port_type {
63 DEVLINK_PORT_TYPE_NOTSET,
64 DEVLINK_PORT_TYPE_AUTO,
65 DEVLINK_PORT_TYPE_ETH,
66 DEVLINK_PORT_TYPE_IB,
67};
68
bf797471
JP
69enum devlink_sb_pool_type {
70 DEVLINK_SB_POOL_TYPE_INGRESS,
71 DEVLINK_SB_POOL_TYPE_EGRESS,
72};
73
74/* static threshold - limiting the maximum number of bytes.
75 * dynamic threshold - limiting the maximum number of bytes
76 * based on the currently available free space in the shared buffer pool.
77 * In this mode, the maximum quota is calculated based
78 * on the following formula:
79 * max_quota = alpha / (1 + alpha) * Free_Buffer
80 * While Free_Buffer is the amount of none-occupied buffer associated to
81 * the relevant pool.
82 * The value range which can be passed is 0-20 and serves
83 * for computation of alpha by following formula:
84 * alpha = 2 ^ (passed_value - 10)
85 */
86
87enum devlink_sb_threshold_type {
88 DEVLINK_SB_THRESHOLD_TYPE_STATIC,
89 DEVLINK_SB_THRESHOLD_TYPE_DYNAMIC,
90};
91
92#define DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX 20
93
bfcd3a46
JP
94enum devlink_attr {
95 /* don't change the order or add anything between, this is ABI! */
96 DEVLINK_ATTR_UNSPEC,
97
98 /* bus name + dev name together are a handle for devlink entity */
99 DEVLINK_ATTR_BUS_NAME, /* string */
100 DEVLINK_ATTR_DEV_NAME, /* string */
101
102 DEVLINK_ATTR_PORT_INDEX, /* u32 */
103 DEVLINK_ATTR_PORT_TYPE, /* u16 */
104 DEVLINK_ATTR_PORT_DESIRED_TYPE, /* u16 */
105 DEVLINK_ATTR_PORT_NETDEV_IFINDEX, /* u32 */
106 DEVLINK_ATTR_PORT_NETDEV_NAME, /* string */
107 DEVLINK_ATTR_PORT_IBDEV_NAME, /* string */
108 DEVLINK_ATTR_PORT_SPLIT_COUNT, /* u32 */
109 DEVLINK_ATTR_PORT_SPLIT_GROUP, /* u32 */
bf797471
JP
110 DEVLINK_ATTR_SB_INDEX, /* u32 */
111 DEVLINK_ATTR_SB_SIZE, /* u32 */
112 DEVLINK_ATTR_SB_INGRESS_POOL_COUNT, /* u16 */
113 DEVLINK_ATTR_SB_EGRESS_POOL_COUNT, /* u16 */
114 DEVLINK_ATTR_SB_INGRESS_TC_COUNT, /* u16 */
115 DEVLINK_ATTR_SB_EGRESS_TC_COUNT, /* u16 */
116 DEVLINK_ATTR_SB_POOL_INDEX, /* u16 */
117 DEVLINK_ATTR_SB_POOL_TYPE, /* u8 */
118 DEVLINK_ATTR_SB_POOL_SIZE, /* u32 */
119 DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE, /* u8 */
120 DEVLINK_ATTR_SB_THRESHOLD, /* u32 */
121 DEVLINK_ATTR_SB_TC_INDEX, /* u16 */
bfcd3a46
JP
122
123 /* add new attributes above here, update the policy in devlink.c */
124
125 __DEVLINK_ATTR_MAX,
126 DEVLINK_ATTR_MAX = __DEVLINK_ATTR_MAX - 1
127};
128
129#endif /* _UAPI_LINUX_DEVLINK_H_ */
This page took 0.068062 seconds and 4 git commands to generate.