1 /* 2 * 802.11e protocol header file 3 * 4 * Portions of this code are copyright (c) 2021 Cypress Semiconductor Corporation 5 * 6 * Copyright (C) 1999-2017, Broadcom Corporation 7 * 8 * Unless you and Broadcom execute a separate written software license 9 * agreement governing use of this software, this software is licensed to you 10 * under the terms of the GNU General Public License version 2 (the "GPL"), 11 * available at http://www.broadcom.com/licenses/GPLv2.php, with the 12 * following added to such license: 13 * 14 * As a special exception, the copyright holders of this software give you 15 * permission to link this software with independent modules, and to copy and 16 * distribute the resulting executable under terms of your choice, provided that 17 * you also meet, for each linked independent module, the terms and conditions of 18 * the license of that module. An independent module is a module which is not 19 * derived from this software. The special exception does not apply to any 20 * modifications of the software. 21 * 22 * Notwithstanding the above, under no circumstances may you combine this 23 * software in any way with any other Broadcom software provided under a license 24 * other than the GPL, without Broadcom's express prior written consent. 25 * 26 * 27 * <<Broadcom-WL-IPTag/Open:>> 28 * 29 * $Id$ 30 */ 31 32 #ifndef _802_11e_H_ 33 #define _802_11e_H_ 34 35 #ifndef _TYPEDEFS_H_ 36 #include <typedefs.h> 37 #endif // endif 38 39 /* This marks the start of a packed structure section. */ 40 #include <packed_section_start.h> 41 42 /* WME Traffic Specification (TSPEC) element */ 43 #define WME_TSPEC_HDR_LEN 2 /* WME TSPEC header length */ 44 #define WME_TSPEC_BODY_OFF 2 /* WME TSPEC body offset */ 45 46 #define WME_CATEGORY_CODE_OFFSET 0 /* WME Category code offset */ 47 #define WME_ACTION_CODE_OFFSET 1 /* WME Action code offset */ 48 #define WME_TOKEN_CODE_OFFSET 2 /* WME Token code offset */ 49 #define WME_STATUS_CODE_OFFSET 3 /* WME Status code offset */ 50 51 BWL_PRE_PACKED_STRUCT struct tsinfo { 52 uint8 octets[3]; 53 } BWL_POST_PACKED_STRUCT; 54 55 typedef struct tsinfo tsinfo_t; 56 57 /* 802.11e TSPEC IE */ 58 typedef BWL_PRE_PACKED_STRUCT struct tspec { 59 uint8 oui[DOT11_OUI_LEN]; /* WME_OUI */ 60 uint8 type; /* WME_TYPE */ 61 uint8 subtype; /* WME_SUBTYPE_TSPEC */ 62 uint8 version; /* WME_VERSION */ 63 tsinfo_t tsinfo; /* TS Info bit field */ 64 uint16 nom_msdu_size; /* (Nominal or fixed) MSDU Size (bytes) */ 65 uint16 max_msdu_size; /* Maximum MSDU Size (bytes) */ 66 uint32 min_srv_interval; /* Minimum Service Interval (us) */ 67 uint32 max_srv_interval; /* Maximum Service Interval (us) */ 68 uint32 inactivity_interval; /* Inactivity Interval (us) */ 69 uint32 suspension_interval; /* Suspension Interval (us) */ 70 uint32 srv_start_time; /* Service Start Time (us) */ 71 uint32 min_data_rate; /* Minimum Data Rate (bps) */ 72 uint32 mean_data_rate; /* Mean Data Rate (bps) */ 73 uint32 peak_data_rate; /* Peak Data Rate (bps) */ 74 uint32 max_burst_size; /* Maximum Burst Size (bytes) */ 75 uint32 delay_bound; /* Delay Bound (us) */ 76 uint32 min_phy_rate; /* Minimum PHY Rate (bps) */ 77 uint16 surplus_bw; /* Surplus Bandwidth Allowance (range 1.0-8.0) */ 78 uint16 medium_time; /* Medium Time (32 us/s periods) */ 79 } BWL_POST_PACKED_STRUCT tspec_t; 80 81 #define WME_TSPEC_LEN (sizeof(tspec_t)) /* not including 2-bytes of header */ 82 83 /* ts_info */ 84 /* 802.1D priority is duplicated - bits 13-11 AND bits 3-1 */ 85 #define TS_INFO_TID_SHIFT 1 /* TS info. TID shift */ 86 #define TS_INFO_TID_MASK (0xf << TS_INFO_TID_SHIFT) /* TS info. TID mask */ 87 #define TS_INFO_CONTENTION_SHIFT 7 /* TS info. contention shift */ 88 #define TS_INFO_CONTENTION_MASK (0x1 << TS_INFO_CONTENTION_SHIFT) /* TS info. contention mask */ 89 #define TS_INFO_DIRECTION_SHIFT 5 /* TS info. direction shift */ 90 #define TS_INFO_DIRECTION_MASK (0x3 << TS_INFO_DIRECTION_SHIFT) /* TS info. direction mask */ 91 #define TS_INFO_PSB_SHIFT 2 /* TS info. PSB bit Shift */ 92 #define TS_INFO_PSB_MASK (1 << TS_INFO_PSB_SHIFT) /* TS info. PSB mask */ 93 #define TS_INFO_UPLINK (0 << TS_INFO_DIRECTION_SHIFT) /* TS info. uplink */ 94 #define TS_INFO_DOWNLINK (1 << TS_INFO_DIRECTION_SHIFT) /* TS info. downlink */ 95 #define TS_INFO_BIDIRECTIONAL (3 << TS_INFO_DIRECTION_SHIFT) /* TS info. bidirectional */ 96 #define TS_INFO_USER_PRIO_SHIFT 3 /* TS info. user priority shift */ 97 /* TS info. user priority mask */ 98 #define TS_INFO_USER_PRIO_MASK (0x7 << TS_INFO_USER_PRIO_SHIFT) 99 100 /* Macro to get/set bit(s) field in TSINFO */ 101 #define WLC_CAC_GET_TID(pt) ((((pt).octets[0]) & TS_INFO_TID_MASK) >> TS_INFO_TID_SHIFT) 102 #define WLC_CAC_GET_DIR(pt) ((((pt).octets[0]) & \ 103 TS_INFO_DIRECTION_MASK) >> TS_INFO_DIRECTION_SHIFT) 104 #define WLC_CAC_GET_PSB(pt) ((((pt).octets[1]) & TS_INFO_PSB_MASK) >> TS_INFO_PSB_SHIFT) 105 #define WLC_CAC_GET_USER_PRIO(pt) ((((pt).octets[1]) & \ 106 TS_INFO_USER_PRIO_MASK) >> TS_INFO_USER_PRIO_SHIFT) 107 108 #define WLC_CAC_SET_TID(pt, id) ((((pt).octets[0]) & (~TS_INFO_TID_MASK)) | \ 109 ((id) << TS_INFO_TID_SHIFT)) 110 #define WLC_CAC_SET_USER_PRIO(pt, prio) ((((pt).octets[0]) & (~TS_INFO_USER_PRIO_MASK)) | \ 111 ((prio) << TS_INFO_USER_PRIO_SHIFT)) 112 113 /* 802.11e QBSS Load IE */ 114 #define QBSS_LOAD_IE_LEN 5 /* QBSS Load IE length */ 115 #define QBSS_LOAD_AAC_OFF 3 /* AAC offset in IE */ 116 117 #define CAC_ADDTS_RESP_TIMEOUT 1000 /* default ADDTS response timeout in ms */ 118 /* DEFVAL dot11ADDTSResponseTimeout = 1s */ 119 120 /* 802.11e ADDTS status code */ 121 #define DOT11E_STATUS_ADMISSION_ACCEPTED 0 /* TSPEC Admission accepted status */ 122 #define DOT11E_STATUS_ADDTS_INVALID_PARAM 1 /* TSPEC invalid parameter status */ 123 #define DOT11E_STATUS_ADDTS_REFUSED_NSBW 3 /* ADDTS refused (non-sufficient BW) */ 124 #define DOT11E_STATUS_ADDTS_REFUSED_AWHILE 47 /* ADDTS refused but could retry later */ 125 #ifdef BCMCCX 126 #define CCX_STATUS_ASSOC_DENIED_UNKNOWN 0xc8 /* unspecified QoS related failure */ 127 #define CCX_STATUS_ASSOC_DENIED_AP_POLICY 0xc9 /* TSPEC refused due to AP policy */ 128 #define CCX_STATUS_ASSOC_DENIED_NO_BW 0xca /* Assoc denied due to AP insufficient BW */ 129 #define CCX_STATUS_ASSOC_DENIED_BAD_PARAM 0xcb /* one or more TSPEC with invalid parameter */ 130 #endif /* BCMCCX */ 131 132 /* 802.11e DELTS status code */ 133 #define DOT11E_STATUS_QSTA_LEAVE_QBSS 36 /* STA leave QBSS */ 134 #define DOT11E_STATUS_END_TS 37 /* END TS */ 135 #define DOT11E_STATUS_UNKNOWN_TS 38 /* UNKNOWN TS */ 136 #define DOT11E_STATUS_QSTA_REQ_TIMEOUT 39 /* STA ADDTS request timeout */ 137 138 /* This marks the end of a packed structure section. */ 139 #include <packed_section_end.h> 140 141 #endif /* _802_11e_CAC_H_ */ 142