10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 52760Sdg199075 * Common Development and Distribution License (the "License"). 62760Sdg199075 * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*8275SEric Cheng * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate /* 270Sstevel@tonic-gate * vlan.h header for common (non-media specific) VLAN declarations. 280Sstevel@tonic-gate */ 290Sstevel@tonic-gate 300Sstevel@tonic-gate #ifndef _SYS_VLAN_H 310Sstevel@tonic-gate #define _SYS_VLAN_H 320Sstevel@tonic-gate 330Sstevel@tonic-gate #ifdef __cplusplus 340Sstevel@tonic-gate extern "C" { 350Sstevel@tonic-gate #endif 360Sstevel@tonic-gate 370Sstevel@tonic-gate #define VLAN_TAGSZ 4 380Sstevel@tonic-gate 39*8275SEric Cheng #define VLAN_TPID 0x8100u 40*8275SEric Cheng 410Sstevel@tonic-gate #define VLAN_ID_MASK 0x0fffu 420Sstevel@tonic-gate #define VLAN_ID_SIZE 12 430Sstevel@tonic-gate #define VLAN_ID_SHIFT 0 440Sstevel@tonic-gate 450Sstevel@tonic-gate #define VLAN_CFI_MASK 0x0001u 460Sstevel@tonic-gate #define VLAN_CFI_SIZE 1 470Sstevel@tonic-gate #define VLAN_CFI_SHIFT (VLAN_ID_SHIFT + VLAN_ID_SIZE) 480Sstevel@tonic-gate 490Sstevel@tonic-gate #define VLAN_PRI_MASK 0x0007u 500Sstevel@tonic-gate #define VLAN_PRI_SIZE 3 510Sstevel@tonic-gate #define VLAN_PRI_SHIFT (VLAN_CFI_SHIFT + VLAN_CFI_SIZE) 520Sstevel@tonic-gate 530Sstevel@tonic-gate #define VLAN_ID_NONE 0 540Sstevel@tonic-gate #define VLAN_ID_MIN 1 550Sstevel@tonic-gate #define VLAN_ID_MAX 4094 560Sstevel@tonic-gate 570Sstevel@tonic-gate #define VLAN_TCI(pri, cfi, vid) \ 580Sstevel@tonic-gate (((pri) << VLAN_PRI_SHIFT) | \ 590Sstevel@tonic-gate ((cfi) << VLAN_CFI_SHIFT) | \ 600Sstevel@tonic-gate ((vid) << VLAN_ID_SHIFT)) 610Sstevel@tonic-gate 620Sstevel@tonic-gate /* 630Sstevel@tonic-gate * Deconstruct a VTAG ... 640Sstevel@tonic-gate */ 650Sstevel@tonic-gate #define VLAN_PRI(tci) (((tci) >> VLAN_PRI_SHIFT) & VLAN_PRI_MASK) 660Sstevel@tonic-gate #define VLAN_CFI(tci) (((tci) >> VLAN_CFI_SHIFT) & VLAN_CFI_MASK) 670Sstevel@tonic-gate #define VLAN_ID(tci) (((tci) >> VLAN_ID_SHIFT) & VLAN_ID_MASK) 680Sstevel@tonic-gate 692760Sdg199075 #define VLAN_BAND_MAP 32 702760Sdg199075 712760Sdg199075 #define VLAN_MBLKPRI(mp) \ 722760Sdg199075 ((((mp)->b_band) / VLAN_BAND_MAP) > 7 ? 0 : \ 732760Sdg199075 (((mp)->b_band) / VLAN_BAND_MAP)) 742760Sdg199075 750Sstevel@tonic-gate #ifdef __cplusplus 760Sstevel@tonic-gate } 770Sstevel@tonic-gate #endif 780Sstevel@tonic-gate 790Sstevel@tonic-gate #endif /* _SYS_VLAN_H */ 80