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