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