uts: make emu10k non-verbose
[unleashed.git] / include / sys / vlan.h
blob11c7d41e8390e448bac534ba7dcbe49bc24a89f8
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
27 * vlan.h header for common (non-media specific) VLAN declarations.
30 #ifndef _SYS_VLAN_H
31 #define _SYS_VLAN_H
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
37 #define VLAN_TAGSZ 4
39 #define VLAN_TPID 0x8100u
41 #define VLAN_ID_MASK 0x0fffu
42 #define VLAN_ID_SIZE 12
43 #define VLAN_ID_SHIFT 0
45 #define VLAN_CFI_MASK 0x0001u
46 #define VLAN_CFI_SIZE 1
47 #define VLAN_CFI_SHIFT (VLAN_ID_SHIFT + VLAN_ID_SIZE)
49 #define VLAN_PRI_MASK 0x0007u
50 #define VLAN_PRI_SIZE 3
51 #define VLAN_PRI_SHIFT (VLAN_CFI_SHIFT + VLAN_CFI_SIZE)
53 #define VLAN_ID_NONE 0
54 #define VLAN_ID_MIN 1
55 #define VLAN_ID_MAX 4094
57 #define VLAN_TCI(pri, cfi, vid) \
58 (((pri) << VLAN_PRI_SHIFT) | \
59 ((cfi) << VLAN_CFI_SHIFT) | \
60 ((vid) << VLAN_ID_SHIFT))
63 * Deconstruct a VTAG ...
65 #define VLAN_PRI(tci) (((tci) >> VLAN_PRI_SHIFT) & VLAN_PRI_MASK)
66 #define VLAN_CFI(tci) (((tci) >> VLAN_CFI_SHIFT) & VLAN_CFI_MASK)
67 #define VLAN_ID(tci) (((tci) >> VLAN_ID_SHIFT) & VLAN_ID_MASK)
69 #define VLAN_BAND_MAP 32
71 #define VLAN_MBLKPRI(mp) \
72 ((((mp)->b_band) / VLAN_BAND_MAP) > 7 ? 0 : \
73 (((mp)->b_band) / VLAN_BAND_MAP))
75 #ifdef __cplusplus
77 #endif
79 #endif /* _SYS_VLAN_H */