Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Kiet Lam | aa8e15a | 2014-02-11 23:30:06 -0800 | [diff] [blame^] | 2 | * Copyright (c) 2012-2013 Qualcomm Atheros, Inc. |
| 3 | * All Rights Reserved. |
| 4 | * Qualcomm Atheros Confidential and Proprietary. |
| 5 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6 | #ifndef _WLAN_HDD_WMM_H |
| 7 | #define _WLAN_HDD_WMM_H |
| 8 | /*============================================================================ |
| 9 | @file wlan_hdd_wmm.h |
| 10 | |
| 11 | This module (wlan_hdd_wmm.h interface + wlan_hdd_wmm.c implementation) |
| 12 | houses all the logic for WMM in HDD. |
| 13 | |
| 14 | On the control path, it has the logic to setup QoS, modify QoS and delete |
| 15 | QoS (QoS here refers to a TSPEC). The setup QoS comes in two flavors: an |
| 16 | explicit application invoked and an internal HDD invoked. The implicit QoS |
| 17 | is for applications that do NOT call the custom QCT WLAN OIDs for QoS but |
| 18 | which DO mark their traffic for priortization. It also has logic to start, |
| 19 | update and stop the U-APSD trigger frame generation. It also has logic to |
| 20 | read WMM related config parameters from the registry. |
| 21 | |
| 22 | On the data path, it has the logic to figure out the WMM AC of an egress |
| 23 | packet and when to signal TL to serve a particular AC queue. It also has the |
| 24 | logic to retrieve a packet based on WMM priority in response to a fetch from |
| 25 | TL. |
| 26 | |
| 27 | The remaining functions are utility functions for information hiding. |
| 28 | |
| 29 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 30 | Copyright (c) 2008-9 Qualcomm Technologies, Inc. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 31 | All Rights Reserved. |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 32 | Qualcomm Technologies Confidential and Proprietary |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 33 | ============================================================================*/ |
| 34 | /* $Header$ */ |
| 35 | |
| 36 | /*---------------------------------------------------------------------------- |
| 37 | * Include Files |
| 38 | * -------------------------------------------------------------------------*/ |
| 39 | #include <linux/workqueue.h> |
| 40 | #include <linux/list.h> |
| 41 | #include <wlan_hdd_main.h> |
| 42 | #include <wlan_hdd_wext.h> |
| 43 | #include <wlan_qct_tl.h> |
| 44 | #include <sme_QosApi.h> |
| 45 | |
| 46 | /*---------------------------------------------------------------------------- |
| 47 | * Preprocessor Definitions and Constants |
| 48 | * -------------------------------------------------------------------------*/ |
| 49 | |
| 50 | // #define HDD_WMM_DEBUG 1 |
| 51 | |
| 52 | #define HDD_WMM_CTX_MAGIC 0x574d4d58 // "WMMX" |
| 53 | |
| 54 | #define HDD_WMM_HANDLE_IMPLICIT 0xFFFFFFFF |
| 55 | |
| 56 | #define HDD_WLAN_INVALID_STA_ID 0xFF |
| 57 | |
| 58 | /*---------------------------------------------------------------------------- |
| 59 | * Type Declarations |
| 60 | * -------------------------------------------------------------------------*/ |
| 61 | /*! @brief AC/Queue Index values for Linux Qdisc to operate on different traffic. |
| 62 | */ |
| 63 | typedef enum |
| 64 | { |
| 65 | HDD_LINUX_AC_VO = 0, |
| 66 | HDD_LINUX_AC_VI = 1, |
| 67 | HDD_LINUX_AC_BE = 2, |
| 68 | HDD_LINUX_AC_BK = 3 |
| 69 | |
| 70 | } hdd_wmm_linuxac_t; |
| 71 | |
| 72 | /*! @brief types of classification supported |
| 73 | */ |
| 74 | typedef enum |
| 75 | { |
| 76 | HDD_WMM_CLASSIFICATION_DSCP = 0, |
| 77 | HDD_WMM_CLASSIFICATION_802_1Q = 1 |
| 78 | |
| 79 | } hdd_wmm_classification_t; |
| 80 | |
| 81 | /*! @brief UAPSD state |
| 82 | */ |
| 83 | typedef enum |
| 84 | { |
| 85 | HDD_WMM_NON_UAPSD = 0, |
| 86 | HDD_WMM_UAPSD = 1 |
| 87 | |
| 88 | } hdd_wmm_uapsd_state_t; |
| 89 | |
| 90 | |
| 91 | typedef enum |
| 92 | { |
| 93 | //STA can associate with any AP, & HDD looks at the SME notification after |
| 94 | // association to find out if associated with QAP and acts accordingly |
| 95 | HDD_WMM_USER_MODE_AUTO = 0, |
| 96 | //SME will add the extra logic to make sure STA associates with a QAP only |
| 97 | HDD_WMM_USER_MODE_QBSS_ONLY = 1, |
| 98 | //SME will not join a QoS AP, unless the phy mode setting says "Auto". In |
| 99 | // that case, STA is free to join 11n AP. Although from HDD point of view, |
| 100 | // it will not be doing any packet classifications |
| 101 | HDD_WMM_USER_MODE_NO_QOS = 2, |
| 102 | |
| 103 | } hdd_wmm_user_mode_t; |
| 104 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 105 | // UAPSD Mask bits |
| 106 | // (Bit0:VO; Bit1:VI; Bit2:BK; Bit3:BE all other bits are ignored) |
| 107 | #define HDD_AC_VO 0x1 |
| 108 | #define HDD_AC_VI 0x2 |
| 109 | #define HDD_AC_BK 0x4 |
| 110 | #define HDD_AC_BE 0x8 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 111 | |
| 112 | /*! @brief WMM Qos instance control block |
| 113 | */ |
| 114 | typedef struct |
| 115 | { |
| 116 | struct list_head node; |
| 117 | v_U32_t handle; |
| 118 | v_U32_t qosFlowId; |
| 119 | hdd_adapter_t* pAdapter; |
| 120 | WLANTL_ACEnumType acType; |
| 121 | hdd_wlan_wmm_status_e lastStatus; |
| 122 | struct work_struct wmmAcSetupImplicitQos; |
| 123 | v_U32_t magic; |
| 124 | } hdd_wmm_qos_context_t; |
| 125 | |
| 126 | /*! @brief WMM related per-AC state & status info |
| 127 | */ |
| 128 | typedef struct |
| 129 | { |
| 130 | // does the AP require access to this AC? |
| 131 | v_BOOL_t wmmAcAccessRequired; |
| 132 | |
| 133 | // does the worker thread need to acquire access to this AC? |
| 134 | v_BOOL_t wmmAcAccessNeeded; |
| 135 | |
| 136 | // is implicit QoS negotiation currently taking place? |
| 137 | v_BOOL_t wmmAcAccessPending; |
| 138 | |
| 139 | // has implicit QoS negotiation already failed? |
| 140 | v_BOOL_t wmmAcAccessFailed; |
| 141 | |
| 142 | // has implicit QoS negotiation already succeeded? |
| 143 | v_BOOL_t wmmAcAccessGranted; |
| 144 | |
| 145 | // is access to this AC allowed, either because we are not doing |
| 146 | // WMM, we are not doing implicit QoS, implict QoS has completed, |
| 147 | // or explicit QoS has completed? |
| 148 | v_BOOL_t wmmAcAccessAllowed; |
| 149 | |
| 150 | // is the wmmAcTspecInfo valid? |
| 151 | v_BOOL_t wmmAcTspecValid; |
| 152 | |
| 153 | // are the wmmAcUapsd* fields valid? |
| 154 | v_BOOL_t wmmAcUapsdInfoValid; |
| 155 | |
| 156 | // current (possibly aggregate) Tspec for this AC |
| 157 | sme_QosWmmTspecInfo wmmAcTspecInfo; |
| 158 | |
| 159 | // current U-APSD parameters |
Madan Mohan Koyyalamudi | 198ade3 | 2013-09-29 03:52:25 +0530 | [diff] [blame] | 160 | v_BOOL_t wmmAcIsUapsdEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 161 | v_U32_t wmmAcUapsdServiceInterval; |
| 162 | v_U32_t wmmAcUapsdSuspensionInterval; |
| 163 | sme_QosWmmDirType wmmAcUapsdDirection; |
| 164 | |
| 165 | #ifdef FEATURE_WLAN_CCX |
| 166 | // Inactivity time parameters for TSPEC |
| 167 | v_U32_t wmmInactivityTime; |
| 168 | v_U32_t wmmPrevTrafficCnt; |
| 169 | vos_timer_t wmmInactivityTimer; |
| 170 | #endif |
| 171 | |
| 172 | } hdd_wmm_ac_status_t; |
| 173 | |
| 174 | /*! @brief WMM state & status info |
| 175 | */ |
| 176 | typedef struct |
| 177 | { |
| 178 | struct list_head wmmContextList; |
| 179 | struct mutex wmmLock; |
| 180 | hdd_wmm_ac_status_t wmmAcStatus[WLANTL_MAX_AC]; |
| 181 | v_BOOL_t wmmQap; |
| 182 | v_BOOL_t wmmQosConnection; |
| 183 | } hdd_wmm_status_t; |
| 184 | |
| 185 | extern const v_U8_t hdd_QdiscAcToTlAC[]; |
| 186 | extern const v_U8_t hddWmmUpToAcMap[]; |
| 187 | extern const v_U8_t hddLinuxUpToAcMap[]; |
| 188 | |
| 189 | /**============================================================================ |
| 190 | @brief hdd_wmm_init() - Function which will initialize the WMM configuation |
| 191 | and status to an initial state. The configuration can later be overwritten |
| 192 | via application APIs |
| 193 | |
| 194 | @param pHddCtx : [in] pointer to HDD context |
| 195 | |
| 196 | @return : VOS_STATUS_SUCCESS if succssful |
| 197 | : other values if failure |
| 198 | |
| 199 | ===========================================================================*/ |
| 200 | VOS_STATUS hdd_wmm_init ( hdd_context_t* pHddCtx ); |
| 201 | |
| 202 | /**============================================================================ |
| 203 | @brief hdd_wmm_adapter_init() - Function which will initialize the WMM configuation |
| 204 | and status to an initial state. The configuration can later be overwritten |
| 205 | via application APIs |
| 206 | |
| 207 | @param pAdapter : [in] pointer to Adapter context |
| 208 | |
| 209 | @return : VOS_STATUS_SUCCESS if succssful |
| 210 | : other values if failure |
| 211 | |
| 212 | ===========================================================================*/ |
| 213 | VOS_STATUS hdd_wmm_adapter_init( hdd_adapter_t *pAdapter ); |
| 214 | |
| 215 | /**============================================================================ |
| 216 | @brief hdd_wmm_adapter_close() - Function which will perform any necessary work to |
| 217 | to clean up the WMM functionality prior to the kernel module unload |
| 218 | |
| 219 | @param pAdapter : [in] pointer to adapter context |
| 220 | |
| 221 | @return : VOS_STATUS_SUCCESS if succssful |
| 222 | : other values if failure |
| 223 | |
| 224 | ===========================================================================*/ |
| 225 | VOS_STATUS hdd_wmm_adapter_close ( hdd_adapter_t* pAdapter ); |
| 226 | |
| 227 | /**============================================================================ |
| 228 | @brief hdd_wmm_select_queue() - Function which will classify an OS packet |
| 229 | into linux Qdisc expectation |
| 230 | |
| 231 | @param dev : [in] pointer to net_device structure |
| 232 | @param skb : [in] pointer to OS packet (sk_buff) |
| 233 | |
| 234 | @return : queue_index/linux AC value. |
| 235 | ===========================================================================*/ |
| 236 | v_U16_t hdd_wmm_select_queue(struct net_device * dev, struct sk_buff *skb); |
| 237 | |
| 238 | /**============================================================================ |
| 239 | @brief hdd_hostapd_select_queue() - Function which will classify the packet |
| 240 | according to linux qdisc expectation. |
| 241 | |
| 242 | |
| 243 | @param dev : [in] pointer to net_device structure |
| 244 | @param skb : [in] pointer to os packet |
| 245 | |
| 246 | @return : Qdisc queue index |
| 247 | ===========================================================================*/ |
| 248 | |
| 249 | v_U16_t hdd_hostapd_select_queue(struct net_device * dev, struct sk_buff *skb); |
| 250 | |
| 251 | |
| 252 | |
| 253 | /**============================================================================ |
| 254 | @brief hdd_wmm_classify_pkt() - Function which will classify an OS packet |
| 255 | into a WMM AC based on either 802.1Q or DSCP |
| 256 | |
| 257 | @param pAdapter : [in] pointer to adapter context |
| 258 | @param skb : [in] pointer to OS packet (sk_buff) |
| 259 | @param pAcType : [out] pointer to WMM AC type of OS packet |
| 260 | |
| 261 | @return : None |
| 262 | ===========================================================================*/ |
| 263 | v_VOID_t hdd_wmm_classify_pkt ( hdd_adapter_t* pAdapter, |
| 264 | struct sk_buff *skb, |
| 265 | WLANTL_ACEnumType* pAcType, |
| 266 | sme_QosWmmUpType* pUserPri); |
| 267 | |
| 268 | |
| 269 | /**============================================================================ |
| 270 | @brief hdd_wmm_acquire_access() - Function which will attempt to acquire |
| 271 | admittance for a WMM AC |
| 272 | |
| 273 | @param pAdapter : [in] pointer to adapter context |
| 274 | @param acType : [in] WMM AC type of OS packet |
| 275 | @param pGranted : [out] pointer to boolean flag when indicates if access |
| 276 | has been granted or not |
| 277 | |
| 278 | @return : VOS_STATUS_SUCCESS if succssful |
| 279 | : other values if failure |
| 280 | ===========================================================================*/ |
| 281 | VOS_STATUS hdd_wmm_acquire_access( hdd_adapter_t* pAdapter, |
| 282 | WLANTL_ACEnumType acType, |
| 283 | v_BOOL_t * pGranted ); |
| 284 | |
| 285 | /**============================================================================ |
| 286 | @brief hdd_wmm_assoc() - Function which will handle the housekeeping |
| 287 | required by WMM when association takes place |
| 288 | |
| 289 | @param pAdapter : [in] pointer to adapter context |
| 290 | @param pRoamInfo: [in] pointer to roam information |
| 291 | @param eBssType : [in] type of BSS |
| 292 | |
| 293 | @return : VOS_STATUS_SUCCESS if succssful |
| 294 | : other values if failure |
| 295 | ===========================================================================*/ |
| 296 | VOS_STATUS hdd_wmm_assoc( hdd_adapter_t* pAdapter, |
| 297 | tCsrRoamInfo *pRoamInfo, |
| 298 | eCsrRoamBssType eBssType ); |
| 299 | |
| 300 | /**============================================================================ |
| 301 | @brief hdd_wmm_connect() - Function which will handle the housekeeping |
| 302 | required by WMM when a connection is established |
| 303 | |
| 304 | @param pAdapter : [in] pointer to adapter context |
| 305 | @param pRoamInfo: [in] pointer to roam information |
| 306 | @param eBssType : [in] type of BSS |
| 307 | |
| 308 | @return : VOS_STATUS_SUCCESS if succssful |
| 309 | : other values if failure |
| 310 | ===========================================================================*/ |
| 311 | VOS_STATUS hdd_wmm_connect( hdd_adapter_t* pAdapter, |
| 312 | tCsrRoamInfo *pRoamInfo, |
| 313 | eCsrRoamBssType eBssType ); |
| 314 | |
| 315 | /**============================================================================ |
| 316 | @brief hdd_wmm_get_uapsd_mask() - Function which will calculate the |
| 317 | initial value of the UAPSD mask based upon the device configuration |
| 318 | |
| 319 | @param pAdapter : [in] pointer to adapter context |
| 320 | @param pUapsdMask: [in] pointer to where the UAPSD Mask is to be stored |
| 321 | |
| 322 | @return : VOS_STATUS_SUCCESS if succssful |
| 323 | : other values if failure |
| 324 | ===========================================================================*/ |
| 325 | VOS_STATUS hdd_wmm_get_uapsd_mask( hdd_adapter_t* pAdapter, |
| 326 | tANI_U8 *pUapsdMask ); |
| 327 | |
| 328 | /**============================================================================ |
| 329 | @brief hdd_wmm_is_active() - Function which will determine if WMM is |
| 330 | active on the current connection |
| 331 | |
| 332 | @param pAdapter : [in] pointer to adapter context |
| 333 | |
| 334 | @return : VOS_TRUE if WMM is enabled |
| 335 | : VOS_FALSE if WMM is not enabled |
| 336 | ===========================================================================*/ |
| 337 | v_BOOL_t hdd_wmm_is_active( hdd_adapter_t* pAdapter ); |
| 338 | |
| 339 | /**============================================================================ |
| 340 | @brief hdd_wmm_addts() - Function which will add a traffic spec at the |
| 341 | request of an application |
| 342 | |
| 343 | @param pAdapter : [in] pointer to adapter context |
| 344 | @param handle : [in] handle to uniquely identify a TS |
| 345 | @param pTspec : [in] pointer to the traffic spec |
| 346 | |
| 347 | @return : HDD_WLAN_WMM_STATUS_* |
| 348 | ===========================================================================*/ |
| 349 | hdd_wlan_wmm_status_e hdd_wmm_addts( hdd_adapter_t* pAdapter, |
| 350 | v_U32_t handle, |
| 351 | sme_QosWmmTspecInfo* pTspec ); |
| 352 | |
| 353 | /**============================================================================ |
| 354 | @brief hdd_wmm_delts() - Function which will delete a traffic spec at the |
| 355 | request of an application |
| 356 | |
| 357 | @param pAdapter : [in] pointer to adapter context |
| 358 | @param handle : [in] handle to uniquely identify a TS |
| 359 | |
| 360 | @return : HDD_WLAN_WMM_STATUS_* |
| 361 | ===========================================================================*/ |
| 362 | hdd_wlan_wmm_status_e hdd_wmm_delts( hdd_adapter_t* pAdapter, |
| 363 | v_U32_t handle ); |
| 364 | |
| 365 | /**============================================================================ |
| 366 | @brief hdd_wmm_checkts() - Function which will return the status of a traffic |
| 367 | spec at the request of an application |
| 368 | |
| 369 | @param pAdapter : [in] pointer to adapter context |
| 370 | @param handle : [in] handle to uniquely identify a TS |
| 371 | |
| 372 | @return : HDD_WLAN_WMM_STATUS_* |
| 373 | ===========================================================================*/ |
| 374 | hdd_wlan_wmm_status_e hdd_wmm_checkts( hdd_adapter_t* pAdapter, |
| 375 | v_U32_t handle ); |
Madan Mohan Koyyalamudi | 70c52d3 | 2013-08-07 14:42:16 +0530 | [diff] [blame] | 376 | /**============================================================================ |
| 377 | @brief hdd_wmm_adapter_clear() - Function which will clear the WMM status |
| 378 | of all ACs |
| 379 | @param pAdapter : [in] pointer to adapter context |
| 380 | |
| 381 | @return : VOS_STATUS_SUCCESS if succssful |
| 382 | : other values if failure |
| 383 | ===========================================================================*/ |
| 384 | VOS_STATUS hdd_wmm_adapter_clear( hdd_adapter_t *pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 385 | |
| 386 | #endif /* #ifndef _WLAN_HDD_WMM_H */ |