1/*
2 * Copyright (c) 2008-2011, 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
23#include <linux/types.h>
24
25/* IEEE 802.1Qaz std supported values */
26#define IEEE_8021QAZ_MAX_TCS	8
27
28#define IEEE_8021QAZ_TSA_STRICT		0
29#define IEEE_8021QAZ_TSA_CB_SHAPER	1
30#define IEEE_8021QAZ_TSA_ETS		2
31#define IEEE_8021QAZ_TSA_VENDOR		255
32
33/* This structure contains the IEEE 802.1Qaz ETS managed object
34 *
35 * @willing: willing bit in ETS configuration TLV
36 * @ets_cap: indicates supported capacity of ets feature
37 * @cbs: credit based shaper ets algorithm supported
38 * @tc_tx_bw: tc tx bandwidth indexed by traffic class
39 * @tc_rx_bw: tc rx bandwidth indexed by traffic class
40 * @tc_tsa: TSA Assignment table, indexed by traffic class
41 * @prio_tc: priority assignment table mapping 8021Qp to traffic class
42 * @tc_reco_bw: recommended tc bandwidth indexed by traffic class for TLV
43 * @tc_reco_tsa: recommended tc bandwidth indexed by traffic class for TLV
44 * @reco_prio_tc: recommended tc tx bandwidth indexed by traffic class for TLV
45 *
46 * Recommended values are used to set fields in the ETS recommendation TLV
47 * with hardware offloaded LLDP.
48 *
49 * ----
50 *  TSA Assignment 8 bit identifiers
51 *	0	strict priority
52 *	1	credit-based shaper
53 *	2	enhanced transmission selection
54 *	3-254	reserved
55 *	255	vendor specific
56 */
57struct ieee_ets {
58	__u8	willing;
59	__u8	ets_cap;
60	__u8	cbs;
61	__u8	tc_tx_bw[IEEE_8021QAZ_MAX_TCS];
62	__u8	tc_rx_bw[IEEE_8021QAZ_MAX_TCS];
63	__u8	tc_tsa[IEEE_8021QAZ_MAX_TCS];
64	__u8	prio_tc[IEEE_8021QAZ_MAX_TCS];
65	__u8	tc_reco_bw[IEEE_8021QAZ_MAX_TCS];
66	__u8	tc_reco_tsa[IEEE_8021QAZ_MAX_TCS];
67	__u8	reco_prio_tc[IEEE_8021QAZ_MAX_TCS];
68};
69
70/* This structure contains rate limit extension to the IEEE 802.1Qaz ETS
71 * managed object.
72 * Values are 64 bits long and specified in Kbps to enable usage over both
73 * slow and very fast networks.
74 *
75 * @tc_maxrate: maximal tc tx bandwidth indexed by traffic class
76 */
77struct ieee_maxrate {
78	__u64	tc_maxrate[IEEE_8021QAZ_MAX_TCS];
79};
80
81enum dcbnl_cndd_states {
82	DCB_CNDD_RESET = 0,
83	DCB_CNDD_EDGE,
84	DCB_CNDD_INTERIOR,
85	DCB_CNDD_INTERIOR_READY,
86};
87
88/* This structure contains the IEEE 802.1Qau QCN managed object.
89 *
90 *@rpg_enable: enable QCN RP
91 *@rppp_max_rps: maximum number of RPs allowed for this CNPV on this port
92 *@rpg_time_reset: time between rate increases if no CNMs received.
93 *		   given in u-seconds
94 *@rpg_byte_reset: transmitted data between rate increases if no CNMs received.
95 *		   given in Bytes
96 *@rpg_threshold: The number of times rpByteStage or rpTimeStage can count
97 *		   before RP rate control state machine advances states
98 *@rpg_max_rate: the maxinun rate, in Mbits per second,
99 *		 at which an RP can transmit
100 *@rpg_ai_rate: The rate, in Mbits per second,
101 *		used to increase rpTargetRate in the RPR_ACTIVE_INCREASE
102 *@rpg_hai_rate: The rate, in Mbits per second,
103 *		 used to increase rpTargetRate in the RPR_HYPER_INCREASE state
104 *@rpg_gd: Upon CNM receive, flow rate is limited to (Fb/Gd)*CurrentRate.
105 *	   rpgGd is given as log2(Gd), where Gd may only be powers of 2
106 *@rpg_min_dec_fac: The minimum factor by which the current transmit rate
107 *		    can be changed by reception of a CNM.
108 *		    value is given as percentage (1-100)
109 *@rpg_min_rate: The minimum value, in bits per second, for rate to limit
110 *@cndd_state_machine: The state of the congestion notification domain
111 *		       defense state machine, as defined by IEEE 802.3Qau
112 *		       section 32.1.1. In the interior ready state,
113 *		       the QCN capable hardware may add CN-TAG TLV to the
114 *		       outgoing traffic, to specifically identify outgoing
115 *		       flows.
116 */
117
118struct ieee_qcn {
119	__u8 rpg_enable[IEEE_8021QAZ_MAX_TCS];
120	__u32 rppp_max_rps[IEEE_8021QAZ_MAX_TCS];
121	__u32 rpg_time_reset[IEEE_8021QAZ_MAX_TCS];
122	__u32 rpg_byte_reset[IEEE_8021QAZ_MAX_TCS];
123	__u32 rpg_threshold[IEEE_8021QAZ_MAX_TCS];
124	__u32 rpg_max_rate[IEEE_8021QAZ_MAX_TCS];
125	__u32 rpg_ai_rate[IEEE_8021QAZ_MAX_TCS];
126	__u32 rpg_hai_rate[IEEE_8021QAZ_MAX_TCS];
127	__u32 rpg_gd[IEEE_8021QAZ_MAX_TCS];
128	__u32 rpg_min_dec_fac[IEEE_8021QAZ_MAX_TCS];
129	__u32 rpg_min_rate[IEEE_8021QAZ_MAX_TCS];
130	__u32 cndd_state_machine[IEEE_8021QAZ_MAX_TCS];
131};
132
133/* This structure contains the IEEE 802.1Qau QCN statistics.
134 *
135 *@rppp_rp_centiseconds: the number of RP-centiseconds accumulated
136 *			 by RPs at this priority level on this Port
137 *@rppp_created_rps: number of active RPs(flows) that react to CNMs
138 */
139
140struct ieee_qcn_stats {
141	__u64 rppp_rp_centiseconds[IEEE_8021QAZ_MAX_TCS];
142	__u32 rppp_created_rps[IEEE_8021QAZ_MAX_TCS];
143};
144
145/* This structure contains the IEEE 802.1Qaz PFC managed object
146 *
147 * @pfc_cap: Indicates the number of traffic classes on the local device
148 *	     that may simultaneously have PFC enabled.
149 * @pfc_en: bitmap indicating pfc enabled traffic classes
150 * @mbc: enable macsec bypass capability
151 * @delay: the allowance made for a round-trip propagation delay of the
152 *	   link in bits.
153 * @requests: count of the sent pfc frames
154 * @indications: count of the received pfc frames
155 */
156struct ieee_pfc {
157	__u8	pfc_cap;
158	__u8	pfc_en;
159	__u8	mbc;
160	__u16	delay;
161	__u64	requests[IEEE_8021QAZ_MAX_TCS];
162	__u64	indications[IEEE_8021QAZ_MAX_TCS];
163};
164
165/* CEE DCBX std supported values */
166#define CEE_DCBX_MAX_PGS	8
167#define CEE_DCBX_MAX_PRIO	8
168
169/**
170 * struct cee_pg - CEE Priority-Group managed object
171 *
172 * @willing: willing bit in the PG tlv
173 * @error: error bit in the PG tlv
174 * @pg_en: enable bit of the PG feature
175 * @tcs_supported: number of traffic classes supported
176 * @pg_bw: bandwidth percentage for each priority group
177 * @prio_pg: priority to PG mapping indexed by priority
178 */
179struct cee_pg {
180	__u8    willing;
181	__u8    error;
182	__u8    pg_en;
183	__u8    tcs_supported;
184	__u8    pg_bw[CEE_DCBX_MAX_PGS];
185	__u8    prio_pg[CEE_DCBX_MAX_PGS];
186};
187
188/**
189 * struct cee_pfc - CEE PFC managed object
190 *
191 * @willing: willing bit in the PFC tlv
192 * @error: error bit in the PFC tlv
193 * @pfc_en: bitmap indicating pfc enabled traffic classes
194 * @tcs_supported: number of traffic classes supported
195 */
196struct cee_pfc {
197	__u8    willing;
198	__u8    error;
199	__u8    pfc_en;
200	__u8    tcs_supported;
201};
202
203/* IEEE 802.1Qaz std supported values */
204#define IEEE_8021QAZ_APP_SEL_ETHERTYPE	1
205#define IEEE_8021QAZ_APP_SEL_STREAM	2
206#define IEEE_8021QAZ_APP_SEL_DGRAM	3
207#define IEEE_8021QAZ_APP_SEL_ANY	4
208
209/* This structure contains the IEEE 802.1Qaz APP managed object. This
210 * object is also used for the CEE std as well. There is no difference
211 * between the objects.
212 *
213 * @selector: protocol identifier type
214 * @protocol: protocol of type indicated
215 * @priority: 3-bit unsigned integer indicating priority for IEEE
216 *            8-bit 802.1p user priority bitmap for CEE
217 *
218 * ----
219 *  Selector field values
220 *	0	Reserved
221 *	1	Ethertype
222 *	2	Well known port number over TCP or SCTP
223 *	3	Well known port number over UDP or DCCP
224 *	4	Well known port number over TCP, SCTP, UDP, or DCCP
225 *	5-7	Reserved
226 */
227struct dcb_app {
228	__u8	selector;
229	__u8	priority;
230	__u16	protocol;
231};
232
233/**
234 * struct dcb_peer_app_info - APP feature information sent by the peer
235 *
236 * @willing: willing bit in the peer APP tlv
237 * @error: error bit in the peer APP tlv
238 *
239 * In addition to this information the full peer APP tlv also contains
240 * a table of 'app_count' APP objects defined above.
241 */
242struct dcb_peer_app_info {
243	__u8	willing;
244	__u8	error;
245};
246
247struct dcbmsg {
248	__u8               dcb_family;
249	__u8               cmd;
250	__u16              dcb_pad;
251};
252
253/**
254 * enum dcbnl_commands - supported DCB commands
255 *
256 * @DCB_CMD_UNDEFINED: unspecified command to catch errors
257 * @DCB_CMD_GSTATE: request the state of DCB in the device
258 * @DCB_CMD_SSTATE: set the state of DCB in the device
259 * @DCB_CMD_PGTX_GCFG: request the priority group configuration for Tx
260 * @DCB_CMD_PGTX_SCFG: set the priority group configuration for Tx
261 * @DCB_CMD_PGRX_GCFG: request the priority group configuration for Rx
262 * @DCB_CMD_PGRX_SCFG: set the priority group configuration for Rx
263 * @DCB_CMD_PFC_GCFG: request the priority flow control configuration
264 * @DCB_CMD_PFC_SCFG: set the priority flow control configuration
265 * @DCB_CMD_SET_ALL: apply all changes to the underlying device
266 * @DCB_CMD_GPERM_HWADDR: get the permanent MAC address of the underlying
267 *                        device.  Only useful when using bonding.
268 * @DCB_CMD_GCAP: request the DCB capabilities of the device
269 * @DCB_CMD_GNUMTCS: get the number of traffic classes currently supported
270 * @DCB_CMD_SNUMTCS: set the number of traffic classes
271 * @DCB_CMD_GBCN: set backward congestion notification configuration
272 * @DCB_CMD_SBCN: get backward congestion notification configration.
273 * @DCB_CMD_GAPP: get application protocol configuration
274 * @DCB_CMD_SAPP: set application protocol configuration
275 * @DCB_CMD_IEEE_SET: set IEEE 802.1Qaz configuration
276 * @DCB_CMD_IEEE_GET: get IEEE 802.1Qaz configuration
277 * @DCB_CMD_GDCBX: get DCBX engine configuration
278 * @DCB_CMD_SDCBX: set DCBX engine configuration
279 * @DCB_CMD_GFEATCFG: get DCBX features flags
280 * @DCB_CMD_SFEATCFG: set DCBX features negotiation flags
281 * @DCB_CMD_CEE_GET: get CEE aggregated configuration
282 * @DCB_CMD_IEEE_DEL: delete IEEE 802.1Qaz configuration
283 */
284enum dcbnl_commands {
285	DCB_CMD_UNDEFINED,
286
287	DCB_CMD_GSTATE,
288	DCB_CMD_SSTATE,
289
290	DCB_CMD_PGTX_GCFG,
291	DCB_CMD_PGTX_SCFG,
292	DCB_CMD_PGRX_GCFG,
293	DCB_CMD_PGRX_SCFG,
294
295	DCB_CMD_PFC_GCFG,
296	DCB_CMD_PFC_SCFG,
297
298	DCB_CMD_SET_ALL,
299
300	DCB_CMD_GPERM_HWADDR,
301
302	DCB_CMD_GCAP,
303
304	DCB_CMD_GNUMTCS,
305	DCB_CMD_SNUMTCS,
306
307	DCB_CMD_PFC_GSTATE,
308	DCB_CMD_PFC_SSTATE,
309
310	DCB_CMD_BCN_GCFG,
311	DCB_CMD_BCN_SCFG,
312
313	DCB_CMD_GAPP,
314	DCB_CMD_SAPP,
315
316	DCB_CMD_IEEE_SET,
317	DCB_CMD_IEEE_GET,
318
319	DCB_CMD_GDCBX,
320	DCB_CMD_SDCBX,
321
322	DCB_CMD_GFEATCFG,
323	DCB_CMD_SFEATCFG,
324
325	DCB_CMD_CEE_GET,
326	DCB_CMD_IEEE_DEL,
327
328	__DCB_CMD_ENUM_MAX,
329	DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1,
330};
331
332/**
333 * enum dcbnl_attrs - DCB top-level netlink attributes
334 *
335 * @DCB_ATTR_UNDEFINED: unspecified attribute to catch errors
336 * @DCB_ATTR_IFNAME: interface name of the underlying device (NLA_STRING)
337 * @DCB_ATTR_STATE: enable state of DCB in the device (NLA_U8)
338 * @DCB_ATTR_PFC_STATE: enable state of PFC in the device (NLA_U8)
339 * @DCB_ATTR_PFC_CFG: priority flow control configuration (NLA_NESTED)
340 * @DCB_ATTR_NUM_TC: number of traffic classes supported in the device (NLA_U8)
341 * @DCB_ATTR_PG_CFG: priority group configuration (NLA_NESTED)
342 * @DCB_ATTR_SET_ALL: bool to commit changes to hardware or not (NLA_U8)
343 * @DCB_ATTR_PERM_HWADDR: MAC address of the physical device (NLA_NESTED)
344 * @DCB_ATTR_CAP: DCB capabilities of the device (NLA_NESTED)
345 * @DCB_ATTR_NUMTCS: number of traffic classes supported (NLA_NESTED)
346 * @DCB_ATTR_BCN: backward congestion notification configuration (NLA_NESTED)
347 * @DCB_ATTR_IEEE: IEEE 802.1Qaz supported attributes (NLA_NESTED)
348 * @DCB_ATTR_DCBX: DCBX engine configuration in the device (NLA_U8)
349 * @DCB_ATTR_FEATCFG: DCBX features flags (NLA_NESTED)
350 * @DCB_ATTR_CEE: CEE std supported attributes (NLA_NESTED)
351 */
352enum dcbnl_attrs {
353	DCB_ATTR_UNDEFINED,
354
355	DCB_ATTR_IFNAME,
356	DCB_ATTR_STATE,
357	DCB_ATTR_PFC_STATE,
358	DCB_ATTR_PFC_CFG,
359	DCB_ATTR_NUM_TC,
360	DCB_ATTR_PG_CFG,
361	DCB_ATTR_SET_ALL,
362	DCB_ATTR_PERM_HWADDR,
363	DCB_ATTR_CAP,
364	DCB_ATTR_NUMTCS,
365	DCB_ATTR_BCN,
366	DCB_ATTR_APP,
367
368	/* IEEE std attributes */
369	DCB_ATTR_IEEE,
370
371	DCB_ATTR_DCBX,
372	DCB_ATTR_FEATCFG,
373
374	/* CEE nested attributes */
375	DCB_ATTR_CEE,
376
377	__DCB_ATTR_ENUM_MAX,
378	DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1,
379};
380
381/**
382 * enum ieee_attrs - IEEE 802.1Qaz get/set attributes
383 *
384 * @DCB_ATTR_IEEE_UNSPEC: unspecified
385 * @DCB_ATTR_IEEE_ETS: negotiated ETS configuration
386 * @DCB_ATTR_IEEE_PFC: negotiated PFC configuration
387 * @DCB_ATTR_IEEE_APP_TABLE: negotiated APP configuration
388 * @DCB_ATTR_IEEE_PEER_ETS: peer ETS configuration - get only
389 * @DCB_ATTR_IEEE_PEER_PFC: peer PFC configuration - get only
390 * @DCB_ATTR_IEEE_PEER_APP: peer APP tlv - get only
391 */
392enum ieee_attrs {
393	DCB_ATTR_IEEE_UNSPEC,
394	DCB_ATTR_IEEE_ETS,
395	DCB_ATTR_IEEE_PFC,
396	DCB_ATTR_IEEE_APP_TABLE,
397	DCB_ATTR_IEEE_PEER_ETS,
398	DCB_ATTR_IEEE_PEER_PFC,
399	DCB_ATTR_IEEE_PEER_APP,
400	DCB_ATTR_IEEE_MAXRATE,
401	DCB_ATTR_IEEE_QCN,
402	DCB_ATTR_IEEE_QCN_STATS,
403	__DCB_ATTR_IEEE_MAX
404};
405#define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1)
406
407enum ieee_attrs_app {
408	DCB_ATTR_IEEE_APP_UNSPEC,
409	DCB_ATTR_IEEE_APP,
410	__DCB_ATTR_IEEE_APP_MAX
411};
412#define DCB_ATTR_IEEE_APP_MAX (__DCB_ATTR_IEEE_APP_MAX - 1)
413
414/**
415 * enum cee_attrs - CEE DCBX get attributes.
416 *
417 * @DCB_ATTR_CEE_UNSPEC: unspecified
418 * @DCB_ATTR_CEE_PEER_PG: peer PG configuration - get only
419 * @DCB_ATTR_CEE_PEER_PFC: peer PFC configuration - get only
420 * @DCB_ATTR_CEE_PEER_APP_TABLE: peer APP tlv - get only
421 * @DCB_ATTR_CEE_TX_PG: TX PG configuration (DCB_CMD_PGTX_GCFG)
422 * @DCB_ATTR_CEE_RX_PG: RX PG configuration (DCB_CMD_PGRX_GCFG)
423 * @DCB_ATTR_CEE_PFC: PFC configuration (DCB_CMD_PFC_GCFG)
424 * @DCB_ATTR_CEE_APP_TABLE: APP configuration (multi DCB_CMD_GAPP)
425 * @DCB_ATTR_CEE_FEAT: DCBX features flags (DCB_CMD_GFEATCFG)
426 *
427 * An aggregated collection of the cee std negotiated parameters.
428 */
429enum cee_attrs {
430	DCB_ATTR_CEE_UNSPEC,
431	DCB_ATTR_CEE_PEER_PG,
432	DCB_ATTR_CEE_PEER_PFC,
433	DCB_ATTR_CEE_PEER_APP_TABLE,
434	DCB_ATTR_CEE_TX_PG,
435	DCB_ATTR_CEE_RX_PG,
436	DCB_ATTR_CEE_PFC,
437	DCB_ATTR_CEE_APP_TABLE,
438	DCB_ATTR_CEE_FEAT,
439	__DCB_ATTR_CEE_MAX
440};
441#define DCB_ATTR_CEE_MAX (__DCB_ATTR_CEE_MAX - 1)
442
443enum peer_app_attr {
444	DCB_ATTR_CEE_PEER_APP_UNSPEC,
445	DCB_ATTR_CEE_PEER_APP_INFO,
446	DCB_ATTR_CEE_PEER_APP,
447	__DCB_ATTR_CEE_PEER_APP_MAX
448};
449#define DCB_ATTR_CEE_PEER_APP_MAX (__DCB_ATTR_CEE_PEER_APP_MAX - 1)
450
451enum cee_attrs_app {
452	DCB_ATTR_CEE_APP_UNSPEC,
453	DCB_ATTR_CEE_APP,
454	__DCB_ATTR_CEE_APP_MAX
455};
456#define DCB_ATTR_CEE_APP_MAX (__DCB_ATTR_CEE_APP_MAX - 1)
457
458/**
459 * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs
460 *
461 * @DCB_PFC_UP_ATTR_UNDEFINED: unspecified attribute to catch errors
462 * @DCB_PFC_UP_ATTR_0: Priority Flow Control value for User Priority 0 (NLA_U8)
463 * @DCB_PFC_UP_ATTR_1: Priority Flow Control value for User Priority 1 (NLA_U8)
464 * @DCB_PFC_UP_ATTR_2: Priority Flow Control value for User Priority 2 (NLA_U8)
465 * @DCB_PFC_UP_ATTR_3: Priority Flow Control value for User Priority 3 (NLA_U8)
466 * @DCB_PFC_UP_ATTR_4: Priority Flow Control value for User Priority 4 (NLA_U8)
467 * @DCB_PFC_UP_ATTR_5: Priority Flow Control value for User Priority 5 (NLA_U8)
468 * @DCB_PFC_UP_ATTR_6: Priority Flow Control value for User Priority 6 (NLA_U8)
469 * @DCB_PFC_UP_ATTR_7: Priority Flow Control value for User Priority 7 (NLA_U8)
470 * @DCB_PFC_UP_ATTR_MAX: highest attribute number currently defined
471 * @DCB_PFC_UP_ATTR_ALL: apply to all priority flow control attrs (NLA_FLAG)
472 *
473 */
474enum dcbnl_pfc_up_attrs {
475	DCB_PFC_UP_ATTR_UNDEFINED,
476
477	DCB_PFC_UP_ATTR_0,
478	DCB_PFC_UP_ATTR_1,
479	DCB_PFC_UP_ATTR_2,
480	DCB_PFC_UP_ATTR_3,
481	DCB_PFC_UP_ATTR_4,
482	DCB_PFC_UP_ATTR_5,
483	DCB_PFC_UP_ATTR_6,
484	DCB_PFC_UP_ATTR_7,
485	DCB_PFC_UP_ATTR_ALL,
486
487	__DCB_PFC_UP_ATTR_ENUM_MAX,
488	DCB_PFC_UP_ATTR_MAX = __DCB_PFC_UP_ATTR_ENUM_MAX - 1,
489};
490
491/**
492 * enum dcbnl_pg_attrs - DCB Priority Group attributes
493 *
494 * @DCB_PG_ATTR_UNDEFINED: unspecified attribute to catch errors
495 * @DCB_PG_ATTR_TC_0: Priority Group Traffic Class 0 configuration (NLA_NESTED)
496 * @DCB_PG_ATTR_TC_1: Priority Group Traffic Class 1 configuration (NLA_NESTED)
497 * @DCB_PG_ATTR_TC_2: Priority Group Traffic Class 2 configuration (NLA_NESTED)
498 * @DCB_PG_ATTR_TC_3: Priority Group Traffic Class 3 configuration (NLA_NESTED)
499 * @DCB_PG_ATTR_TC_4: Priority Group Traffic Class 4 configuration (NLA_NESTED)
500 * @DCB_PG_ATTR_TC_5: Priority Group Traffic Class 5 configuration (NLA_NESTED)
501 * @DCB_PG_ATTR_TC_6: Priority Group Traffic Class 6 configuration (NLA_NESTED)
502 * @DCB_PG_ATTR_TC_7: Priority Group Traffic Class 7 configuration (NLA_NESTED)
503 * @DCB_PG_ATTR_TC_MAX: highest attribute number currently defined
504 * @DCB_PG_ATTR_TC_ALL: apply to all traffic classes (NLA_NESTED)
505 * @DCB_PG_ATTR_BW_ID_0: Percent of link bandwidth for Priority Group 0 (NLA_U8)
506 * @DCB_PG_ATTR_BW_ID_1: Percent of link bandwidth for Priority Group 1 (NLA_U8)
507 * @DCB_PG_ATTR_BW_ID_2: Percent of link bandwidth for Priority Group 2 (NLA_U8)
508 * @DCB_PG_ATTR_BW_ID_3: Percent of link bandwidth for Priority Group 3 (NLA_U8)
509 * @DCB_PG_ATTR_BW_ID_4: Percent of link bandwidth for Priority Group 4 (NLA_U8)
510 * @DCB_PG_ATTR_BW_ID_5: Percent of link bandwidth for Priority Group 5 (NLA_U8)
511 * @DCB_PG_ATTR_BW_ID_6: Percent of link bandwidth for Priority Group 6 (NLA_U8)
512 * @DCB_PG_ATTR_BW_ID_7: Percent of link bandwidth for Priority Group 7 (NLA_U8)
513 * @DCB_PG_ATTR_BW_ID_MAX: highest attribute number currently defined
514 * @DCB_PG_ATTR_BW_ID_ALL: apply to all priority groups (NLA_FLAG)
515 *
516 */
517enum dcbnl_pg_attrs {
518	DCB_PG_ATTR_UNDEFINED,
519
520	DCB_PG_ATTR_TC_0,
521	DCB_PG_ATTR_TC_1,
522	DCB_PG_ATTR_TC_2,
523	DCB_PG_ATTR_TC_3,
524	DCB_PG_ATTR_TC_4,
525	DCB_PG_ATTR_TC_5,
526	DCB_PG_ATTR_TC_6,
527	DCB_PG_ATTR_TC_7,
528	DCB_PG_ATTR_TC_MAX,
529	DCB_PG_ATTR_TC_ALL,
530
531	DCB_PG_ATTR_BW_ID_0,
532	DCB_PG_ATTR_BW_ID_1,
533	DCB_PG_ATTR_BW_ID_2,
534	DCB_PG_ATTR_BW_ID_3,
535	DCB_PG_ATTR_BW_ID_4,
536	DCB_PG_ATTR_BW_ID_5,
537	DCB_PG_ATTR_BW_ID_6,
538	DCB_PG_ATTR_BW_ID_7,
539	DCB_PG_ATTR_BW_ID_MAX,
540	DCB_PG_ATTR_BW_ID_ALL,
541
542	__DCB_PG_ATTR_ENUM_MAX,
543	DCB_PG_ATTR_MAX = __DCB_PG_ATTR_ENUM_MAX - 1,
544};
545
546/**
547 * enum dcbnl_tc_attrs - DCB Traffic Class attributes
548 *
549 * @DCB_TC_ATTR_PARAM_UNDEFINED: unspecified attribute to catch errors
550 * @DCB_TC_ATTR_PARAM_PGID: (NLA_U8) Priority group the traffic class belongs to
551 *                          Valid values are:  0-7
552 * @DCB_TC_ATTR_PARAM_UP_MAPPING: (NLA_U8) Traffic class to user priority map
553 *                                Some devices may not support changing the
554 *                                user priority map of a TC.
555 * @DCB_TC_ATTR_PARAM_STRICT_PRIO: (NLA_U8) Strict priority setting
556 *                                 0 - none
557 *                                 1 - group strict
558 *                                 2 - link strict
559 * @DCB_TC_ATTR_PARAM_BW_PCT: optional - (NLA_U8) If supported by the device and
560 *                            not configured to use link strict priority,
561 *                            this is the percentage of bandwidth of the
562 *                            priority group this traffic class belongs to
563 * @DCB_TC_ATTR_PARAM_ALL: (NLA_FLAG) all traffic class parameters
564 *
565 */
566enum dcbnl_tc_attrs {
567	DCB_TC_ATTR_PARAM_UNDEFINED,
568
569	DCB_TC_ATTR_PARAM_PGID,
570	DCB_TC_ATTR_PARAM_UP_MAPPING,
571	DCB_TC_ATTR_PARAM_STRICT_PRIO,
572	DCB_TC_ATTR_PARAM_BW_PCT,
573	DCB_TC_ATTR_PARAM_ALL,
574
575	__DCB_TC_ATTR_PARAM_ENUM_MAX,
576	DCB_TC_ATTR_PARAM_MAX = __DCB_TC_ATTR_PARAM_ENUM_MAX - 1,
577};
578
579/**
580 * enum dcbnl_cap_attrs - DCB Capability attributes
581 *
582 * @DCB_CAP_ATTR_UNDEFINED: unspecified attribute to catch errors
583 * @DCB_CAP_ATTR_ALL: (NLA_FLAG) all capability parameters
584 * @DCB_CAP_ATTR_PG: (NLA_U8) device supports Priority Groups
585 * @DCB_CAP_ATTR_PFC: (NLA_U8) device supports Priority Flow Control
586 * @DCB_CAP_ATTR_UP2TC: (NLA_U8) device supports user priority to
587 *                               traffic class mapping
588 * @DCB_CAP_ATTR_PG_TCS: (NLA_U8) bitmap where each bit represents a
589 *                                number of traffic classes the device
590 *                                can be configured to use for Priority Groups
591 * @DCB_CAP_ATTR_PFC_TCS: (NLA_U8) bitmap where each bit represents a
592 *                                 number of traffic classes the device can be
593 *                                 configured to use for Priority Flow Control
594 * @DCB_CAP_ATTR_GSP: (NLA_U8) device supports group strict priority
595 * @DCB_CAP_ATTR_BCN: (NLA_U8) device supports Backwards Congestion
596 *                             Notification
597 * @DCB_CAP_ATTR_DCBX: (NLA_U8) device supports DCBX engine
598 *
599 */
600enum dcbnl_cap_attrs {
601	DCB_CAP_ATTR_UNDEFINED,
602	DCB_CAP_ATTR_ALL,
603	DCB_CAP_ATTR_PG,
604	DCB_CAP_ATTR_PFC,
605	DCB_CAP_ATTR_UP2TC,
606	DCB_CAP_ATTR_PG_TCS,
607	DCB_CAP_ATTR_PFC_TCS,
608	DCB_CAP_ATTR_GSP,
609	DCB_CAP_ATTR_BCN,
610	DCB_CAP_ATTR_DCBX,
611
612	__DCB_CAP_ATTR_ENUM_MAX,
613	DCB_CAP_ATTR_MAX = __DCB_CAP_ATTR_ENUM_MAX - 1,
614};
615
616/**
617 * DCBX capability flags
618 *
619 * @DCB_CAP_DCBX_HOST: DCBX negotiation is performed by the host LLDP agent.
620 *                     'set' routines are used to configure the device with
621 *                     the negotiated parameters
622 *
623 * @DCB_CAP_DCBX_LLD_MANAGED: DCBX negotiation is not performed in the host but
624 *                            by another entity
625 *                            'get' routines are used to retrieve the
626 *                            negotiated parameters
627 *                            'set' routines can be used to set the initial
628 *                            negotiation configuration
629 *
630 * @DCB_CAP_DCBX_VER_CEE: for a non-host DCBX engine, indicates the engine
631 *                        supports the CEE protocol flavor
632 *
633 * @DCB_CAP_DCBX_VER_IEEE: for a non-host DCBX engine, indicates the engine
634 *                         supports the IEEE protocol flavor
635 *
636 * @DCB_CAP_DCBX_STATIC: for a non-host DCBX engine, indicates the engine
637 *                       supports static configuration (i.e no actual
638 *                       negotiation is performed negotiated parameters equal
639 *                       the initial configuration)
640 *
641 */
642#define DCB_CAP_DCBX_HOST		0x01
643#define DCB_CAP_DCBX_LLD_MANAGED	0x02
644#define DCB_CAP_DCBX_VER_CEE		0x04
645#define DCB_CAP_DCBX_VER_IEEE		0x08
646#define DCB_CAP_DCBX_STATIC		0x10
647
648/**
649 * enum dcbnl_numtcs_attrs - number of traffic classes
650 *
651 * @DCB_NUMTCS_ATTR_UNDEFINED: unspecified attribute to catch errors
652 * @DCB_NUMTCS_ATTR_ALL: (NLA_FLAG) all traffic class attributes
653 * @DCB_NUMTCS_ATTR_PG: (NLA_U8) number of traffic classes used for
654 *                               priority groups
655 * @DCB_NUMTCS_ATTR_PFC: (NLA_U8) number of traffic classes which can
656 *                                support priority flow control
657 */
658enum dcbnl_numtcs_attrs {
659	DCB_NUMTCS_ATTR_UNDEFINED,
660	DCB_NUMTCS_ATTR_ALL,
661	DCB_NUMTCS_ATTR_PG,
662	DCB_NUMTCS_ATTR_PFC,
663
664	__DCB_NUMTCS_ATTR_ENUM_MAX,
665	DCB_NUMTCS_ATTR_MAX = __DCB_NUMTCS_ATTR_ENUM_MAX - 1,
666};
667
668enum dcbnl_bcn_attrs{
669	DCB_BCN_ATTR_UNDEFINED = 0,
670
671	DCB_BCN_ATTR_RP_0,
672	DCB_BCN_ATTR_RP_1,
673	DCB_BCN_ATTR_RP_2,
674	DCB_BCN_ATTR_RP_3,
675	DCB_BCN_ATTR_RP_4,
676	DCB_BCN_ATTR_RP_5,
677	DCB_BCN_ATTR_RP_6,
678	DCB_BCN_ATTR_RP_7,
679	DCB_BCN_ATTR_RP_ALL,
680
681	DCB_BCN_ATTR_BCNA_0,
682	DCB_BCN_ATTR_BCNA_1,
683	DCB_BCN_ATTR_ALPHA,
684	DCB_BCN_ATTR_BETA,
685	DCB_BCN_ATTR_GD,
686	DCB_BCN_ATTR_GI,
687	DCB_BCN_ATTR_TMAX,
688	DCB_BCN_ATTR_TD,
689	DCB_BCN_ATTR_RMIN,
690	DCB_BCN_ATTR_W,
691	DCB_BCN_ATTR_RD,
692	DCB_BCN_ATTR_RU,
693	DCB_BCN_ATTR_WRTT,
694	DCB_BCN_ATTR_RI,
695	DCB_BCN_ATTR_C,
696	DCB_BCN_ATTR_ALL,
697
698	__DCB_BCN_ATTR_ENUM_MAX,
699	DCB_BCN_ATTR_MAX = __DCB_BCN_ATTR_ENUM_MAX - 1,
700};
701
702/**
703 * enum dcb_general_attr_values - general DCB attribute values
704 *
705 * @DCB_ATTR_UNDEFINED: value used to indicate an attribute is not supported
706 *
707 */
708enum dcb_general_attr_values {
709	DCB_ATTR_VALUE_UNDEFINED = 0xff
710};
711
712#define DCB_APP_IDTYPE_ETHTYPE	0x00
713#define DCB_APP_IDTYPE_PORTNUM	0x01
714enum dcbnl_app_attrs {
715	DCB_APP_ATTR_UNDEFINED,
716
717	DCB_APP_ATTR_IDTYPE,
718	DCB_APP_ATTR_ID,
719	DCB_APP_ATTR_PRIORITY,
720
721	__DCB_APP_ATTR_ENUM_MAX,
722	DCB_APP_ATTR_MAX = __DCB_APP_ATTR_ENUM_MAX - 1,
723};
724
725/**
726 * enum dcbnl_featcfg_attrs - features conifiguration flags
727 *
728 * @DCB_FEATCFG_ATTR_UNDEFINED: unspecified attribute to catch errors
729 * @DCB_FEATCFG_ATTR_ALL: (NLA_FLAG) all features configuration attributes
730 * @DCB_FEATCFG_ATTR_PG: (NLA_U8) configuration flags for priority groups
731 * @DCB_FEATCFG_ATTR_PFC: (NLA_U8) configuration flags for priority
732 *                                 flow control
733 * @DCB_FEATCFG_ATTR_APP: (NLA_U8) configuration flags for application TLV
734 *
735 */
736#define DCB_FEATCFG_ERROR	0x01	/* error in feature resolution */
737#define DCB_FEATCFG_ENABLE	0x02	/* enable feature */
738#define DCB_FEATCFG_WILLING	0x04	/* feature is willing */
739#define DCB_FEATCFG_ADVERTISE	0x08	/* advertise feature */
740enum dcbnl_featcfg_attrs {
741	DCB_FEATCFG_ATTR_UNDEFINED,
742	DCB_FEATCFG_ATTR_ALL,
743	DCB_FEATCFG_ATTR_PG,
744	DCB_FEATCFG_ATTR_PFC,
745	DCB_FEATCFG_ATTR_APP,
746
747	__DCB_FEATCFG_ATTR_ENUM_MAX,
748	DCB_FEATCFG_ATTR_MAX = __DCB_FEATCFG_ATTR_ENUM_MAX - 1,
749};
750
751#endif /* __LINUX_DCBNL_H__ */
752