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