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