Root/package/broadcom-57xx/src/proto/vlan.h

1/*
2 * 802.1Q VLAN protocol definitions
3 *
4 * Copyright 2007, 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.
11 *
12 */
13
14#ifndef _vlan_h_
15#define _vlan_h_
16
17/* enable structure packing */
18#if defined(__GNUC__)
19#define PACKED __attribute__((packed))
20#else
21#pragma pack(1)
22#define PACKED
23#endif
24
25#define VLAN_VID_MASK 0xfff /* low 12 bits are vlan id */
26#define VLAN_CFI_SHIFT 12 /* canonical format indicator bit */
27#define VLAN_PRI_SHIFT 13 /* user priority */
28
29#define VLAN_PRI_MASK 7 /* 3 bits of priority */
30
31#define VLAN_TAG_LEN 4
32#define VLAN_TAG_OFFSET (2 * ETHER_ADDR_LEN) /* offset in Ethernet II packet only */
33
34#define VLAN_TPID 0x8100 /* VLAN ethertype/Tag Protocol ID */
35
36struct ethervlan_header {
37    uint8 ether_dhost[ETHER_ADDR_LEN];
38    uint8 ether_shost[ETHER_ADDR_LEN];
39    uint16 vlan_type; /* 0x8100 */
40    uint16 vlan_tag; /* priority, cfi and vid */
41    uint16 ether_type;
42};
43
44#define ETHERVLAN_HDR_LEN (ETHER_HDR_LEN + VLAN_TAG_LEN)
45
46#undef PACKED
47#if !defined(__GNUC__)
48#pragma pack()
49#endif
50
51#endif /* _vlan_h_ */
52

Archive Download this file



interactive