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