]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - include/linux/dcbnl.h
dcbnl: add support for ieee8021Qaz attributes
[mirror_ubuntu-artful-kernel.git] / include / linux / dcbnl.h
CommitLineData
2f90b865
AD
1/*
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
5c252221
CL
23#include <linux/types.h>
24
3e29027a
JF
25/* IEEE 802.1Qaz std supported values */
26#define IEEE_8021QAZ_MAX_TCS 8
27
28/* This structure contains the IEEE 802.1Qaz ETS managed object
29 *
30 * @willing: willing bit in ETS configuratin TLV
31 * @ets_cap: indicates supported capacity of ets feature
32 * @cbs: credit based shaper ets algorithm supported
33 * @tc_tx_bw: tc tx bandwidth indexed by traffic class
34 * @tc_rx_bw: tc rx bandwidth indexed by traffic class
35 * @tc_tsa: TSA Assignment table, indexed by traffic class
36 * @prio_tc: priority assignment table mapping 8021Qp to traffic class
37 * @tc_reco_bw: recommended tc bandwidth indexed by traffic class for TLV
38 * @tc_reco_tsa: recommended tc bandwidth indexed by traffic class for TLV
39 * @reco_prio_tc: recommended tc tx bandwidth indexed by traffic class for TLV
40 *
41 * Recommended values are used to set fields in the ETS recommendation TLV
42 * with hardware offloaded LLDP.
43 *
44 * ----
45 * TSA Assignment 8 bit identifiers
46 * 0 strict priority
47 * 1 credit-based shaper
48 * 2 enhanced transmission selection
49 * 3-254 reserved
50 * 255 vendor specific
51 */
52struct ieee_ets {
53 __u8 willing;
54 __u8 ets_cap;
55 __u8 cbs;
56 __u8 tc_tx_bw[IEEE_8021QAZ_MAX_TCS];
57 __u8 tc_rx_bw[IEEE_8021QAZ_MAX_TCS];
58 __u8 tc_tsa[IEEE_8021QAZ_MAX_TCS];
59 __u8 prio_tc[IEEE_8021QAZ_MAX_TCS];
60 __u8 tc_reco_bw[IEEE_8021QAZ_MAX_TCS];
61 __u8 tc_reco_tsa[IEEE_8021QAZ_MAX_TCS];
62 __u8 reco_prio_tc[IEEE_8021QAZ_MAX_TCS];
63};
64
65/* This structure contains the IEEE 802.1Qaz PFC managed object
66 *
67 * @pfc_cap: Indicates the number of traffic classes on the local device
68 * that may simultaneously have PFC enabled.
69 * @pfc_en: bitmap indicating pfc enabled traffic classes
70 * @mbc: enable macsec bypass capability
71 * @delay: the allowance made for a round-trip propagation delay of the
72 * link in bits.
73 * @requests: count of the sent pfc frames
74 * @indications: count of the received pfc frames
75 */
76struct ieee_pfc {
77 __u8 pfc_cap;
78 __u8 pfc_en;
79 __u8 mbc;
80 __u16 delay;
81 __u64 requests[IEEE_8021QAZ_MAX_TCS];
82 __u64 indications[IEEE_8021QAZ_MAX_TCS];
83};
84
85/* This structure contains the IEEE 802.1Qaz APP managed object
86 *
87 * @selector: protocol identifier type
88 * @protocol: protocol of type indicated
89 * @priority: 3-bit unsigned integer indicating priority
90 *
91 * ----
92 * Selector field values
93 * 0 Reserved
94 * 1 Ethertype
95 * 2 Well known port number over TCP or SCTP
96 * 3 Well known port number over UDP or DCCP
97 * 4 Well known port number over TCP, SCTP, UDP, or DCCP
98 * 5-7 Reserved
99 */
100struct dcb_app {
101 __u8 selector;
102 __u32 protocol;
103 __u8 priority;
104};
105
2f90b865 106struct dcbmsg {
5c252221 107 __u8 dcb_family;
2f90b865
AD
108 __u8 cmd;
109 __u16 dcb_pad;
110};
111
112/**
113 * enum dcbnl_commands - supported DCB commands
114 *
115 * @DCB_CMD_UNDEFINED: unspecified command to catch errors
116 * @DCB_CMD_GSTATE: request the state of DCB in the device
117 * @DCB_CMD_SSTATE: set the state of DCB in the device
118 * @DCB_CMD_PGTX_GCFG: request the priority group configuration for Tx
119 * @DCB_CMD_PGTX_SCFG: set the priority group configuration for Tx
120 * @DCB_CMD_PGRX_GCFG: request the priority group configuration for Rx
121 * @DCB_CMD_PGRX_SCFG: set the priority group configuration for Rx
122 * @DCB_CMD_PFC_GCFG: request the priority flow control configuration
123 * @DCB_CMD_PFC_SCFG: set the priority flow control configuration
124 * @DCB_CMD_SET_ALL: apply all changes to the underlying device
125 * @DCB_CMD_GPERM_HWADDR: get the permanent MAC address of the underlying
126 * device. Only useful when using bonding.
46132188 127 * @DCB_CMD_GCAP: request the DCB capabilities of the device
33dbabc4
AD
128 * @DCB_CMD_GNUMTCS: get the number of traffic classes currently supported
129 * @DCB_CMD_SNUMTCS: set the number of traffic classes
859ee3c4
AD
130 * @DCB_CMD_GBCN: set backward congestion notification configuration
131 * @DCB_CMD_SBCN: get backward congestion notification configration.
0f6f2902
YZ
132 * @DCB_CMD_GAPP: get application protocol configuration
133 * @DCB_CMD_SAPP: set application protocol configuration
3e29027a
JF
134 * @DCB_CMD_IEEE_SET: set IEEE 802.1Qaz configuration
135 * @DCB_CMD_IEEE_GET: get IEEE 802.1Qaz configuration
2f90b865
AD
136 */
137enum dcbnl_commands {
138 DCB_CMD_UNDEFINED,
139
140 DCB_CMD_GSTATE,
141 DCB_CMD_SSTATE,
142
143 DCB_CMD_PGTX_GCFG,
144 DCB_CMD_PGTX_SCFG,
145 DCB_CMD_PGRX_GCFG,
146 DCB_CMD_PGRX_SCFG,
147
148 DCB_CMD_PFC_GCFG,
149 DCB_CMD_PFC_SCFG,
150
151 DCB_CMD_SET_ALL,
859ee3c4 152
2f90b865 153 DCB_CMD_GPERM_HWADDR,
859ee3c4 154
46132188 155 DCB_CMD_GCAP,
859ee3c4 156
33dbabc4
AD
157 DCB_CMD_GNUMTCS,
158 DCB_CMD_SNUMTCS,
859ee3c4 159
0eb3aa9b
AD
160 DCB_CMD_PFC_GSTATE,
161 DCB_CMD_PFC_SSTATE,
2f90b865 162
859ee3c4
AD
163 DCB_CMD_BCN_GCFG,
164 DCB_CMD_BCN_SCFG,
165
0f6f2902
YZ
166 DCB_CMD_GAPP,
167 DCB_CMD_SAPP,
168
3e29027a
JF
169 DCB_CMD_IEEE_SET,
170 DCB_CMD_IEEE_GET,
171
2f90b865
AD
172 __DCB_CMD_ENUM_MAX,
173 DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1,
174};
175
2f90b865
AD
176/**
177 * enum dcbnl_attrs - DCB top-level netlink attributes
178 *
179 * @DCB_ATTR_UNDEFINED: unspecified attribute to catch errors
180 * @DCB_ATTR_IFNAME: interface name of the underlying device (NLA_STRING)
181 * @DCB_ATTR_STATE: enable state of DCB in the device (NLA_U8)
182 * @DCB_ATTR_PFC_STATE: enable state of PFC in the device (NLA_U8)
183 * @DCB_ATTR_PFC_CFG: priority flow control configuration (NLA_NESTED)
184 * @DCB_ATTR_NUM_TC: number of traffic classes supported in the device (NLA_U8)
185 * @DCB_ATTR_PG_CFG: priority group configuration (NLA_NESTED)
186 * @DCB_ATTR_SET_ALL: bool to commit changes to hardware or not (NLA_U8)
187 * @DCB_ATTR_PERM_HWADDR: MAC address of the physical device (NLA_NESTED)
46132188 188 * @DCB_ATTR_CAP: DCB capabilities of the device (NLA_NESTED)
33dbabc4 189 * @DCB_ATTR_NUMTCS: number of traffic classes supported (NLA_NESTED)
859ee3c4 190 * @DCB_ATTR_BCN: backward congestion notification configuration (NLA_NESTED)
3e29027a 191 * @DCB_ATTR_IEEE: IEEE 802.1Qaz supported attributes (NLA_NESTED)
2f90b865
AD
192 */
193enum dcbnl_attrs {
194 DCB_ATTR_UNDEFINED,
195
196 DCB_ATTR_IFNAME,
197 DCB_ATTR_STATE,
198 DCB_ATTR_PFC_STATE,
199 DCB_ATTR_PFC_CFG,
200 DCB_ATTR_NUM_TC,
201 DCB_ATTR_PG_CFG,
202 DCB_ATTR_SET_ALL,
203 DCB_ATTR_PERM_HWADDR,
46132188 204 DCB_ATTR_CAP,
33dbabc4 205 DCB_ATTR_NUMTCS,
859ee3c4 206 DCB_ATTR_BCN,
0f6f2902 207 DCB_ATTR_APP,
2f90b865 208
3e29027a
JF
209 /* IEEE std attributes */
210 DCB_ATTR_IEEE,
211
2f90b865
AD
212 __DCB_ATTR_ENUM_MAX,
213 DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1,
214};
215
3e29027a
JF
216enum ieee_attrs {
217 DCB_ATTR_IEEE_UNSPEC,
218 DCB_ATTR_IEEE_ETS,
219 DCB_ATTR_IEEE_PFC,
220 DCB_ATTR_IEEE_APP_TABLE,
221 __DCB_ATTR_IEEE_MAX
222};
223#define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1)
224
225enum ieee_attrs_app {
226 DCB_ATTR_IEEE_APP_UNSPEC,
227 DCB_ATTR_IEEE_APP,
228 __DCB_ATTR_IEEE_APP_MAX
229};
230#define DCB_ATTR_IEEE_APP_MAX (__DCB_ATTR_IEEE_APP_MAX - 1)
231
2f90b865
AD
232/**
233 * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs
234 *
235 * @DCB_PFC_UP_ATTR_UNDEFINED: unspecified attribute to catch errors
236 * @DCB_PFC_UP_ATTR_0: Priority Flow Control value for User Priority 0 (NLA_U8)
237 * @DCB_PFC_UP_ATTR_1: Priority Flow Control value for User Priority 1 (NLA_U8)
238 * @DCB_PFC_UP_ATTR_2: Priority Flow Control value for User Priority 2 (NLA_U8)
239 * @DCB_PFC_UP_ATTR_3: Priority Flow Control value for User Priority 3 (NLA_U8)
240 * @DCB_PFC_UP_ATTR_4: Priority Flow Control value for User Priority 4 (NLA_U8)
241 * @DCB_PFC_UP_ATTR_5: Priority Flow Control value for User Priority 5 (NLA_U8)
242 * @DCB_PFC_UP_ATTR_6: Priority Flow Control value for User Priority 6 (NLA_U8)
243 * @DCB_PFC_UP_ATTR_7: Priority Flow Control value for User Priority 7 (NLA_U8)
244 * @DCB_PFC_UP_ATTR_MAX: highest attribute number currently defined
245 * @DCB_PFC_UP_ATTR_ALL: apply to all priority flow control attrs (NLA_FLAG)
246 *
247 */
248enum dcbnl_pfc_up_attrs {
249 DCB_PFC_UP_ATTR_UNDEFINED,
250
251 DCB_PFC_UP_ATTR_0,
252 DCB_PFC_UP_ATTR_1,
253 DCB_PFC_UP_ATTR_2,
254 DCB_PFC_UP_ATTR_3,
255 DCB_PFC_UP_ATTR_4,
256 DCB_PFC_UP_ATTR_5,
257 DCB_PFC_UP_ATTR_6,
258 DCB_PFC_UP_ATTR_7,
259 DCB_PFC_UP_ATTR_ALL,
260
261 __DCB_PFC_UP_ATTR_ENUM_MAX,
262 DCB_PFC_UP_ATTR_MAX = __DCB_PFC_UP_ATTR_ENUM_MAX - 1,
263};
264
265/**
266 * enum dcbnl_pg_attrs - DCB Priority Group attributes
267 *
268 * @DCB_PG_ATTR_UNDEFINED: unspecified attribute to catch errors
269 * @DCB_PG_ATTR_TC_0: Priority Group Traffic Class 0 configuration (NLA_NESTED)
270 * @DCB_PG_ATTR_TC_1: Priority Group Traffic Class 1 configuration (NLA_NESTED)
271 * @DCB_PG_ATTR_TC_2: Priority Group Traffic Class 2 configuration (NLA_NESTED)
272 * @DCB_PG_ATTR_TC_3: Priority Group Traffic Class 3 configuration (NLA_NESTED)
273 * @DCB_PG_ATTR_TC_4: Priority Group Traffic Class 4 configuration (NLA_NESTED)
274 * @DCB_PG_ATTR_TC_5: Priority Group Traffic Class 5 configuration (NLA_NESTED)
275 * @DCB_PG_ATTR_TC_6: Priority Group Traffic Class 6 configuration (NLA_NESTED)
276 * @DCB_PG_ATTR_TC_7: Priority Group Traffic Class 7 configuration (NLA_NESTED)
277 * @DCB_PG_ATTR_TC_MAX: highest attribute number currently defined
278 * @DCB_PG_ATTR_TC_ALL: apply to all traffic classes (NLA_NESTED)
279 * @DCB_PG_ATTR_BW_ID_0: Percent of link bandwidth for Priority Group 0 (NLA_U8)
280 * @DCB_PG_ATTR_BW_ID_1: Percent of link bandwidth for Priority Group 1 (NLA_U8)
281 * @DCB_PG_ATTR_BW_ID_2: Percent of link bandwidth for Priority Group 2 (NLA_U8)
282 * @DCB_PG_ATTR_BW_ID_3: Percent of link bandwidth for Priority Group 3 (NLA_U8)
283 * @DCB_PG_ATTR_BW_ID_4: Percent of link bandwidth for Priority Group 4 (NLA_U8)
284 * @DCB_PG_ATTR_BW_ID_5: Percent of link bandwidth for Priority Group 5 (NLA_U8)
285 * @DCB_PG_ATTR_BW_ID_6: Percent of link bandwidth for Priority Group 6 (NLA_U8)
286 * @DCB_PG_ATTR_BW_ID_7: Percent of link bandwidth for Priority Group 7 (NLA_U8)
287 * @DCB_PG_ATTR_BW_ID_MAX: highest attribute number currently defined
288 * @DCB_PG_ATTR_BW_ID_ALL: apply to all priority groups (NLA_FLAG)
289 *
290 */
291enum dcbnl_pg_attrs {
292 DCB_PG_ATTR_UNDEFINED,
293
294 DCB_PG_ATTR_TC_0,
295 DCB_PG_ATTR_TC_1,
296 DCB_PG_ATTR_TC_2,
297 DCB_PG_ATTR_TC_3,
298 DCB_PG_ATTR_TC_4,
299 DCB_PG_ATTR_TC_5,
300 DCB_PG_ATTR_TC_6,
301 DCB_PG_ATTR_TC_7,
302 DCB_PG_ATTR_TC_MAX,
303 DCB_PG_ATTR_TC_ALL,
304
305 DCB_PG_ATTR_BW_ID_0,
306 DCB_PG_ATTR_BW_ID_1,
307 DCB_PG_ATTR_BW_ID_2,
308 DCB_PG_ATTR_BW_ID_3,
309 DCB_PG_ATTR_BW_ID_4,
310 DCB_PG_ATTR_BW_ID_5,
311 DCB_PG_ATTR_BW_ID_6,
312 DCB_PG_ATTR_BW_ID_7,
313 DCB_PG_ATTR_BW_ID_MAX,
314 DCB_PG_ATTR_BW_ID_ALL,
315
316 __DCB_PG_ATTR_ENUM_MAX,
317 DCB_PG_ATTR_MAX = __DCB_PG_ATTR_ENUM_MAX - 1,
318};
319
320/**
321 * enum dcbnl_tc_attrs - DCB Traffic Class attributes
322 *
323 * @DCB_TC_ATTR_PARAM_UNDEFINED: unspecified attribute to catch errors
324 * @DCB_TC_ATTR_PARAM_PGID: (NLA_U8) Priority group the traffic class belongs to
325 * Valid values are: 0-7
326 * @DCB_TC_ATTR_PARAM_UP_MAPPING: (NLA_U8) Traffic class to user priority map
327 * Some devices may not support changing the
328 * user priority map of a TC.
329 * @DCB_TC_ATTR_PARAM_STRICT_PRIO: (NLA_U8) Strict priority setting
330 * 0 - none
331 * 1 - group strict
332 * 2 - link strict
333 * @DCB_TC_ATTR_PARAM_BW_PCT: optional - (NLA_U8) If supported by the device and
334 * not configured to use link strict priority,
335 * this is the percentage of bandwidth of the
336 * priority group this traffic class belongs to
337 * @DCB_TC_ATTR_PARAM_ALL: (NLA_FLAG) all traffic class parameters
338 *
339 */
340enum dcbnl_tc_attrs {
341 DCB_TC_ATTR_PARAM_UNDEFINED,
342
343 DCB_TC_ATTR_PARAM_PGID,
344 DCB_TC_ATTR_PARAM_UP_MAPPING,
345 DCB_TC_ATTR_PARAM_STRICT_PRIO,
346 DCB_TC_ATTR_PARAM_BW_PCT,
347 DCB_TC_ATTR_PARAM_ALL,
348
349 __DCB_TC_ATTR_PARAM_ENUM_MAX,
350 DCB_TC_ATTR_PARAM_MAX = __DCB_TC_ATTR_PARAM_ENUM_MAX - 1,
351};
352
46132188
AD
353/**
354 * enum dcbnl_cap_attrs - DCB Capability attributes
355 *
356 * @DCB_CAP_ATTR_UNDEFINED: unspecified attribute to catch errors
357 * @DCB_CAP_ATTR_ALL: (NLA_FLAG) all capability parameters
358 * @DCB_CAP_ATTR_PG: (NLA_U8) device supports Priority Groups
359 * @DCB_CAP_ATTR_PFC: (NLA_U8) device supports Priority Flow Control
360 * @DCB_CAP_ATTR_UP2TC: (NLA_U8) device supports user priority to
361 * traffic class mapping
362 * @DCB_CAP_ATTR_PG_TCS: (NLA_U8) bitmap where each bit represents a
363 * number of traffic classes the device
364 * can be configured to use for Priority Groups
365 * @DCB_CAP_ATTR_PFC_TCS: (NLA_U8) bitmap where each bit represents a
366 * number of traffic classes the device can be
367 * configured to use for Priority Flow Control
368 * @DCB_CAP_ATTR_GSP: (NLA_U8) device supports group strict priority
369 * @DCB_CAP_ATTR_BCN: (NLA_U8) device supports Backwards Congestion
370 * Notification
371 */
372enum dcbnl_cap_attrs {
373 DCB_CAP_ATTR_UNDEFINED,
374 DCB_CAP_ATTR_ALL,
375 DCB_CAP_ATTR_PG,
376 DCB_CAP_ATTR_PFC,
377 DCB_CAP_ATTR_UP2TC,
378 DCB_CAP_ATTR_PG_TCS,
379 DCB_CAP_ATTR_PFC_TCS,
380 DCB_CAP_ATTR_GSP,
381 DCB_CAP_ATTR_BCN,
382
383 __DCB_CAP_ATTR_ENUM_MAX,
384 DCB_CAP_ATTR_MAX = __DCB_CAP_ATTR_ENUM_MAX - 1,
385};
33dbabc4
AD
386
387/**
388 * enum dcbnl_numtcs_attrs - number of traffic classes
389 *
390 * @DCB_NUMTCS_ATTR_UNDEFINED: unspecified attribute to catch errors
391 * @DCB_NUMTCS_ATTR_ALL: (NLA_FLAG) all traffic class attributes
392 * @DCB_NUMTCS_ATTR_PG: (NLA_U8) number of traffic classes used for
393 * priority groups
394 * @DCB_NUMTCS_ATTR_PFC: (NLA_U8) number of traffic classes which can
395 * support priority flow control
396 */
397enum dcbnl_numtcs_attrs {
398 DCB_NUMTCS_ATTR_UNDEFINED,
399 DCB_NUMTCS_ATTR_ALL,
400 DCB_NUMTCS_ATTR_PG,
401 DCB_NUMTCS_ATTR_PFC,
402
403 __DCB_NUMTCS_ATTR_ENUM_MAX,
404 DCB_NUMTCS_ATTR_MAX = __DCB_NUMTCS_ATTR_ENUM_MAX - 1,
405};
406
859ee3c4
AD
407enum dcbnl_bcn_attrs{
408 DCB_BCN_ATTR_UNDEFINED = 0,
409
410 DCB_BCN_ATTR_RP_0,
411 DCB_BCN_ATTR_RP_1,
412 DCB_BCN_ATTR_RP_2,
413 DCB_BCN_ATTR_RP_3,
414 DCB_BCN_ATTR_RP_4,
415 DCB_BCN_ATTR_RP_5,
416 DCB_BCN_ATTR_RP_6,
417 DCB_BCN_ATTR_RP_7,
418 DCB_BCN_ATTR_RP_ALL,
419
f4314e81
DS
420 DCB_BCN_ATTR_BCNA_0,
421 DCB_BCN_ATTR_BCNA_1,
859ee3c4
AD
422 DCB_BCN_ATTR_ALPHA,
423 DCB_BCN_ATTR_BETA,
424 DCB_BCN_ATTR_GD,
425 DCB_BCN_ATTR_GI,
426 DCB_BCN_ATTR_TMAX,
427 DCB_BCN_ATTR_TD,
428 DCB_BCN_ATTR_RMIN,
429 DCB_BCN_ATTR_W,
430 DCB_BCN_ATTR_RD,
431 DCB_BCN_ATTR_RU,
432 DCB_BCN_ATTR_WRTT,
433 DCB_BCN_ATTR_RI,
434 DCB_BCN_ATTR_C,
435 DCB_BCN_ATTR_ALL,
436
437 __DCB_BCN_ATTR_ENUM_MAX,
438 DCB_BCN_ATTR_MAX = __DCB_BCN_ATTR_ENUM_MAX - 1,
439};
440
2f90b865
AD
441/**
442 * enum dcb_general_attr_values - general DCB attribute values
443 *
444 * @DCB_ATTR_UNDEFINED: value used to indicate an attribute is not supported
445 *
446 */
447enum dcb_general_attr_values {
448 DCB_ATTR_VALUE_UNDEFINED = 0xff
449};
450
0f6f2902
YZ
451#define DCB_APP_IDTYPE_ETHTYPE 0x00
452#define DCB_APP_IDTYPE_PORTNUM 0x01
453enum dcbnl_app_attrs {
454 DCB_APP_ATTR_UNDEFINED,
455
456 DCB_APP_ATTR_IDTYPE,
457 DCB_APP_ATTR_ID,
458 DCB_APP_ATTR_PRIORITY,
459
460 __DCB_APP_ATTR_ENUM_MAX,
461 DCB_APP_ATTR_MAX = __DCB_APP_ATTR_ENUM_MAX - 1,
462};
2f90b865
AD
463
464#endif /* __LINUX_DCBNL_H__ */