2 * Copyright (c) 2008, Intel Corporation.
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.
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
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.
17 * Author: Lucy Liu <lucy.liu@intel.com>
20 #ifndef __LINUX_DCBNL_H__
21 #define __LINUX_DCBNL_H__
23 #include <linux/types.h>
25 /* IEEE 802.1Qaz std supported values */
26 #define IEEE_8021QAZ_MAX_TCS 8
28 /* This structure contains the IEEE 802.1Qaz ETS managed object
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
41 * Recommended values are used to set fields in the ETS recommendation TLV
42 * with hardware offloaded LLDP.
45 * TSA Assignment 8 bit identifiers
47 * 1 credit-based shaper
48 * 2 enhanced transmission selection
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];
65 /* This structure contains the IEEE 802.1Qaz PFC managed object
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
73 * @requests: count of the sent pfc frames
74 * @indications: count of the received pfc frames
81 __u64 requests[IEEE_8021QAZ_MAX_TCS];
82 __u64 indications[IEEE_8021QAZ_MAX_TCS];
85 /* This structure contains the IEEE 802.1Qaz APP managed object. This
86 * object is also used for the CEE std as well. There is no difference
87 * between the objects.
89 * @selector: protocol identifier type
90 * @protocol: protocol of type indicated
91 * @priority: 3-bit unsigned integer indicating priority
94 * Selector field values
97 * 2 Well known port number over TCP or SCTP
98 * 3 Well known port number over UDP or DCCP
99 * 4 Well known port number over TCP, SCTP, UDP, or DCCP
115 * enum dcbnl_commands - supported DCB commands
117 * @DCB_CMD_UNDEFINED: unspecified command to catch errors
118 * @DCB_CMD_GSTATE: request the state of DCB in the device
119 * @DCB_CMD_SSTATE: set the state of DCB in the device
120 * @DCB_CMD_PGTX_GCFG: request the priority group configuration for Tx
121 * @DCB_CMD_PGTX_SCFG: set the priority group configuration for Tx
122 * @DCB_CMD_PGRX_GCFG: request the priority group configuration for Rx
123 * @DCB_CMD_PGRX_SCFG: set the priority group configuration for Rx
124 * @DCB_CMD_PFC_GCFG: request the priority flow control configuration
125 * @DCB_CMD_PFC_SCFG: set the priority flow control configuration
126 * @DCB_CMD_SET_ALL: apply all changes to the underlying device
127 * @DCB_CMD_GPERM_HWADDR: get the permanent MAC address of the underlying
128 * device. Only useful when using bonding.
129 * @DCB_CMD_GCAP: request the DCB capabilities of the device
130 * @DCB_CMD_GNUMTCS: get the number of traffic classes currently supported
131 * @DCB_CMD_SNUMTCS: set the number of traffic classes
132 * @DCB_CMD_GBCN: set backward congestion notification configuration
133 * @DCB_CMD_SBCN: get backward congestion notification configration.
134 * @DCB_CMD_GAPP: get application protocol configuration
135 * @DCB_CMD_SAPP: set application protocol configuration
136 * @DCB_CMD_IEEE_SET: set IEEE 802.1Qaz configuration
137 * @DCB_CMD_IEEE_GET: get IEEE 802.1Qaz configuration
138 * @DCB_CMD_GDCBX: get DCBX engine configuration
139 * @DCB_CMD_SDCBX: set DCBX engine configuration
140 * @DCB_CMD_GFEATCFG: get DCBX features flags
141 * @DCB_CMD_SFEATCFG: set DCBX features negotiation flags
143 enum dcbnl_commands {
159 DCB_CMD_GPERM_HWADDR,
185 DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1,
189 * enum dcbnl_attrs - DCB top-level netlink attributes
191 * @DCB_ATTR_UNDEFINED: unspecified attribute to catch errors
192 * @DCB_ATTR_IFNAME: interface name of the underlying device (NLA_STRING)
193 * @DCB_ATTR_STATE: enable state of DCB in the device (NLA_U8)
194 * @DCB_ATTR_PFC_STATE: enable state of PFC in the device (NLA_U8)
195 * @DCB_ATTR_PFC_CFG: priority flow control configuration (NLA_NESTED)
196 * @DCB_ATTR_NUM_TC: number of traffic classes supported in the device (NLA_U8)
197 * @DCB_ATTR_PG_CFG: priority group configuration (NLA_NESTED)
198 * @DCB_ATTR_SET_ALL: bool to commit changes to hardware or not (NLA_U8)
199 * @DCB_ATTR_PERM_HWADDR: MAC address of the physical device (NLA_NESTED)
200 * @DCB_ATTR_CAP: DCB capabilities of the device (NLA_NESTED)
201 * @DCB_ATTR_NUMTCS: number of traffic classes supported (NLA_NESTED)
202 * @DCB_ATTR_BCN: backward congestion notification configuration (NLA_NESTED)
203 * @DCB_ATTR_IEEE: IEEE 802.1Qaz supported attributes (NLA_NESTED)
204 * @DCB_ATTR_DCBX: DCBX engine configuration in the device (NLA_U8)
205 * @DCB_ATTR_FEATCFG: DCBX features flags (NLA_NESTED)
217 DCB_ATTR_PERM_HWADDR,
223 /* IEEE std attributes */
230 DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1,
234 DCB_ATTR_IEEE_UNSPEC,
237 DCB_ATTR_IEEE_APP_TABLE,
240 #define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1)
242 enum ieee_attrs_app {
243 DCB_ATTR_IEEE_APP_UNSPEC,
245 __DCB_ATTR_IEEE_APP_MAX
247 #define DCB_ATTR_IEEE_APP_MAX (__DCB_ATTR_IEEE_APP_MAX - 1)
250 * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs
252 * @DCB_PFC_UP_ATTR_UNDEFINED: unspecified attribute to catch errors
253 * @DCB_PFC_UP_ATTR_0: Priority Flow Control value for User Priority 0 (NLA_U8)
254 * @DCB_PFC_UP_ATTR_1: Priority Flow Control value for User Priority 1 (NLA_U8)
255 * @DCB_PFC_UP_ATTR_2: Priority Flow Control value for User Priority 2 (NLA_U8)
256 * @DCB_PFC_UP_ATTR_3: Priority Flow Control value for User Priority 3 (NLA_U8)
257 * @DCB_PFC_UP_ATTR_4: Priority Flow Control value for User Priority 4 (NLA_U8)
258 * @DCB_PFC_UP_ATTR_5: Priority Flow Control value for User Priority 5 (NLA_U8)
259 * @DCB_PFC_UP_ATTR_6: Priority Flow Control value for User Priority 6 (NLA_U8)
260 * @DCB_PFC_UP_ATTR_7: Priority Flow Control value for User Priority 7 (NLA_U8)
261 * @DCB_PFC_UP_ATTR_MAX: highest attribute number currently defined
262 * @DCB_PFC_UP_ATTR_ALL: apply to all priority flow control attrs (NLA_FLAG)
265 enum dcbnl_pfc_up_attrs {
266 DCB_PFC_UP_ATTR_UNDEFINED,
278 __DCB_PFC_UP_ATTR_ENUM_MAX,
279 DCB_PFC_UP_ATTR_MAX = __DCB_PFC_UP_ATTR_ENUM_MAX - 1,
283 * enum dcbnl_pg_attrs - DCB Priority Group attributes
285 * @DCB_PG_ATTR_UNDEFINED: unspecified attribute to catch errors
286 * @DCB_PG_ATTR_TC_0: Priority Group Traffic Class 0 configuration (NLA_NESTED)
287 * @DCB_PG_ATTR_TC_1: Priority Group Traffic Class 1 configuration (NLA_NESTED)
288 * @DCB_PG_ATTR_TC_2: Priority Group Traffic Class 2 configuration (NLA_NESTED)
289 * @DCB_PG_ATTR_TC_3: Priority Group Traffic Class 3 configuration (NLA_NESTED)
290 * @DCB_PG_ATTR_TC_4: Priority Group Traffic Class 4 configuration (NLA_NESTED)
291 * @DCB_PG_ATTR_TC_5: Priority Group Traffic Class 5 configuration (NLA_NESTED)
292 * @DCB_PG_ATTR_TC_6: Priority Group Traffic Class 6 configuration (NLA_NESTED)
293 * @DCB_PG_ATTR_TC_7: Priority Group Traffic Class 7 configuration (NLA_NESTED)
294 * @DCB_PG_ATTR_TC_MAX: highest attribute number currently defined
295 * @DCB_PG_ATTR_TC_ALL: apply to all traffic classes (NLA_NESTED)
296 * @DCB_PG_ATTR_BW_ID_0: Percent of link bandwidth for Priority Group 0 (NLA_U8)
297 * @DCB_PG_ATTR_BW_ID_1: Percent of link bandwidth for Priority Group 1 (NLA_U8)
298 * @DCB_PG_ATTR_BW_ID_2: Percent of link bandwidth for Priority Group 2 (NLA_U8)
299 * @DCB_PG_ATTR_BW_ID_3: Percent of link bandwidth for Priority Group 3 (NLA_U8)
300 * @DCB_PG_ATTR_BW_ID_4: Percent of link bandwidth for Priority Group 4 (NLA_U8)
301 * @DCB_PG_ATTR_BW_ID_5: Percent of link bandwidth for Priority Group 5 (NLA_U8)
302 * @DCB_PG_ATTR_BW_ID_6: Percent of link bandwidth for Priority Group 6 (NLA_U8)
303 * @DCB_PG_ATTR_BW_ID_7: Percent of link bandwidth for Priority Group 7 (NLA_U8)
304 * @DCB_PG_ATTR_BW_ID_MAX: highest attribute number currently defined
305 * @DCB_PG_ATTR_BW_ID_ALL: apply to all priority groups (NLA_FLAG)
308 enum dcbnl_pg_attrs {
309 DCB_PG_ATTR_UNDEFINED,
330 DCB_PG_ATTR_BW_ID_MAX,
331 DCB_PG_ATTR_BW_ID_ALL,
333 __DCB_PG_ATTR_ENUM_MAX,
334 DCB_PG_ATTR_MAX = __DCB_PG_ATTR_ENUM_MAX - 1,
338 * enum dcbnl_tc_attrs - DCB Traffic Class attributes
340 * @DCB_TC_ATTR_PARAM_UNDEFINED: unspecified attribute to catch errors
341 * @DCB_TC_ATTR_PARAM_PGID: (NLA_U8) Priority group the traffic class belongs to
342 * Valid values are: 0-7
343 * @DCB_TC_ATTR_PARAM_UP_MAPPING: (NLA_U8) Traffic class to user priority map
344 * Some devices may not support changing the
345 * user priority map of a TC.
346 * @DCB_TC_ATTR_PARAM_STRICT_PRIO: (NLA_U8) Strict priority setting
350 * @DCB_TC_ATTR_PARAM_BW_PCT: optional - (NLA_U8) If supported by the device and
351 * not configured to use link strict priority,
352 * this is the percentage of bandwidth of the
353 * priority group this traffic class belongs to
354 * @DCB_TC_ATTR_PARAM_ALL: (NLA_FLAG) all traffic class parameters
357 enum dcbnl_tc_attrs {
358 DCB_TC_ATTR_PARAM_UNDEFINED,
360 DCB_TC_ATTR_PARAM_PGID,
361 DCB_TC_ATTR_PARAM_UP_MAPPING,
362 DCB_TC_ATTR_PARAM_STRICT_PRIO,
363 DCB_TC_ATTR_PARAM_BW_PCT,
364 DCB_TC_ATTR_PARAM_ALL,
366 __DCB_TC_ATTR_PARAM_ENUM_MAX,
367 DCB_TC_ATTR_PARAM_MAX = __DCB_TC_ATTR_PARAM_ENUM_MAX - 1,
371 * enum dcbnl_cap_attrs - DCB Capability attributes
373 * @DCB_CAP_ATTR_UNDEFINED: unspecified attribute to catch errors
374 * @DCB_CAP_ATTR_ALL: (NLA_FLAG) all capability parameters
375 * @DCB_CAP_ATTR_PG: (NLA_U8) device supports Priority Groups
376 * @DCB_CAP_ATTR_PFC: (NLA_U8) device supports Priority Flow Control
377 * @DCB_CAP_ATTR_UP2TC: (NLA_U8) device supports user priority to
378 * traffic class mapping
379 * @DCB_CAP_ATTR_PG_TCS: (NLA_U8) bitmap where each bit represents a
380 * number of traffic classes the device
381 * can be configured to use for Priority Groups
382 * @DCB_CAP_ATTR_PFC_TCS: (NLA_U8) bitmap where each bit represents a
383 * number of traffic classes the device can be
384 * configured to use for Priority Flow Control
385 * @DCB_CAP_ATTR_GSP: (NLA_U8) device supports group strict priority
386 * @DCB_CAP_ATTR_BCN: (NLA_U8) device supports Backwards Congestion
388 * @DCB_CAP_ATTR_DCBX: (NLA_U8) device supports DCBX engine
391 enum dcbnl_cap_attrs {
392 DCB_CAP_ATTR_UNDEFINED,
398 DCB_CAP_ATTR_PFC_TCS,
403 __DCB_CAP_ATTR_ENUM_MAX,
404 DCB_CAP_ATTR_MAX = __DCB_CAP_ATTR_ENUM_MAX - 1,
408 * DCBX capability flags
410 * @DCB_CAP_DCBX_HOST: DCBX negotiation is performed by the host LLDP agent.
411 * 'set' routines are used to configure the device with
412 * the negotiated parameters
414 * @DCB_CAP_DCBX_LLD_MANAGED: DCBX negotiation is not performed in the host but
416 * 'get' routines are used to retrieve the
417 * negotiated parameters
418 * 'set' routines can be used to set the initial
419 * negotiation configuration
421 * @DCB_CAP_DCBX_VER_CEE: for a non-host DCBX engine, indicates the engine
422 * supports the CEE protocol flavor
424 * @DCB_CAP_DCBX_VER_IEEE: for a non-host DCBX engine, indicates the engine
425 * supports the IEEE protocol flavor
427 * @DCB_CAP_DCBX_STATIC: for a non-host DCBX engine, indicates the engine
428 * supports static configuration (i.e no actual
429 * negotiation is performed negotiated parameters equal
430 * the initial configuration)
433 #define DCB_CAP_DCBX_HOST 0x01
434 #define DCB_CAP_DCBX_LLD_MANAGED 0x02
435 #define DCB_CAP_DCBX_VER_CEE 0x04
436 #define DCB_CAP_DCBX_VER_IEEE 0x08
437 #define DCB_CAP_DCBX_STATIC 0x10
440 * enum dcbnl_numtcs_attrs - number of traffic classes
442 * @DCB_NUMTCS_ATTR_UNDEFINED: unspecified attribute to catch errors
443 * @DCB_NUMTCS_ATTR_ALL: (NLA_FLAG) all traffic class attributes
444 * @DCB_NUMTCS_ATTR_PG: (NLA_U8) number of traffic classes used for
446 * @DCB_NUMTCS_ATTR_PFC: (NLA_U8) number of traffic classes which can
447 * support priority flow control
449 enum dcbnl_numtcs_attrs {
450 DCB_NUMTCS_ATTR_UNDEFINED,
455 __DCB_NUMTCS_ATTR_ENUM_MAX,
456 DCB_NUMTCS_ATTR_MAX = __DCB_NUMTCS_ATTR_ENUM_MAX - 1,
459 enum dcbnl_bcn_attrs{
460 DCB_BCN_ATTR_UNDEFINED = 0,
489 __DCB_BCN_ATTR_ENUM_MAX,
490 DCB_BCN_ATTR_MAX = __DCB_BCN_ATTR_ENUM_MAX - 1,
494 * enum dcb_general_attr_values - general DCB attribute values
496 * @DCB_ATTR_UNDEFINED: value used to indicate an attribute is not supported
499 enum dcb_general_attr_values {
500 DCB_ATTR_VALUE_UNDEFINED = 0xff
503 #define DCB_APP_IDTYPE_ETHTYPE 0x00
504 #define DCB_APP_IDTYPE_PORTNUM 0x01
505 enum dcbnl_app_attrs {
506 DCB_APP_ATTR_UNDEFINED,
510 DCB_APP_ATTR_PRIORITY,
512 __DCB_APP_ATTR_ENUM_MAX,
513 DCB_APP_ATTR_MAX = __DCB_APP_ATTR_ENUM_MAX - 1,
517 * enum dcbnl_featcfg_attrs - features conifiguration flags
519 * @DCB_FEATCFG_ATTR_UNDEFINED: unspecified attribute to catch errors
520 * @DCB_FEATCFG_ATTR_ALL: (NLA_FLAG) all features configuration attributes
521 * @DCB_FEATCFG_ATTR_PG: (NLA_U8) configuration flags for priority groups
522 * @DCB_FEATCFG_ATTR_PFC: (NLA_U8) configuration flags for priority
524 * @DCB_FEATCFG_ATTR_APP: (NLA_U8) configuration flags for application TLV
527 #define DCB_FEATCFG_ERROR 0x01 /* error in feature resolution */
528 #define DCB_FEATCFG_ENABLE 0x02 /* enable feature */
529 #define DCB_FEATCFG_WILLING 0x04 /* feature is willing */
530 #define DCB_FEATCFG_ADVERTISE 0x08 /* advertise feature */
531 enum dcbnl_featcfg_attrs {
532 DCB_FEATCFG_ATTR_UNDEFINED,
533 DCB_FEATCFG_ATTR_ALL,
535 DCB_FEATCFG_ATTR_PFC,
536 DCB_FEATCFG_ATTR_APP,
538 __DCB_FEATCFG_ATTR_ENUM_MAX,
539 DCB_FEATCFG_ATTR_MAX = __DCB_FEATCFG_ATTR_ENUM_MAX - 1,
542 #endif /* __LINUX_DCBNL_H__ */