1 /****************************************************************************
2 **+-----------------------------------------------------------------------+**
3 **| |**
4 **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved. |**
5 **| All rights reserved. |**
6 **| |**
7 **| Redistribution and use in source and binary forms, with or without |**
8 **| modification, are permitted provided that the following conditions |**
9 **| are met: |**
10 **| |**
11 **| * Redistributions of source code must retain the above copyright |**
12 **| notice, this list of conditions and the following disclaimer. |**
13 **| * Redistributions in binary form must reproduce the above copyright |**
14 **| notice, this list of conditions and the following disclaimer in |**
15 **| the documentation and/or other materials provided with the |**
16 **| distribution. |**
17 **| * Neither the name Texas Instruments nor the names of its |**
18 **| contributors may be used to endorse or promote products derived |**
19 **| from this software without specific prior written permission. |**
20 **| |**
21 **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |**
22 **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |**
23 **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |**
24 **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |**
25 **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |**
26 **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |**
27 **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |**
28 **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |**
29 **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |**
30 **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |**
31 **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |**
32 **| |**
33 **+-----------------------------------------------------------------------+**
34 ****************************************************************************/
35
36
37 /** \file qosMngr.c
38 * \brief QOS module interface
39 *
40 * \see qosMngr.h
41 */
42
43 /****************************************************************************************************/
44 /* */
45 /* MODULE: qosMGr.c */
46 /* PURPOSE: QOS module interface. */
47 /* This module handles the QOS manager configuration. */
48 /* */
49 /****************************************************************************************************/
50 #include "report.h"
51 #include "osApi.h"
52 #include "paramOut.h"
53 #include "paramIn.h"
54 #include "utils.h"
55 #include "siteMgrApi.h"
56 #include "public_infoele.h"
57 #include "whalCtrl_api.h"
58 #include "qosMngr.h"
59 #include "qosMngr_API.h"
60 #include "qosMngr_QueueMapping.h"
61 #include "smeSmApi.h"
62 #include "EvHandler.h"
63 #ifdef EXC_MODULE_INCLUDED
64 #include "excMngr.h"
65 #include "excTSMngr.h"
66 #endif
67
68 static int NonQosTagToACTable[MAX_NUM_OF_802_1d_TAGS] = { NonQosTag0ToAC, NonQosTag1ToAC, NonQosTag2ToAC, NonQosTag3ToAC, NonQosTag4ToAC, NonQosTag5ToAC, NonQosTag6ToAC, NonQosTag7ToAC };
69
70 /* This structure is now shared between the qosMngr and TxData to allow PS_POLL voice delivery mode for NON_QOS AP */
71 int WMEQosTagToACTable[MAX_NUM_OF_802_1d_TAGS] = { WMEQosTag0ToAC, WMEQosTag1ToAC, WMEQosTag2ToAC, WMEQosTag3ToAC, WMEQosTag4ToAC, WMEQosTag5ToAC, WMEQosTag6ToAC, WMEQosTag7ToAC };
72
73 /* This array is now shared between qosMngr and TxData */
74 UINT8 wmeAcToUpIndex[MAX_NUM_OF_AC] = {0,1,4,6};
75
76 /* Used to indicate no user priority is assigned for AC */
77 #define INACTIVE_USER_PRIORITY 0xFF
78
79 /********************************************************************************/
80 /* Internal functions prototypes. */
81 /********************************************************************************/
82 static void release_module(qosMngr_t *pQosMngr, UINT32 initVec);
83 static TI_STATUS verifyAndConfigTrafficParams(qosMngr_t *pQosMngr, queueTrafficParams_t *pQtrafficParams);
84 static TI_STATUS verifyAndConfigQosParams(qosMngr_t *pQosMngr,acQosParams_t *pAcQosParams);
85 static TI_STATUS getWMEInfoElement(qosMngr_t *pQosMngr,UINT8 *pWMEie,UINT8 *pLen);
86 static TI_STATUS verifyWmeIeParams(qosMngr_t *pQosMngr,UINT8 *pQosIeParams);
87 static TI_STATUS updateACParams(qosMngr_t *pQosMngr,ACParameters_t *pAcParams);
88 static void updateTagToAcTable(qosMngr_t *pQosMngr,acTrfcType_e *pProtocolTagToACTable);
89 static TI_STATUS setWmeSiteParams(qosMngr_t *pQosMngr, UINT8 *pQosIeParams);
90 void qosMngr_resetAdmCtrlParameters(TI_HANDLE hQosMngr);
91 static TI_STATUS qosMngr_getCurrAcStatus(TI_HANDLE hQosMngr, OS_802_11_AC_UPSD_STATUS_PARAMS *pAcStatusParams);
92 static void deleteTspecConfiguration(qosMngr_t *pQosMngr, UINT8 acID);
93 static void setNonQosAdmissionState(qosMngr_t *pQosMngr, UINT8 acID);
94 static void qosMngr_storeTspecCandidateParams (tspecInfo_t *pCandidateParams, OS_802_11_QOS_TSPEC_PARAMS *pTSPECParams, UINT8 ac);
95
96 /********************************************************************************
97 * qosMngr_create *
98 ********************************************************************************
99 DESCRIPTION: QOS module creation function, called by the config mgr in creation phase.
100 performs the following:
101 - Allocate the QOS MNGR handle.
102 INPUT: hOs - Handle to OS
103
104
105 OUTPUT:
106
107 RETURN: Handle to the QOS MNGR module on success, NULL otherwise
108
109 ************************************************************************/
qosMngr_create(TI_HANDLE hOs)110 TI_HANDLE qosMngr_create(TI_HANDLE hOs)
111 {
112 qosMngr_t *pQosMngr = NULL;
113 UINT32 initVec = 0;
114
115 if(!hOs)
116 return NULL;
117
118 /* allocating the WME object */
119 pQosMngr = os_memoryAlloc(hOs,sizeof(qosMngr_t));
120
121 if (pQosMngr == NULL)
122 return NULL;
123
124 initVec |= (1 << QOS_MNGR_INIT_BIT_LOCAL_VECTOR);
125
126 /* create admission control object */
127 pQosMngr->pTrafficAdmCtrl = trafficAdmCtrl_create(hOs);
128
129 if (pQosMngr->pTrafficAdmCtrl == NULL)
130 {
131 qosMngr_destroy(pQosMngr);
132 return NULL;
133 }
134
135 initVec |= (1 << QOS_MNGR_INIT_BIT_ADM_CTRL);
136
137 return(pQosMngr);
138 }
139
140 /************************************************************************
141 * qosMngr_destroy *
142 ************************************************************************
143 DESCRIPTION: QOS MNGR module destroy function, called by the config mgr in
144 the destroy phase
145 performs the following:
146 - Free all memory alocated by the module
147
148 INPUT: hQosMngr - QOS Manager handle.
149
150 OUTPUT:
151
152 RETURN: OK on success, NOK otherwise
153
154 ************************************************************************/
qosMngr_destroy(TI_HANDLE hQosMngr)155 TI_STATUS qosMngr_destroy(TI_HANDLE hQosMngr)
156 {
157 UINT32 initVec;
158 qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
159
160 if (pQosMngr == NULL)
161 return OK;
162
163 initVec = 0xFFFF;
164 release_module(pQosMngr, initVec);
165
166 return OK;
167 }
168
169 /***********************************************************************
170 * release_module
171 ***********************************************************************
172 DESCRIPTION: Called by the destroy function or by the create function (on failure)
173 Go over the vector, for each bit that is set, release the corresponding module.
174
175 INPUT: pQosMngr - QOS Mngr pointer.
176 initVec - Vector that contains a bit set for each module thah had been initiualized
177
178 OUTPUT:
179
180 RETURN: OK on success, NOK otherwise
181 ************************************************************************/
release_module(qosMngr_t * pQosMngr,UINT32 initVec)182 static void release_module(qosMngr_t *pQosMngr, UINT32 initVec)
183 {
184
185 if (initVec & (1 << QOS_MNGR_INIT_BIT_ADM_CTRL))
186 trafficAdmCtrl_unload(pQosMngr->pTrafficAdmCtrl);
187
188 if (initVec & (1 << QOS_MNGR_INIT_BIT_LOCAL_VECTOR))
189 utils_nullMemoryFree(pQosMngr->hOs, pQosMngr, sizeof(qosMngr_t));
190
191 initVec = 0;
192 }
193
194 /************************************************************************
195 * qosMngr_config *
196 ************************************************************************
197 DESCRIPTION: QOS Manager module configuration function, called by the config
198 mgr in configuration phase
199 performs the following:
200 - Reset & initiailzes local variables
201 - Init the handles to be used by the module
202
203 INPUT: hQosMngr - Qos Manager handle.
204 List of handles to be used by the module
205 pQosMngrInitParams - Init table of the module.
206
207
208 OUTPUT:
209
210 RETURN: OK on success, NOK otherwise
211
212 ************************************************************************/
qosMngr_config(TI_HANDLE hQosMngr,TI_HANDLE hHalCtrl,TI_HANDLE hSiteMgr,TI_HANDLE hReport,TI_HANDLE hOs,TI_HANDLE hTxData,TI_HANDLE hMeasurementMngr,TI_HANDLE hSmeSm,TI_HANDLE hMemMgr,TI_HANDLE hCtrlData,TI_HANDLE hEvHandler,TI_HANDLE hExcMgr,QosMngrInitParams_t * pQosMngrInitParams)213 TI_STATUS qosMngr_config(TI_HANDLE hQosMngr,
214 TI_HANDLE hHalCtrl,
215 TI_HANDLE hSiteMgr,
216 TI_HANDLE hReport,
217 TI_HANDLE hOs,
218 TI_HANDLE hTxData,
219 TI_HANDLE hMeasurementMngr,
220 TI_HANDLE hSmeSm,
221 TI_HANDLE hMemMgr,
222 TI_HANDLE hCtrlData,
223 TI_HANDLE hEvHandler,
224 TI_HANDLE hExcMgr,
225 QosMngrInitParams_t *pQosMngrInitParams)
226 {
227
228 qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
229 paramInfo_t param;
230 UINT8 acID;
231 TI_STATUS status;
232
233 /* init handles */
234 pQosMngr->hOs = hOs;
235 pQosMngr->hReport = hReport;
236 pQosMngr->hSiteMgr = hSiteMgr;
237 pQosMngr->hHalCtrl = hHalCtrl;
238 pQosMngr->hTxData = hTxData;
239 pQosMngr->hMeasurementMngr = hMeasurementMngr;
240 pQosMngr->hSmeSm = hSmeSm;
241 pQosMngr->hMemMgr = hMemMgr;
242 pQosMngr->hCtrlData = hCtrlData;
243 pQosMngr->hEvHandler = hEvHandler;
244 pQosMngr->hExcMgr = hExcMgr;
245
246 pQosMngr->isConnected = FALSE;
247
248 /* init params */
249 pQosMngr->WMEEnable = pQosMngrInitParams->wmeEnable;
250 pQosMngr->trafficAdmCtrlEnable = pQosMngrInitParams->trafficAdmCtrlEnable;
251 pQosMngr->tagZeroConverHeader = pQosMngrInitParams->qosTagZeroConverHeader;
252 pQosMngr->qosPacketBurstEnable = pQosMngrInitParams->PacketBurstEnable;
253 pQosMngr->qosPacketBurstTxOpLimit = pQosMngrInitParams->PacketBurstTxOpLimit;
254 pQosMngr->desiredPsMode = pQosMngrInitParams->desiredPsMode;
255
256 pQosMngr->activeProtocol = NONE_QOS;
257 pQosMngr->WMESiteSupport = FALSE;
258
259 pQosMngr->desiredMaxSpLen = pQosMngrInitParams->desiredMaxSpLen;
260 pQosMngr->desiredVoiceDeliveryProtocol = PS_SCHEME_LEGACY_PSPOLL;
261
262 pQosMngr->voiceTspecConfigured = FALSE;
263 pQosMngr->videoTspecConfigured = FALSE;
264 pQosMngr->performTSPECRenegotiation = FALSE;
265 pQosMngr->TSPECNegotiationResultCallb = NULL;
266 pQosMngr->TSPECNegotiationResultModule = NULL;
267
268 /* No template has been set for UPSD */
269 pQosMngr->QosNullDataTemplateUserPriority = 0xFF;
270
271 /* configure admission control parameters */
272 qosMngr_resetAdmCtrlParameters(pQosMngr);
273
274 status = trafficAdmCtrl_config(pQosMngr->pTrafficAdmCtrl,
275 pQosMngr->hTxData,
276 pQosMngr->hReport,
277 pQosMngr->hOs,
278 pQosMngr,
279 pQosMngr->hCtrlData,
280 pQosMngr->hMemMgr,
281 pQosMngr->hExcMgr,
282 &pQosMngrInitParams->trafficAdmCtrlInitParams);
283 if(status != OK)
284 return NOK;
285
286 /*
287 * configure per AC traffic parameters
288 */
289 for(acID = FIRST_AC_INDEX;acID < MAX_NUM_OF_AC; acID++)
290 {
291 /*
292 * setting ac traffic params for TrafficCategoryCfg (TNET configuration
293 * The parameters can be changed in run-time, so they are saved in "init params"
294 * for 'disconnecting' .
295 * the parameters being set in setSite; "select" phase.
296 */
297 pQosMngr->acParams[acID].QtrafficParams.queueID = acID;
298 pQosMngr->acParams[acID].QtrafficParams.channelType = CHANNEL_TYPE_EDCF;
299 pQosMngr->acParams[acID].QtrafficParams.tsid = acID;
300 pQosMngr->acParams[acID].QtrafficParams.dot11EDCATableMSDULifeTime = 0;
301 pQosMngr->acParams[acID].QtrafficParams.psScheme = PS_SCHEME_LEGACY;
302 pQosMngr->acParams[acID].QtrafficParams.ackPolicy = pQosMngrInitParams->acAckPolicy[acID];
303 pQosMngr->acParams[acID].QtrafficParams.APSDConf[0] = 0;
304 pQosMngr->acParams[acID].QtrafficParams.APSDConf[1] = 0;
305
306
307 /*
308 * Update the qTrafficInitParams as well
309 */
310 os_memoryCopy(hOs,&(pQosMngr->acParams[acID].QTrafficInitParams),&(pQosMngr->acParams[acID].QtrafficParams),sizeof(queueTrafficParams_t));
311
312 /* will be config only after select */
313 verifyAndConfigTrafficParams(pQosMngr,&(pQosMngr->acParams[acID].QtrafficParams));
314
315 /*
316 * setting ac QoS params for acQosParams (TNET configuration)
317 * The parameters can be changed in run-time, so they are saved in "init params"
318 * for 'disconnecting'.
319 * the parameters being set in setSite; "select" phase.
320 */
321 pQosMngr->acParams[acID].acQosParams.ac = acID;
322 pQosMngr->acParams[acID].acQosParams.aifsn = AIFS_DEF;
323 pQosMngr->acParams[acID].acQosParams.cwMax = CW_MAX_DEF;
324 pQosMngr->acParams[acID].acQosParams.cwMin = CW_MIN_MAX;
325 pQosMngr->acParams[acID].acQosParams.txopLimit = QOS_TX_OP_LIMIT_DEF;
326 pQosMngr->acParams[acID].msduLifeTimeParam = pQosMngrInitParams->MsduLifeTime[acID];
327
328 /* The protocol is NONE_QOS. If Packet Burst is Enable, */
329 /* then, the BE queue is configured to the TxOP Limit of Packet burst */
330 /* (that is, 3 ms) and the txopContinuation is set to qosPacketBurstEnable */
331 /* The protocol is NONE_QOS. If Packet Burst is Enable, */
332 /* then, the BE queue is configured to the TxOP Limit of Packet burst */
333 /* (that is, 3 ms) and the txopContinuation is set to qosPacketBurstEnable */
334
335 if (acID == QOS_AC_BE)
336 {
337 if (pQosMngr->qosPacketBurstEnable==TRUE)
338 {
339 pQosMngr->acParams[QOS_AC_BE].acQosParams.txopLimit = pQosMngr->qosPacketBurstTxOpLimit;
340 }
341 else
342 {
343 pQosMngr->acParams[QOS_AC_BE].acQosParams.txopLimit = QOS_TX_OP_LIMIT_DEF;
344 }
345 }
346
347 /*
348 * Update the acQosInitParams as well
349 */
350 os_memoryCopy(hOs,&(pQosMngr->acParams[acID].acQosInitParams),&(pQosMngr->acParams[acID].acQosParams),sizeof(acQosParams_t));
351
352 /* will be config only after select */
353 verifyAndConfigQosParams(hQosMngr,&(pQosMngr->acParams[acID].acQosParams));
354
355
356
357
358 /*
359 * setting ps mode per ac for protocol specific configuration.
360 */
361
362 /* validity check - allow to set the desired Ps mode per-AC to UPSD ONLY IF the station supports UPSD */
363 if ((pQosMngrInitParams->desiredPsMode == PS_SCHEME_UPSD_TRIGGER) && (pQosMngrInitParams->desiredWmeAcPsMode[acID] == PS_SCHEME_UPSD_TRIGGER))
364 {
365 pQosMngr->acParams[acID].desiredWmeAcPsMode = PS_SCHEME_UPSD_TRIGGER;
366 }
367 else
368 {
369 pQosMngr->acParams[acID].desiredWmeAcPsMode = PS_SCHEME_LEGACY_PSPOLL;
370 }
371
372 pQosMngr->acParams[acID].currentWmeAcPsMode = PS_SCHEME_LEGACY_PSPOLL; /* default configuration is legacy PS for all queues */
373
374 /*
375 * configure TxData per AC params
376 */
377 param.content.txDataQosParams.acID = acID;
378 param.content.txDataQosParams.acTrfcCtrl.PsMode = PS_SCHEME_LEGACY;
379 param.content.txDataQosParams.acTrfcCtrl.QueueIndex = acID;
380 param.content.txDataQosParams.acTrfcCtrl.TxQueueSize = pQosMngrInitParams->TxQueueSize[acID];
381 param.content.txDataQosParams.acTrfcCtrl.QueueOvFlowPolicy = pQosMngrInitParams->QueueOvFlowPolicy[acID];
382 param.content.txDataQosParams.acTrfcCtrl.MsduLifeTime = pQosMngrInitParams->MsduLifeTime[acID];
383 param.content.txDataQosParams.acTrfcCtrl.ackPolicy = ACK_POLICY_LEGACY; /* working with Non - Qos method */
384
385 param.paramType = TX_DATA_PS_MODE_PARAM;
386 txData_setParam(pQosMngr->hTxData,¶m);
387
388 param.paramType = TX_DATA_CONFIG_TX_QUEUE_SIZE;
389 txData_setParam(pQosMngr->hTxData,¶m);
390
391 param.paramType = TX_DATA_CONFIG_TX_QUEUE_OVFLOW_POLICY;
392 txData_setParam(pQosMngr->hTxData,¶m);
393
394 param.paramType = TX_DATA_CONFIG_AC_MSDU_LIFE_TIME;
395 txData_setParam(pQosMngr->hTxData,¶m);
396
397 param.paramType = TX_DATA_CONFIG_AC_ACK_POLICY;
398 txData_setParam(pQosMngr->hTxData,¶m);
399
400
401 /* setting wme Ack Policy */
402 pQosMngr->acParams[acID].wmeAcAckPolicy = pQosMngrInitParams->acAckPolicy[acID];
403
404 /* Set admission state per AC for non-QoS and update the Tx module. */
405 setNonQosAdmissionState(pQosMngr, acID);
406 }
407
408 pQosMngr->headerConvetMode = LEGACY_CONVERT;
409 param.content.txDataQosParams.qosParams.headerConverMode = LEGACY_CONVERT;
410
411 /* Update the Tx tag to AC tables for legacy mode. */
412 updateTagToAcTable(pQosMngr, (acTrfcType_e *)NonQosTagToACTable);
413
414
415 param.paramType = TX_DATA_CONVERT_HEADER_MODE;
416 txData_setParam(pQosMngr->hTxData,¶m);
417
418 param.paramType = TX_DATA_CONVERT_TAG_ZERO_HEADER_MODE;
419 param.content.txDataQosParams.qosParams.convertTagZeroFrames = pQosMngrInitParams->qosTagZeroConverHeader;
420 txData_setParam(pQosMngr->hTxData,¶m);
421
422 WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
423 ("qosMngr_config : QoS configuration complete!"));
424
425
426 return OK;
427 }
428
429 /************************************************************************
430 * qosMngr_resetAdmCtrlParameters *
431 ************************************************************************
432 DESCRIPTION: reset the admCtrl parameters
433
434 INPUT: hQosMngr - Qos Manager handle.
435
436 OUTPUT:
437
438 RETURN:
439
440 ************************************************************************/
441
qosMngr_resetAdmCtrlParameters(TI_HANDLE hQosMngr)442 void qosMngr_resetAdmCtrlParameters(TI_HANDLE hQosMngr)
443 {
444 UINT8 acID;
445 qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
446
447 /* reset admission control parameters */
448 for(acID = FIRST_AC_INDEX ; acID < MAX_NUM_OF_AC ; acID++)
449 {
450 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].AC = (acTrfcType_e)acID;
451 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].userPriority = INACTIVE_USER_PRIORITY; /* Setting invalid user Priority to prevent GET_TSPEC or DELETE */
452 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].nominalMsduSize = 0;
453 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].minimumPHYRate = 0;
454 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].meanDataRate = 0;
455 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].surplausBwAllowance = 0;
456 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].mediumTime = 0;
457 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].UPSDFlag = 0;
458 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].streamDirection = BI_DIRECTIONAL;
459 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].trafficAdmState = AC_NOT_ADMITTED;
460
461 pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].AC = (acTrfcType_e)acID;
462 pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].userPriority = INACTIVE_USER_PRIORITY; /* Setting invalid user Priority to prevent GET_TSPEC or DELETE */
463 pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].nominalMsduSize = 0;
464 pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].minimumPHYRate = 0;
465 pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].meanDataRate = 0;
466 pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].surplausBwAllowance = 0;
467 pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].mediumTime = 0;
468 pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].UPSDFlag = 0;
469 pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].streamDirection = BI_DIRECTIONAL;
470 pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].trafficAdmState = AC_NOT_ADMITTED;
471
472 pQosMngr->resourceMgmtTable.totalAllocatedMediumTime = 0;
473 }
474 }
475
476
477 /************************************************************************
478 * qosMngr_disconnect *
479 ************************************************************************
480 DESCRIPTION: the function is called upon driver disconnecting to reset all
481 QOS parameters to init values.
482
483 INPUT: hQosMngr - Qos Manager handle.
484
485 OUTPUT:
486
487 RETURN: OK on success, NOK otherwise
488
489 ************************************************************************/
490
qosMngr_disconnect(TI_HANDLE hQosMngr)491 TI_STATUS qosMngr_disconnect(TI_HANDLE hQosMngr)
492 {
493 qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
494 paramInfo_t param;
495 UINT8 acID;
496 TI_STATUS status;
497
498 if(hQosMngr == NULL)
499 return OK;
500
501 pQosMngr->activeProtocol = NONE_QOS;
502 pQosMngr->WMESiteSupport = FALSE;
503
504 /* clear admission control params */
505 qosMngr_resetAdmCtrlParameters(pQosMngr);
506
507 trafficAdmCtrl_stop(pQosMngr->pTrafficAdmCtrl);
508
509 for(acID = FIRST_AC_INDEX;acID < MAX_NUM_OF_AC; acID++)
510 {
511
512 /* disable event in rate adaptation */
513 ctrlData_setTspecsRateEvent(pQosMngr->hCtrlData, acID, FALSE);
514
515 /* Disable medium time events in TX */
516 txData_setAdmisionCtrlParams(pQosMngr->hTxData, acID, 0 , 0, FALSE);
517
518 /* The protocol after disconnect is NONE_QOS. If Packet Burst is Enabled, the BE queue InitParams
519 is configured to the TxOP Limit of Packet burst (that is, 3 ms) and the
520 txopContinuation is set to qosPacketBurstEnable. */
521
522 if (acID == QOS_AC_BE)
523 {
524 if (pQosMngr->qosPacketBurstEnable==TRUE)
525 {
526 pQosMngr->acParams[QOS_AC_BE].acQosInitParams.txopLimit = pQosMngr->qosPacketBurstTxOpLimit;
527 }
528 else
529 {
530 pQosMngr->acParams[QOS_AC_BE].acQosInitParams.txopLimit = QOS_TX_OP_LIMIT_DEF;
531 }
532 }
533
534 /* Copy init traffic params (non-QoS defaults) to current traffic params, and config to HAL and TNET. */
535 os_memoryCopy(pQosMngr->hOs,&(pQosMngr->acParams[acID].acQosParams),&(pQosMngr->acParams[acID].acQosInitParams),sizeof(acQosParams_t));
536
537 /*
538 * Update the qTrafficInitParams as well
539 */
540 os_memoryCopy(pQosMngr->hOs,&(pQosMngr->acParams[acID].QtrafficParams),&(pQosMngr->acParams[acID].QTrafficInitParams),sizeof(queueTrafficParams_t));
541
542
543
544 pQosMngr->acParams[acID].currentWmeAcPsMode = PS_SCHEME_LEGACY_PSPOLL; /* default configuration is legacy PS for all queues */
545
546 /*
547 * setting TxData params, only PS , Txoplimit and Admission State and AC status
548 * can be changed and reset to defaults.
549 */
550 param.content.txDataQosParams.acID = acID;
551 param.content.txDataQosParams.acTrfcCtrl.PsMode = PS_SCHEME_LEGACY;
552 param.content.txDataQosParams.acTrfcCtrl.ackPolicy = ACK_POLICY_LEGACY; /* working with Non - Qos method */
553 param.content.txDataQosParams.acTrfcCtrl.MsduLifeTime = pQosMngr->acParams[acID].msduLifeTimeParam;
554
555 param.paramType = TX_DATA_CONFIG_AC_MSDU_LIFE_TIME;
556 txData_setParam(pQosMngr->hTxData, ¶m);
557
558 param.paramType = TX_DATA_PS_MODE_PARAM;
559 txData_setParam(pQosMngr->hTxData,¶m);
560
561 param.paramType = TX_DATA_CONFIG_AC_ACK_POLICY;
562 txData_setParam(pQosMngr->hTxData,¶m);
563
564 /* Set admission state per AC for non-QoS and update the Tx module. */
565 setNonQosAdmissionState(pQosMngr, acID);
566 }
567
568 /*
569 * configure only BE AC
570 * NOTE : this is done after "disconnect" or Init phase so those are defaults BE params
571 */
572
573 /*
574 * configureQueue
575 */
576 status = verifyAndConfigTrafficParams(hQosMngr,&(pQosMngr->acParams[QOS_AC_BE].QtrafficParams));
577 if (status != OK)
578 {
579 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
580 ("qosMngr_setSite:failed to init NON_QOS Queue Traffic parameters!!!\n\n"));
581 return status;
582 }
583
584 /*
585 * configureAC
586 */
587
588 status = verifyAndConfigQosParams(hQosMngr,&(pQosMngr->acParams[QOS_AC_BE].acQosParams));
589 if (status != OK)
590 {
591 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
592 ("qosMngr_setSite:failed to init NON_QOS AC QoS parameters!!!\n\n"));
593 return status;
594 }
595
596
597 /*
598 * reset TxData globals parameters: header converting to legacy and Tag to Ac table without
599 * QOS
600 */
601 pQosMngr->headerConvetMode = LEGACY_CONVERT;
602 param.content.txDataQosParams.qosParams.headerConverMode = LEGACY_CONVERT;
603
604
605
606 /* Update the Tx and HAL tag to AC tables for legacy mode. */
607 updateTagToAcTable(pQosMngr, (acTrfcType_e *)NonQosTagToACTable);
608
609
610 param.paramType = TX_DATA_CONVERT_HEADER_MODE;
611 txData_setParam(pQosMngr->hTxData,¶m);
612
613
614 /* Update our internal state */
615 pQosMngr->isConnected = FALSE;
616
617 /* Mark that no Qos Null template is currently set into firmware */
618 pQosMngr->QosNullDataTemplateUserPriority = 0xFF;
619
620 pQosMngr->voiceTspecConfigured = FALSE;
621
622 pQosMngr->videoTspecConfigured = FALSE;
623
624 /* Mark that no Qos Null template is currently set into firmware */
625 pQosMngr->QosNullDataTemplateUserPriority = 0xFF;
626
627 WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
628 ("qosMngr_disconnect : QoS disconnect complete!"));
629
630 #ifdef EXC_MODULE_INCLUDED
631 measurementMgr_stopTsMetrics(pQosMngr->hMeasurementMngr);
632 #endif
633
634 return OK;
635 }
636
637
638 /************************************************************************
639 * qosMngr_connect *
640 ************************************************************************
641 DESCRIPTION: the function is called upon driver connection to inform all
642 the other modules about the voice mode
643
644 INPUT: hQosMngr - Qos Manager handle.
645
646 OUTPUT:
647
648 RETURN: OK on success, NOK otherwise
649
650 ************************************************************************/
651
qosMngr_connect(TI_HANDLE hQosMngr)652 TI_STATUS qosMngr_connect(TI_HANDLE hQosMngr)
653 {
654 qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
655 psPollTemplate_t psPollTemplate;
656 whalCtrl_setTemplate_t templateStruct;
657 QosNullDataTemplate_t QosNullDataTemplate;
658 UINT8 acID,UPSDCnt=0;
659
660 if (pQosMngr->isConnected == TRUE)
661 {
662 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG, ("qosMngr_connect : Already connected !!!\n"));
663 return OK;
664 }
665
666 /* Send PsPoll template to HAL */
667
668 templateStruct.pTemplate = (UINT8 *)&psPollTemplate;
669 templateStruct.templateType = PS_POLL_TEMPLATE;
670 buildPsPollTemplate(pQosMngr->hSiteMgr, &templateStruct);
671 whalCtrl_SetTemplate(pQosMngr->hHalCtrl, &templateStruct);
672
673 /* Update our internal state */
674 pQosMngr->isConnected = TRUE;
675
676 /* Set Qos-Null Data template into firmware */
677 for(acID = FIRST_AC_INDEX;acID < MAX_NUM_OF_AC; acID++)
678 {
679 /* Set QOS Null data template into the firmware (only if at least one AC is configured as UPSD )*/
680 if (pQosMngr->acParams[acID].currentWmeAcPsMode == PS_SCHEME_UPSD_TRIGGER)
681 {
682 UPSDCnt++;
683 if ( pQosMngr->acParams[acID].apInitAdmissionState != ADMISSION_REQUIRED )
684 {
685 pQosMngr->QosNullDataTemplateUserPriority = wmeAcToUpIndex[acID];
686
687 templateStruct.pTemplate = (UINT8 *)&QosNullDataTemplate;
688 templateStruct.templateType = QOS_NULL_DATA_TEMPLATE;
689 buildQosNullDataTemplate(pQosMngr->hSiteMgr, &templateStruct,pQosMngr->QosNullDataTemplateUserPriority);
690 whalCtrl_SetTemplate(pQosMngr->hHalCtrl, &templateStruct);
691
692 WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
693 ("setWmeSiteParams: Setting QOS Null data for UserPriority %d (belongs to AC %d)\n",wmeAcToUpIndex[acID],acID));
694
695 break; /* Only need to set ONE template, so after setting it, we can exit the loop */
696 }
697 }
698
699 }
700
701 /* If MAX_NUM_OF_AC (4) ACs were found as UPSD, but we still haven't configured any UP in the Qos Null data template, it must mean all ACs require admission - not valid*/
702 if ((pQosMngr->QosNullDataTemplateUserPriority == 0xFF) && (UPSDCnt == MAX_NUM_OF_AC))
703 {
704 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG, ("qosMngr_connect : QOS Null Data template not set since all ACs require admission !!!\n"));
705 }
706
707 return OK;
708 }
709
710 /************************************************************************
711 * qosMngr_evalSite *
712 ************************************************************************
713 DESCRIPTION: Evaluate the site for the selction algorithm
714 In case the station is configure to work in UPSD mode
715 prefer a site that support UPSD and return 1.
716 All other case return 0.
717
718 INPUT: siteAPSDSupport - the UPSD capabilit of the site
719
720 OUTPUT:
721
722 RETURN: 1 - evaluation is good...
723 0 - evaluation can be better....
724
725 ************************************************************************/
qosMngr_evalSite(TI_HANDLE hQosMngr,BOOL siteAPSDSupport)726 UINT8 qosMngr_evalSite(TI_HANDLE hQosMngr, BOOL siteAPSDSupport)
727 {
728 qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
729
730 if (pQosMngr->desiredPsMode == PS_SCHEME_UPSD_TRIGGER && siteAPSDSupport)
731 {
732 return 1;
733 }
734
735 return 0;
736 }
737
738 /************************************************************************
739 * qosMngr_getParamsPatial *
740 ************************************************************************
741 DESCRIPTION: The function is an API for external modules to qet qos parameters
742
743 INPUT: hQosMngr - Qos Manager handle.
744 pParamInfo - qos parameters information.
745
746
747 OUTPUT:
748
749 RETURN: OK on success, NOK otherwise
750
751 ************************************************************************/
752
qosMngr_getParamsPatial(TI_HANDLE hQosMngr,paramInfoPartial_t * pParamInfo)753 TI_STATUS qosMngr_getParamsPatial(TI_HANDLE hQosMngr,paramInfoPartial_t *pParamInfo)
754 {
755 qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
756
757 if(pQosMngr == NULL)
758 return NOK;
759
760 WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG, ("qosMngr_getParams: %x\n", pParamInfo->paramType));
761
762 switch(pParamInfo->paramType)
763 {
764
765 case QOS_MNGR_VOICE_RE_NEGOTIATE_TSPEC:
766 /* Check if voice call present. If so, store current TSPEC configuration */
767 pParamInfo->content.TspecConfigure.voiceTspecConfigure = (UINT8)pQosMngr->voiceTspecConfigured;
768 pParamInfo->content.TspecConfigure.videoTspecConfigure = (UINT8)pQosMngr->videoTspecConfigured;
769
770 WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG, ("qosMngr_getParams: QOS_MNGR_VOICE_RE_NEGOTIATE_TSPEC=%d\n", pQosMngr->voiceTspecConfigured));
771
772 if (pQosMngr->voiceTspecConfigured == TRUE)
773 {
774 OS_802_11_QOS_TSPEC_PARAMS *pTspecParams;
775 tspecInfo_t *pConfiguredParams;
776
777 /* Store voice TSPEC params - must be configured */
778 pTspecParams = &pQosMngr->tspecRenegotiationParams[USER_PRIORITY_6];
779 pConfiguredParams = &pQosMngr->resourceMgmtTable.candidateTspecInfo[USER_PRIORITY_6];
780
781 pTspecParams->uUserPriority = pConfiguredParams->userPriority;
782 pTspecParams->uNominalMSDUsize = pConfiguredParams->nominalMsduSize;
783 pTspecParams->uMeanDataRate = pConfiguredParams->meanDataRate;
784 pTspecParams->uMinimumPHYRate = pConfiguredParams->minimumPHYRate;
785 pTspecParams->uSurplusBandwidthAllowance = pConfiguredParams->surplausBwAllowance;
786 pTspecParams->uAPSDFlag = pConfiguredParams->UPSDFlag;
787 pTspecParams->uMediumTime = pConfiguredParams->mediumTime;
788 }
789 else
790 {
791 pQosMngr->tspecRenegotiationParams[USER_PRIORITY_6].uUserPriority = MAX_USER_PRIORITY;
792 }
793
794 if (pQosMngr->videoTspecConfigured == TRUE)
795 {
796 OS_802_11_QOS_TSPEC_PARAMS *pTspecParams;
797 tspecInfo_t *pConfiguredParams;
798
799 /* Store signalling TSPEC params if configured in user priority 4 */
800 pTspecParams = &pQosMngr->tspecRenegotiationParams[USER_PRIORITY_4];
801 pConfiguredParams = &pQosMngr->resourceMgmtTable.candidateTspecInfo[USER_PRIORITY_4];
802
803 pTspecParams->uUserPriority = pConfiguredParams->userPriority;
804 pTspecParams->uNominalMSDUsize = pConfiguredParams->nominalMsduSize;
805 pTspecParams->uMeanDataRate = pConfiguredParams->meanDataRate;
806 pTspecParams->uMinimumPHYRate = pConfiguredParams->minimumPHYRate;
807 pTspecParams->uSurplusBandwidthAllowance = pConfiguredParams->surplausBwAllowance;
808 pTspecParams->uAPSDFlag = pConfiguredParams->UPSDFlag;
809 pTspecParams->uMediumTime = pConfiguredParams->mediumTime;
810 }
811 else
812 {
813 pQosMngr->tspecRenegotiationParams[USER_PRIORITY_4].uUserPriority = MAX_USER_PRIORITY;
814 }
815 break;
816
817 default:
818 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
819 ("qosMngr_getParamsExtend Error: unknown paramType 0x%x!\n",pParamInfo->paramType));
820 return (PARAM_NOT_SUPPORTED);
821
822 }
823 return OK;
824 }
825
826 /************************************************************************
827 * qosMngr_getACparams *
828 ************************************************************************
829 DESCRIPTION: The function is an API for external modules to qet qos parameters
830
831 INPUT: hQosMngr - Qos Manager handle.
832 pParamInfo - qos parameters information.
833
834
835 OUTPUT:
836
837 RETURN: OK on success, NOK otherwise
838
839 ************************************************************************/
840
qosMngr_getParams(TI_HANDLE hQosMngr,paramInfo_t * pParamInfo)841 TI_STATUS qosMngr_getParams(TI_HANDLE hQosMngr,paramInfo_t *pParamInfo)
842 {
843 acTrfcType_e acID;
844 qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
845
846 if(pQosMngr == NULL)
847 return NOK;
848
849 WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG, ("qosMngr_getParams: %x\n", pParamInfo->paramType));
850
851 switch(pParamInfo->paramType)
852 {
853 case QOS_PACKET_BURST_ENABLE:
854 pParamInfo->content.qosPacketBurstEnb = pQosMngr->qosPacketBurstEnable;
855 break;
856 case QOS_MNGR_CURRENT_PS_MODE:
857 pParamInfo->content.currentPsMode = pQosMngr->currentPsMode;
858 break;
859
860 case QOS_MNGR_ACTIVE_PROTOCOL:
861 pParamInfo->content.qosSiteProtocol = pQosMngr->activeProtocol;
862 break;
863
864 case QOS_MNGR_GET_DESIRED_PS_MODE:
865 pParamInfo->content.qosDesiredPsMode.uDesiredPsMode = pQosMngr->desiredPsMode;
866 for(acID = FIRST_AC_INDEX; acID < MAX_NUM_OF_AC ; acID++ )
867 pParamInfo->content.qosDesiredPsMode.uDesiredWmeAcPsMode[acID] = pQosMngr->acParams[acID].desiredWmeAcPsMode;
868 break;
869
870 case QOS_MNGR_VOICE_RE_NEGOTIATE_TSPEC:
871 /* Check if voice call present. If so, store current TSPEC configuration */
872 pParamInfo->content.TspecConfigure.voiceTspecConfigure = (UINT8)pQosMngr->voiceTspecConfigured;
873 pParamInfo->content.TspecConfigure.videoTspecConfigure = (UINT8)pQosMngr->videoTspecConfigured;
874
875 WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG, ("qosMngr_getParams: QOS_MNGR_VOICE_RE_NEGOTIATE_TSPEC=%d\n", pQosMngr->voiceTspecConfigured));
876
877 if (pQosMngr->voiceTspecConfigured == TRUE)
878 {
879 OS_802_11_QOS_TSPEC_PARAMS *pTspecParams;
880 tspecInfo_t *pConfiguredParams;
881
882 /* Store voice TSPEC params - must be configured */
883 pTspecParams = &pQosMngr->tspecRenegotiationParams[USER_PRIORITY_6];
884 pConfiguredParams = &pQosMngr->resourceMgmtTable.candidateTspecInfo[USER_PRIORITY_6];
885
886 pTspecParams->uUserPriority = pConfiguredParams->userPriority;
887 pTspecParams->uNominalMSDUsize = pConfiguredParams->nominalMsduSize;
888 pTspecParams->uMeanDataRate = pConfiguredParams->meanDataRate;
889 pTspecParams->uMinimumPHYRate = pConfiguredParams->minimumPHYRate;
890 pTspecParams->uSurplusBandwidthAllowance = pConfiguredParams->surplausBwAllowance;
891 pTspecParams->uAPSDFlag = pConfiguredParams->UPSDFlag;
892 pTspecParams->uMediumTime = pConfiguredParams->mediumTime;
893 }
894 else
895 {
896 pQosMngr->tspecRenegotiationParams[USER_PRIORITY_6].uUserPriority = MAX_USER_PRIORITY;
897 }
898
899 if (pQosMngr->videoTspecConfigured == TRUE)
900 {
901 OS_802_11_QOS_TSPEC_PARAMS *pTspecParams;
902 tspecInfo_t *pConfiguredParams;
903
904 /* Store signalling TSPEC params if configured in user priority 4 */
905 pTspecParams = &pQosMngr->tspecRenegotiationParams[USER_PRIORITY_4];
906 pConfiguredParams = &pQosMngr->resourceMgmtTable.candidateTspecInfo[USER_PRIORITY_4];
907
908 pTspecParams->uUserPriority = pConfiguredParams->userPriority;
909 pTspecParams->uNominalMSDUsize = pConfiguredParams->nominalMsduSize;
910 pTspecParams->uMeanDataRate = pConfiguredParams->meanDataRate;
911 pTspecParams->uMinimumPHYRate = pConfiguredParams->minimumPHYRate;
912 pTspecParams->uSurplusBandwidthAllowance = pConfiguredParams->surplausBwAllowance;
913 pTspecParams->uAPSDFlag = pConfiguredParams->UPSDFlag;
914 pTspecParams->uMediumTime = pConfiguredParams->mediumTime;
915 }
916 else
917 {
918 pQosMngr->tspecRenegotiationParams[USER_PRIORITY_4].uUserPriority = MAX_USER_PRIORITY;
919 }
920 break;
921
922 default:
923 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
924 ("qosMngr_getParams Error: unknown paramType 0x%x!\n",pParamInfo->paramType));
925 return (PARAM_NOT_SUPPORTED);
926 /* break; - unreachable */
927
928 }
929 return OK;
930 }
931
932 /************************************************************************
933 * qosMngr_setParams *
934 ************************************************************************
935 DESCRIPTION: The function is an API for external modules to set qos parameters
936
937 INPUT: hQosMngr - Qos Manager handle.
938 pParamInfo - qos parameters information.
939
940
941 OUTPUT:
942
943 RETURN: OK on success, NOK otherwise
944
945 ************************************************************************/
946
qosMngr_setParams(TI_HANDLE hQosMngr,paramInfo_t * pParamInfo)947 TI_STATUS qosMngr_setParams(TI_HANDLE hQosMngr,paramInfo_t *pParamInfo)
948 {
949 qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
950 paramInfo_t param;
951 whalParamInfo_t whalParam;
952 acTrfcType_e acID;
953 TI_STATUS status;
954
955 if(pQosMngr == NULL)
956 return NOK;
957
958 if(pParamInfo == NULL)
959 {
960 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
961 ("qosMngr_setParams :Error trying to set NULL params!\n"));
962 return NOK;
963 }
964
965 WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG, ("qosMngr_setParams: %x\n", pParamInfo->paramType));
966
967 switch(pParamInfo->paramType)
968 {
969
970 case QOS_PACKET_BURST_ENABLE:
971
972 if (pParamInfo->content.qosPacketBurstEnb > QOS_PACKET_BURST_ENABLE_MAX)
973 return (PARAM_VALUE_NOT_VALID);
974
975 /* No change */
976 if (pParamInfo->content.qosPacketBurstEnb == pQosMngr->qosPacketBurstEnable)
977 return OK;
978
979 /* Update the qosPacketBurstEnable parameter */
980 pQosMngr->qosPacketBurstEnable = pParamInfo->content.qosPacketBurstEnb;
981
982 /* Packet burst enable changed from F to T */
983 if (pParamInfo->content.qosPacketBurstEnb == TRUE)
984 {
985 /* Update the acTrafficInitParams of BE to the packet burst def*/
986 pQosMngr->acParams[QOS_AC_BE].acQosInitParams.txopLimit = pQosMngr->qosPacketBurstTxOpLimit;
987
988 /* Update the acTrafficParams of BE and the hal to the packet burst def*/
989 if (pQosMngr->activeProtocol == NONE_QOS)
990 {
991 pQosMngr->acParams[QOS_AC_BE].acQosParams.txopLimit = pQosMngr->qosPacketBurstTxOpLimit;
992 /* verify the parameters and update the hal */
993 status = verifyAndConfigQosParams(hQosMngr,&(pQosMngr->acParams[QOS_AC_BE].acQosParams));
994 if(status != OK)
995 return status;
996 }
997 }
998
999 /* Packet burst enable changed from T to F*/
1000 else
1001 {
1002 /* Update the acTrafficInitParams of BE to the AC def*/
1003 pQosMngr->acParams[QOS_AC_BE].acQosInitParams.txopLimit = QOS_TX_OP_LIMIT_DEF;
1004
1005 /* Update the acTrafficParams of BE and the hal to the AC def*/
1006 if (pQosMngr->activeProtocol == NONE_QOS)
1007 {
1008 pQosMngr->acParams[QOS_AC_BE].acQosParams.txopLimit = QOS_TX_OP_LIMIT_DEF;
1009 /* verify the parameters and update the hal */
1010 status = verifyAndConfigQosParams(hQosMngr,&(pQosMngr->acParams[QOS_AC_BE].acQosParams));
1011 if(status != OK)
1012 return status;
1013 }
1014 }
1015 break;
1016
1017 case QOS_MNGR_SET_SITE_PROTOCOL:
1018 if(pParamInfo->content.qosSiteProtocol == WME)
1019 pQosMngr->WMESiteSupport = TRUE;
1020 else
1021 pQosMngr->WMESiteSupport = FALSE;
1022 break;
1023
1024 case QOS_MNGR_SET_OS_PARAMS:
1025 if((acTrfcType_e)pParamInfo->content.qosOsParams.acID > QOS_HIGHEST_AC_INDEX)
1026 {
1027 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1028 ("qosMngr_setParams :Error trying to set invalid acId: %d param",pParamInfo->content.qosOsParams.acID));
1029
1030 return (PARAM_VALUE_NOT_VALID);
1031 }
1032
1033 if((pParamInfo->content.qosOsParams.VoiceDeliveryProtocol != TRUE) && (pParamInfo->content.qosOsParams.VoiceDeliveryProtocol != FALSE))
1034 {
1035 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1036 ("qosMngr_setParams :Error trying to set invalid VoiceDeliveryProtocol: %d param",pParamInfo->content.qosOsParams.VoiceDeliveryProtocol));
1037
1038 return (PARAM_VALUE_NOT_VALID);
1039 }
1040
1041 if((pParamInfo->content.qosOsParams.VoiceDeliveryProtocol == TRUE) && ((PSScheme_e)pParamInfo->content.qosOsParams.PSDeliveryProtocol == PS_SCHEME_UPSD_TRIGGER))
1042 {
1043 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1044 ("qosMngr_setParams Error: trying to set invalid VoiceDeliveryProtocol == PS_POLL and PSDeliveryProtocol = UPSD\n"));
1045
1046 return (PARAM_VALUE_NOT_VALID);
1047 }
1048
1049 if((pParamInfo->content.qosOsParams.VoiceDeliveryProtocol == TRUE) && ((acTrfcType_e)pParamInfo->content.qosOsParams.acID != QOS_AC_VO))
1050 {
1051 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1052 ("qosMngr_setParams Error: trying to set invalid VoiceDeliveryProtocol == PS_POLL and AC != VOICE \n"));
1053
1054 return (PARAM_VALUE_NOT_VALID);
1055 }
1056
1057 if(((PSScheme_e)pParamInfo->content.qosOsParams.PSDeliveryProtocol != PS_SCHEME_LEGACY_PSPOLL) && ((PSScheme_e)pParamInfo->content.qosOsParams.PSDeliveryProtocol != PS_SCHEME_UPSD_TRIGGER))
1058 {
1059 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1060 ("qosMngr_setParams :Error trying to set invalid PSDeliveryProtocol: %d param\n",pParamInfo->content.qosOsParams.PSDeliveryProtocol));
1061
1062 return (PARAM_VALUE_NOT_VALID);
1063 }
1064
1065 /* config tidConf */
1066 acID = (acTrfcType_e)pParamInfo->content.qosOsParams.acID;
1067
1068 /* Convert TRUE/FALSE setting (from Utility Adapter) to PS_POLL or PS_NONE settings */
1069 if (pParamInfo->content.qosOsParams.VoiceDeliveryProtocol == FALSE)
1070 {
1071 pParamInfo->content.qosOsParams.VoiceDeliveryProtocol = PS_SCHEME_LEGACY;
1072 }
1073 if (pParamInfo->content.qosOsParams.VoiceDeliveryProtocol == TRUE)
1074 {
1075 pParamInfo->content.qosOsParams.VoiceDeliveryProtocol = PS_SCHEME_LEGACY_PSPOLL;
1076 }
1077
1078
1079 if( (pParamInfo->content.qosOsParams.PSDeliveryProtocol != pQosMngr->acParams[acID].desiredWmeAcPsMode) &&
1080 (pQosMngr->isConnected == TRUE) )
1081 {
1082 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1083 ("qosMngr_setParams :Error trying to set new PS protocol while connected"));
1084
1085 return (PARAM_VALUE_NOT_VALID);
1086 }
1087
1088
1089 /* UPSD_FW open in upsd integration */
1090 /* set the current PS mode. In not connected state it is always Legacy since the currentPsMode only
1091 update after connection */
1092 pQosMngr->acParams[acID].QtrafficParams.psScheme = pQosMngr->acParams[acID].currentWmeAcPsMode;
1093 pQosMngr->acParams[acID].msduLifeTimeParam = pParamInfo->content.qosOsParams.MaxLifeTime;
1094
1095 status = verifyAndConfigTrafficParams(pQosMngr,&(pQosMngr->acParams[acID].QtrafficParams));
1096 if(status != OK)
1097 return status;
1098
1099 /* set txData Voice Delivery Protocol mode */
1100 if(acID == QOS_AC_VO)
1101 pQosMngr->desiredVoiceDeliveryProtocol = pParamInfo->content.qosOsParams.VoiceDeliveryProtocol;
1102
1103 param.content.txDataQosParams.acID = acID;
1104 param.content.txDataQosParams.acTrfcCtrl.PsMode = pParamInfo->content.qosOsParams.VoiceDeliveryProtocol;
1105 param.paramType = TX_DATA_PS_MODE_PARAM;
1106 txData_setParam(pQosMngr->hTxData,¶m);
1107
1108 param.content.txDataQosParams.acTrfcCtrl.MsduLifeTime = pParamInfo->content.qosOsParams.MaxLifeTime;
1109 param.paramType = TX_DATA_CONFIG_AC_MSDU_LIFE_TIME;
1110 txData_setParam(pQosMngr->hTxData,¶m);
1111
1112 /* synch psPoll mode with qosMngr */
1113 /* Update the PsMode parameter */
1114 pQosMngr->acParams[acID].desiredWmeAcPsMode = pParamInfo->content.qosOsParams.PSDeliveryProtocol;
1115 break;
1116
1117 case QOS_MNGR_CURRENT_PS_MODE:
1118 if( (pQosMngr->activeProtocol == WME) && (pQosMngr->desiredPsMode == PS_SCHEME_UPSD_TRIGGER) && (pParamInfo->content.currentPsMode == PS_SCHEME_UPSD_TRIGGER) )
1119 pQosMngr->currentPsMode = PS_SCHEME_UPSD_TRIGGER;
1120 else
1121 pQosMngr->currentPsMode = PS_SCHEME_LEGACY_PSPOLL;
1122 break;
1123
1124 case QOS_MNGR_ADD_TSPEC_REQUEST:
1125 pQosMngr->TSPECNegotiationResultCallb = NULL;
1126 pQosMngr->TSPECNegotiationResultModule = NULL;
1127 return (qosMngr_requestAdmission(hQosMngr, &pParamInfo->content.qosAddTspecRequest));
1128 /* break; - unreachable */
1129
1130 case QOS_MNGR_RESEND_TSPEC_REQUEST:
1131 WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1132 ("qosMngr_setParams: QOS_MNGR_RESEND_TSPEC_REQUEST\n"));
1133 pQosMngr->TSPECNegotiationResultCallb = (qosMngrCallb_t)pParamInfo->content.qosRenegotiateTspecRequest.callback;
1134 pQosMngr->TSPECNegotiationResultModule = pParamInfo->content.qosRenegotiateTspecRequest.handler;
1135 status = qosMngr_requestAdmission(hQosMngr, &pQosMngr->tspecRenegotiationParams[USER_PRIORITY_6]);
1136
1137 if ((status == OK) && (pQosMngr->tspecRenegotiationParams[USER_PRIORITY_4].uUserPriority != MAX_USER_PRIORITY))
1138 {
1139 status = qosMngr_requestAdmission(hQosMngr, &pQosMngr->tspecRenegotiationParams[USER_PRIORITY_4]);
1140 }
1141 return (status);
1142 /* break; - unreachable */
1143
1144 case QOS_MNGR_DEL_TSPEC_REQUEST:
1145 return (qosMngr_deleteAdmission(hQosMngr, &pParamInfo->content.qosDelTspecRequest));
1146 /* break; - unreachable */
1147
1148 case QOS_MNGR_AC_STATUS:
1149 return (qosMngr_getCurrAcStatus (hQosMngr,&pParamInfo->content.qosCurrentAcStatus));
1150 /* break; - unreachable */
1151
1152 case QOS_MNGR_AP_QOS_PARAMETERS: /* API GetAPQosParameters */
1153 acID = (acTrfcType_e) pParamInfo->content.qosApQosParams.uAC;
1154
1155 if(acID > QOS_HIGHEST_AC_INDEX)
1156 {
1157 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1158 ("qosMngr_setParams :Error trying to set invalid acId: %d param\n",pParamInfo->content.qosApQosParams.uAC));
1159
1160 return (PARAM_VALUE_NOT_VALID);
1161 }
1162 if(pQosMngr->isConnected == FALSE)
1163 {
1164 return NOT_CONNECTED;
1165 }
1166 if(pQosMngr->activeProtocol == NONE_QOS)
1167 {
1168 return NO_QOS_AP;
1169 }
1170
1171 pParamInfo->content.qosApQosParams.uAssocAdmissionCtrlFlag = pQosMngr->acParams[acID].apInitAdmissionState; /* admission flag */
1172 pParamInfo->content.qosApQosParams.uAIFS = pQosMngr->acParams[acID].acQosParams.aifsn;
1173 pParamInfo->content.qosApQosParams.uCwMin = (1 << pQosMngr->acParams[acID].acQosParams.cwMin)-1;
1174 pParamInfo->content.qosApQosParams.uCwMax = (1 << pQosMngr->acParams[acID].acQosParams.cwMax)-1;
1175 pParamInfo->content.qosApQosParams.uTXOPLimit = pQosMngr->acParams[acID].acQosParams.txopLimit << 5;
1176
1177 break;
1178
1179 case QOS_MNGR_OS_TSPEC_PARAMS:
1180
1181 if( pParamInfo->content.qosTspecParameters.uUserPriority > MAX_USER_PRIORITY )
1182 {
1183 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1184 ("qosMngr_getTspecParams: userPriority > 7 -> Ignore !!!\n"));
1185 return NOK;
1186 }
1187
1188 if(pQosMngr->isConnected == FALSE)
1189 {
1190 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1191 ("qosMngr_getTspecParams: Not connected - Ignoring request !!!\n"));
1192 return NOT_CONNECTED;
1193 }
1194
1195 if(pQosMngr->activeProtocol == NONE_QOS)
1196 {
1197 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1198 ("qosMngr_getTspecParams: Not connected to QOS AP - Ignoring reqeust !!!\n"));
1199 return NO_QOS_AP;
1200 }
1201
1202 acID = (acTrfcType_e)WMEQosTagToACTable[pParamInfo->content.qosTspecParameters.uUserPriority];
1203
1204 /* check if signaling is already in process*/
1205 if(pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].trafficAdmState == AC_WAIT_ADMISSION)
1206 {
1207 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,("qosMngr_requestAdmission: AC = %d , TSPEC Signaling is in progress -> Ignoring request !!!\n",acID));
1208 return TRAFIC_ADM_PENDING;
1209 }
1210
1211 /* check if UP is admitted or not */
1212 if(pQosMngr->resourceMgmtTable.currentTspecInfo[acID].userPriority != pParamInfo->content.qosTspecParameters.uUserPriority)
1213 {
1214 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1215 ("qosMngr_getTspecParams: user priority is not admitted. -> Ignore !!!\n"));
1216 return USER_PRIORITY_NOT_ADMITTED;
1217 }
1218
1219 pParamInfo->content.qosTspecParameters.uMeanDataRate = pQosMngr->resourceMgmtTable.currentTspecInfo[acID].meanDataRate;
1220 pParamInfo->content.qosTspecParameters.uNominalMSDUsize = pQosMngr->resourceMgmtTable.currentTspecInfo[acID].nominalMsduSize;
1221 pParamInfo->content.qosTspecParameters.uAPSDFlag = pQosMngr->resourceMgmtTable.currentTspecInfo[acID].UPSDFlag;
1222 pParamInfo->content.qosTspecParameters.uMinimumPHYRate = pQosMngr->resourceMgmtTable.currentTspecInfo[acID].minimumPHYRate;
1223 pParamInfo->content.qosTspecParameters.uSurplusBandwidthAllowance = pQosMngr->resourceMgmtTable.currentTspecInfo[acID].surplausBwAllowance;
1224 pParamInfo->content.qosTspecParameters.uMediumTime = pQosMngr->resourceMgmtTable.currentTspecInfo[acID].mediumTime;
1225 break;
1226
1227 case QOS_SET_RATE_THRESHOLD:
1228
1229 ctrlData_setTspecsRateThresholds(pQosMngr->hCtrlData,
1230 (UINT8)pParamInfo->content.QOSRateThreshold.uAC,
1231 (UINT8)pParamInfo->content.QOSRateThreshold.uHighThreshold,
1232 (UINT8)pParamInfo->content.QOSRateThreshold.uLowThreshold);
1233
1234
1235 /* If currently connected to a QOS AP , need to enable the TSPEc event upon the setting of the thresholds */
1236 if(pQosMngr->activeProtocol == WME)
1237 {
1238 ctrlData_setTspecsRateEvent(pQosMngr->hCtrlData, (UINT8)pParamInfo->content.QOSRateThreshold.uAC, TRUE);
1239 }
1240
1241 break;
1242
1243 case QOS_GET_RATE_THRESHOLD:
1244
1245 /* SET operation is performed, but actually this is only for AC parameter transfer from Utility Adapter to driver, since copy
1246 of user supplied block of data (and vice versa) is only performed in SetParam calls, the driver can also modify the supplied
1247 structure and thus return it to user mode */
1248 ctrlData_getTspecsRateThresholds(pQosMngr->hCtrlData,
1249 (UINT8)pParamInfo->content.QOSRateThreshold.uAC,
1250 (UINT32*)&pParamInfo->content.QOSRateThreshold.uHighThreshold,
1251 (UINT32*)&pParamInfo->content.QOSRateThreshold.uLowThreshold);
1252
1253 break;
1254
1255 case QOS_SET_RX_TIME_OUT:
1256 if (pParamInfo->content.rxTimeOut.UPSD == 0)
1257 {
1258 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1259 ("%s :Error trying to set invalid zero timeout for UPSD \n",__FUNCTION__));
1260 return PARAM_VALUE_NOT_VALID;
1261
1262 }
1263 pQosMngr->rxTimeOut.psPoll = (UINT16)pParamInfo->content.rxTimeOut.psPoll;
1264 pQosMngr->rxTimeOut.UPSD = (UINT16)pParamInfo->content.rxTimeOut.UPSD;
1265
1266
1267 /* set RxTimeOut to FW */
1268 whalParam.paramType = HAL_CTRL_RX_TIME_OUT_PARAM;
1269 whalParam.content.halCtrlRxTimeOut = pQosMngr->rxTimeOut;
1270 whalCtrl_SetParam(pQosMngr->hHalCtrl,&whalParam);
1271 break;
1272
1273
1274 case QOS_MNGR_VOICE_RE_NEGOTIATE_TSPEC:
1275 if( pParamInfo->content.TspecConfigure.voiceTspecConfigure || pParamInfo->content.TspecConfigure.videoTspecConfigure)
1276 pQosMngr->performTSPECRenegotiation = TRUE;
1277 else
1278 pQosMngr->performTSPECRenegotiation = FALSE;
1279
1280 WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1281 ("qosMngr_setParams: QOS_MNGR_VOICE_RE_NEGOTIATE_TSPEC=%d\n", pQosMngr->performTSPECRenegotiation));
1282 break;
1283
1284 default:
1285 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1286 ("qosMngr_getParams Error: unknown paramType 0x%x!\n",pParamInfo->paramType));
1287 return (PARAM_NOT_SUPPORTED);
1288 /* break; - unreachable */
1289 }
1290
1291 return OK;
1292
1293
1294 }
1295
qosMngr_setParamsPartial(TI_HANDLE hQosMngr,paramInfoPartial_t * pParamInfo)1296 TI_STATUS qosMngr_setParamsPartial(TI_HANDLE hQosMngr,paramInfoPartial_t *pParamInfo)
1297 {
1298 qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
1299
1300 if(pQosMngr == NULL)
1301 return NOK;
1302
1303 if(pParamInfo == NULL)
1304 {
1305 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1306 ("qosMngr_setParams :Error trying to set NULL params!\n"));
1307 return NOK;
1308 }
1309
1310 WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG, ("qosMngr_setParams: %x\n", pParamInfo->paramType));
1311
1312 switch(pParamInfo->paramType)
1313 {
1314 case QOS_MNGR_VOICE_RE_NEGOTIATE_TSPEC:
1315 if( pParamInfo->content.TspecConfigure.voiceTspecConfigure || pParamInfo->content.TspecConfigure.videoTspecConfigure)
1316 pQosMngr->performTSPECRenegotiation = TRUE;
1317 else
1318 pQosMngr->performTSPECRenegotiation = FALSE;
1319
1320 WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1321 ("qosMngr_setParams: QOS_MNGR_VOICE_RE_NEGOTIATE_TSPEC=%d\n", pQosMngr->performTSPECRenegotiation));
1322 break;
1323
1324 default:
1325 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1326 ("qosMngr_getParams Error: unknown paramType 0x%x!\n",pParamInfo->paramType));
1327 return (PARAM_NOT_SUPPORTED);
1328 }
1329
1330 return OK;
1331 }
1332
1333 /************************************************************************
1334 * verifyAndConfigTrafficParams *
1335 ************************************************************************
1336 DESCRIPTION: The function verifies the parameters set by qosMngr to
1337 the queue traffic params in whalCtrl to be configured to TNET.
1338
1339 INPUT: hQosMngr - Qos Manager handle.
1340 pAcTrafficParams - pointer to ac parameters.
1341
1342 OUTPUT:
1343
1344 RETURN: OK on success, NOK otherwise
1345
1346 ************************************************************************/
1347
verifyAndConfigTrafficParams(qosMngr_t * pQosMngr,queueTrafficParams_t * pQtrafficParams)1348 static TI_STATUS verifyAndConfigTrafficParams(qosMngr_t *pQosMngr, queueTrafficParams_t *pQtrafficParams)
1349 {
1350 whalParamInfo_t whalParam;
1351 queueTrafficParams_t queueTrafficParams;
1352
1353 if(pQtrafficParams->queueID > MAX_NUM_OF_TX_QUEUES - 1)
1354 {
1355 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1356 ("verifyAndConfigTrafficParams :Error trying to set invalid queueID: %d param",pQtrafficParams->queueID));
1357
1358 return (PARAM_VALUE_NOT_VALID);
1359 }
1360
1361
1362 if(pQtrafficParams->channelType > MAX_CHANNEL_TYPE)
1363 {
1364 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1365 ("verifyAndConfigTrafficParams :Error trying to set invalid channelType: %d param",pQtrafficParams->channelType));
1366
1367 return (PARAM_VALUE_NOT_VALID);
1368
1369 }
1370
1371 /* TBD */
1372 if(pQtrafficParams->tsid > AC_PARAMS_MAX_TSID)
1373 {
1374 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1375 ("verifyAndConfigTrafficParams :Error trying to set invalid tsid: %d param",pQtrafficParams->tsid));
1376
1377 return (PARAM_VALUE_NOT_VALID);
1378
1379 }
1380
1381
1382 if(pQtrafficParams->psScheme > MAX_PS_SCHEME)
1383 {
1384 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1385 ("verifyAndConfigTrafficParams :Error trying to set invalid psScheme: %d param",pQtrafficParams->psScheme));
1386
1387 return (PARAM_VALUE_NOT_VALID);
1388 }
1389
1390 /* TBD */
1391 #if 0
1392 if(pQtrafficParams->APSDConf > MAX_APSD_CONF)
1393 {
1394 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1395 ("verifyAndConfigTrafficParams :Error trying to set invalid APSDConf: %d param",pQtrafficParams->APSDConf));
1396
1397 return (PARAM_VALUE_NOT_VALID);
1398 }
1399 #endif
1400
1401 if(pQtrafficParams->ackPolicy > MAX_ACK_POLICY)
1402 {
1403 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1404 ("verifyAndConfigTrafficParams :Error trying to set invalid ackPolicy: %d param",pQtrafficParams->ackPolicy));
1405
1406 return (PARAM_VALUE_NOT_VALID);
1407 }
1408
1409 /*
1410 * Convert the QOS PS-scheme enum into the WHAL enum.
1411 * NOTE: need to copy for not to change the QoS configuration
1412 */
1413 queueTrafficParams = *pQtrafficParams;
1414
1415 switch (queueTrafficParams.psScheme)
1416 {
1417 case PS_SCHEME_LEGACY:
1418 queueTrafficParams.psScheme = PS_SCHEME_LEGACY;
1419 break;
1420 case PS_SCHEME_UPSD_TRIGGER:
1421 queueTrafficParams.psScheme = PS_SCHEME_UPSD_TRIGGER;
1422 break;
1423 case PS_SCHEME_LEGACY_PSPOLL:
1424 queueTrafficParams.psScheme = PS_SCHEME_LEGACY;
1425 break;
1426 case PS_SCHEME_SAPSD:
1427 queueTrafficParams.psScheme = PS_SCHEME_SAPSD;
1428 break;
1429 }
1430
1431 whalParam.paramType = HAL_CTRL_QUEUES_PARAMS;
1432 /* set parameters */
1433 whalParam.content.pQueueTrafficParams = &queueTrafficParams;
1434
1435 return(whalCtrl_SetParam(pQosMngr->hHalCtrl, &whalParam));
1436 }
1437
1438 /************************************************************************
1439 * verifyAndConfigQosParams *
1440 ************************************************************************
1441 DESCRIPTION: The function verifies the parameters set by qosMngr to
1442 the AC Qos params in whalCtrl to be configured to TNET.
1443
1444 INPUT: hQosMngr - Qos Manager handle.
1445 pAcTrafficParams - pointer to ac parameters.
1446
1447 OUTPUT:
1448
1449 RETURN: OK on success, NOK otherwise
1450
1451 ************************************************************************/
1452
verifyAndConfigQosParams(qosMngr_t * pQosMngr,acQosParams_t * pAcQosParams)1453 static TI_STATUS verifyAndConfigQosParams(qosMngr_t *pQosMngr,acQosParams_t *pAcQosParams)
1454 {
1455 whalParamInfo_t whalParam;
1456 acQosParams_t acQosParams;
1457
1458 if(pAcQosParams->ac > MAX_NUM_OF_AC - 1 )
1459 {
1460 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1461 ("verifyAndConfigQosParams :Error trying to set invalid ac : %d param",pAcQosParams->ac));
1462
1463 return (PARAM_VALUE_NOT_VALID);
1464 }
1465 /* verification is unnecessary due to limited range of pAcQosParams->aifsn data type (UINT8)
1466 if(pAcQosParams->aifsn > QOS_AIFS_MAX )
1467 {
1468 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1469 ("verifyAndConfigQosParams :Error trying to set invalid aifsn : %d param",pAcQosParams->aifsn));
1470
1471 return (PARAM_VALUE_NOT_VALID);
1472 }
1473 */
1474 if(pAcQosParams->cwMax > QOS_CWMAX_MAX )
1475 {
1476 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1477 ("verifyAndConfigQosParams :Error trying to set invalid cwMax : %d param",pAcQosParams->cwMax));
1478
1479 return (PARAM_VALUE_NOT_VALID);
1480 }
1481
1482 if(pAcQosParams->cwMin > QOS_CWMIN_MAX )
1483 {
1484 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1485 ("verifyAndConfigQosParams :Error trying to set invalid cwMax : %d param",pAcQosParams->cwMax));
1486
1487 return (PARAM_VALUE_NOT_VALID);
1488 }
1489
1490 if(pAcQosParams->txopLimit > QOS_TX_OP_LIMIT_MAX )
1491 {
1492 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1493 ("verifyAndConfigQosParams :Error trying to set invalid txopLimit : %d param",pAcQosParams->txopLimit));
1494
1495 return (PARAM_VALUE_NOT_VALID);
1496 }
1497
1498
1499 whalParam.paramType = HAL_CTRL_AC_PARAMS;
1500
1501 acQosParams.ac = pAcQosParams->ac;
1502 acQosParams.aifsn = pAcQosParams->aifsn;
1503
1504 /* convert to TNET units */
1505 acQosParams.cwMax = (1 << pAcQosParams->cwMax) - 1; /* CwMax = 2^CwMax - 1*/
1506 acQosParams.cwMin = (1 << pAcQosParams->cwMin) - 1; /* CwMin = 2^CwMin - 1*/
1507 acQosParams.txopLimit = pAcQosParams->txopLimit << 5; /* in us */
1508
1509
1510
1511 /* set parameters */
1512 whalParam.content.configureCmdCBParams.CB_buf = (UINT8*)&acQosParams;
1513 whalParam.content.configureCmdCBParams.CB_Func = NULL;
1514 whalParam.content.configureCmdCBParams.CB_handle = NULL;
1515
1516 return whalCtrl_SetParam(pQosMngr->hHalCtrl, &whalParam);
1517 }
1518
1519 /************************************************************************
1520 * qosMngr_selectActiveProtocol *
1521 ************************************************************************
1522 DESCRIPTION: The function is called in order to set the active protocol in
1523 the qosMngr according to site capabilities and desired mode.
1524 called from SystemConfig.
1525
1526 INPUT:
1527
1528 OUTPUT:
1529
1530 RETURN: OK on success, NOK otherwise
1531
1532 ************************************************************************/
qosMngr_selectActiveProtocol(TI_HANDLE hQosMngr)1533 TI_STATUS qosMngr_selectActiveProtocol(TI_HANDLE hQosMngr)
1534 {
1535 qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
1536
1537 /* decide qos protocol */
1538 /* NOTE: if both exc qnd wme supported wme is chosen */
1539 if(pQosMngr->WMESiteSupport && pQosMngr->WMEEnable)
1540 {
1541 pQosMngr->activeProtocol = WME;
1542 }
1543 else
1544 {
1545 pQosMngr->activeProtocol = NONE_QOS;
1546 }
1547 WLAN_REPORT_DEBUG_TX(pQosMngr->hReport,
1548 (" qosMngr_selectActiveProtocol() : pQosMngr->activeProtocol %d\n",pQosMngr->activeProtocol));
1549
1550 return OK;
1551 }
1552
1553 /************************************************************************
1554 * qosMngr_setAcPsDeliveryMode *
1555 ************************************************************************
1556 DESCRIPTION: The function is called in order to set the upsd/ps_poll according
1557 to the desired and current upsd mode (per AC as well).
1558 called from systemConfig.
1559
1560 INPUT:
1561
1562 OUTPUT:
1563
1564 RETURN: OK on success, NOK otherwise
1565
1566 ************************************************************************/
qosMngr_setAcPsDeliveryMode(TI_HANDLE hQosMngr)1567 TI_STATUS qosMngr_setAcPsDeliveryMode(TI_HANDLE hQosMngr)
1568 {
1569 UINT8 acID;
1570 qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
1571
1572 /* in case the current PS mode is not UPSD - the IE is empty */
1573 if(pQosMngr->currentPsMode == PS_SCHEME_UPSD_TRIGGER)
1574 {
1575 for(acID = FIRST_AC_INDEX;acID < MAX_NUM_OF_AC; acID++)
1576 {
1577 if(pQosMngr->acParams[acID].desiredWmeAcPsMode == PS_SCHEME_UPSD_TRIGGER)
1578 {
1579 pQosMngr->acParams[acID].currentWmeAcPsMode = PS_SCHEME_UPSD_TRIGGER;
1580 }
1581 }
1582 }
1583 else {
1584 paramInfo_t param;
1585
1586 // Setting params for PS Poll mode
1587 // This was done to enable voice delivery protocol when the AP doesn't
1588 // support UASPD.
1589 // Note these values have been taken from the default value table in
1590 // TiCtrl.c -- see TiUAPSDConfig()
1591
1592 os_memoryZero( pQosMngr->hOs, ¶m, sizeof(paramInfo_t) );
1593 param.paramType = QOS_MNGR_SET_OS_PARAMS;
1594
1595 // Setting AC Best Effort settings
1596 param.content.qosOsParams.acID = QOS_AC_BE;
1597 param.content.qosOsParams.MaxLifeTime = 512;
1598 param.content.qosOsParams.VoiceDeliveryProtocol = FALSE;
1599 param.content.qosOsParams.PSDeliveryProtocol = PS_SCHEME_LEGACY_PSPOLL;
1600 qosMngr_setParams( pQosMngr, ¶m );
1601
1602
1603 // Setting AC Background settings
1604 param.content.qosOsParams.acID = QOS_AC_BK;
1605 param.content.qosOsParams.MaxLifeTime = 100;
1606 param.content.qosOsParams.VoiceDeliveryProtocol = FALSE;
1607 param.content.qosOsParams.PSDeliveryProtocol = PS_SCHEME_LEGACY_PSPOLL;
1608 qosMngr_setParams( pQosMngr, ¶m );
1609
1610
1611 // Setting AC Video settings
1612 param.content.qosOsParams.acID = QOS_AC_VI;
1613 param.content.qosOsParams.MaxLifeTime = 100;
1614 param.content.qosOsParams.VoiceDeliveryProtocol = FALSE;
1615 param.content.qosOsParams.PSDeliveryProtocol = PS_SCHEME_LEGACY_PSPOLL;
1616 qosMngr_setParams( pQosMngr, ¶m );
1617
1618 // Setting AC Voice settings
1619 param.content.qosOsParams.acID = QOS_AC_VO;
1620 param.content.qosOsParams.MaxLifeTime = 60;
1621 param.content.qosOsParams.VoiceDeliveryProtocol = TRUE;
1622 param.content.qosOsParams.PSDeliveryProtocol = PS_SCHEME_LEGACY_PSPOLL;
1623 qosMngr_setParams( pQosMngr, ¶m );
1624 }
1625
1626 return OK;
1627
1628 }
1629
1630
1631 /************************************************************************
1632 * qosMngr_getQosCapabiltyInfeElement *
1633 ************************************************************************
1634 DESCRIPTION: The function is called in order to build the Qos Capability
1635 IE for the associatiomn request.
1636
1637 INPUT:
1638
1639 OUTPUT:
1640
1641 RETURN: OK on success, NOK otherwise
1642
1643 ************************************************************************/
qosMngr_getQosCapabiltyInfeElement(TI_HANDLE hQosMngr,UINT8 * pQosIe,UINT8 * pLen)1644 TI_STATUS qosMngr_getQosCapabiltyInfeElement(TI_HANDLE hQosMngr, UINT8 *pQosIe, UINT8 *pLen)
1645 {
1646 qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
1647 dot11_QOS_CAPABILITY_IE_t *dot11_QOS_CAPABILITY_IE = (dot11_QOS_CAPABILITY_IE_t *)pQosIe;
1648 TI_STATUS status = OK;
1649 UINT8 extraIeLen = 0;
1650
1651 if(pQosMngr->activeProtocol == WME)
1652 {
1653 dot11_QOS_CAPABILITY_IE->hdr.eleId = DOT11_QOS_CAPABILITY_ELE_ID;
1654 dot11_QOS_CAPABILITY_IE->hdr.eleLen = DOT11_QOS_CAPABILITY_ELE_LEN;
1655
1656 /* The default configuration of QoS info Field is legacy PS for all ACs */
1657 dot11_QOS_CAPABILITY_IE->QosInfoField = 0;
1658
1659 /* in case the current PS mode is not UPSD - the IE is empty */
1660 if(pQosMngr->currentPsMode == PS_SCHEME_UPSD_TRIGGER)
1661 {
1662 if(pQosMngr->acParams[QOS_AC_VO].currentWmeAcPsMode == PS_SCHEME_UPSD_TRIGGER)
1663 {
1664 dot11_QOS_CAPABILITY_IE->QosInfoField |= (1 << AC_VO_APSD_FLAGS_SHIFT);
1665 }
1666 if(pQosMngr->acParams[QOS_AC_VI].currentWmeAcPsMode == PS_SCHEME_UPSD_TRIGGER)
1667 {
1668 dot11_QOS_CAPABILITY_IE->QosInfoField |= (1 << AC_VI_APSD_FLAGS_SHIFT);
1669 }
1670
1671 if(pQosMngr->acParams[QOS_AC_BK].currentWmeAcPsMode == PS_SCHEME_UPSD_TRIGGER)
1672 {
1673 dot11_QOS_CAPABILITY_IE->QosInfoField |= (1 << AC_BK_APSD_FLAGS_SHIFT);
1674 }
1675
1676 if(pQosMngr->acParams[QOS_AC_BE].currentWmeAcPsMode == PS_SCHEME_UPSD_TRIGGER)
1677 {
1678 dot11_QOS_CAPABILITY_IE->QosInfoField |= (1 << AC_BE_APSD_FLAGS_SHIFT);
1679 }
1680
1681 dot11_QOS_CAPABILITY_IE->QosInfoField |= (((pQosMngr->desiredMaxSpLen) & MAX_SP_LENGTH_MASK) << MAX_SP_LENGTH_SHIFT);
1682
1683 WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1684 ("dot11_QOS_CAPABILITY_IE->QosInfoField = 0x%x\n",dot11_QOS_CAPABILITY_IE->QosInfoField));
1685 }
1686
1687 *pLen = dot11_QOS_CAPABILITY_IE->hdr.eleLen + sizeof(dot11_eleHdr_t);
1688
1689 #ifdef EXC_MODULE_INCLUDED
1690 /* If required, add exc info-elements to the association request packets */
1691 if (pQosMngr->performTSPECRenegotiation == TRUE)
1692 {
1693 WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1694 ("qosMngr_getQosCapabiltyInfeElement: performing TSPEC renegotiation\n"));
1695
1696 status = excMngr_getEXCQosIElements(pQosMngr->hExcMgr, (pQosIe+(*pLen)), &extraIeLen);
1697 }
1698 #endif
1699 *pLen += extraIeLen;
1700 }
1701 else
1702 {
1703 *pLen = 0;
1704 }
1705
1706 return status;
1707
1708 }
1709 /************************************************************************
1710 * qosMngr_assocReqBuild *
1711 ************************************************************************
1712 DESCRIPTION: The function is called in order to build the assocReq IE for
1713 the current site QOS protocol.
1714
1715 INPUT: hQosMngr - Qos Manager handle.
1716
1717 OUTPUT:
1718
1719 RETURN: OK on success, NOK otherwise
1720
1721 ************************************************************************/
1722
qosMngr_assocReqBuild(TI_HANDLE hQosMngr,UINT8 * pQosIe,UINT8 * pLen)1723 TI_STATUS qosMngr_assocReqBuild(TI_HANDLE hQosMngr, UINT8 *pQosIe, UINT8 *pLen)
1724 {
1725 qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
1726 TI_STATUS status;
1727
1728
1729 if(pQosMngr == NULL)
1730 {
1731 *pLen = 0;
1732 return OK;
1733 }
1734
1735 /* building assocReq frame */
1736 switch(pQosMngr->activeProtocol)
1737 {
1738 case WME:
1739 status = getWMEInfoElement(pQosMngr,pQosIe,pLen);
1740 if (status !=OK)
1741 {
1742 *pLen = 0;
1743 }
1744 break;
1745
1746 case NONE_QOS:
1747 *pLen = 0;
1748 return OK;
1749 /* break; - unreachable */
1750
1751 default:
1752 *pLen = 0;
1753 break;
1754 }
1755
1756 return OK;
1757 }
1758
1759 /************************************************************************
1760 * getWMEInfoElement *
1761 ************************************************************************
1762 DESCRIPTION: building WME IE.
1763
1764 INPUT: hQosMngr - Qos Manager handle.
1765
1766 OUTPUT:
1767
1768 RETURN: OK on success, NOK otherwise
1769
1770 ************************************************************************/
1771
getWMEInfoElement(qosMngr_t * pQosMngr,UINT8 * pWMEie,UINT8 * pLen)1772 static TI_STATUS getWMEInfoElement(qosMngr_t *pQosMngr,UINT8 *pWMEie,UINT8 *pLen)
1773 {
1774 dot11_WME_IE_t *pDot11_WME_IE = (dot11_WME_IE_t *)pWMEie;
1775
1776 pDot11_WME_IE->hdr.eleId = DOT11_WME_ELE_ID;
1777 pDot11_WME_IE->hdr.eleLen = DOT11_WME_ELE_LEN;
1778 pDot11_WME_IE->OUI[0] = 0x00;
1779 pDot11_WME_IE->OUI[1] = 0x50;
1780 pDot11_WME_IE->OUI[2] = 0xf2;
1781 pDot11_WME_IE->OUIType = dot11_WME_OUI_TYPE;
1782 pDot11_WME_IE->OUISubType = dot11_WME_OUI_SUB_TYPE_IE;
1783 pDot11_WME_IE->version = dot11_WME_VERSION;
1784 pDot11_WME_IE->ACInfoField = 0;
1785
1786 if(pQosMngr->currentPsMode == PS_SCHEME_UPSD_TRIGGER)
1787 {
1788 if(pQosMngr->acParams[QOS_AC_VO].currentWmeAcPsMode == PS_SCHEME_UPSD_TRIGGER)
1789 {
1790 pDot11_WME_IE->ACInfoField |= (1 << AC_VO_APSD_FLAGS_SHIFT);
1791 }
1792 if(pQosMngr->acParams[QOS_AC_VI].currentWmeAcPsMode == PS_SCHEME_UPSD_TRIGGER)
1793 {
1794 pDot11_WME_IE->ACInfoField |= (1 << AC_VI_APSD_FLAGS_SHIFT);
1795 }
1796
1797 if(pQosMngr->acParams[QOS_AC_BK].currentWmeAcPsMode == PS_SCHEME_UPSD_TRIGGER)
1798 {
1799 pDot11_WME_IE->ACInfoField |= (1 << AC_BK_APSD_FLAGS_SHIFT);
1800 }
1801
1802 if(pQosMngr->acParams[QOS_AC_BE].currentWmeAcPsMode == PS_SCHEME_UPSD_TRIGGER)
1803 {
1804 pDot11_WME_IE->ACInfoField |= (1 << AC_BE_APSD_FLAGS_SHIFT);
1805 }
1806
1807 pDot11_WME_IE->ACInfoField |= (((pQosMngr->desiredMaxSpLen) & MAX_SP_LENGTH_MASK) << MAX_SP_LENGTH_SHIFT);
1808 }
1809
1810 *pLen = pDot11_WME_IE->hdr.eleLen + sizeof(dot11_eleHdr_t);
1811
1812 return OK;
1813
1814 }
1815
1816 /************************************************************************
1817 * qosMngr_checkTspecRenegResults *
1818 ************************************************************************
1819 DESCRIPTION: The function is called upon association response to check
1820 Tspec renegotiation results
1821
1822 INPUT: hQosMngr - Qos Manager handle.
1823 assocRsp - pointer to received IE parameters received
1824 in association response.
1825 OUTPUT:
1826
1827 RETURN: -
1828
1829 ************************************************************************/
qosMngr_checkTspecRenegResults(TI_HANDLE hQosMngr,assocRsp_t * assocRsp)1830 void qosMngr_checkTspecRenegResults(TI_HANDLE hQosMngr, assocRsp_t *assocRsp)
1831 {
1832 tspecInfo_t tspecInfo;
1833 qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
1834 #ifdef EXC_MODULE_INCLUDED
1835 UINT32 acCount;
1836 #endif
1837
1838 WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1839 ("qosMngr_checkTspecRenegResults: performTSPECRenegotiation = %d, tspecParams received= %x\n",
1840 pQosMngr->performTSPECRenegotiation, assocRsp->tspecVoiceParameters));
1841
1842 if (pQosMngr->performTSPECRenegotiation != TRUE)
1843 {
1844 /* If no re-negotiation was requested, no parsing shall be done */
1845 #ifdef EXC_MODULE_INCLUDED
1846 measurementMgr_disableTsMetrics(pQosMngr->hMeasurementMngr, MAX_NUM_OF_AC);
1847 #endif
1848 return;
1849 }
1850
1851 if (assocRsp->tspecVoiceParameters == NULL && assocRsp->tspecSignalParameters == NULL)
1852 {
1853 /* The renegotiation request was ignored - update QoS Manager database */
1854 qosMngr_setAdmissionInfo(pQosMngr, USER_PRIORITY_6,
1855 &pQosMngr->resourceMgmtTable.candidateTspecInfo[USER_PRIORITY_6],
1856 STATUS_TRAFFIC_ADM_REQUEST_REJECT);
1857
1858 if (pQosMngr->tspecRenegotiationParams[USER_PRIORITY_4].uUserPriority != MAX_USER_PRIORITY)
1859 {
1860 qosMngr_setAdmissionInfo(pQosMngr, USER_PRIORITY_4,
1861 &pQosMngr->resourceMgmtTable.candidateTspecInfo[USER_PRIORITY_4],
1862 STATUS_TRAFFIC_ADM_REQUEST_REJECT);
1863 }
1864 #ifdef EXC_MODULE_INCLUDED
1865 measurementMgr_disableTsMetrics(pQosMngr->hMeasurementMngr, MAX_NUM_OF_AC);
1866 #endif
1867 return;
1868 }
1869
1870 if (assocRsp->tspecVoiceParameters != NULL)
1871 {
1872 /* The renogitaion was performed - update QoS Manager database */
1873 pQosMngr->voiceTspecConfigured = TRUE;
1874 trafficAdmCtrl_parseTspecIE(pQosMngr->pTrafficAdmCtrl, &tspecInfo, assocRsp->tspecVoiceParameters);
1875
1876 qosMngr_setAdmissionInfo(pQosMngr, tspecInfo.AC, &tspecInfo, STATUS_TRAFFIC_ADM_REQUEST_ACCEPT);
1877 }
1878
1879 if (assocRsp->tspecSignalParameters != NULL)
1880 {
1881 /* Signal TSPEC was re-negotiated as well */
1882 pQosMngr->videoTspecConfigured = TRUE;
1883 trafficAdmCtrl_parseTspecIE(pQosMngr->pTrafficAdmCtrl, &tspecInfo, assocRsp->tspecSignalParameters);
1884 qosMngr_setAdmissionInfo(pQosMngr, tspecInfo.AC, &tspecInfo, STATUS_TRAFFIC_ADM_REQUEST_ACCEPT);
1885 }
1886 else if (pQosMngr->tspecRenegotiationParams[USER_PRIORITY_4].uUserPriority != MAX_USER_PRIORITY)
1887 {
1888 /* Signal TSPEC was not re-negotiated although requested to - ERROR */
1889 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1890 ("qosMngr_setSite: Signal TSPEC was not re-negotiated while voice was \n"));
1891 qosMngr_setAdmissionInfo(pQosMngr, USER_PRIORITY_4,
1892 &pQosMngr->resourceMgmtTable.candidateTspecInfo[USER_PRIORITY_4],
1893 STATUS_TRAFFIC_ADM_REQUEST_REJECT);
1894 }
1895
1896 #ifdef EXC_MODULE_INCLUDED
1897 /* If EXC IEs are present for one or more ACs, update other modules with received parameters */
1898 for (acCount = 0; acCount < MAX_NUM_OF_AC; acCount++)
1899 {
1900 excMngr_setEXCQoSParams(pQosMngr->hExcMgr, &assocRsp->excIEs[acCount], acCount);
1901 }
1902 #endif
1903 }
1904
1905
1906 /************************************************************************
1907 * qosMngr_setSite *
1908 ************************************************************************
1909 DESCRIPTION: The function is called upon association response to set site
1910 parameters.
1911
1912 INPUT: hQosMngr - Qos Manager handle.
1913 assocRsp - pointer to received IE parameters received
1914 in association response.
1915 OUTPUT:
1916
1917 RETURN: OK on success, NOK otherwise
1918
1919 ************************************************************************/
qosMngr_setSite(TI_HANDLE hQosMngr,assocRsp_t * assocRsp)1920 TI_STATUS qosMngr_setSite(TI_HANDLE hQosMngr, assocRsp_t *assocRsp)
1921 {
1922 qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
1923 TI_STATUS status;
1924 paramInfo_t param;
1925
1926 if(hQosMngr == NULL)
1927 return NOK;
1928
1929 /* checking active protocol */
1930 switch(pQosMngr->activeProtocol)
1931 {
1932 case WME:
1933 /* verify QOS protocol received in association response */
1934 status = verifyWmeIeParams(pQosMngr, (UINT8 *)assocRsp->WMEParams);
1935 if(status != OK)
1936 {
1937 pQosMngr->activeProtocol = NONE_QOS;
1938 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1939 ("qosMngr_setSite: setting active protocol WME params with non WME IE params frame, setting active protocol back to NONE \n"));
1940 return NOK;
1941 }
1942
1943 status = setWmeSiteParams(pQosMngr, (UINT8 *)assocRsp->WMEParams);
1944 if (status != OK)
1945 {
1946 pQosMngr->activeProtocol = NONE_QOS;
1947 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1948 ("Warning: qosMngr_setSite-> failed to set AC WME parameters!!! , setting active protocol back to NONE\n"));
1949 return NOK;
1950 }
1951 /* update siteMgr with recevied params */
1952 status = siteMgr_setWMEParamsSite(pQosMngr->hSiteMgr, assocRsp->WMEParams);
1953 if (status != OK)
1954 {
1955 pQosMngr->activeProtocol = NONE_QOS;
1956 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1957 ("qosMngr_setSite:failed to init WME parameters!!! , setting active protocol back to NONE\n\n"));
1958 return NOK;
1959 }
1960
1961 break;
1962
1963 case NONE_QOS:
1964
1965 /* Check if the packet burst is enable, if it is,
1966 should update the BE parames and the hal to the packet burst def */
1967 if (pQosMngr->qosPacketBurstEnable == TRUE)
1968 {
1969 /* Update the acTrafficInitParams of BE to the packet burst def*/
1970 pQosMngr->acParams[QOS_AC_BE].acQosInitParams.txopLimit = pQosMngr->qosPacketBurstTxOpLimit;
1971 /* Update the acTrafficParams of BE to the packet burst def*/
1972 pQosMngr->acParams[QOS_AC_BE].acQosInitParams.txopLimit = pQosMngr->qosPacketBurstTxOpLimit;
1973 /* verify the parameters and update the hal */
1974 status = verifyAndConfigQosParams(hQosMngr,&(pQosMngr->acParams[QOS_AC_BE].acQosParams));
1975 if (status != OK)
1976 {
1977 WLAN_REPORT_WARNING(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1978 ("qosMngr_setSite:failed to init NON_QOS parameters!!!\n\n"));
1979 return NOK;
1980 }
1981 }
1982
1983 /* By setting the PS_MODE of QOS_AC_VO to desiredVoiceDeliveryProtocol, we enable sending PS_POLL packets by the txData module
1984 Even though all user priorities are mapped to QOS_AC_BE, when txData checks if Ps_Poll is needed for AC_VO */
1985 param.content.txDataQosParams.acID = QOS_AC_VO;
1986 param.content.txDataQosParams.acTrfcCtrl.PsMode = pQosMngr->desiredVoiceDeliveryProtocol;
1987 param.paramType = TX_DATA_PS_MODE_PARAM;
1988 txData_setParam(pQosMngr->hTxData,¶m);
1989
1990 break;
1991
1992 default:
1993 WLAN_REPORT_WARNING(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
1994 ("Warning: qosMngr_setSite NO active protocls To set \n"));
1995 break;
1996 }
1997
1998 /* Check if TSPEC re-negotiation was performed, if so - look for results */
1999 qosMngr_checkTspecRenegResults(pQosMngr, assocRsp);
2000
2001 return OK;
2002
2003 }
2004
2005 /************************************************************************
2006 * qosMngr_updateIEinfo *
2007 ************************************************************************
2008 DESCRIPTION: The function is called upon run-time update of AC parameters
2009
2010 INPUT: hQosMngr - Qos Manager handle.
2011 pQosIeParams - pointer to received IE parameters received
2012 in beacon or probe response.
2013 OUTPUT:
2014
2015 RETURN: OK on success, NOK otherwise
2016
2017 ************************************************************************/
2018
qosMngr_updateIEinfo(TI_HANDLE hQosMngr,UINT8 * pQosIeParams,qosProtocols_e qosSetProtocol)2019 void qosMngr_updateIEinfo(TI_HANDLE hQosMngr, UINT8 *pQosIeParams,qosProtocols_e qosSetProtocol)
2020 {
2021 qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
2022 TI_STATUS status;
2023 dot11_WME_PARAM_t *pWMEparams;
2024
2025
2026
2027 if(pQosMngr == NULL)
2028 return;
2029
2030 /* checking active protocol */
2031 switch(pQosMngr->activeProtocol)
2032 {
2033 case WME:
2034 if(qosSetProtocol != WME)
2035 return;
2036
2037 if(pQosIeParams == NULL)
2038 {
2039 WLAN_REPORT_WARNING(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,("Warning: updateIEinfo -> trying to update WME parameters with NULL site parameters!!!\n"));
2040 return ;
2041 }
2042
2043 /* verify QOS protocol received in update IE */
2044 status = verifyWmeIeParams(pQosMngr,pQosIeParams);
2045 if(status != OK)
2046 {
2047 WLAN_REPORT_WARNING(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,("Warning: updateIEinfo ->upadting active protocl WME params with non WME IE params frame !!!\n"));
2048 return ;
2049 }
2050 pWMEparams = (dot11_WME_PARAM_t *)pQosIeParams;
2051
2052 /* update AC params */
2053 status = updateACParams(pQosMngr,&(pWMEparams->WME_ACParameteres));
2054 if(status != OK)
2055 {
2056 WLAN_REPORT_WARNING(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,("updateIEinfo-> failed to update AC WME parameters!!!\n\n"));
2057 return ;
2058 }
2059 break;
2060
2061
2062 default:
2063 WLAN_REPORT_WARNING(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,("updateIEinfo-> trying to update qos paramters without active protocol !!!"));
2064 break;
2065 }
2066 }
2067
2068 /************************************************************************
2069 * qosMngr_buildTSPec *
2070 ************************************************************************/
qosMngr_buildTSPec(TI_HANDLE hQosMngr,UINT32 user_priority,UINT8 * pQosIe)2071 UINT32 qosMngr_buildTSPec(TI_HANDLE hQosMngr, UINT32 user_priority, UINT8 *pQosIe)
2072 {
2073 qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
2074 OS_802_11_QOS_TSPEC_PARAMS *pPreservedParams;
2075 tspecInfo_t *pCandidateParams;
2076 UINT32 ieLen;
2077
2078 pPreservedParams = &pQosMngr->tspecRenegotiationParams[user_priority];
2079 pCandidateParams = &pQosMngr->resourceMgmtTable.candidateTspecInfo[user_priority];
2080
2081 if (pPreservedParams->uUserPriority != MAX_USER_PRIORITY)
2082 {
2083 qosMngr_storeTspecCandidateParams (pCandidateParams, pPreservedParams, user_priority);
2084 pCandidateParams->trafficAdmState = AC_WAIT_ADMISSION;
2085
2086 trafficAdmCtrl_buildTSPec(pQosMngr->pTrafficAdmCtrl, pCandidateParams, pQosIe, &ieLen);
2087 return ieLen;
2088 }
2089 else
2090 {
2091 return 0;
2092 }
2093 }
2094
2095 /************************************************************************
2096 * setWmeSiteParams *
2097 ************************************************************************
2098 DESCRIPTION: The function is called upon association response to set WME site
2099 parameters.
2100
2101 INPUT: hQosMngr - Qos Manager handle.
2102 pQosIeParams - pointer to received IE parameters received
2103 in association response.
2104 OUTPUT:
2105
2106 RETURN: OK on success, NOK otherwise
2107
2108 ************************************************************************/
2109
setWmeSiteParams(qosMngr_t * pQosMngr,UINT8 * pQosIeParams)2110 static TI_STATUS setWmeSiteParams(qosMngr_t *pQosMngr, UINT8 *pQosIeParams)
2111 {
2112 dot11_WME_PARAM_t *pWMEparams = (dot11_WME_PARAM_t *)pQosIeParams;
2113 TI_STATUS status;
2114 paramInfo_t param;
2115 UINT8 acID;
2116
2117 if (pQosIeParams == NULL)
2118 {
2119 WLAN_REPORT_WARNING(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
2120 ("setWmeSiteParams: pQosIeParams is NULL !"));
2121 return NOK;
2122 }
2123
2124 for(acID = FIRST_AC_INDEX;acID < MAX_NUM_OF_AC; acID++)
2125 {
2126 /* configure queue */
2127 status = verifyAndConfigTrafficParams(pQosMngr,&(pQosMngr->acParams[acID].QtrafficParams));
2128 if(status != OK)
2129 return status;
2130
2131
2132
2133 /* Enable event in rate adaptation */
2134 ctrlData_setTspecsRateEvent(pQosMngr->hCtrlData, acID, TRUE);
2135
2136 /* ac powerSave protocol mode */
2137 param.content.txDataQosParams.acID = acID;
2138 param.content.txDataQosParams.acTrfcCtrl.PsMode = pQosMngr->acParams[acID].currentWmeAcPsMode;
2139 param.content.txDataQosParams.acTrfcCtrl.ackPolicy = pQosMngr->acParams[acID].wmeAcAckPolicy; /* working with Non - Qos method */
2140
2141 /* In case QOS_AC_VO is not configured for UPSD, set it according to the desired voice delivery protocol, which can be either PS_POLL or PS_NONE */
2142 if ((acID == QOS_AC_VO) && (pQosMngr->acParams[acID].currentWmeAcPsMode != PS_SCHEME_UPSD_TRIGGER))
2143 {
2144 param.content.txDataQosParams.acTrfcCtrl.PsMode = pQosMngr->desiredVoiceDeliveryProtocol;
2145 }
2146
2147 param.paramType = TX_DATA_PS_MODE_PARAM;
2148 txData_setParam(pQosMngr->hTxData,¶m);
2149
2150 param.paramType = TX_DATA_CONFIG_AC_ACK_POLICY;
2151 txData_setParam(pQosMngr->hTxData,¶m);
2152
2153 }
2154
2155 /* update AC params */
2156 status = updateACParams(pQosMngr,&(pWMEparams->WME_ACParameteres));
2157 if(status != OK)
2158 return status;
2159
2160
2161 /* update per protocol params */
2162
2163 /* update header convert mode */
2164 pQosMngr->headerConvetMode = QOS_CONVERT;
2165 param.content.txDataQosParams.qosParams.headerConverMode = QOS_CONVERT;
2166 param.paramType = TX_DATA_CONVERT_HEADER_MODE;
2167 txData_setParam(pQosMngr->hTxData,¶m);
2168
2169 return OK;
2170 }
2171
2172
2173 /************************************************************************
2174 * updateACParams *
2175 ************************************************************************
2176 DESCRIPTION: the function is called upon QOS protocol updates paramters
2177 to TNET and TxData object
2178
2179 INPUT: hQosMngr - Qos Manager handle.
2180
2181 OUTPUT:
2182
2183 RETURN: OK on success, NOK otherwise
2184
2185 ************************************************************************/
2186
updateACParams(qosMngr_t * pQosMngr,ACParameters_t * pAcParams)2187 static TI_STATUS updateACParams(qosMngr_t *pQosMngr,ACParameters_t *pAcParams)
2188 {
2189 UINT8 acID,i;
2190 TI_STATUS status;
2191 QOS_AC_IE_ParametersRecord_t *pACParameteresRecord;
2192 paramInfo_t param;
2193
2194 /*
2195 * For WME: setting ac traffic params (edcf etc')
2196 * in this order BE, BK , VI, VO .
2197 */
2198
2199 pACParameteresRecord = (QOS_AC_IE_ParametersRecord_t *)pAcParams;
2200
2201 for(i = FIRST_AC_INDEX; i < MAX_NUM_OF_AC; i++, pACParameteresRecord++)
2202 {
2203 /* getting ac from ACI */
2204 acID = (pACParameteresRecord->ACI_AIFSN & AC_PARAMS_ACI_MASK) >> 5;
2205
2206 /* edcf params */
2207
2208 pQosMngr->acParams[acID].acQosParams.ac = acID;
2209 pQosMngr->acParams[acID].acQosParams.aifsn = pACParameteresRecord->ACI_AIFSN & AC_PARAMS_AIFSN_MASK;
2210 pQosMngr->acParams[acID].acQosParams.cwMin = pACParameteresRecord->ECWmin_ECWmax & AC_PARAMS_CWMIN_MASK;
2211 pQosMngr->acParams[acID].acQosParams.cwMax = (pACParameteresRecord->ECWmin_ECWmax & AC_PARAMS_CWMAX_MASK) >> 4;
2212 pQosMngr->acParams[acID].acQosParams.txopLimit = pACParameteresRecord->TXOPLimit;
2213
2214 status = verifyAndConfigQosParams(pQosMngr,&(pQosMngr->acParams[acID].acQosParams));
2215 if(status != OK)
2216 return status;
2217
2218
2219 /* UPSD configuration */
2220 pQosMngr->acParams[acID].QtrafficParams.psScheme = pQosMngr->acParams[acID].currentWmeAcPsMode;
2221 status = verifyAndConfigTrafficParams(pQosMngr,&(pQosMngr->acParams[acID].QtrafficParams));
2222 if(status != OK)
2223 return status;
2224
2225
2226 /* update admission state */
2227 if(pACParameteresRecord->ACI_AIFSN & AC_PARAMS_ACM_MASK)
2228 {
2229 pQosMngr->acParams[acID].apInitAdmissionState = ADMISSION_REQUIRED;
2230 param.content.txDataQosParams.qosParams.admissionRequired = ADMISSION_REQUIRED;
2231
2232 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].trafficAdmState = AC_NOT_ADMITTED;
2233 param.content.txDataQosParams.qosParams.admissionState = AC_NOT_ADMITTED;
2234 }
2235 else
2236 {
2237 pQosMngr->acParams[acID].apInitAdmissionState = ADMISSION_NOT_REQUIRED;
2238 param.content.txDataQosParams.qosParams.admissionRequired = ADMISSION_NOT_REQUIRED;
2239
2240 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].trafficAdmState = AC_ADMITTED;
2241 param.content.txDataQosParams.qosParams.admissionState = AC_ADMITTED;
2242 }
2243
2244 param.content.txDataQosParams.acID = acID;
2245 param.paramType = TX_DATA_AC_ADMISSION_STATE;
2246 txData_setParam(pQosMngr->hTxData,¶m);
2247 }
2248
2249 /* Update the Tx and HAL tag to AC tables for WME mode. */
2250 updateTagToAcTable(pQosMngr, (acTrfcType_e *)WMEQosTagToACTable);
2251
2252 return OK;
2253 }
2254
2255 /************************************************************************
2256 * updateTagToAcTable *
2257 ************************************************************************
2258 DESCRIPTION: the function updates tag to AC index according to the delivered
2259 protocol tag to AC table (WME or legacy).
2260
2261 INPUT: hQosMngr - Qos Manager handle.
2262 pProtocolTagToACTable - protocol tag to AC table.
2263
2264 OUTPUT:
2265
2266 RETURN: OK on success, NOK otherwise
2267
2268 ************************************************************************/
2269
updateTagToAcTable(qosMngr_t * pQosMngr,acTrfcType_e * pProtocolTagToACTable)2270 void updateTagToAcTable(qosMngr_t *pQosMngr,acTrfcType_e *pProtocolTagToACTable)
2271 {
2272 paramInfo_t param;
2273
2274 /*
2275 * Update the Tx and HAL Tag to AC tables.
2276 */
2277 os_memoryCopy(pQosMngr->hOs,(param.content.txDataQosParams.qosParams.tag_ToAcClsfrTable),
2278 pProtocolTagToACTable, sizeof(acTrfcType_e) * MAX_NUM_OF_802_1d_TAGS);
2279
2280 param.paramType = TX_DATA_TAG_TO_AC_CLASSIFIER_TABLE;
2281 txData_setParam(pQosMngr->hTxData,¶m);
2282
2283 }
2284
2285
2286 /************************************************************************
2287 * verifyWmeIeParams *
2288 ************************************************************************
2289 DESCRIPTION: verify WME IE.
2290
2291 INPUT: hQosMngr - Qos Manager handle.
2292
2293 OUTPUT:
2294
2295 RETURN: OK on success, NOK otherwise
2296
2297 ************************************************************************/
2298
verifyWmeIeParams(qosMngr_t * pQosMngr,UINT8 * pQosIeParams)2299 static TI_STATUS verifyWmeIeParams(qosMngr_t *pQosMngr,UINT8 *pQosIeParams)
2300 {
2301 dot11_WME_IE_t WMEie;
2302 UINT8 Len;
2303 dot11_WME_IE_t *pWMERecvIe = (dot11_WME_IE_t *)pQosIeParams;
2304
2305 if(pQosIeParams == NULL)
2306 {
2307 WLAN_REPORT_WARNING(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,("verifyWmeIeParams: FAILED"));
2308 return NOK;
2309 }
2310
2311
2312 /* get WME IE */
2313 getWMEInfoElement(pQosMngr,(UINT8 *)&WMEie,(UINT8 *)&Len);
2314
2315 if((WMEie.hdr.eleId != pWMERecvIe->hdr.eleId ) ||
2316 (WMEie.OUI[0] != pWMERecvIe->OUI[0]) ||
2317 (WMEie.OUI[1] != pWMERecvIe->OUI[1]) ||
2318 (WMEie.OUI[2] != pWMERecvIe->OUI[2]) ||
2319 (WMEie.OUIType != pWMERecvIe->OUIType))
2320 {
2321 WLAN_REPORT_WARNING(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,("verifyWmeIeParams: FAILED"));
2322 return NOK;
2323 }
2324
2325
2326 if(WMEie.version != pWMERecvIe->version)
2327 WLAN_REPORT_WARNING(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,("WARNING: verifyWmeIeParams: Driver WME version: %d, Site WME version: %d",WMEie.version,pWMERecvIe->version));
2328
2329 /* compare assocRsp IE to WME IE (without acInfo field */
2330 return OK;
2331 }
2332
2333
2334 /************************************************************************
2335 * Admission Control Functions *
2336 ************************************************************************/
2337 /************************************************************************
2338 * qosMngr_requestAdmission *
2339 ************************************************************************
2340 DESCRIPTION: This function is API function for TSPEC request.
2341
2342 INPUT: hQosMngr - Qos Manager handle.
2343 addTspecParams - The Tspec Parameters
2344 OUTPUT:
2345
2346 RETURN: OK on success, NOK otherwise
2347
2348 ************************************************************************/
2349
qosMngr_requestAdmission(TI_HANDLE hQosMngr,OS_802_11_QOS_TSPEC_PARAMS * addTspecParams)2350 TI_STATUS qosMngr_requestAdmission(TI_HANDLE hQosMngr,
2351 OS_802_11_QOS_TSPEC_PARAMS *addTspecParams)
2352 {
2353
2354 qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
2355 TI_STATUS status;
2356 UINT8 acID;
2357
2358
2359 /* check if STA is already connected to AP */
2360 if(pQosMngr->isConnected == FALSE)
2361 {
2362 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,("qosMngr_requestAdmission: Not connected - Ignoring request !!!\n"));
2363 return NOT_CONNECTED;
2364 }
2365
2366 /* check if AP support WME */
2367 if(pQosMngr->activeProtocol != WME)
2368 {
2369 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,("qosMngr_requestAdmission: Not connected to a QOS AP - Ignoring request !!!\n"));
2370 return NO_QOS_AP;
2371 }
2372
2373 /* check if Traffic Admission Control is enable */
2374 if(pQosMngr->trafficAdmCtrlEnable == FALSE)
2375 {
2376 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,("qosMngr_requestAdmission: Admission-Control is disabled - Ignoring request !!!\n"));
2377 return ADM_CTRL_DISABLE;
2378 }
2379
2380 /* check UP validity */
2381 if( addTspecParams->uUserPriority > MAX_USER_PRIORITY)
2382 {
2383 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,("uUserPriority = %d > 7 !!!\n",addTspecParams->uUserPriority));
2384 return NOK;
2385 }
2386
2387 /* find acID from the user priority */
2388 acID = WMEQosTagToACTable[addTspecParams->uUserPriority];
2389
2390 /* check if signaling is already in process for this AC */
2391 if(pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].trafficAdmState == AC_WAIT_ADMISSION)
2392 {
2393 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,("qosMngr_requestAdmission: AC = %d , signaling is in process -> Ignore Request !!!\n",acID));
2394 return TRAFIC_ADM_PENDING;
2395 }
2396
2397 /* check if AC is already admitted with other UP */
2398 if( (pQosMngr->resourceMgmtTable.currentTspecInfo[acID].trafficAdmState == AC_ADMITTED) &&
2399 (pQosMngr->resourceMgmtTable.currentTspecInfo[acID].userPriority <= MAX_USER_PRIORITY) &&
2400 (pQosMngr->resourceMgmtTable.currentTspecInfo[acID].userPriority != addTspecParams->uUserPriority) )
2401 {
2402 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
2403 ("qosMngr_requestAdmission: AC = %d , another UP (%d) on same AC is already admited -> Ignoring request !!!\n",
2404 acID, pQosMngr->resourceMgmtTable.currentTspecInfo[acID].userPriority));
2405 return AC_ALREADY_IN_USE;
2406 }
2407
2408 /* check msdu size validity */
2409 if( (addTspecParams->uNominalMSDUsize & !FIX_MSDU_SIZE) > MAX_DATA_BODY_LENGTH)
2410 {
2411 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,("uNominalMSDUsize = %d > 2312, !!!\n",addTspecParams->uNominalMSDUsize));
2412 return NOK;
2413 }
2414
2415 /* check PS mode validity */
2416 if( (addTspecParams->uAPSDFlag == PS_SCHEME_UPSD_TRIGGER) && (pQosMngr->currentPsMode != PS_SCHEME_UPSD_TRIGGER) )
2417 {
2418 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
2419 ("The STA's current status does not support UPSD -> Ignoring TSPEC request that has UPSD on !!!\n"));
2420 return NOK;
2421 }
2422
2423 WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,("qosMngr_requestAdmission: UP = %d , acID = %d\n",addTspecParams->uUserPriority, acID));
2424
2425 /* The following code was removed since TX module is updated on UPSD/PS-POLL configuration of AC, and therefore will NOT
2426 send PS-POLLs when QOS_AC_VO is configured for UPSD */
2427 #if 0
2428 /* check PS mode validity for the voice queue*/
2429 /* Do not allow CHANGING QOS_AC_VO currentPsMode to UPSD while the desiredVoiceDeliveryProtocol is enabled */
2430 if( (acID == QOS_AC_VO) &&
2431 ((addTspecParams->uAPSDFlag == UPSD) && (pQosMngr->acParams[acID].currentWmeAcPsMode != UPSD)) &&
2432 (pQosMngr->desiredVoiceDeliveryProtocol == PS_POLL) )
2433 {
2434 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
2435 ("The STA's current QOS_AC_VO configured to VoiceDeliveryProtocol,\n This configuration can not be in parallel with UPSD.\n In order to change the AC_VO to UPSD, user must first disable the VoiceDeliveryProtocol!!!\n"));
2436 return NOK;
2437 }
2438 #endif
2439
2440 /* set tspec parameters in candidateTspecInfo table */
2441 qosMngr_storeTspecCandidateParams (&(pQosMngr->resourceMgmtTable.candidateTspecInfo[acID]),
2442 addTspecParams, (UINT8)acID);
2443
2444 /* Perhaps this should be done only if the request was successfully sent */
2445 if (acID == QOS_AC_VO)
2446 {
2447 pQosMngr->voiceTspecConfigured = TRUE;
2448 }
2449
2450 if (acID == QOS_AC_VI)
2451 {
2452 pQosMngr->videoTspecConfigured = TRUE;
2453 }
2454
2455 /* call TrafficAdmCtrl API function for the signaling proccess */
2456 status = trafficAdmCtrl_startAdmRequest(pQosMngr->pTrafficAdmCtrl, &(pQosMngr->resourceMgmtTable.candidateTspecInfo[acID]));
2457
2458 if(status == OK)
2459 {
2460 /* request transmitted OK */
2461 pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].trafficAdmState = AC_WAIT_ADMISSION;
2462 WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,("qosMngr_requestAdmission: UP = %d , request OK !!!\n",addTspecParams->uUserPriority));
2463 }
2464 else
2465 {
2466 /* reaquest not transmitted OK */
2467 pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].trafficAdmState = AC_NOT_ADMITTED;
2468 WLAN_REPORT_WARNING(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,("qosMngr_requestAdmission: UP = %d , request NOT OK status=%d!!!\n",addTspecParams->uUserPriority, status));
2469 return NOK;
2470 }
2471
2472 return status;
2473 }
2474
2475 /************************************************************************
2476 * qosMngr_deleteAdmission *
2477 ************************************************************************
2478 DESCRIPTION: This function is API fuunction for tspec delete.
2479
2480 INPUT: hQosMngr - Qos Manager handle.
2481 delAdmissionParams -
2482 OUTPUT:
2483
2484 RETURN: OK on success, NOK otherwise
2485
2486 ************************************************************************/
2487
qosMngr_deleteAdmission(TI_HANDLE hQosMngr,OS_802_11_QOS_DELETE_TSPEC_PARAMS * delAdmissionParams)2488 TI_STATUS qosMngr_deleteAdmission(TI_HANDLE hQosMngr, OS_802_11_QOS_DELETE_TSPEC_PARAMS *delAdmissionParams)
2489 {
2490
2491 qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
2492 UINT8 acID;
2493
2494 /* check UP validity */
2495 if( delAdmissionParams->uUserPriority > MAX_USER_PRIORITY )
2496 {
2497 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
2498 ("qosMngr_deleteAdmission: userPriority > 7 -> Ignore !!!"));
2499 return NOK;
2500 }
2501
2502 /* check if STA is already connected to AP */
2503 if(pQosMngr->isConnected == FALSE)
2504 {
2505 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
2506 ("qosMngr_deleteAdmission: pQosMngr->connected == FALSE -> Ignore !!!"));
2507 return NOT_CONNECTED;
2508 }
2509
2510 /* check if AP support WME */
2511 if(pQosMngr->activeProtocol != WME)
2512 {
2513 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
2514 ("qosMngr_deleteAdmission: activeProtocol != WME -> Ignore !!!"));
2515 return NO_QOS_AP;
2516 }
2517
2518 /* find acID from the user priority */
2519 acID = WMEQosTagToACTable[delAdmissionParams->uUserPriority];
2520
2521 /* check if tspec is already addmited for this AC */
2522 if(pQosMngr->resourceMgmtTable.currentTspecInfo[acID].trafficAdmState != AC_ADMITTED)
2523 {
2524 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
2525 ("qosMngr_deleteAdmission: AC is not ADMITED -> Ignore !!!"));
2526 return NOK;
2527 }
2528
2529 /* check if AC is already admited with the same UP */
2530 if(pQosMngr->resourceMgmtTable.currentTspecInfo[acID].userPriority != delAdmissionParams->uUserPriority)
2531 {
2532 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
2533 ("qosMngr_deleteAdmission: user priority is invalid. -> Ignore !!!\n"));
2534 return USER_PRIORITY_NOT_ADMITTED;
2535 }
2536
2537 /* check if signaling is already in procces for this AC */
2538 if(pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].trafficAdmState == AC_WAIT_ADMISSION)
2539 {
2540 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
2541 ("qosMngr_deleteAdmission: AC is under negotiation -> Ignore !!!"));
2542 return TRAFIC_ADM_PENDING;
2543 }
2544
2545
2546
2547 /* call TrafficAdmCtrl API function for the delete tspec */
2548 trafficAdmCtrl_sendDeltsFrame(pQosMngr->pTrafficAdmCtrl, &(pQosMngr->resourceMgmtTable.currentTspecInfo[acID]),
2549 (UINT8)delAdmissionParams->uReasonCode );
2550
2551
2552 deleteTspecConfiguration(pQosMngr, acID);
2553
2554 return OK;
2555
2556 }
2557 /************************************************************************
2558 * deleteTspecConfiguration *
2559 ************************************************************************
2560 DESCRIPTION: configure the driver and FW to default configuration after
2561 tspec deletion.
2562
2563 INPUT: hQosMngr - Qos Manager handle.
2564 acID - the AC of the Tspec to delete
2565 OUTPUT:
2566
2567 RETURN: OK on success, NOK otherwise
2568
2569 ************************************************************************/
2570
deleteTspecConfiguration(qosMngr_t * pQosMngr,UINT8 acID)2571 static void deleteTspecConfiguration(qosMngr_t *pQosMngr, UINT8 acID)
2572 {
2573 paramInfo_t param;
2574
2575 /* Zero Tspec parameters */
2576 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].nominalMsduSize = 0;
2577 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].minimumPHYRate = 0;
2578 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].meanDataRate = 0;
2579 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].surplausBwAllowance = 0;
2580 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].mediumTime = 0;
2581 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].UPSDFlag = 0;
2582 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].streamDirection = BI_DIRECTIONAL;
2583
2584 /* update total medium time */
2585 pQosMngr->resourceMgmtTable.totalAllocatedMediumTime -= pQosMngr->resourceMgmtTable.currentTspecInfo[acID].mediumTime;
2586
2587
2588 /* set params to TX */
2589 /*------------------*/
2590 /* disable TSRS for this ac */
2591 param.content.txDataQosParams.acID = acID;
2592 param.content.txDataQosParams.tsrsArrLen = 0;
2593 param.paramType = CTRL_DATA_TSRS_PARAM;
2594 ctrlData_setParam(pQosMngr->hCtrlData, ¶m);
2595
2596 /* restore default MSDU lifetime value */
2597 param.content.txDataQosParams.acID = acID;
2598 param.content.txDataQosParams.acTrfcCtrl.MsduLifeTime = pQosMngr->acParams[acID].msduLifeTimeParam;
2599 param.paramType = TX_DATA_CONFIG_AC_MSDU_LIFE_TIME;
2600 txData_setParam(pQosMngr->hTxData, ¶m);
2601
2602 /* stop TS metrix for this ac */
2603 #ifdef EXC_MODULE_INCLUDED
2604 measurementMgr_disableTsMetrics(pQosMngr->hMeasurementMngr, acID);
2605 #endif
2606
2607 /* update medium time and rate adaptation event only when init admission bit was 0 */
2608 if( pQosMngr->acParams[acID].apInitAdmissionState == ADMISSION_REQUIRED )
2609 {
2610 /* update currentTspecInfo parameters */
2611 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].trafficAdmState = AC_NOT_ADMITTED;
2612
2613 /* set params to TX */
2614 txData_setAdmisionCtrlParams(pQosMngr->hTxData,
2615 acID,
2616 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].mediumTime ,
2617 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].minimumPHYRate, FALSE);
2618 }
2619 else
2620 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].trafficAdmState = AC_ADMITTED;
2621
2622 /* After we have updated the TxData with the new status of the UP, we can zero the userPriority field */
2623 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].userPriority = INACTIVE_USER_PRIORITY;
2624
2625 /* set PS mode according to the PS mode from the association */
2626 /* restore the current Ps mode per AC to UPSD ONLY IF both the station and AP support UPSD */
2627 if ((pQosMngr->currentPsMode == PS_SCHEME_UPSD_TRIGGER) && (pQosMngr->acParams[acID].desiredWmeAcPsMode == PS_SCHEME_UPSD_TRIGGER))
2628 {
2629 pQosMngr->acParams[acID].currentWmeAcPsMode = PS_SCHEME_UPSD_TRIGGER;
2630 }
2631 else
2632 {
2633 pQosMngr->acParams[acID].currentWmeAcPsMode = PS_SCHEME_LEGACY_PSPOLL;
2634 }
2635
2636 if(acID == QOS_AC_VO)
2637 {
2638 /* update TX with "new" PS Voice Delivery mode */
2639 txData_setPsVoiceDeliveryMode(pQosMngr->hTxData,pQosMngr->acParams[QOS_AC_VO].currentWmeAcPsMode);
2640 pQosMngr->voiceTspecConfigured = FALSE;
2641 }
2642
2643 if (acID == QOS_AC_VI)
2644 {
2645 pQosMngr->videoTspecConfigured = FALSE;
2646 }
2647
2648 /* UPSD_FW - open comment in UPSD FW integration */
2649
2650 /* UPSD configuration */
2651 pQosMngr->acParams[acID].QtrafficParams.psScheme = pQosMngr->acParams[acID].currentWmeAcPsMode;
2652 verifyAndConfigTrafficParams(pQosMngr,&(pQosMngr->acParams[acID].QtrafficParams));
2653
2654
2655 }
2656
2657 /*-----------------------------------------------------------------------------
2658 Routine Name: qosMngr_sendUnexpectedTSPECResponse
2659 Routine Description: send event to user application, informing of unexpected TSPEC response
2660 which might imply loss of UPSD mode synch between AP and STA
2661 Arguments: pTspecInfo - contains unexpected TSPEC response information
2662 Return Value:
2663 -----------------------------------------------------------------------------*/
qosMngr_sendUnexpectedTSPECResponseEvent(TI_HANDLE hQosMngr,tspecInfo_t * pTspecInfo)2664 TI_STATUS qosMngr_sendUnexpectedTSPECResponseEvent(TI_HANDLE hQosMngr,
2665 tspecInfo_t *pTspecInfo)
2666 {
2667 OS_802_11_QOS_TSPEC_PARAMS addtsReasonCode;
2668 qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
2669
2670 /* set the event params */
2671 addtsReasonCode.uAPSDFlag = pTspecInfo->UPSDFlag;
2672 addtsReasonCode.uUserPriority = pTspecInfo->userPriority;
2673 addtsReasonCode.uNominalMSDUsize = pTspecInfo->nominalMsduSize;
2674 addtsReasonCode.uMeanDataRate = pTspecInfo->meanDataRate;
2675 addtsReasonCode.uMinimumPHYRate = pTspecInfo->minimumPHYRate;
2676 addtsReasonCode.uSurplusBandwidthAllowance = pTspecInfo->surplausBwAllowance;
2677 addtsReasonCode.uMediumTime = pTspecInfo->mediumTime;
2678
2679 addtsReasonCode.uReasonCode = pTspecInfo->statusCode + TSPEC_RESPONSE_UNEXPECTED;
2680
2681 /* send event */
2682 EvHandlerSendEvent(pQosMngr->hEvHandler, IPC_EVENT_TSPEC_STATUS, (UINT8*)(&addtsReasonCode), sizeof(OS_802_11_QOS_TSPEC_PARAMS));
2683
2684 return OK;
2685 }
2686
2687 /************************************************************************
2688 * qosMngr_setAdmissionInfo *
2689 ************************************************************************
2690 DESCRIPTION: This function is API function.
2691 the trafficAdmCtrl object calls this function in
2692 order to update the QOSMngr on TSPEC request status
2693
2694 INPUT: hQosMngr - Qos Manager handle.
2695 pTspecInfo - The TSPEC Parameters
2696 trafficAdmRequestStatus - the status of the request
2697 OUTPUT:
2698
2699 RETURN: OK on success, NOK otherwise
2700
2701 ************************************************************************/
qosMngr_setAdmissionInfo(TI_HANDLE hQosMngr,UINT8 acID,tspecInfo_t * pTspecInfo,trafficAdmRequestStatus_e trafficAdmRequestStatus)2702 TI_STATUS qosMngr_setAdmissionInfo(TI_HANDLE hQosMngr,
2703 UINT8 acID,
2704 tspecInfo_t *pTspecInfo,
2705 trafficAdmRequestStatus_e trafficAdmRequestStatus)
2706 {
2707 UINT32 actualMediumTime;
2708 OS_802_11_QOS_TSPEC_PARAMS addtsReasonCode;
2709 qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
2710 whalCtrl_setTemplate_t templateStruct;
2711 QosNullDataTemplate_t QosNullDataTemplate;
2712
2713 /* Check if the updated AC is in WAIT state */
2714 if(pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].trafficAdmState != AC_WAIT_ADMISSION)
2715 {
2716 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
2717 ("qosMngr_setAdmissionInfo: acID = %d, trafficAdmState != WAIT. IGNORE !!!\n", acID));
2718
2719 return NOK;
2720 }
2721
2722 if (pQosMngr->TSPECNegotiationResultCallb != NULL)
2723 {
2724 pQosMngr->TSPECNegotiationResultCallb (pQosMngr->TSPECNegotiationResultModule, trafficAdmRequestStatus);
2725 pQosMngr->TSPECNegotiationResultCallb = NULL;
2726 pQosMngr->TSPECNegotiationResultModule = NULL;
2727 }
2728
2729 switch(trafficAdmRequestStatus)
2730 {
2731 case STATUS_TRAFFIC_ADM_REQUEST_ACCEPT:
2732 /* Received admission response with status accept */
2733
2734 WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
2735 ("qosMngr_setAdmissionInfo: admCtrl status = REQUEST_ACCEPT [ acID = %d, mediumTime = %d, minimumPHYRate = %d ]\n",
2736 acID, pTspecInfo->mediumTime, pTspecInfo->minimumPHYRate));
2737
2738 /* Set the event params */
2739 addtsReasonCode.uAPSDFlag = pTspecInfo->UPSDFlag;
2740 addtsReasonCode.uUserPriority = pTspecInfo->userPriority;
2741 addtsReasonCode.uNominalMSDUsize = pTspecInfo->nominalMsduSize;
2742 addtsReasonCode.uMeanDataRate = pTspecInfo->meanDataRate;
2743 addtsReasonCode.uMinimumPHYRate = pTspecInfo->minimumPHYRate;
2744 addtsReasonCode.uSurplusBandwidthAllowance = pTspecInfo->surplausBwAllowance;
2745 addtsReasonCode.uMediumTime = pTspecInfo->mediumTime;
2746
2747 /* Free the candidate parameters */
2748 pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].trafficAdmState = AC_NOT_ADMITTED;
2749
2750 /* Validate tid matching */
2751 if (pTspecInfo->tid == pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].tid)
2752 {
2753 addtsReasonCode.uReasonCode = ADDTS_RESPONSE_ACCEPT;
2754
2755 /* Send event */
2756 EvHandlerSendEvent (pQosMngr->hEvHandler,
2757 IPC_EVENT_TSPEC_STATUS,
2758 (UINT8*)&addtsReasonCode,
2759 sizeof(OS_802_11_QOS_TSPEC_PARAMS));
2760 }
2761 else
2762 {
2763 addtsReasonCode.uReasonCode = ADDTS_RESPONSE_AP_PARAM_INVALID;
2764
2765 /* Send event */
2766 EvHandlerSendEvent (pQosMngr->hEvHandler,
2767 IPC_EVENT_TSPEC_STATUS,
2768 (UINT8*)&addtsReasonCode,
2769 sizeof(OS_802_11_QOS_TSPEC_PARAMS));
2770 return OK;
2771 }
2772
2773 /* Update the current TSPEC parameters from the received TSPEC */
2774 os_memoryCopy (pQosMngr->hOs,
2775 &pQosMngr->resourceMgmtTable.currentTspecInfo[acID],
2776 pTspecInfo,
2777 sizeof(tspecInfo_t));
2778
2779 /* Set the TSPEC to admitted */
2780 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].trafficAdmState = AC_ADMITTED;
2781
2782 /* Update total medium time */
2783 pQosMngr->resourceMgmtTable.totalAllocatedMediumTime += pTspecInfo->mediumTime;
2784
2785 /*
2786 * Set QOS Null-data template into the firmware.
2787 * When a new TSPEC with UPSD is "accepted" by the AP,
2788 * we set the user priority of it into the firmware.
2789 * Since this AC is already ADMITTED (we are processing the successful response),
2790 * it is OK to set the qos null data template with this UP
2791 */
2792 if (addtsReasonCode.uAPSDFlag == PS_SCHEME_UPSD_TRIGGER &&
2793 pQosMngr->QosNullDataTemplateUserPriority == 0xFF)
2794 {
2795 /* Remember the user priority which we have set */
2796 pQosMngr->QosNullDataTemplateUserPriority = (UINT8)addtsReasonCode.uUserPriority;
2797
2798 templateStruct.pTemplate = (UINT8 *)&QosNullDataTemplate;
2799 templateStruct.templateType = QOS_NULL_DATA_TEMPLATE;
2800 buildQosNullDataTemplate (pQosMngr->hSiteMgr, &templateStruct, pQosMngr->QosNullDataTemplateUserPriority);
2801 whalCtrl_SetTemplate (pQosMngr->hHalCtrl, &templateStruct);
2802
2803 WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
2804 ("qosMngr_setAdmissionInfo: Setting QOS null data for UserPriority=%d (due to TSPEC ACCEPT response)\n",
2805 addtsReasonCode.uUserPriority));
2806 }
2807
2808 /* Set params to TX */
2809 /*------------------*/
2810
2811 /* Update medium time and rate adaptation event only when init admission bit was 0 */
2812 if (pQosMngr->acParams[acID].apInitAdmissionState == ADMISSION_REQUIRED)
2813 {
2814 /* mediumTime is in units of 32uSec and we work in mSec */
2815 actualMediumTime = (pTspecInfo->mediumTime * 32) / 1000;
2816
2817 /* Set TX params */
2818 txData_setAdmisionCtrlParams (pQosMngr->hTxData,
2819 acID,
2820 actualMediumTime,
2821 pTspecInfo->minimumPHYRate,
2822 TRUE);
2823 }
2824
2825 {
2826 PSScheme_e psMode = pTspecInfo->UPSDFlag ? PS_SCHEME_UPSD_TRIGGER
2827 : PS_SCHEME_LEGACY_PSPOLL;
2828
2829 if (pQosMngr->acParams[acID].currentWmeAcPsMode != psMode)
2830 {
2831 TI_STATUS status;
2832
2833 pQosMngr->acParams[acID].currentWmeAcPsMode = psMode;
2834
2835 /* UPSD_FW - open comment in UPSD FW integration */
2836 pQosMngr->acParams[acID].QtrafficParams.psScheme = pQosMngr->acParams[acID].currentWmeAcPsMode;
2837 status = verifyAndConfigTrafficParams (pQosMngr, &pQosMngr->acParams[acID].QtrafficParams);
2838 if (status != OK)
2839 return status;
2840
2841 if (acID == QOS_AC_VO)
2842 {
2843 /* Update TX with "new" PS Voice Delivery mode */
2844 txData_setPsVoiceDeliveryMode (pQosMngr->hTxData, pQosMngr->acParams[QOS_AC_VO].currentWmeAcPsMode);
2845 }
2846 }
2847 }
2848 break;
2849
2850 case STATUS_TRAFFIC_ADM_REQUEST_REJECT:
2851 /* Received admission response with status reject */
2852
2853 WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
2854 ("qosMngr_setAdmissionInfo: admCtrl status = REQUEST_REJECT [ acID = %d ]\n", acID));
2855
2856 /* Validate tid matching */
2857 if (pTspecInfo->tid == pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].tid)
2858 {
2859 addtsReasonCode.uReasonCode = pTspecInfo->statusCode;
2860 }
2861 else
2862 {
2863 addtsReasonCode.uReasonCode = ADDTS_RESPONSE_AP_PARAM_INVALID;
2864 }
2865
2866 // put the candidateTspec back to a previously accepted TSPEC if
2867 // one exist. This will prevent TI from sending same rejected
2868 // TSPEC when roaming to another AP that has the same configuration
2869 // as our current AP (under which case our the new AP will likely reject
2870 // the TSPEC as well and we will not be able to roam
2871 os_memoryCopy (pQosMngr->hOs,
2872 &pQosMngr->resourceMgmtTable.candidateTspecInfo[acID],
2873 &pQosMngr->resourceMgmtTable.currentTspecInfo[acID],
2874 sizeof(tspecInfo_t));
2875 if( pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].userPriority == INACTIVE_USER_PRIORITY ) {
2876 if( acID == QOS_AC_VO ) pQosMngr->voiceTspecConfigured = FALSE;
2877 else if( acID == QOS_AC_VI ) pQosMngr->voiceTspecConfigured = FALSE;
2878 }
2879
2880
2881 /* Send event to application */
2882 addtsReasonCode.uAPSDFlag = pTspecInfo->UPSDFlag;
2883 addtsReasonCode.uUserPriority = pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].userPriority;
2884 addtsReasonCode.uNominalMSDUsize = pTspecInfo->nominalMsduSize;
2885 addtsReasonCode.uMeanDataRate = pTspecInfo->meanDataRate;
2886 addtsReasonCode.uMinimumPHYRate = pTspecInfo->minimumPHYRate;
2887 addtsReasonCode.uSurplusBandwidthAllowance = pTspecInfo->surplausBwAllowance;
2888 addtsReasonCode.uMediumTime = pTspecInfo->mediumTime;
2889
2890 EvHandlerSendEvent (pQosMngr->hEvHandler,
2891 IPC_EVENT_TSPEC_STATUS,
2892 (UINT8*)&addtsReasonCode,
2893 sizeof(OS_802_11_QOS_TSPEC_PARAMS));
2894 break;
2895
2896 case STATUS_TRAFFIC_ADM_REQUEST_TIMEOUT:
2897 WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
2898 ("qosMngr_setAdmissionInfo: admCtrl status = REQUEST_TIMEOUT [ acID = %d ]\n", acID));
2899
2900 /* Free the candidate parameters */
2901 pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].trafficAdmState = AC_NOT_ADMITTED;
2902
2903 /* Send event to application */
2904 addtsReasonCode.uUserPriority = pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].userPriority;
2905 addtsReasonCode.uReasonCode = ADDTS_RESPONSE_TIMEOUT;
2906 addtsReasonCode.uAPSDFlag = 0;
2907 addtsReasonCode.uNominalMSDUsize = 0;
2908 addtsReasonCode.uMeanDataRate = 0;
2909 addtsReasonCode.uMinimumPHYRate = 0;
2910 addtsReasonCode.uSurplusBandwidthAllowance = 0;
2911 addtsReasonCode.uMediumTime = 0;
2912
2913 EvHandlerSendEvent (pQosMngr->hEvHandler,
2914 IPC_EVENT_TSPEC_STATUS,
2915 (UINT8*)&addtsReasonCode,
2916 sizeof(OS_802_11_QOS_TSPEC_PARAMS));
2917 break;
2918
2919 default:
2920 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
2921 ("qosMngr_setAdmissionInfo: receive state from admCtrl = unknown !!! \n"));
2922 break;
2923 }
2924
2925 return OK;
2926 }
2927
2928 /************************************************************************
2929 * QosMngr_receiveActionFrames *
2930 ************************************************************************
2931 DESCRIPTION:
2932
2933 RETURN: OK on success, NOK otherwise
2934
2935 ************************************************************************/
QosMngr_receiveActionFrames(TI_HANDLE hQosMngr,UINT8 * pData,UINT8 action,UINT32 bodyLen)2936 TI_STATUS QosMngr_receiveActionFrames(TI_HANDLE hQosMngr, UINT8* pData, UINT8 action, UINT32 bodyLen)
2937 {
2938 UINT8 acID;
2939 tsInfo_t tsInfo;
2940 UINT8 userPriority;
2941 dot11_WME_TSPEC_IE_t* dot11_WME_TSPEC_IE;
2942 OS_802_11_QOS_TSPEC_PARAMS addtsReasonCode;
2943
2944
2945 qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
2946
2947 /* check if STA is already connected to AP */
2948 if( (pQosMngr->isConnected == FALSE) ||
2949 (pQosMngr->activeProtocol != WME) ||
2950 (pQosMngr->trafficAdmCtrlEnable == FALSE) )
2951 {
2952 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,("QosMngr_receiveActionFrames: Ignore !!!"));
2953 return NOK;
2954 }
2955
2956 /* check DELTS action code */
2957 if (action == DELTS_ACTION)
2958 {
2959 /* parse the frame */
2960 pData++; /* DIALOG TOKEN */
2961 pData++; /* STATUS CODE */
2962
2963 #if 0 /* Need to send TSPEC IE in DELTS or only the tsinfo ??*/
2964 /* only tsinfo */
2965 tsInfo.tsInfoArr[0] = *pData;
2966 pData++;
2967 tsInfo.tsInfoArr[1] = *pData;
2968 pData++;
2969 tsInfo.tsInfoArr[2] = *pData;
2970 pData++;
2971 #else
2972 /* TSpec IE in DELTS*/
2973 dot11_WME_TSPEC_IE = (dot11_WME_TSPEC_IE_t*)pData;
2974 tsInfo.tsInfoArr[0] = dot11_WME_TSPEC_IE->tHdr.tsInfoField.tsInfoArr[0];
2975 pData++;
2976 bodyLen--;
2977 tsInfo.tsInfoArr[1] = dot11_WME_TSPEC_IE->tHdr.tsInfoField.tsInfoArr[1];
2978 pData++;
2979 bodyLen--;
2980 tsInfo.tsInfoArr[2] = dot11_WME_TSPEC_IE->tHdr.tsInfoField.tsInfoArr[2];
2981 #endif
2982
2983 userPriority = (((tsInfo.tsInfoArr[1]) & TS_INFO_1_USER_PRIORITY_MASK) >> USER_PRIORITY_SHIFT);
2984
2985 acID = WMEQosTagToACTable[userPriority];
2986
2987
2988 WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
2989 ("QosMngr_receiveActionFrames: DELTS [ acID = %d ] \n", acID));
2990
2991
2992 /* check if this AC is admitted with the correct userPriority */
2993 if( (pQosMngr->resourceMgmtTable.currentTspecInfo[acID].trafficAdmState == AC_ADMITTED) &&
2994 ( pQosMngr->resourceMgmtTable.currentTspecInfo[acID].userPriority == userPriority) )
2995 {
2996 deleteTspecConfiguration(pQosMngr, acID);
2997
2998 /* Send event to notify DEL_TS */
2999 addtsReasonCode.uAPSDFlag = 0;
3000 addtsReasonCode.uUserPriority = userPriority;
3001 addtsReasonCode.uReasonCode = TSPEC_DELETED_BY_AP;
3002 addtsReasonCode.uNominalMSDUsize = 0;
3003 addtsReasonCode.uMeanDataRate = 0;
3004 addtsReasonCode.uMinimumPHYRate = 0;
3005 addtsReasonCode.uSurplusBandwidthAllowance = 0;
3006 addtsReasonCode.uMediumTime = 0;
3007
3008 EvHandlerSendEvent(pQosMngr->hEvHandler, IPC_EVENT_TSPEC_STATUS, (UINT8*)(&addtsReasonCode), sizeof(OS_802_11_QOS_TSPEC_PARAMS));
3009 }
3010 else
3011 {
3012 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
3013 ("QosMngr_receiveActionFrames: DELTS [ acID = %d userPriority = %d currentUserPriority = %d] Current State in not ADMITED !! \n", acID, userPriority,pQosMngr->resourceMgmtTable.currentTspecInfo[acID].userPriority));
3014
3015 }
3016 }
3017 /* if action code is ADDTS call trafficAdmCtrl object API function */
3018 else if (action == ADDTS_RESPONSE_ACTION)
3019 {
3020 if (trafficAdmCtrl_recv(pQosMngr->pTrafficAdmCtrl, pData, action) == OK)
3021 {
3022 #ifdef EXC_MODULE_INCLUDED
3023 /* Check if EXC IEs present, if so, parse them and update relevant modules;
3024 skip the TSPEC IE;
3025 do not forget 2 bytes of status and dialog code that must be skipped as well */
3026 EXCv4IEs_t excIE;
3027 UINT32 readLen;
3028
3029 excIE.edcaLifetimeParameter = NULL;
3030 excIE.trafficStreamParameter = NULL;
3031 excIE.tsMetrixParameter = NULL;
3032
3033 userPriority = ((((dot11_WME_TSPEC_IE_t *)(pData+2))->tHdr.tsInfoField.tsInfoArr[1] & TS_INFO_1_USER_PRIORITY_MASK) >> USER_PRIORITY_SHIFT);
3034 acID = WMEQosTagToACTable[userPriority];
3035
3036 readLen = ((dot11_eleHdr_t *)(pData+2))->eleLen;
3037
3038 /* 4 stands for 1 byte of token+1 byte of status+1 byte of EID+1 byte of len */
3039 bodyLen = bodyLen - 4 - readLen;
3040 pData = pData + 4 + readLen;
3041
3042 while (bodyLen)
3043 {
3044 mlmeParser_readExcOui(pData, bodyLen, &readLen, &excIE);
3045 bodyLen -= readLen;
3046 pData += readLen;
3047 }
3048
3049 excMngr_setEXCQoSParams(pQosMngr->hExcMgr, &excIE, acID);
3050 #endif
3051 }
3052 }
3053 else
3054 {
3055 WLAN_REPORT_WARNING(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
3056 ("QosMngr_receiveActionFrames: Receive unknown action code = %d -> Ignore !! \n",action));
3057 }
3058
3059 return OK;
3060 }
3061
3062 /************************************************************************
3063 * qosMngr_getCurrAcStatus *
3064 ************************************************************************
3065 DESCRIPTION: This function is API fuunction for getting tha AC status .
3066
3067 INPUT: hQosMngr - Qos Manager handle.
3068 pAcStatusParams
3069
3070 OUTPUT:
3071
3072 RETURN: OK on success, NOK otherwise
3073
3074 ************************************************************************/
qosMngr_getCurrAcStatus(TI_HANDLE hQosMngr,OS_802_11_AC_UPSD_STATUS_PARAMS * pAcStatusParams)3075 static TI_STATUS qosMngr_getCurrAcStatus(TI_HANDLE hQosMngr, OS_802_11_AC_UPSD_STATUS_PARAMS *pAcStatusParams)
3076 {
3077 qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
3078
3079 /* check AC validity */
3080 if( pAcStatusParams->uAC > MAX_NUM_OF_AC )
3081 {
3082 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
3083 ("qosMngr_getCurrAcStatus: acID > 3 -> Ignore !!!"));
3084 return NOK;
3085 }
3086
3087 /* check if sta is connected to AP */
3088 if(pQosMngr->isConnected == FALSE)
3089 {
3090 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
3091 ("qosMngr_getCurrAcStatus: pQosMngr->connected == FALSE -> Ignore !!!"));
3092 return NOT_CONNECTED;
3093 }
3094
3095 /* check if AP support WME */
3096 if(pQosMngr->activeProtocol != WME)
3097 {
3098 WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
3099 ("qosMngr_getCurrAcStatus: activeProtocol != WME -> Ignore !!!"));
3100 return NO_QOS_AP;
3101 }
3102
3103 pAcStatusParams->uCurrentUAPSDStatus = pQosMngr->acParams[pAcStatusParams->uAC].currentWmeAcPsMode;
3104 pAcStatusParams->pCurrentAdmissionStatus = pQosMngr->resourceMgmtTable.currentTspecInfo[pAcStatusParams->uAC].trafficAdmState;
3105
3106 return OK;
3107 }
3108
3109
3110
3111 /************************************************************************
3112 * setNonQosAdmissionState *
3113 ************************************************************************
3114 DESCRIPTION: This function resets the admission state variables as required
3115 for non-QoS mode and configures the Tx module.
3116
3117 INPUT: pQosMngr - Qos Manager pointer.
3118 acId - the AC to update.
3119
3120 OUTPUT:
3121
3122 RETURN:
3123
3124 ************************************************************************/
3125
setNonQosAdmissionState(qosMngr_t * pQosMngr,UINT8 acID)3126 static void setNonQosAdmissionState(qosMngr_t *pQosMngr, UINT8 acID)
3127 {
3128 paramInfo_t param;
3129
3130 if(acID == QOS_AC_BE)
3131 {
3132 pQosMngr->acParams[acID].apInitAdmissionState = ADMISSION_NOT_REQUIRED;
3133 param.content.txDataQosParams.qosParams.admissionRequired = ADMISSION_NOT_REQUIRED;
3134
3135
3136 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].trafficAdmState = AC_ADMITTED;
3137 param.content.txDataQosParams.qosParams.admissionState = AC_ADMITTED;
3138 }
3139 else
3140 {
3141 pQosMngr->acParams[acID].apInitAdmissionState = ADMISSION_REQUIRED;
3142 param.content.txDataQosParams.qosParams.admissionRequired = ADMISSION_REQUIRED;
3143
3144
3145 pQosMngr->resourceMgmtTable.currentTspecInfo[acID].trafficAdmState = AC_NOT_ADMITTED;
3146 param.content.txDataQosParams.qosParams.admissionState = AC_NOT_ADMITTED;
3147 }
3148
3149 param.content.txDataQosParams.acID = acID;
3150 param.paramType = TX_DATA_AC_ADMISSION_STATE;
3151
3152 txData_setParam(pQosMngr->hTxData,¶m);
3153 }
3154
qosMngr_storeTspecCandidateParams(tspecInfo_t * pCandidateParams,OS_802_11_QOS_TSPEC_PARAMS * pTSPECParams,UINT8 ac)3155 static void qosMngr_storeTspecCandidateParams (tspecInfo_t *pCandidateParams, OS_802_11_QOS_TSPEC_PARAMS *pTSPECParams, UINT8 ac)
3156 {
3157 pCandidateParams->AC = (acTrfcType_e)ac;
3158 pCandidateParams->tid = (UINT8)pTSPECParams->uUserPriority;
3159 pCandidateParams->userPriority = (UINT8)pTSPECParams->uUserPriority;
3160 pCandidateParams->meanDataRate = pTSPECParams->uMeanDataRate;
3161 pCandidateParams->nominalMsduSize = (UINT16)pTSPECParams->uNominalMSDUsize;
3162 pCandidateParams->UPSDFlag = (BOOL)pTSPECParams->uAPSDFlag;
3163 pCandidateParams->surplausBwAllowance = (UINT16)pTSPECParams->uSurplusBandwidthAllowance;
3164 pCandidateParams->minimumPHYRate = pTSPECParams->uMinimumPHYRate;
3165 pCandidateParams->streamDirection = BI_DIRECTIONAL;
3166 pCandidateParams->mediumTime = 0;
3167 }
3168