blob: e25ec8e61d631de6f47855f860c0c23cea42773d [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lamaa8e15a2014-02-11 23:30:06 -08002 * Copyright (c) 2012-2013 Qualcomm Atheros, Inc.
3 * All Rights Reserved.
4 * Qualcomm Atheros Confidential and Proprietary.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08005 */
Jeff Johnson295189b2012-06-20 16:38:30 -07006#if !defined( __SME_QOSAPI_H )
7#define __SME_QOSAPI_H
8
9
10/**=========================================================================
11
12 \file sme_QosApi.h
13
14 \brief prototype for SME QoS APIs
15
16 Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
17
18 Qualcomm Confidential and Proprietary.
19
20 ========================================================================*/
21
22/* $Header$ */
23
24/*--------------------------------------------------------------------------
25 Include Files
26 ------------------------------------------------------------------------*/
27#include "vos_lock.h"
28#include "vos_trace.h"
29#include "vos_memory.h"
30#include "vos_types.h"
31#include "aniGlobal.h"
32#include "sirApi.h"
33
Madan Mohan Koyyalamudi4f2a39f2013-08-13 23:04:47 +053034/*--------------------------------------------------------------------------
35 Pre-processor Definitions
36 ------------------------------------------------------------------------*/
37#define SME_QOS_UAPSD_VO 0x01
38#define SME_QOS_UAPSD_VI 0x02
39#define SME_QOS_UAPSD_BE 0x08
40#define SME_QOS_UAPSD_BK 0x04
41
Jeff Johnson295189b2012-06-20 16:38:30 -070042/*--------------------------------------------------------------------------
43 Type declarations
44 ------------------------------------------------------------------------*/
45
46/*---------------------------------------------------------------------------
47 Enumeration of the various QoS status types that would be reported to HDD
48---------------------------------------------------------------------------*/
49typedef enum
50{
51 //async: once PE notifies successful TSPEC negotiation, or CSR notifies for
52 //successful reassoc, notifies HDD with current QoS Params
53 SME_QOS_STATUS_SETUP_SUCCESS_IND = 0,
54 //sync: only when App asked for APSD & it's already set with ACM = 0
55 SME_QOS_STATUS_SETUP_SUCCESS_APSD_SET_ALREADY,
56 //both: sync or async: in case of async notifies HDD with current QoS Params
57 SME_QOS_STATUS_SETUP_FAILURE_RSP,
58 //sync
59 SME_QOS_STATUS_SETUP_INVALID_PARAMS_RSP,
60 //sync: AP doesn't support QoS (WMM)
61 SME_QOS_STATUS_SETUP_NOT_QOS_AP_RSP,
62 //sync: either req has been sent down to PE or just buffered in SME
63 SME_QOS_STATUS_SETUP_REQ_PENDING_RSP,
64 //async: in case of flow aggregation, if the new TSPEC negotiation is
65 //successful, OR,
66 //notify existing flows that TSPEC is modified with current QoS Params
67 SME_QOS_STATUS_SETUP_MODIFIED_IND,
68 //sync: no APSD asked for & ACM = 0
69 SME_QOS_STATUS_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP,
70 //async: In case of UAPSD, once PE notifies successful TSPEC negotiation, or
71 //CSR notifies for successful reassoc to SME-QoS, notify HDD if PMC can't
72 //put the module in UAPSD mode right away (eHAL_STATUS_PMC_PENDING)
73 SME_QOS_STATUS_SETUP_SUCCESS_IND_APSD_PENDING,
74 //async: In case of UAPSD, once PE notifies successful TSPEC negotiation, or
75 //CSR notifies for successful reassoc to SME-QoS, notify HDD if PMC can't
76 //put the module in UAPSD mode at all (eHAL_STATUS_FAILURE)
77 SME_QOS_STATUS_SETUP_SUCCESS_IND_APSD_SET_FAILED,
78
79 //sync: req has been sent down to PE in case of delts or addts for remain
80 // flows, OR if the AC doesn't have APSD or ACM
81 //async: once the downgrade req for QoS params is successful
82 SME_QOS_STATUS_RELEASE_SUCCESS_RSP = 100,
83 //both: sync or async: in case of async notifies HDD with current QoS Params
84 SME_QOS_STATUS_RELEASE_FAILURE_RSP,
85 //async: AP sent DELTS indication
86 SME_QOS_STATUS_RELEASE_QOS_LOST_IND,
87 //sync: an addts req has been sent down to PE to downgrade the QoS params or
88 // just buffered in SME
89 SME_QOS_STATUS_RELEASE_REQ_PENDING_RSP,
90 //sync
91 SME_QOS_STATUS_RELEASE_INVALID_PARAMS_RSP,
92
93 //async: for QoS modify request if modification is successful, notifies HDD
94 // with current QoS Params
95 SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_IND = 200,
96 //sync: only when App asked for APSD & it's already set with ACM = 0
97 SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_APSD_SET_ALREADY,
98 //both: sync or async: in case of async notifies HDD with current QoS Params
99 SME_QOS_STATUS_MODIFY_SETUP_FAILURE_RSP,
100 //sync: either req has been sent down to PE or just buffered in SME
101 SME_QOS_STATUS_MODIFY_SETUP_PENDING_RSP,
102 //sync: no APSD asked for & ACM = 0
103 SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP,
104 //sync
105 SME_QOS_STATUS_MODIFY_SETUP_INVALID_PARAMS_RSP,
106 //async: In case of UAPSD, once PE notifies successful TSPEC negotiation, or
107 //CSR notifies for successful reassoc to SME-QoS, notify HDD if PMC can't
108 //put the module in UAPSD mode right away (eHAL_STATUS_PMC_PENDING)
109 SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_IND_APSD_PENDING,
110 //async: In case of UAPSD, once PE notifies successful TSPEC negotiation, or
111 //CSR notifies for successful reassoc to SME-QoS, notify HDD if PMC can't
112 //put the module in UAPSD mode at all (eHAL_STATUS_FAILURE)
113 SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_IND_APSD_SET_FAILED,
114 //sync: STA is handing off to a new AP
115 SME_QOS_STATUS_HANDING_OFF = 300,
116 //async:powersave mode changed by PMC from UAPSD to Full power
117 SME_QOS_STATUS_OUT_OF_APSD_POWER_MODE_IND = 400,
118 //async:powersave mode changed by PMC from Full power to UAPSD
119 SME_QOS_STATUS_INTO_APSD_POWER_MODE_IND,
120
121}sme_QosStatusType;
122
123/*---------------------------------------------------------------------------
124 Enumeration of the various User priority (UP) types
125
126 From 802.1D/802.11e/WMM specifications (all refer to same table)
127---------------------------------------------------------------------------*/
128typedef enum
129{
130 SME_QOS_WMM_UP_BE = 0,
131 SME_QOS_WMM_UP_BK = 1,
132 SME_QOS_WMM_UP_RESV = 2, /* Reserved */
133 SME_QOS_WMM_UP_EE = 3,
134 SME_QOS_WMM_UP_CL = 4,
135 SME_QOS_WMM_UP_VI = 5,
136 SME_QOS_WMM_UP_VO = 6,
137 SME_QOS_WMM_UP_NC = 7,
138
139 SME_QOS_WMM_UP_MAX
140
141}sme_QosWmmUpType;
142
143/*---------------------------------------------------------------------------
144 Enumeration of the various TSPEC directions
145
146 From 802.11e/WMM specifications
147---------------------------------------------------------------------------*/
148
149typedef enum
150{
151 SME_QOS_WMM_TS_DIR_UPLINK = 0,
152 SME_QOS_WMM_TS_DIR_DOWNLINK = 1,
153 SME_QOS_WMM_TS_DIR_RESV = 2, /* Reserved */
154 SME_QOS_WMM_TS_DIR_BOTH = 3,
155
156}sme_QosWmmDirType;
157
158/*---------------------------------------------------------------------------
159 Enumeration of the various TSPEC ack policies.
160
161 From 802.11 WMM specification
162---------------------------------------------------------------------------*/
163
164typedef enum
165{
166 SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK = 0,
167 SME_QOS_WMM_TS_ACK_POLICY_RESV1 = 1,
168 SME_QOS_WMM_TS_ACK_POLICY_RESV2 = 2, /* Reserved */
169 SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK = 3,
170
171}sme_QosWmmAckPolicyType;
172
173/*---------------------------------------------------------------------------
174 TS Info field in the WMM TSPEC
175
176 See suggestive values above
177---------------------------------------------------------------------------*/
178typedef struct
179{
180 v_U8_t burst_size_defn;
181 sme_QosWmmAckPolicyType ack_policy;
182 sme_QosWmmUpType up; /* User priority */
183 v_U8_t psb; /* power-save bit */
184 sme_QosWmmDirType direction; /* Direction */
185 v_U8_t tid; /* TID : To be filled up by SME-QoS */
186} sme_QosWmmTsInfoType;
187
188/*---------------------------------------------------------------------------
189 The WMM TSPEC Element (from the WMM spec)
190---------------------------------------------------------------------------*/
191typedef struct
192{
193 sme_QosWmmTsInfoType ts_info;
194 v_U16_t nominal_msdu_size;
195 v_U16_t maximum_msdu_size;
196 v_U32_t min_service_interval;
197 v_U32_t max_service_interval;
198 v_U32_t inactivity_interval;
199 v_U32_t suspension_interval;
200 v_U32_t svc_start_time;
201 v_U32_t min_data_rate;
202 v_U32_t mean_data_rate;
203 v_U32_t peak_data_rate;
204 v_U32_t max_burst_size;
205 v_U32_t delay_bound;
206 v_U32_t min_phy_rate;
207 v_U16_t surplus_bw_allowance;
208 v_U16_t medium_time;
209} sme_QosWmmTspecInfo;
210
211
212/*--------------------------------------------------------------------------
213 External APIs
214 ------------------------------------------------------------------------*/
215
216/*--------------------------------------------------------------------------
217 \brief sme_QosCallback() - This is a callback function which is registered
218 per flow while HDD is requesting for QoS. Used for any notification for the
219 flow (i.e. setup success/failure/release) which needs to be sent to HDD. HDD
220 will notify the application in turn, if needed.
221
222 \param hHal - The handle returned by macOpen.
223 \param HDDcontext - A cookie passed by HDD during QoS setup, to be used by SME
224 during any QoS notification (through the callabck) to HDD
225 \param pCurrentQoSInfo - Pointer to sme_QosWmmTspecInfo which contains the WMM
226 TSPEC related info as defined above, fed back to HDD
227 \param status - The status of the flow running on an AC. It could be of
228 sme_QosStatusType
229
230 \return eHAL_STATUS_SUCCESS - Callback invoke successful.
231
232
233 \sa
234
235 --------------------------------------------------------------------------*/
236typedef eHalStatus (*sme_QosCallback)(tHalHandle hHal, void * HDDcontext,
237 sme_QosWmmTspecInfo * pCurrentQoSInfo,
238 sme_QosStatusType status,
239 v_U32_t QosFlowID);
240
241/*--------------------------------------------------------------------------
242 \brief sme_QosSetupReq() - The SME QoS API exposed to HDD to request for QoS
243 on a particular AC. This function should be called after a link has been
244 established, i.e. STA is associated with an AP etc. If the request involves
245 admission control on the requested AC, HDD needs to provide the necessary
246 Traffic Specification (TSPEC) parameters otherwise SME is going to use the
247 default params.
248
249 \param hHal - The handle returned by macOpen.
250 \param sessionId - sessionId returned by sme_OpenSession. Current QOS code doesn't
251 support multiple session. This function returns failure when different
252 sessionId is passed in before calling sme_QosReleaseReq.
253 \param pQoSInfo - Pointer to sme_QosWmmTspecInfo which contains the WMM TSPEC
254 related info as defined above, provided by HDD
255 \param QoSCallback - The callback which is registered per flow while
256 requesting for QoS. Used for any notification for the
257 flow (i.e. setup success/failure/release) which needs to
258 be sent to HDD
259 \param HDDcontext - A cookie passed by HDD to be used by SME during any QoS
260 notification (through the callabck) to HDD
261 \param UPType - Useful only if HDD or any other upper layer module (BAP etc.)
262 looking for implicit QoS setup, in that
263 case, the pQoSInfo will be NULL & SME will know about the AC
264 (from the UP provided in this param) QoS is requested on
265 \param pQosFlowID - Identification per flow running on each AC generated by
266 SME.
267 It is only meaningful if the QoS setup for the flow is
268 successful
269
270 \return SME_QOS_STATUS_SETUP_SUCCESS - Setup request processed successfully.
271
272 Other status means Setup request failed
273 \sa
274
275 --------------------------------------------------------------------------*/
276sme_QosStatusType sme_QosSetupReq(tHalHandle hHal, tANI_U32 sessionId,
277 sme_QosWmmTspecInfo * pQoSInfo,
278 sme_QosCallback QoSCallback, void * HDDcontext,
279 sme_QosWmmUpType UPType, v_U32_t * pQosFlowID);
280
281/*--------------------------------------------------------------------------
282 \brief sme_QosModifyReq() - The SME QoS API exposed to HDD to request for
283 modification of certain QoS params on a flow running on a particular AC.
284 This function should be called after a link has been established, i.e. STA is
285 associated with an AP etc. & a QoS setup has been succesful for that flow.
286 If the request involves admission control on the requested AC, HDD needs to
287 provide the necessary Traffic Specification (TSPEC) parameters & SME might
288 start the renegotiation process through ADDTS.
289
290 \param hHal - The handle returned by macOpen.
291 \param pQoSInfo - Pointer to sme_QosWmmTspecInfo which contains the WMM TSPEC
292 related info as defined above, provided by HDD
293 \param QosFlowID - Identification per flow running on each AC generated by
294 SME.
295 It is only meaningful if the QoS setup for the flow has
296 been successful already
297
298 \return SME_QOS_STATUS_SETUP_SUCCESS - Modification request processed
299 successfully.
300
301 Other status means request failed
302 \sa
303
304 --------------------------------------------------------------------------*/
305sme_QosStatusType sme_QosModifyReq(tHalHandle hHal,
306 sme_QosWmmTspecInfo * pQoSInfo,
307 v_U32_t QosFlowID);
308
309/*--------------------------------------------------------------------------
310 \brief sme_QosReleaseReq() - The SME QoS API exposed to HDD to request for
311 releasing a QoS flow running on a particular AC. This function should be
312 called only if a QoS is set up with a valid FlowID. HDD sould invoke this
313 API only if an explicit request for QoS release has come from Application
314
315 \param hHal - The handle returned by macOpen.
316 \param QosFlowID - Identification per flow running on each AC generated by SME
317 It is only meaningful if the QoS setup for the flow is
318 successful
319
320 \return SME_QOS_STATUS_RELEASE_SUCCESS - Release request processed
321 successfully.
322
323 \sa
324
325 --------------------------------------------------------------------------*/
326sme_QosStatusType sme_QosReleaseReq(tHalHandle hHal, v_U32_t QosFlowID);
327
328/*--------------------------------------------------------------------------
329 \brief sme_QosIsTSInfoAckPolicyValid() - The SME QoS API exposed to HDD to
330 check if TS info ack policy field can be set to "HT-immediate block acknowledgement"
331
332 \param pMac - The handle returned by macOpen.
333 \param pQoSInfo - Pointer to sme_QosWmmTspecInfo which contains the WMM TSPEC
334 related info, provided by HDD
335 \param sessionId - sessionId returned by sme_OpenSession.
336
337 \return VOS_TRUE - Current Association is HT association and so TS info ack policy
338 can be set to "HT-immediate block acknowledgement"
339
340 \sa
341
342 --------------------------------------------------------------------------*/
343v_BOOL_t sme_QosIsTSInfoAckPolicyValid(tpAniSirGlobal pMac,
344 sme_QosWmmTspecInfo * pQoSInfo,
345 v_U8_t sessionId);
346
Mukul Sharma5960ac82014-01-09 20:31:35 +0530347
348/*--------------------------------------------------------------------------
349 \brief sme_QosUpdateHandOff() - Function which can be called to update
350 Hand-off state of SME QoS Session
351 \param sessionId - session id
352 \param updateHandOff - value True/False to update the handoff flag
353
354 \sa
355
356-------------------------------------------------------------------------*/
357void sme_QosUpdateHandOff(v_U8_t sessionId,
358 v_BOOL_t updateHandOff);
359
Jeff Johnson295189b2012-06-20 16:38:30 -0700360#endif //#if !defined( __SME_QOSAPI_H )