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