[ar7] let 802.1q tagged frames go in and out from cpmac (#6730)
[openwrt.git] / package / broadcom-wl / src / driver / proto / 802.11e.h
1 /*
2 * 802.11e protocol header file
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 _802_11e_H_
15 #define _802_11e_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 #ifdef BCMDBG
26 extern const char *aci_names[];
27 #endif /* BCMDBG */
28
29 /* WME Traffic Specification (TSPEC) element */
30 #define WME_TSPEC_HDR_LEN 2 /* WME TSPEC header length */
31 #define WME_TSPEC_BODY_OFF 2 /* WME TSPEC body offset */
32
33 #define WME_CATEGORY_CODE_OFFSET 0 /* WME Category code offset */
34 #define WME_ACTION_CODE_OFFSET 1 /* WME Action code offset */
35 #define WME_TOKEN_CODE_OFFSET 2 /* WME Token code offset */
36 #define WME_STATUS_CODE_OFFSET 3 /* WME Status code offset */
37
38 struct tsinfo {
39 uint8 octets[3];
40 } PACKED;
41
42 typedef struct tsinfo tsinfo_t;
43
44 /* 802.11e TSPEC IE */
45 typedef struct tspec {
46 uint8 oui[DOT11_OUI_LEN]; /* WME_OUI */
47 uint8 type; /* WME_TYPE */
48 uint8 subtype; /* WME_SUBTYPE_TSPEC */
49 uint8 version; /* WME_VERSION */
50 tsinfo_t tsinfo; /* TS Info bit field */
51 uint16 nom_msdu_size; /* (Nominal or fixed) MSDU Size (bytes) */
52 uint16 max_msdu_size; /* Maximum MSDU Size (bytes) */
53 uint32 min_srv_interval; /* Minimum Service Interval (us) */
54 uint32 max_srv_interval; /* Maximum Service Interval (us) */
55 uint32 inactivity_interval; /* Inactivity Interval (us) */
56 uint32 suspension_interval; /* Suspension Interval (us) */
57 uint32 srv_start_time; /* Service Start Time (us) */
58 uint32 min_data_rate; /* Minimum Data Rate (bps) */
59 uint32 mean_data_rate; /* Mean Data Rate (bps) */
60 uint32 peak_data_rate; /* Peak Data Rate (bps) */
61 uint32 max_burst_size; /* Maximum Burst Size (bytes) */
62 uint32 delay_bound; /* Delay Bound (us) */
63 uint32 min_phy_rate; /* Minimum PHY Rate (bps) */
64 uint16 surplus_bw; /* Surplus Bandwidth Allowance Factor */
65 uint16 medium_time; /* Medium Time (32 us/s periods) */
66 } PACKED tspec_t;
67
68 #define WME_TSPEC_LEN (sizeof(tspec_t)) /* not including 2-bytes of header */
69
70 /* ts_info */
71 /* 802.1D priority is duplicated - bits 13-11 AND bits 3-1 */
72 #define TS_INFO_TID_SHIFT 1 /* TS info. TID shift */
73 #define TS_INFO_TID_MASK (0xf << TS_INFO_TID_SHIFT) /* TS info. TID mask */
74 #define TS_INFO_CONTENTION_SHIFT 7 /* TS info. contention shift */
75 #define TS_INFO_CONTENTION_MASK (0x1 << TS_INFO_CONTENTION_SHIFT) /* TS info. contention mask */
76 #define TS_INFO_DIRECTION_SHIFT 5 /* TS info. direction shift */
77 #define TS_INFO_DIRECTION_MASK (0x3 << TS_INFO_DIRECTION_SHIFT) /* TS info. direction mask */
78 #define TS_INFO_PSB_SHIFT 2 /* TS info. PSB bit Shift */
79 #define TS_INFO_PSB_MASK (1 << TS_INFO_PSB_SHIFT) /* TS info. PSB mask */
80 #define TS_INFO_UPLINK (0 << TS_INFO_DIRECTION_SHIFT) /* TS info. uplink */
81 #define TS_INFO_DOWNLINK (1 << TS_INFO_DIRECTION_SHIFT) /* TS info. downlink */
82 #define TS_INFO_BIDIRECTIONAL (3 << TS_INFO_DIRECTION_SHIFT) /* TS info. bidirectional */
83 #define TS_INFO_USER_PRIO_SHIFT 3 /* TS info. user priority shift */
84 /* TS info. user priority mask */
85 #define TS_INFO_USER_PRIO_MASK (0x7 << TS_INFO_USER_PRIO_SHIFT)
86
87 /* Macro to get/set bit(s) field in TSINFO */
88 #define WLC_CAC_GET_TID(pt) ((((pt).octets[0]) & TS_INFO_TID_MASK) >> TS_INFO_TID_SHIFT)
89 #define WLC_CAC_GET_DIR(pt) ((((pt).octets[0]) & \
90 TS_INFO_DIRECTION_MASK) >> TS_INFO_DIRECTION_SHIFT)
91 #define WLC_CAC_GET_PSB(pt) ((((pt).octets[1]) & WLC_CAC_PSB_MASK) >> WLC_CAC_PSB_SHIFT)
92 #define WLC_CAC_GET_USER_PRIO(pt) ((((pt).octets[1]) & \
93 TS_INFO_USER_PRIO_MASK) >> TS_INFO_USER_PRIO_SHIFT)
94
95 #define WLC_CAC_SET_TID(pt, id) ((((pt).octets[0]) & (~TS_INFO_TID_MASK)) | \
96 ((id) << TS_INFO_TID_SHIFT))
97 #define WLC_CAC_SET_USER_PRIO(pt, prio) ((((pt).octets[0]) & (~TS_INFO_USER_PRIO_MASK)) | \
98 ((prio) << TS_INFO_USER_PRIO_SHIFT))
99
100 /* 802.11e QBSS Load IE */
101 #define QBSS_LOAD_IE_LEN 5 /* QBSS Load IE length */
102 #define QBSS_LOAD_AAC_OFF 3 /* AAC offset in IE */
103
104 #define CAC_ADDTS_RESP_TIMEOUT 300 /* default ADDTS response timeout in ms */
105
106 /* 802.11e ADDTS status code */
107 #define DOT11E_STATUS_ADMISSION_ACCEPTED 0 /* TSPEC Admission accepted status */
108 #define DOT11E_STATUS_ADDTS_INVALID_PARAM 1 /* TSPEC invalid parameter status */
109 #define DOT11E_STATUS_ADDTS_REFUSED_NSBW 3 /* ADDTS refused (non-sufficient BW) */
110
111 /* 802.11e DELTS status code */
112 #define DOT11E_STATUS_QSTA_LEAVE_QBSS 36 /* STA leave QBSS */
113 #define DOT11E_STATUS_END_TS 37 /* END TS */
114 #define DOT11E_STATUS_UNKNOWN_TS 38 /* UNKNOWN TS */
115 #define DOT11E_STATUS_QSTA_REQ_TIMEOUT 39 /* STA ADDTS request timeout */
116
117 #undef PACKED
118 #if !defined(__GNUC__)
119 #pragma pack()
120 #endif
121
122 #endif /* _802_11e_CAC_H_ */
This page took 0.054705 seconds and 5 git commands to generate.