blob: 8723491f7dfd2c0d8c9e3a349d38316c38a40da8 [file] [log] [blame]
Alexander Duyck2f90b862008-11-20 20:52:10 -08001/*
2 * Copyright (c) 2008, Intel Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307 USA.
16 *
17 * Author: Lucy Liu <lucy.liu@intel.com>
18 */
19
20#ifndef __LINUX_DCBNL_H__
21#define __LINUX_DCBNL_H__
22
Chris Leech5c252222009-02-27 10:01:36 +000023#include <linux/types.h>
24
Alexander Duyck2f90b862008-11-20 20:52:10 -080025struct dcbmsg {
Chris Leech5c252222009-02-27 10:01:36 +000026 __u8 dcb_family;
Alexander Duyck2f90b862008-11-20 20:52:10 -080027 __u8 cmd;
28 __u16 dcb_pad;
29};
30
31/**
32 * enum dcbnl_commands - supported DCB commands
33 *
34 * @DCB_CMD_UNDEFINED: unspecified command to catch errors
35 * @DCB_CMD_GSTATE: request the state of DCB in the device
36 * @DCB_CMD_SSTATE: set the state of DCB in the device
37 * @DCB_CMD_PGTX_GCFG: request the priority group configuration for Tx
38 * @DCB_CMD_PGTX_SCFG: set the priority group configuration for Tx
39 * @DCB_CMD_PGRX_GCFG: request the priority group configuration for Rx
40 * @DCB_CMD_PGRX_SCFG: set the priority group configuration for Rx
41 * @DCB_CMD_PFC_GCFG: request the priority flow control configuration
42 * @DCB_CMD_PFC_SCFG: set the priority flow control configuration
43 * @DCB_CMD_SET_ALL: apply all changes to the underlying device
44 * @DCB_CMD_GPERM_HWADDR: get the permanent MAC address of the underlying
45 * device. Only useful when using bonding.
Alexander Duyck46132182008-11-20 21:05:08 -080046 * @DCB_CMD_GCAP: request the DCB capabilities of the device
Alexander Duyck33dbabc2008-11-20 21:08:19 -080047 * @DCB_CMD_GNUMTCS: get the number of traffic classes currently supported
48 * @DCB_CMD_SNUMTCS: set the number of traffic classes
Alexander Duyck859ee3c2008-11-20 21:10:23 -080049 * @DCB_CMD_GBCN: set backward congestion notification configuration
50 * @DCB_CMD_SBCN: get backward congestion notification configration.
Yi Zou0f6f2902009-08-31 12:32:34 +000051 * @DCB_CMD_GAPP: get application protocol configuration
52 * @DCB_CMD_SAPP: set application protocol configuration
Alexander Duyck2f90b862008-11-20 20:52:10 -080053 */
54enum dcbnl_commands {
55 DCB_CMD_UNDEFINED,
56
57 DCB_CMD_GSTATE,
58 DCB_CMD_SSTATE,
59
60 DCB_CMD_PGTX_GCFG,
61 DCB_CMD_PGTX_SCFG,
62 DCB_CMD_PGRX_GCFG,
63 DCB_CMD_PGRX_SCFG,
64
65 DCB_CMD_PFC_GCFG,
66 DCB_CMD_PFC_SCFG,
67
68 DCB_CMD_SET_ALL,
Alexander Duyck859ee3c2008-11-20 21:10:23 -080069
Alexander Duyck2f90b862008-11-20 20:52:10 -080070 DCB_CMD_GPERM_HWADDR,
Alexander Duyck859ee3c2008-11-20 21:10:23 -080071
Alexander Duyck46132182008-11-20 21:05:08 -080072 DCB_CMD_GCAP,
Alexander Duyck859ee3c2008-11-20 21:10:23 -080073
Alexander Duyck33dbabc2008-11-20 21:08:19 -080074 DCB_CMD_GNUMTCS,
75 DCB_CMD_SNUMTCS,
Alexander Duyck859ee3c2008-11-20 21:10:23 -080076
Alexander Duyck0eb3aa92008-11-20 21:09:23 -080077 DCB_CMD_PFC_GSTATE,
78 DCB_CMD_PFC_SSTATE,
Alexander Duyck2f90b862008-11-20 20:52:10 -080079
Alexander Duyck859ee3c2008-11-20 21:10:23 -080080 DCB_CMD_BCN_GCFG,
81 DCB_CMD_BCN_SCFG,
82
Yi Zou0f6f2902009-08-31 12:32:34 +000083 DCB_CMD_GAPP,
84 DCB_CMD_SAPP,
85
Alexander Duyck2f90b862008-11-20 20:52:10 -080086 __DCB_CMD_ENUM_MAX,
87 DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1,
88};
89
Alexander Duyck2f90b862008-11-20 20:52:10 -080090/**
91 * enum dcbnl_attrs - DCB top-level netlink attributes
92 *
93 * @DCB_ATTR_UNDEFINED: unspecified attribute to catch errors
94 * @DCB_ATTR_IFNAME: interface name of the underlying device (NLA_STRING)
95 * @DCB_ATTR_STATE: enable state of DCB in the device (NLA_U8)
96 * @DCB_ATTR_PFC_STATE: enable state of PFC in the device (NLA_U8)
97 * @DCB_ATTR_PFC_CFG: priority flow control configuration (NLA_NESTED)
98 * @DCB_ATTR_NUM_TC: number of traffic classes supported in the device (NLA_U8)
99 * @DCB_ATTR_PG_CFG: priority group configuration (NLA_NESTED)
100 * @DCB_ATTR_SET_ALL: bool to commit changes to hardware or not (NLA_U8)
101 * @DCB_ATTR_PERM_HWADDR: MAC address of the physical device (NLA_NESTED)
Alexander Duyck46132182008-11-20 21:05:08 -0800102 * @DCB_ATTR_CAP: DCB capabilities of the device (NLA_NESTED)
Alexander Duyck33dbabc2008-11-20 21:08:19 -0800103 * @DCB_ATTR_NUMTCS: number of traffic classes supported (NLA_NESTED)
Alexander Duyck859ee3c2008-11-20 21:10:23 -0800104 * @DCB_ATTR_BCN: backward congestion notification configuration (NLA_NESTED)
Alexander Duyck2f90b862008-11-20 20:52:10 -0800105 */
106enum dcbnl_attrs {
107 DCB_ATTR_UNDEFINED,
108
109 DCB_ATTR_IFNAME,
110 DCB_ATTR_STATE,
111 DCB_ATTR_PFC_STATE,
112 DCB_ATTR_PFC_CFG,
113 DCB_ATTR_NUM_TC,
114 DCB_ATTR_PG_CFG,
115 DCB_ATTR_SET_ALL,
116 DCB_ATTR_PERM_HWADDR,
Alexander Duyck46132182008-11-20 21:05:08 -0800117 DCB_ATTR_CAP,
Alexander Duyck33dbabc2008-11-20 21:08:19 -0800118 DCB_ATTR_NUMTCS,
Alexander Duyck859ee3c2008-11-20 21:10:23 -0800119 DCB_ATTR_BCN,
Yi Zou0f6f2902009-08-31 12:32:34 +0000120 DCB_ATTR_APP,
Alexander Duyck2f90b862008-11-20 20:52:10 -0800121
122 __DCB_ATTR_ENUM_MAX,
123 DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1,
124};
125
126/**
127 * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs
128 *
129 * @DCB_PFC_UP_ATTR_UNDEFINED: unspecified attribute to catch errors
130 * @DCB_PFC_UP_ATTR_0: Priority Flow Control value for User Priority 0 (NLA_U8)
131 * @DCB_PFC_UP_ATTR_1: Priority Flow Control value for User Priority 1 (NLA_U8)
132 * @DCB_PFC_UP_ATTR_2: Priority Flow Control value for User Priority 2 (NLA_U8)
133 * @DCB_PFC_UP_ATTR_3: Priority Flow Control value for User Priority 3 (NLA_U8)
134 * @DCB_PFC_UP_ATTR_4: Priority Flow Control value for User Priority 4 (NLA_U8)
135 * @DCB_PFC_UP_ATTR_5: Priority Flow Control value for User Priority 5 (NLA_U8)
136 * @DCB_PFC_UP_ATTR_6: Priority Flow Control value for User Priority 6 (NLA_U8)
137 * @DCB_PFC_UP_ATTR_7: Priority Flow Control value for User Priority 7 (NLA_U8)
138 * @DCB_PFC_UP_ATTR_MAX: highest attribute number currently defined
139 * @DCB_PFC_UP_ATTR_ALL: apply to all priority flow control attrs (NLA_FLAG)
140 *
141 */
142enum dcbnl_pfc_up_attrs {
143 DCB_PFC_UP_ATTR_UNDEFINED,
144
145 DCB_PFC_UP_ATTR_0,
146 DCB_PFC_UP_ATTR_1,
147 DCB_PFC_UP_ATTR_2,
148 DCB_PFC_UP_ATTR_3,
149 DCB_PFC_UP_ATTR_4,
150 DCB_PFC_UP_ATTR_5,
151 DCB_PFC_UP_ATTR_6,
152 DCB_PFC_UP_ATTR_7,
153 DCB_PFC_UP_ATTR_ALL,
154
155 __DCB_PFC_UP_ATTR_ENUM_MAX,
156 DCB_PFC_UP_ATTR_MAX = __DCB_PFC_UP_ATTR_ENUM_MAX - 1,
157};
158
159/**
160 * enum dcbnl_pg_attrs - DCB Priority Group attributes
161 *
162 * @DCB_PG_ATTR_UNDEFINED: unspecified attribute to catch errors
163 * @DCB_PG_ATTR_TC_0: Priority Group Traffic Class 0 configuration (NLA_NESTED)
164 * @DCB_PG_ATTR_TC_1: Priority Group Traffic Class 1 configuration (NLA_NESTED)
165 * @DCB_PG_ATTR_TC_2: Priority Group Traffic Class 2 configuration (NLA_NESTED)
166 * @DCB_PG_ATTR_TC_3: Priority Group Traffic Class 3 configuration (NLA_NESTED)
167 * @DCB_PG_ATTR_TC_4: Priority Group Traffic Class 4 configuration (NLA_NESTED)
168 * @DCB_PG_ATTR_TC_5: Priority Group Traffic Class 5 configuration (NLA_NESTED)
169 * @DCB_PG_ATTR_TC_6: Priority Group Traffic Class 6 configuration (NLA_NESTED)
170 * @DCB_PG_ATTR_TC_7: Priority Group Traffic Class 7 configuration (NLA_NESTED)
171 * @DCB_PG_ATTR_TC_MAX: highest attribute number currently defined
172 * @DCB_PG_ATTR_TC_ALL: apply to all traffic classes (NLA_NESTED)
173 * @DCB_PG_ATTR_BW_ID_0: Percent of link bandwidth for Priority Group 0 (NLA_U8)
174 * @DCB_PG_ATTR_BW_ID_1: Percent of link bandwidth for Priority Group 1 (NLA_U8)
175 * @DCB_PG_ATTR_BW_ID_2: Percent of link bandwidth for Priority Group 2 (NLA_U8)
176 * @DCB_PG_ATTR_BW_ID_3: Percent of link bandwidth for Priority Group 3 (NLA_U8)
177 * @DCB_PG_ATTR_BW_ID_4: Percent of link bandwidth for Priority Group 4 (NLA_U8)
178 * @DCB_PG_ATTR_BW_ID_5: Percent of link bandwidth for Priority Group 5 (NLA_U8)
179 * @DCB_PG_ATTR_BW_ID_6: Percent of link bandwidth for Priority Group 6 (NLA_U8)
180 * @DCB_PG_ATTR_BW_ID_7: Percent of link bandwidth for Priority Group 7 (NLA_U8)
181 * @DCB_PG_ATTR_BW_ID_MAX: highest attribute number currently defined
182 * @DCB_PG_ATTR_BW_ID_ALL: apply to all priority groups (NLA_FLAG)
183 *
184 */
185enum dcbnl_pg_attrs {
186 DCB_PG_ATTR_UNDEFINED,
187
188 DCB_PG_ATTR_TC_0,
189 DCB_PG_ATTR_TC_1,
190 DCB_PG_ATTR_TC_2,
191 DCB_PG_ATTR_TC_3,
192 DCB_PG_ATTR_TC_4,
193 DCB_PG_ATTR_TC_5,
194 DCB_PG_ATTR_TC_6,
195 DCB_PG_ATTR_TC_7,
196 DCB_PG_ATTR_TC_MAX,
197 DCB_PG_ATTR_TC_ALL,
198
199 DCB_PG_ATTR_BW_ID_0,
200 DCB_PG_ATTR_BW_ID_1,
201 DCB_PG_ATTR_BW_ID_2,
202 DCB_PG_ATTR_BW_ID_3,
203 DCB_PG_ATTR_BW_ID_4,
204 DCB_PG_ATTR_BW_ID_5,
205 DCB_PG_ATTR_BW_ID_6,
206 DCB_PG_ATTR_BW_ID_7,
207 DCB_PG_ATTR_BW_ID_MAX,
208 DCB_PG_ATTR_BW_ID_ALL,
209
210 __DCB_PG_ATTR_ENUM_MAX,
211 DCB_PG_ATTR_MAX = __DCB_PG_ATTR_ENUM_MAX - 1,
212};
213
214/**
215 * enum dcbnl_tc_attrs - DCB Traffic Class attributes
216 *
217 * @DCB_TC_ATTR_PARAM_UNDEFINED: unspecified attribute to catch errors
218 * @DCB_TC_ATTR_PARAM_PGID: (NLA_U8) Priority group the traffic class belongs to
219 * Valid values are: 0-7
220 * @DCB_TC_ATTR_PARAM_UP_MAPPING: (NLA_U8) Traffic class to user priority map
221 * Some devices may not support changing the
222 * user priority map of a TC.
223 * @DCB_TC_ATTR_PARAM_STRICT_PRIO: (NLA_U8) Strict priority setting
224 * 0 - none
225 * 1 - group strict
226 * 2 - link strict
227 * @DCB_TC_ATTR_PARAM_BW_PCT: optional - (NLA_U8) If supported by the device and
228 * not configured to use link strict priority,
229 * this is the percentage of bandwidth of the
230 * priority group this traffic class belongs to
231 * @DCB_TC_ATTR_PARAM_ALL: (NLA_FLAG) all traffic class parameters
232 *
233 */
234enum dcbnl_tc_attrs {
235 DCB_TC_ATTR_PARAM_UNDEFINED,
236
237 DCB_TC_ATTR_PARAM_PGID,
238 DCB_TC_ATTR_PARAM_UP_MAPPING,
239 DCB_TC_ATTR_PARAM_STRICT_PRIO,
240 DCB_TC_ATTR_PARAM_BW_PCT,
241 DCB_TC_ATTR_PARAM_ALL,
242
243 __DCB_TC_ATTR_PARAM_ENUM_MAX,
244 DCB_TC_ATTR_PARAM_MAX = __DCB_TC_ATTR_PARAM_ENUM_MAX - 1,
245};
246
247/**
Alexander Duyck46132182008-11-20 21:05:08 -0800248 * enum dcbnl_cap_attrs - DCB Capability attributes
249 *
250 * @DCB_CAP_ATTR_UNDEFINED: unspecified attribute to catch errors
251 * @DCB_CAP_ATTR_ALL: (NLA_FLAG) all capability parameters
252 * @DCB_CAP_ATTR_PG: (NLA_U8) device supports Priority Groups
253 * @DCB_CAP_ATTR_PFC: (NLA_U8) device supports Priority Flow Control
254 * @DCB_CAP_ATTR_UP2TC: (NLA_U8) device supports user priority to
255 * traffic class mapping
256 * @DCB_CAP_ATTR_PG_TCS: (NLA_U8) bitmap where each bit represents a
257 * number of traffic classes the device
258 * can be configured to use for Priority Groups
259 * @DCB_CAP_ATTR_PFC_TCS: (NLA_U8) bitmap where each bit represents a
260 * number of traffic classes the device can be
261 * configured to use for Priority Flow Control
262 * @DCB_CAP_ATTR_GSP: (NLA_U8) device supports group strict priority
263 * @DCB_CAP_ATTR_BCN: (NLA_U8) device supports Backwards Congestion
264 * Notification
265 */
266enum dcbnl_cap_attrs {
267 DCB_CAP_ATTR_UNDEFINED,
268 DCB_CAP_ATTR_ALL,
269 DCB_CAP_ATTR_PG,
270 DCB_CAP_ATTR_PFC,
271 DCB_CAP_ATTR_UP2TC,
272 DCB_CAP_ATTR_PG_TCS,
273 DCB_CAP_ATTR_PFC_TCS,
274 DCB_CAP_ATTR_GSP,
275 DCB_CAP_ATTR_BCN,
276
277 __DCB_CAP_ATTR_ENUM_MAX,
278 DCB_CAP_ATTR_MAX = __DCB_CAP_ATTR_ENUM_MAX - 1,
279};
Alexander Duyck33dbabc2008-11-20 21:08:19 -0800280
281/**
282 * enum dcbnl_numtcs_attrs - number of traffic classes
283 *
284 * @DCB_NUMTCS_ATTR_UNDEFINED: unspecified attribute to catch errors
285 * @DCB_NUMTCS_ATTR_ALL: (NLA_FLAG) all traffic class attributes
286 * @DCB_NUMTCS_ATTR_PG: (NLA_U8) number of traffic classes used for
287 * priority groups
288 * @DCB_NUMTCS_ATTR_PFC: (NLA_U8) number of traffic classes which can
289 * support priority flow control
290 */
291enum dcbnl_numtcs_attrs {
292 DCB_NUMTCS_ATTR_UNDEFINED,
293 DCB_NUMTCS_ATTR_ALL,
294 DCB_NUMTCS_ATTR_PG,
295 DCB_NUMTCS_ATTR_PFC,
296
297 __DCB_NUMTCS_ATTR_ENUM_MAX,
298 DCB_NUMTCS_ATTR_MAX = __DCB_NUMTCS_ATTR_ENUM_MAX - 1,
299};
300
Alexander Duyck859ee3c2008-11-20 21:10:23 -0800301enum dcbnl_bcn_attrs{
302 DCB_BCN_ATTR_UNDEFINED = 0,
303
304 DCB_BCN_ATTR_RP_0,
305 DCB_BCN_ATTR_RP_1,
306 DCB_BCN_ATTR_RP_2,
307 DCB_BCN_ATTR_RP_3,
308 DCB_BCN_ATTR_RP_4,
309 DCB_BCN_ATTR_RP_5,
310 DCB_BCN_ATTR_RP_6,
311 DCB_BCN_ATTR_RP_7,
312 DCB_BCN_ATTR_RP_ALL,
313
Don Skidmoref4314e82008-12-21 20:10:29 -0800314 DCB_BCN_ATTR_BCNA_0,
315 DCB_BCN_ATTR_BCNA_1,
Alexander Duyck859ee3c2008-11-20 21:10:23 -0800316 DCB_BCN_ATTR_ALPHA,
317 DCB_BCN_ATTR_BETA,
318 DCB_BCN_ATTR_GD,
319 DCB_BCN_ATTR_GI,
320 DCB_BCN_ATTR_TMAX,
321 DCB_BCN_ATTR_TD,
322 DCB_BCN_ATTR_RMIN,
323 DCB_BCN_ATTR_W,
324 DCB_BCN_ATTR_RD,
325 DCB_BCN_ATTR_RU,
326 DCB_BCN_ATTR_WRTT,
327 DCB_BCN_ATTR_RI,
328 DCB_BCN_ATTR_C,
329 DCB_BCN_ATTR_ALL,
330
331 __DCB_BCN_ATTR_ENUM_MAX,
332 DCB_BCN_ATTR_MAX = __DCB_BCN_ATTR_ENUM_MAX - 1,
333};
334
Alexander Duyck46132182008-11-20 21:05:08 -0800335/**
Alexander Duyck2f90b862008-11-20 20:52:10 -0800336 * enum dcb_general_attr_values - general DCB attribute values
337 *
338 * @DCB_ATTR_UNDEFINED: value used to indicate an attribute is not supported
339 *
340 */
341enum dcb_general_attr_values {
342 DCB_ATTR_VALUE_UNDEFINED = 0xff
343};
344
Yi Zou0f6f2902009-08-31 12:32:34 +0000345#define DCB_APP_IDTYPE_ETHTYPE 0x00
346#define DCB_APP_IDTYPE_PORTNUM 0x01
347enum dcbnl_app_attrs {
348 DCB_APP_ATTR_UNDEFINED,
349
350 DCB_APP_ATTR_IDTYPE,
351 DCB_APP_ATTR_ID,
352 DCB_APP_ATTR_PRIORITY,
353
354 __DCB_APP_ATTR_ENUM_MAX,
355 DCB_APP_ATTR_MAX = __DCB_APP_ATTR_ENUM_MAX - 1,
356};
Alexander Duyck2f90b862008-11-20 20:52:10 -0800357
358#endif /* __LINUX_DCBNL_H__ */