wmm_ac.h revision 337817
1281681Srpaulo/* 2281681Srpaulo * Wi-Fi Multimedia Admission Control (WMM-AC) 3281681Srpaulo * Copyright(c) 2014, Intel Mobile Communication GmbH. 4281681Srpaulo * Copyright(c) 2014, Intel Corporation. All rights reserved. 5281681Srpaulo * 6281681Srpaulo * This software may be distributed under the terms of the BSD license. 7281681Srpaulo * See README for more details. 8281681Srpaulo */ 9281681Srpaulo 10281681Srpaulo#ifndef WMM_AC_H 11281681Srpaulo#define WMM_AC_H 12281681Srpaulo 13281681Srpaulo#include "common/ieee802_11_defs.h" 14281681Srpaulo#include "drivers/driver.h" 15281681Srpaulo 16281681Srpaulostruct wpa_supplicant; 17281681Srpaulo 18281681Srpaulo#define WMM_AC_ACCESS_POLICY_EDCA 1 19281681Srpaulo#define WMM_AC_FIXED_MSDU_SIZE BIT(15) 20281681Srpaulo 21281681Srpaulo#define WMM_AC_MAX_TID 7 22281681Srpaulo#define WMM_AC_MAX_USER_PRIORITY 7 23281681Srpaulo#define WMM_AC_MIN_SBA_UNITY 0x2000 24281681Srpaulo#define WMM_AC_MAX_NOMINAL_MSDU 32767 25281681Srpaulo 26281681Srpaulo/** 27281681Srpaulo * struct wmm_ac_assoc_data - WMM Admission Control Association Data 28281681Srpaulo * 29281681Srpaulo * This struct will store any relevant WMM association data needed by WMM AC. 30281681Srpaulo * In case there is a valid WMM association, an instance of this struct will be 31281681Srpaulo * created. In case there is no instance of this struct, the station is not 32281681Srpaulo * associated to a valid WMM BSS and hence, WMM AC will not be used. 33281681Srpaulo */ 34281681Srpaulostruct wmm_ac_assoc_data { 35281681Srpaulo struct { 36281681Srpaulo /* 37281681Srpaulo * acm - Admission Control Mandatory 38281681Srpaulo * In case an access category is ACM, the traffic will have 39281681Srpaulo * to be admitted by WMM-AC's admission mechanism before use. 40281681Srpaulo */ 41281681Srpaulo unsigned int acm:1; 42281681Srpaulo 43281681Srpaulo /* 44281681Srpaulo * uapsd_queues - Unscheduled Automatic Power Save Delivery 45281681Srpaulo * queues. 46281681Srpaulo * Indicates whether ACs are configured for U-APSD (or legacy 47281681Srpaulo * PS). Storing this value is necessary in order to set the 48281681Srpaulo * Power Save Bit (PSB) in ADDTS request Action frames (if not 49281681Srpaulo * given). 50281681Srpaulo */ 51281681Srpaulo unsigned int uapsd:1; 52281681Srpaulo } ac_params[WMM_AC_NUM]; 53281681Srpaulo}; 54281681Srpaulo 55281681Srpaulo/** 56281681Srpaulo * wmm_ac_dir - WMM Admission Control Direction 57281681Srpaulo */ 58281681Srpauloenum wmm_ac_dir { 59281681Srpaulo WMM_AC_DIR_UPLINK = 0, 60281681Srpaulo WMM_AC_DIR_DOWNLINK = 1, 61281681Srpaulo WMM_AC_DIR_BIDIRECTIONAL = 3 62281681Srpaulo}; 63281681Srpaulo 64281681Srpaulo/** 65281681Srpaulo * ts_dir_idx - indices of internally saved tspecs 66281681Srpaulo * 67281681Srpaulo * we can have multiple tspecs (downlink + uplink) per ac. 68281681Srpaulo * save them in array, and use the enum to directly access 69281681Srpaulo * the respective tspec slot (according to the direction). 70281681Srpaulo */ 71281681Srpauloenum ts_dir_idx { 72281681Srpaulo TS_DIR_IDX_UPLINK, 73281681Srpaulo TS_DIR_IDX_DOWNLINK, 74281681Srpaulo TS_DIR_IDX_BIDI, 75281681Srpaulo 76281681Srpaulo TS_DIR_IDX_COUNT 77281681Srpaulo}; 78281681Srpaulo#define TS_DIR_IDX_ALL (BIT(TS_DIR_IDX_COUNT) - 1) 79281681Srpaulo 80281681Srpaulo/** 81281681Srpaulo * struct wmm_ac_addts_request - ADDTS Request Information 82281681Srpaulo * 83281681Srpaulo * The last sent ADDTS request(s) will be saved as element(s) of this struct in 84281681Srpaulo * order to be compared with the received ADDTS response in ADDTS response 85281681Srpaulo * action frame handling and should be stored until that point. 86281681Srpaulo * In case a new traffic stream will be created/replaced/updated, only its 87281681Srpaulo * relevant traffic stream information will be stored as a wmm_ac_ts struct. 88281681Srpaulo */ 89281681Srpaulostruct wmm_ac_addts_request { 90281681Srpaulo /* 91337817Scy * dialog token - Used to link the received ADDTS response with this 92281681Srpaulo * saved ADDTS request when ADDTS response is being handled 93281681Srpaulo */ 94281681Srpaulo u8 dialog_token; 95281681Srpaulo 96281681Srpaulo /* 97281681Srpaulo * address - The alleged traffic stream's receiver/transmitter address 98281681Srpaulo * Address and TID are used to identify the TS (TID is contained in 99281681Srpaulo * TSPEC) 100281681Srpaulo */ 101281681Srpaulo u8 address[ETH_ALEN]; 102281681Srpaulo 103281681Srpaulo /* 104281681Srpaulo * tspec - Traffic Stream Specification, will be used to compare the 105281681Srpaulo * sent TSPEC in ADDTS request to the received TSPEC in ADDTS response 106281681Srpaulo * and act accordingly in ADDTS response handling 107281681Srpaulo */ 108281681Srpaulo struct wmm_tspec_element tspec; 109281681Srpaulo}; 110281681Srpaulo 111281681Srpaulo 112281681Srpaulo/** 113281681Srpaulo * struct wmm_ac_ts_setup_params - TS setup parameters 114281681Srpaulo * 115281681Srpaulo * This struct holds parameters which should be provided 116281681Srpaulo * to wmm_ac_ts_setup in order to setup a traffic stream 117281681Srpaulo */ 118281681Srpaulostruct wmm_ac_ts_setup_params { 119281681Srpaulo /* 120281681Srpaulo * tsid - Traffic ID 121281681Srpaulo * TID and address are used to identify the TS 122281681Srpaulo */ 123281681Srpaulo int tsid; 124281681Srpaulo 125281681Srpaulo /* 126281681Srpaulo * direction - Traffic Stream's direction 127281681Srpaulo */ 128281681Srpaulo enum wmm_ac_dir direction; 129281681Srpaulo 130281681Srpaulo /* 131281681Srpaulo * user_priority - Traffic Stream's user priority 132281681Srpaulo */ 133281681Srpaulo int user_priority; 134281681Srpaulo 135281681Srpaulo /* 136281681Srpaulo * nominal_msdu_size - Nominal MAC service data unit size 137281681Srpaulo */ 138281681Srpaulo int nominal_msdu_size; 139281681Srpaulo 140281681Srpaulo /* 141281681Srpaulo * fixed_nominal_msdu - Whether the size is fixed 142281681Srpaulo * 0 = Nominal MSDU size is not fixed 143281681Srpaulo * 1 = Nominal MSDU size is fixed 144281681Srpaulo */ 145281681Srpaulo int fixed_nominal_msdu; 146281681Srpaulo 147281681Srpaulo /* 148281681Srpaulo * surplus_bandwidth_allowance - Specifies excess time allocation 149281681Srpaulo */ 150281681Srpaulo int mean_data_rate; 151281681Srpaulo 152281681Srpaulo /* 153281681Srpaulo * minimum_phy_rate - Specifies the minimum supported PHY rate in bps 154281681Srpaulo */ 155281681Srpaulo int minimum_phy_rate; 156281681Srpaulo 157281681Srpaulo /* 158281681Srpaulo * surplus_bandwidth_allowance - Specifies excess time allocation 159281681Srpaulo */ 160281681Srpaulo int surplus_bandwidth_allowance; 161281681Srpaulo}; 162281681Srpaulo 163281681Srpaulovoid wmm_ac_notify_assoc(struct wpa_supplicant *wpa_s, const u8 *ies, 164281681Srpaulo size_t ies_len, const struct wmm_params *wmm_params); 165281681Srpaulovoid wmm_ac_notify_disassoc(struct wpa_supplicant *wpa_s); 166281681Srpauloint wpas_wmm_ac_addts(struct wpa_supplicant *wpa_s, 167281681Srpaulo struct wmm_ac_ts_setup_params *params); 168281681Srpauloint wpas_wmm_ac_delts(struct wpa_supplicant *wpa_s, u8 tsid); 169281681Srpaulovoid wmm_ac_rx_action(struct wpa_supplicant *wpa_s, const u8 *da, 170281681Srpaulo const u8 *sa, const u8 *data, size_t len); 171281681Srpauloint wpas_wmm_ac_status(struct wpa_supplicant *wpa_s, char *buf, size_t buflen); 172281681Srpaulovoid wmm_ac_save_tspecs(struct wpa_supplicant *wpa_s); 173281681Srpaulovoid wmm_ac_clear_saved_tspecs(struct wpa_supplicant *wpa_s); 174281681Srpauloint wmm_ac_restore_tspecs(struct wpa_supplicant *wpa_s); 175281681Srpaulo 176281681Srpaulo#endif /* WMM_AC_H */ 177