Broadcom SDK and wireless driver: another attempt to update to ver. 5.10.147.0
[tomato.git] / release / src-rt / include / proto / vlan.h
blob6b4a198f556b4c25cc58bf5e983c239d4cdeb04d
1 /*
2 * 802.1Q VLAN protocol definitions
4 * Copyright (C) 2009, Broadcom Corporation
5 * All Rights Reserved.
6 *
7 * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8 * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9 * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
10 * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
12 * $Id: vlan.h,v 9.4.130.1 2009/10/12 23:01:02 Exp $
15 #ifndef _vlan_h_
16 #define _vlan_h_
18 /* enable structure packing */
19 #if defined(__GNUC__)
20 #define PACKED __attribute__((packed))
21 #else
22 #pragma pack(1)
23 #define PACKED
24 #endif
26 #define VLAN_VID_MASK 0xfff /* low 12 bits are vlan id */
27 #define VLAN_CFI_SHIFT 12 /* canonical format indicator bit */
28 #define VLAN_PRI_SHIFT 13 /* user priority */
30 #define VLAN_PRI_MASK 7 /* 3 bits of priority */
32 #define VLAN_TAG_LEN 4
33 #define VLAN_TAG_OFFSET (2 * ETHER_ADDR_LEN) /* offset in Ethernet II packet only */
35 #define VLAN_TPID 0x8100 /* VLAN ethertype/Tag Protocol ID */
37 struct ethervlan_header {
38 uint8 ether_dhost[ETHER_ADDR_LEN];
39 uint8 ether_shost[ETHER_ADDR_LEN];
40 uint16 vlan_type; /* 0x8100 */
41 uint16 vlan_tag; /* priority, cfi and vid */
42 uint16 ether_type;
45 #define ETHERVLAN_HDR_LEN (ETHER_HDR_LEN + VLAN_TAG_LEN)
47 #undef PACKED
48 #if !defined(__GNUC__)
49 #pragma pack()
50 #endif
52 #define ETHERVLAN_MOVE_HDR(d, s) \
53 do { \
54 struct ethervlan_header t; \
55 t = *(struct ethervlan_header *)(s); \
56 *(struct ethervlan_header *)(d) = t; \
57 } while (0)
59 #endif /* _vlan_h_ */