blob: 2c917746e7c6d19251a78712fbb9f274a02a0fe6 [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;
231} sme_QosWmmTspecInfo;
232
233
234/*--------------------------------------------------------------------------
235 External APIs
236 ------------------------------------------------------------------------*/
237
238/*--------------------------------------------------------------------------
239 \brief sme_QosCallback() - This is a callback function which is registered
240 per flow while HDD is requesting for QoS. Used for any notification for the
241 flow (i.e. setup success/failure/release) which needs to be sent to HDD. HDD
242 will notify the application in turn, if needed.
243
244 \param hHal - The handle returned by macOpen.
245 \param HDDcontext - A cookie passed by HDD during QoS setup, to be used by SME
246 during any QoS notification (through the callabck) to HDD
247 \param pCurrentQoSInfo - Pointer to sme_QosWmmTspecInfo which contains the WMM
248 TSPEC related info as defined above, fed back to HDD
249 \param status - The status of the flow running on an AC. It could be of
250 sme_QosStatusType
251
252 \return eHAL_STATUS_SUCCESS - Callback invoke successful.
253
254
255 \sa
256
257 --------------------------------------------------------------------------*/
258typedef eHalStatus (*sme_QosCallback)(tHalHandle hHal, void * HDDcontext,
259 sme_QosWmmTspecInfo * pCurrentQoSInfo,
260 sme_QosStatusType status,
261 v_U32_t QosFlowID);
262
263/*--------------------------------------------------------------------------
264 \brief sme_QosSetupReq() - The SME QoS API exposed to HDD to request for QoS
265 on a particular AC. This function should be called after a link has been
266 established, i.e. STA is associated with an AP etc. If the request involves
267 admission control on the requested AC, HDD needs to provide the necessary
268 Traffic Specification (TSPEC) parameters otherwise SME is going to use the
269 default params.
270
271 \param hHal - The handle returned by macOpen.
272 \param sessionId - sessionId returned by sme_OpenSession. Current QOS code doesn't
273 support multiple session. This function returns failure when different
274 sessionId is passed in before calling sme_QosReleaseReq.
275 \param pQoSInfo - Pointer to sme_QosWmmTspecInfo which contains the WMM TSPEC
276 related info as defined above, provided by HDD
277 \param QoSCallback - The callback which is registered per flow while
278 requesting for QoS. Used for any notification for the
279 flow (i.e. setup success/failure/release) which needs to
280 be sent to HDD
281 \param HDDcontext - A cookie passed by HDD to be used by SME during any QoS
282 notification (through the callabck) to HDD
283 \param UPType - Useful only if HDD or any other upper layer module (BAP etc.)
284 looking for implicit QoS setup, in that
285 case, the pQoSInfo will be NULL & SME will know about the AC
286 (from the UP provided in this param) QoS is requested on
287 \param pQosFlowID - Identification per flow running on each AC generated by
288 SME.
289 It is only meaningful if the QoS setup for the flow is
290 successful
291
292 \return SME_QOS_STATUS_SETUP_SUCCESS - Setup request processed successfully.
293
294 Other status means Setup request failed
295 \sa
296
297 --------------------------------------------------------------------------*/
298sme_QosStatusType sme_QosSetupReq(tHalHandle hHal, tANI_U32 sessionId,
299 sme_QosWmmTspecInfo * pQoSInfo,
300 sme_QosCallback QoSCallback, void * HDDcontext,
301 sme_QosWmmUpType UPType, v_U32_t * pQosFlowID);
302
303/*--------------------------------------------------------------------------
304 \brief sme_QosModifyReq() - The SME QoS API exposed to HDD to request for
305 modification of certain QoS params on a flow running on a particular AC.
306 This function should be called after a link has been established, i.e. STA is
307 associated with an AP etc. & a QoS setup has been succesful for that flow.
308 If the request involves admission control on the requested AC, HDD needs to
309 provide the necessary Traffic Specification (TSPEC) parameters & SME might
310 start the renegotiation process through ADDTS.
311
312 \param hHal - The handle returned by macOpen.
313 \param pQoSInfo - Pointer to sme_QosWmmTspecInfo which contains the WMM TSPEC
314 related info as defined above, provided by HDD
315 \param QosFlowID - Identification per flow running on each AC generated by
316 SME.
317 It is only meaningful if the QoS setup for the flow has
318 been successful already
319
320 \return SME_QOS_STATUS_SETUP_SUCCESS - Modification request processed
321 successfully.
322
323 Other status means request failed
324 \sa
325
326 --------------------------------------------------------------------------*/
327sme_QosStatusType sme_QosModifyReq(tHalHandle hHal,
328 sme_QosWmmTspecInfo * pQoSInfo,
329 v_U32_t QosFlowID);
330
331/*--------------------------------------------------------------------------
332 \brief sme_QosReleaseReq() - The SME QoS API exposed to HDD to request for
333 releasing a QoS flow running on a particular AC. This function should be
334 called only if a QoS is set up with a valid FlowID. HDD sould invoke this
335 API only if an explicit request for QoS release has come from Application
336
337 \param hHal - The handle returned by macOpen.
338 \param QosFlowID - Identification per flow running on each AC generated by SME
339 It is only meaningful if the QoS setup for the flow is
340 successful
341
342 \return SME_QOS_STATUS_RELEASE_SUCCESS - Release request processed
343 successfully.
344
345 \sa
346
347 --------------------------------------------------------------------------*/
348sme_QosStatusType sme_QosReleaseReq(tHalHandle hHal, v_U32_t QosFlowID);
349
350/*--------------------------------------------------------------------------
351 \brief sme_QosIsTSInfoAckPolicyValid() - The SME QoS API exposed to HDD to
352 check if TS info ack policy field can be set to "HT-immediate block acknowledgement"
353
354 \param pMac - The handle returned by macOpen.
355 \param pQoSInfo - Pointer to sme_QosWmmTspecInfo which contains the WMM TSPEC
356 related info, provided by HDD
357 \param sessionId - sessionId returned by sme_OpenSession.
358
359 \return VOS_TRUE - Current Association is HT association and so TS info ack policy
360 can be set to "HT-immediate block acknowledgement"
361
362 \sa
363
364 --------------------------------------------------------------------------*/
365v_BOOL_t sme_QosIsTSInfoAckPolicyValid(tpAniSirGlobal pMac,
366 sme_QosWmmTspecInfo * pQoSInfo,
367 v_U8_t sessionId);
368
Mukul Sharma5960ac82014-01-09 20:31:35 +0530369
370/*--------------------------------------------------------------------------
371 \brief sme_QosUpdateHandOff() - Function which can be called to update
372 Hand-off state of SME QoS Session
373 \param sessionId - session id
374 \param updateHandOff - value True/False to update the handoff flag
375
376 \sa
377
378-------------------------------------------------------------------------*/
379void sme_QosUpdateHandOff(v_U8_t sessionId,
380 v_BOOL_t updateHandOff);
381
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -0700382
383/*--------------------------------------------------------------------------
384 \brief sme_UpdateDSCPtoUPMapping() - Function which can be called to update
385 qos mapping table maintained in HDD
386 \param hHal - The handle returned by macOpen.
387 \param dscpmapping - pointer to the qos mapping structure in HDD
388
389 \sa
390-------------------------------------------------------------------------*/
391VOS_STATUS sme_UpdateDSCPtoUPMapping( tHalHandle hHal, sme_QosWmmUpType* dscpmapping);
Jeff Johnson295189b2012-06-20 16:38:30 -0700392#endif //#if !defined( __SME_QOSAPI_H )