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