Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | #if !defined(__SME_QOSAPI_H) |
| 29 | #define __SME_QOSAPI_H |
| 30 | |
| 31 | /** |
| 32 | * \file sme_qos_api.h |
| 33 | * |
| 34 | * \brief prototype for SME QoS APIs |
| 35 | */ |
| 36 | |
| 37 | /*-------------------------------------------------------------------------- |
| 38 | Include Files |
| 39 | ------------------------------------------------------------------------*/ |
| 40 | #include "cdf_lock.h" |
| 41 | #include "cdf_trace.h" |
| 42 | #include "cdf_memory.h" |
| 43 | #include "cdf_types.h" |
| 44 | #include "ani_global.h" |
| 45 | #include "sir_api.h" |
| 46 | |
| 47 | /*-------------------------------------------------------------------------- |
| 48 | Pre-processor Definitions |
| 49 | ------------------------------------------------------------------------*/ |
| 50 | #define SME_QOS_UAPSD_VO 0x01 |
| 51 | #define SME_QOS_UAPSD_VI 0x02 |
| 52 | #define SME_QOS_UAPSD_BE 0x08 |
| 53 | #define SME_QOS_UAPSD_BK 0x04 |
| 54 | |
| 55 | /*--------------------------------------------------------------------------- |
| 56 | Enumeration of the various QoS status types that would be reported to HDD |
| 57 | ---------------------------------------------------------------------------*/ |
| 58 | typedef enum { |
| 59 | /* |
| 60 | * async: once PE notifies successful TSPEC negotiation, or CSR notifies |
| 61 | * for successful reassoc, notifies HDD with current QoS Params |
| 62 | */ |
| 63 | SME_QOS_STATUS_SETUP_SUCCESS_IND = 0, |
| 64 | /* sync: only when App asked for APSD & it's already set with ACM = 0 */ |
| 65 | SME_QOS_STATUS_SETUP_SUCCESS_APSD_SET_ALREADY, |
| 66 | /* sync or async: in case of async notify HDD with current QoS Params */ |
| 67 | SME_QOS_STATUS_SETUP_FAILURE_RSP, |
| 68 | /* sync */ |
| 69 | SME_QOS_STATUS_SETUP_INVALID_PARAMS_RSP, |
| 70 | /* sync: AP doesn't support QoS (WMM) */ |
| 71 | SME_QOS_STATUS_SETUP_NOT_QOS_AP_RSP, |
| 72 | /* sync: either req has been sent down to PE or just buffered in SME */ |
| 73 | SME_QOS_STATUS_SETUP_REQ_PENDING_RSP, |
| 74 | /* |
| 75 | * async: in case of flow aggregation, if the new TSPEC negotiation |
| 76 | * is successful, OR, notify existing flows that TSPEC is modified with |
| 77 | * current QoS Params |
| 78 | */ |
| 79 | SME_QOS_STATUS_SETUP_MODIFIED_IND, |
| 80 | /* sync: no APSD asked for & ACM = 0 */ |
| 81 | SME_QOS_STATUS_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP, |
| 82 | /* |
| 83 | * async: In case of UAPSD, once PE notifies successful TSPEC |
| 84 | * negotiation, or CSR notifies for successful reassoc to SME-QoS, |
| 85 | * notify HDD if PMC can't put the module in UAPSD mode right away |
| 86 | * (CDF_STATUS_PMC_PENDING) |
| 87 | */ |
| 88 | SME_QOS_STATUS_SETUP_SUCCESS_IND_APSD_PENDING, |
| 89 | /* |
| 90 | * async: In case of UAPSD, once PE notifies successful TSPEC |
| 91 | * negotiation, or CSR notifies for successful reassoc to SME-QoS, |
| 92 | * notify HDD if PMC can't put the module in UAPSD mode at all |
| 93 | * (CDF_STATUS_E_FAILURE) |
| 94 | */ |
| 95 | SME_QOS_STATUS_SETUP_SUCCESS_IND_APSD_SET_FAILED, |
| 96 | /* |
| 97 | * sync: req has been sent down to PE in case of delts or addts |
| 98 | * for remain flows, OR if the AC doesn't have APSD or ACM |
| 99 | * async: once the downgrade req for QoS params is successful |
| 100 | */ |
| 101 | SME_QOS_STATUS_RELEASE_SUCCESS_RSP = 100, |
| 102 | /* sync or async: in case of async notify HDD with current QoS Param */ |
| 103 | SME_QOS_STATUS_RELEASE_FAILURE_RSP, |
| 104 | /* async: AP sent DELTS indication */ |
| 105 | SME_QOS_STATUS_RELEASE_QOS_LOST_IND, |
| 106 | /* |
| 107 | * sync: an addts req has been sent down to PE to downgrade the |
| 108 | * QoS params or just buffered in SME |
| 109 | */ |
| 110 | SME_QOS_STATUS_RELEASE_REQ_PENDING_RSP, |
| 111 | /* sync */ |
| 112 | SME_QOS_STATUS_RELEASE_INVALID_PARAMS_RSP, |
| 113 | /* |
| 114 | * async: for QoS modify request if modification is successful, |
| 115 | * notifies HDD with current QoS Params |
| 116 | */ |
| 117 | SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_IND = 200, |
| 118 | /* sync: only when App asked for APSD & it's already set with ACM = 0 */ |
| 119 | SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_APSD_SET_ALREADY, |
| 120 | /* sync or async: in case of async notify HDD with current QoS Param */ |
| 121 | SME_QOS_STATUS_MODIFY_SETUP_FAILURE_RSP, |
| 122 | /* sync: either req has been sent down to PE or just buffered in SME */ |
| 123 | SME_QOS_STATUS_MODIFY_SETUP_PENDING_RSP, |
| 124 | /* sync: no APSD asked for & ACM = 0 */ |
| 125 | SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP, |
| 126 | /* sync */ |
| 127 | SME_QOS_STATUS_MODIFY_SETUP_INVALID_PARAMS_RSP, |
| 128 | /* |
| 129 | * async: In case of UAPSD, once PE notifies successful TSPEC |
| 130 | * negotiation or CSR notifies for successful reassoc to SME-QoS, |
| 131 | * notify HDD if PMC can't put the module in UAPSD mode right away |
| 132 | * (CDF_STATUS_PMC_PENDING) |
| 133 | */ |
| 134 | SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_IND_APSD_PENDING, |
| 135 | /* |
| 136 | * async: In case of UAPSD, once PE notifies successful TSPEC |
| 137 | * negotiation, or CSR notifies for successful reassoc to SME-QoS, |
| 138 | * notify HDD if PMC can't put the module in UAPSD mode at all |
| 139 | * (CDF_STATUS_E_FAILURE) |
| 140 | */ |
| 141 | SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_IND_APSD_SET_FAILED, |
| 142 | /* sync: STA is handing off to a new AP */ |
| 143 | SME_QOS_STATUS_HANDING_OFF = 300, |
| 144 | /* async:powersave mode changed by PMC from UAPSD to Full power */ |
| 145 | SME_QOS_STATUS_OUT_OF_APSD_POWER_MODE_IND = 400, |
| 146 | /* async:powersave mode changed by PMC from Full power to UAPSD */ |
| 147 | SME_QOS_STATUS_INTO_APSD_POWER_MODE_IND, |
| 148 | |
| 149 | } sme_QosStatusType; |
| 150 | |
| 151 | /*--------------------------------------------------------------------------- |
| 152 | Enumeration of the various User priority (UP) types |
| 153 | |
| 154 | From 802.1D/802.11e/WMM specifications (all refer to same table) |
| 155 | ---------------------------------------------------------------------------*/ |
| 156 | typedef enum { |
| 157 | SME_QOS_WMM_UP_BE = 0, |
| 158 | SME_QOS_WMM_UP_BK = 1, |
| 159 | SME_QOS_WMM_UP_RESV = 2, /* Reserved */ |
| 160 | SME_QOS_WMM_UP_EE = 3, |
| 161 | SME_QOS_WMM_UP_CL = 4, |
| 162 | SME_QOS_WMM_UP_VI = 5, |
| 163 | SME_QOS_WMM_UP_VO = 6, |
| 164 | SME_QOS_WMM_UP_NC = 7, |
| 165 | SME_QOS_WMM_UP_MAX |
| 166 | } sme_QosWmmUpType; |
| 167 | |
| 168 | /*--------------------------------------------------------------------------- |
| 169 | Enumeration of the various TSPEC directions |
| 170 | |
| 171 | From 802.11e/WMM specifications |
| 172 | ---------------------------------------------------------------------------*/ |
| 173 | |
| 174 | typedef enum { |
| 175 | SME_QOS_WMM_TS_DIR_UPLINK = 0, |
| 176 | SME_QOS_WMM_TS_DIR_DOWNLINK = 1, |
| 177 | SME_QOS_WMM_TS_DIR_RESV = 2, /* Reserved */ |
| 178 | SME_QOS_WMM_TS_DIR_BOTH = 3, |
| 179 | } sme_QosWmmDirType; |
| 180 | |
| 181 | /*--------------------------------------------------------------------------- |
| 182 | Enumeration of the various TSPEC ack policies. |
| 183 | |
| 184 | From 802.11 WMM specification |
| 185 | ---------------------------------------------------------------------------*/ |
| 186 | |
| 187 | typedef enum { |
| 188 | SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK = 0, |
| 189 | SME_QOS_WMM_TS_ACK_POLICY_RESV1 = 1, |
| 190 | SME_QOS_WMM_TS_ACK_POLICY_RESV2 = 2, /* Reserved */ |
| 191 | SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK = 3, |
| 192 | |
| 193 | } sme_QosWmmAckPolicyType; |
| 194 | |
| 195 | /*--------------------------------------------------------------------------- |
| 196 | TS Info field in the WMM TSPEC |
| 197 | |
| 198 | See suggestive values above |
| 199 | ---------------------------------------------------------------------------*/ |
| 200 | typedef struct { |
| 201 | uint8_t burst_size_defn; |
| 202 | sme_QosWmmAckPolicyType ack_policy; |
| 203 | sme_QosWmmUpType up; /* User priority */ |
| 204 | uint8_t psb; /* power-save bit */ |
| 205 | sme_QosWmmDirType direction; /* Direction */ |
| 206 | uint8_t tid; /* TID : To be filled up by SME-QoS */ |
| 207 | } sme_QosWmmTsInfoType; |
| 208 | |
| 209 | /*--------------------------------------------------------------------------- |
| 210 | The WMM TSPEC Element (from the WMM spec) |
| 211 | ---------------------------------------------------------------------------*/ |
| 212 | typedef struct { |
| 213 | sme_QosWmmTsInfoType ts_info; |
| 214 | uint16_t nominal_msdu_size; |
| 215 | uint16_t maximum_msdu_size; |
| 216 | uint32_t min_service_interval; |
| 217 | uint32_t max_service_interval; |
| 218 | uint32_t inactivity_interval; |
| 219 | uint32_t suspension_interval; |
| 220 | uint32_t svc_start_time; |
| 221 | uint32_t min_data_rate; |
| 222 | uint32_t mean_data_rate; |
| 223 | uint32_t peak_data_rate; |
| 224 | uint32_t max_burst_size; |
| 225 | uint32_t delay_bound; |
| 226 | uint32_t min_phy_rate; |
| 227 | uint16_t surplus_bw_allowance; |
| 228 | uint16_t medium_time; |
| 229 | } sme_QosWmmTspecInfo; |
| 230 | |
| 231 | /*-------------------------------------------------------------------------- |
| 232 | External APIs |
| 233 | ------------------------------------------------------------------------*/ |
| 234 | typedef CDF_STATUS (*sme_QosCallback)(tHalHandle hHal, void *HDDcontext, |
| 235 | sme_QosWmmTspecInfo *pCurrentQoSInfo, |
| 236 | sme_QosStatusType status, uint32_t QosFlowID); |
| 237 | sme_QosStatusType sme_qos_setup_req(tHalHandle hHal, uint32_t sessionId, |
| 238 | sme_QosWmmTspecInfo *pQoSInfo, |
| 239 | sme_QosCallback QoSCallback, void *HDDcontext, |
| 240 | sme_QosWmmUpType UPType, uint32_t *pQosFlowID); |
| 241 | sme_QosStatusType sme_qos_modify_req(tHalHandle hHal, |
| 242 | sme_QosWmmTspecInfo *pQoSInfo, uint32_t QosFlowID); |
| 243 | sme_QosStatusType sme_qos_release_req(tHalHandle hHal, uint32_t QosFlowID); |
| 244 | bool sme_qos_is_ts_info_ack_policy_valid(tpAniSirGlobal pMac, |
| 245 | sme_QosWmmTspecInfo *pQoSInfo, uint8_t sessionId); |
| 246 | void sme_qos_update_hand_off(uint8_t sessionId, bool updateHandOff); |
| 247 | CDF_STATUS sme_update_dsc_pto_up_mapping(tHalHandle hHal, |
| 248 | sme_QosWmmUpType *dscpmapping, uint8_t sessionId); |
| 249 | |
| 250 | CDF_STATUS sme_offload_qos_process_out_of_uapsd_mode(tpAniSirGlobal mac_ctx, |
| 251 | uint32_t session_id); |
| 252 | CDF_STATUS sme_offload_qos_process_into_uapsd_mode(tpAniSirGlobal mac_ctx, |
| 253 | uint32_t session_id); |
| 254 | bool sme_qos_tspec_active(tpAniSirGlobal pMac, sme_ac_enum_type ac, |
| 255 | uint8_t sessionId, uint8_t *pActiveTspec); |
| 256 | |
| 257 | #endif /* #if !defined( __SME_QOSAPI_H ) */ |