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