1 /* 2 * Wi-Fi Multimedia Admission Control (WMM-AC) 3 * Copyright(c) 2014, Intel Mobile Communication GmbH. 4 * Copyright(c) 2014, Intel Corporation. All rights reserved. 5 * 6 * This software may be distributed under the terms of the BSD license. 7 * See README for more details. 8 */ 9 10 #ifndef WMM_AC_H 11 #define WMM_AC_H 12 13 #include "common/ieee802_11_defs.h" 14 #include "drivers/driver.h" 15 16 struct wpa_supplicant; 17 18 #define WMM_AC_ACCESS_POLICY_EDCA 1 19 #define WMM_AC_FIXED_MSDU_SIZE BIT(15) 20 21 #define WMM_AC_MAX_TID 7 22 #define WMM_AC_MAX_USER_PRIORITY 7 23 #define WMM_AC_MIN_SBA_UNITY 0x2000 24 #define WMM_AC_MAX_NOMINAL_MSDU 32767 25 26 /** 27 * struct wmm_ac_assoc_data - WMM Admission Control Association Data 28 * 29 * This struct will store any relevant WMM association data needed by WMM AC. 30 * In case there is a valid WMM association, an instance of this struct will be 31 * created. In case there is no instance of this struct, the station is not 32 * associated to a valid WMM BSS and hence, WMM AC will not be used. 33 */ 34 struct wmm_ac_assoc_data { 35 struct { 36 /* 37 * acm - Admission Control Mandatory 38 * In case an access category is ACM, the traffic will have 39 * to be admitted by WMM-AC's admission mechanism before use. 40 */ 41 unsigned int acm:1; 42 43 /* 44 * uapsd_queues - Unscheduled Automatic Power Save Delivery 45 * queues. 46 * Indicates whether ACs are configured for U-APSD (or legacy 47 * PS). Storing this value is necessary in order to set the 48 * Power Save Bit (PSB) in ADDTS request Action frames (if not 49 * given). 50 */ 51 unsigned int uapsd:1; 52 } ac_params[WMM_AC_NUM]; 53 }; 54 55 /** 56 * wmm_ac_dir - WMM Admission Control Direction 57 */ 58 enum wmm_ac_dir { 59 WMM_AC_DIR_UPLINK = 0, 60 WMM_AC_DIR_DOWNLINK = 1, 61 WMM_AC_DIR_BIDIRECTIONAL = 3 62 }; 63 64 /** 65 * ts_dir_idx - indices of internally saved tspecs 66 * 67 * we can have multiple tspecs (downlink + uplink) per ac. 68 * save them in array, and use the enum to directly access 69 * the respective tspec slot (according to the direction). 70 */ 71 enum ts_dir_idx { 72 TS_DIR_IDX_UPLINK, 73 TS_DIR_IDX_DOWNLINK, 74 TS_DIR_IDX_BIDI, 75 76 TS_DIR_IDX_COUNT 77 }; 78 #define TS_DIR_IDX_ALL (BIT(TS_DIR_IDX_COUNT) - 1) 79 80 /** 81 * struct wmm_ac_addts_request - ADDTS Request Information 82 * 83 * The last sent ADDTS request(s) will be saved as element(s) of this struct in 84 * order to be compared with the received ADDTS response in ADDTS response 85 * action frame handling and should be stored until that point. 86 * In case a new traffic stream will be created/replaced/updated, only its 87 * relevant traffic stream information will be stored as a wmm_ac_ts struct. 88 */ 89 struct wmm_ac_addts_request { 90 /* 91 * dialog token - Used to link the received ADDTS response with this 92 * saved ADDTS request when ADDTS response is being handled 93 */ 94 u8 dialog_token; 95 96 /* 97 * address - The alleged traffic stream's receiver/transmitter address 98 * Address and TID are used to identify the TS (TID is contained in 99 * TSPEC) 100 */ 101 u8 address[ETH_ALEN]; 102 103 /* 104 * tspec - Traffic Stream Specification, will be used to compare the 105 * sent TSPEC in ADDTS request to the received TSPEC in ADDTS response 106 * and act accordingly in ADDTS response handling 107 */ 108 struct wmm_tspec_element tspec; 109 }; 110 111 112 /** 113 * struct wmm_ac_ts_setup_params - TS setup parameters 114 * 115 * This struct holds parameters which should be provided 116 * to wmm_ac_ts_setup in order to setup a traffic stream 117 */ 118 struct wmm_ac_ts_setup_params { 119 /* 120 * tsid - Traffic ID 121 * TID and address are used to identify the TS 122 */ 123 int tsid; 124 125 /* 126 * direction - Traffic Stream's direction 127 */ 128 enum wmm_ac_dir direction; 129 130 /* 131 * user_priority - Traffic Stream's user priority 132 */ 133 int user_priority; 134 135 /* 136 * nominal_msdu_size - Nominal MAC service data unit size 137 */ 138 int nominal_msdu_size; 139 140 /* 141 * fixed_nominal_msdu - Whether the size is fixed 142 * 0 = Nominal MSDU size is not fixed 143 * 1 = Nominal MSDU size is fixed 144 */ 145 int fixed_nominal_msdu; 146 147 /* 148 * surplus_bandwidth_allowance - Specifies excess time allocation 149 */ 150 int mean_data_rate; 151 152 /* 153 * minimum_phy_rate - Specifies the minimum supported PHY rate in bps 154 */ 155 int minimum_phy_rate; 156 157 /* 158 * surplus_bandwidth_allowance - Specifies excess time allocation 159 */ 160 int surplus_bandwidth_allowance; 161 }; 162 163 void wmm_ac_notify_assoc(struct wpa_supplicant *wpa_s, const u8 *ies, 164 size_t ies_len, const struct wmm_params *wmm_params); 165 void wmm_ac_notify_disassoc(struct wpa_supplicant *wpa_s); 166 int wpas_wmm_ac_addts(struct wpa_supplicant *wpa_s, 167 struct wmm_ac_ts_setup_params *params); 168 int wpas_wmm_ac_delts(struct wpa_supplicant *wpa_s, u8 tsid); 169 void wmm_ac_rx_action(struct wpa_supplicant *wpa_s, const u8 *da, 170 const u8 *sa, const u8 *data, size_t len); 171 int wpas_wmm_ac_status(struct wpa_supplicant *wpa_s, char *buf, size_t buflen); 172 void wmm_ac_save_tspecs(struct wpa_supplicant *wpa_s); 173 void wmm_ac_clear_saved_tspecs(struct wpa_supplicant *wpa_s); 174 int wmm_ac_restore_tspecs(struct wpa_supplicant *wpa_s); 175 176 #endif /* WMM_AC_H */ 177