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