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