1 /*
2  * Copyright (C) 1999-2013, Broadcom Corporation
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  *
16  * Fundamental types and constants relating to 802.1D
17  *
18  * $Id: 802.1d.h 382882 2013-02-04 23:24:31Z $
19  */
20 
21 #ifndef _802_1_D_
22 #define _802_1_D_
23 
24 /* 802.1D priority defines */
25 #define	PRIO_8021D_NONE		2	/* None = - */
26 #define	PRIO_8021D_BK		1	/* BK - Background */
27 #define	PRIO_8021D_BE		0	/* BE - Best-effort */
28 #define	PRIO_8021D_EE		3	/* EE - Excellent-effort */
29 #define	PRIO_8021D_CL		4	/* CL - Controlled Load */
30 #define	PRIO_8021D_VI		5	/* Vi - Video */
31 #define	PRIO_8021D_VO		6	/* Vo - Voice */
32 #define	PRIO_8021D_NC		7	/* NC - Network Control */
33 #define	MAXPRIO			7	/* 0-7 */
34 #define NUMPRIO			(MAXPRIO + 1)
35 
36 #define ALLPRIO		-1	/* All prioirty */
37 
38 /* Converts prio to precedence since the numerical value of
39  * PRIO_8021D_BE and PRIO_8021D_NONE are swapped.
40  */
41 #define PRIO2PREC(prio) \
42 	(((prio) == PRIO_8021D_NONE || (prio) == PRIO_8021D_BE) ? ((prio^2)) : (prio))
43 
44 #endif /* _802_1_D__ */
45