1 /*
2 * Ctrl.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 /***************************************************************************/
35 /* */
36 /* MODULE: Ctrl.c */
37 /* PURPOSE: Control module functions */
38 /* */
39 /***************************************************************************/
40 #define __FILE_ID__ FILE_ID_51
41 #include "Ctrl.h"
42 #include "802_11Defs.h"
43 #include "DataCtrl_Api.h"
44 #include "osApi.h"
45 #include "report.h"
46 #include "smeApi.h"
47 #include "siteMgrApi.h"
48 #include "TrafficMonitorAPI.h"
49 #include "TI_IPC_Api.h"
50 #include "EvHandler.h"
51 #include "apConn.h"
52 #include "rate.h"
53 #include "TWDriver.h"
54 #include "DrvMainModules.h"
55 #include "StaCap.h"
56
57 static void selectRateTable(TI_HANDLE hCtrlData, TI_UINT32 rateMask);
58 static void ctrlData_setTxRatePolicies(ctrlData_t *pCtrlData);
59 static void ctrlData_UnregisterTrafficIntensityEvents (TI_HANDLE hCtrlData);
60 static void ctrlData_RegisterTrafficIntensityEvents (TI_HANDLE hCtrlData);
61 static void ctrlData_storeTSRateSet(ctrlData_t *pCtrlData, TTxDataQosParams *tsrsParams);
62 static void ctrlData_TrafficThresholdCrossed(TI_HANDLE Context,TI_UINT32 Cookie);
63
64
65 /* definitions for medium usage calculations - in uSec units*/
66 #define AVERAGE_ACK_TIME 10
67 #define AVERAGE_CTS_TIME 20
68 #define B_SIFS 10
69
70 #define SHORT_PREAMBLE_TIME 96
71 #define LONG_PREAMBLE_TIME 192
72
73 #define OFDM_PREAMBLE 12
74 #define OFDM_SIGNAL_EXT 6
75 #define OFDM_PLCP_HDR 24
76
77 #define OFDM_DURATION (B_SIFS + OFDM_PLCP_HDR + OFDM_SIGNAL_EXT)
78 #define NONOFDM_SHORT_DURATION (B_SIFS + SHORT_PREAMBLE_TIME)
79 #define NONOFDM_LONG_DURATION (B_SIFS + LONG_PREAMBLE_TIME)
80
81 /*************************************************************************
82 * ctrlData_create *
83 **************************************************************************
84 * DESCRIPTION: This function initializes the Ctrl data module.
85 *
86 * INPUT: hOs - handle to Os Abstraction Layer
87 *
88 * RETURN: Handle to the allocated Ctrl data control block
89 ************************************************************************/
ctrlData_create(TI_HANDLE hOs)90 TI_HANDLE ctrlData_create(TI_HANDLE hOs)
91 {
92 TI_HANDLE hCtrlData;
93
94 if( hOs == NULL )
95 {
96 WLAN_OS_REPORT(("FATAL ERROR: ctrlData_create(): OS handle Error - Aborting\n"));
97 return NULL;
98 }
99
100 /* alocate Control module control block */
101 hCtrlData = os_memoryAlloc (hOs, sizeof(ctrlData_t));
102 if (!hCtrlData)
103 {
104 return NULL;
105 }
106
107 /* reset control module control block */
108 os_memoryZero (hOs, hCtrlData, sizeof(ctrlData_t));
109
110 ((ctrlData_t *)hCtrlData)->hOs = hOs;
111
112 return (hCtrlData);
113 }
114
115
116 /***************************************************************************
117 * ctrlData_config *
118 ****************************************************************************
119 * DESCRIPTION: This function configures the Ctrl Data module
120 *
121 * INPUTS: pStadHandles - Other modules handles
122 * retriesUpdateCBFunc - Link test retries callback function
123 * retriesUpdateCBObj - Link test retries callback handle
124 *
125 * OUTPUT:
126 *
127 * RETURNS: void
128 ***************************************************************************/
ctrlData_init(TStadHandlesList * pStadHandles,retriesCB_t retriesUpdateCBFunc,TI_HANDLE retriesUpdateCBObj)129 void ctrlData_init (TStadHandlesList *pStadHandles,
130 retriesCB_t retriesUpdateCBFunc,
131 TI_HANDLE retriesUpdateCBObj)
132 {
133 ctrlData_t *pCtrlData = (ctrlData_t *)(pStadHandles->hCtrlData);
134
135 /* set objects handles */
136 pCtrlData->hTWD = pStadHandles->hTWD;
137 pCtrlData->hSiteMgr = pStadHandles->hSiteMgr;
138 pCtrlData->hTxCtrl = pStadHandles->hTxCtrl;
139 pCtrlData->hRxData = pStadHandles->hRxData;
140 pCtrlData->hOs = pStadHandles->hOs;
141 pCtrlData->hReport = pStadHandles->hReport;
142 pCtrlData->hAPConn = pStadHandles->hAPConnection;
143 pCtrlData->hEvHandler = pStadHandles->hEvHandler;
144 pCtrlData->hTrafficMonitor = pStadHandles->hTrafficMon;
145 pCtrlData->hTxDataQ = pStadHandles->hTxDataQ;
146 pCtrlData->hStaCap = pStadHandles->hStaCap;
147
148 #ifdef XCC_MODULE_INCLUDED
149 /* Register the link test retries CB */
150 pCtrlData->retriesUpdateCBFunc = retriesUpdateCBFunc;
151 pCtrlData->retriesUpdateCBObj = retriesUpdateCBObj;
152 #endif
153
154 TRACE0(pCtrlData->hReport, REPORT_SEVERITY_INIT, ".....Ctrl Data configured successfully ...\n");
155 }
156
157
ctrlData_SetDefaults(TI_HANDLE hCtrlData,ctrlDataInitParams_t * ctrlDataInitParams)158 TI_STATUS ctrlData_SetDefaults (TI_HANDLE hCtrlData, ctrlDataInitParams_t *ctrlDataInitParams)
159 {
160 ctrlData_t *pCtrlData = (ctrlData_t *)hCtrlData;
161 TI_UINT32 ac;
162
163 /* set Control module parameters */
164 pCtrlData->ctrlDataDesiredIbssProtection = ctrlDataInitParams->ctrlDataDesiredIbssProtection;
165 pCtrlData->ctrlDataIbssProtectionType = ctrlDataInitParams->ctrlDataDesiredIbssProtection;
166 pCtrlData->ctrlDataRtsCtsStatus = ctrlDataInitParams->ctrlDataDesiredCtsRtsStatus;
167
168 MAC_COPY (pCtrlData->ctrlDataDeviceMacAddress,
169 ctrlDataInitParams->ctrlDataDeviceMacAddress);
170
171 pCtrlData->ctrlDataCurrentBssType = BSS_INFRASTRUCTURE;
172
173 /* Set short/long retry for all ACs plus one policy for management packets */
174 for (ac=0; ac < MAX_NUM_OF_AC + 1; ac++)
175 {
176 pCtrlData->ctrlDataTxRatePolicy.rateClass[ac].longRetryLimit = ctrlDataInitParams->ctrlDataTxRatePolicy.longRetryLimit;
177 pCtrlData->ctrlDataTxRatePolicy.rateClass[ac].shortRetryLimit = ctrlDataInitParams->ctrlDataTxRatePolicy.shortRetryLimit;
178 }
179
180 /* Set enabled rates bitmap for each rates mode */
181 pCtrlData->policyEnabledRatesMaskCck = ctrlDataInitParams->policyEnabledRatesMaskCck;
182 pCtrlData->policyEnabledRatesMaskOfdm = ctrlDataInitParams->policyEnabledRatesMaskOfdm;
183 pCtrlData->policyEnabledRatesMaskOfdmA = ctrlDataInitParams->policyEnabledRatesMaskOfdmA;
184 pCtrlData->policyEnabledRatesMaskOfdmN = ctrlDataInitParams->policyEnabledRatesMaskOfdmN;
185
186 ctrlData_updateTxRateAttributes(hCtrlData); /* Update TxCtrl module with rate change.*/
187
188 /* Initialize traffic intensity threshold parameters */
189 pCtrlData->ctrlDataTrafficIntensityEventsEnabled = ctrlDataInitParams->ctrlDataTrafficThresholdEnabled;
190 pCtrlData->ctrlDataTrafficIntensityThresholds.uHighThreshold = ctrlDataInitParams->ctrlDataTrafficThreshold.uHighThreshold;
191 pCtrlData->ctrlDataTrafficIntensityThresholds.uLowThreshold = ctrlDataInitParams->ctrlDataTrafficThreshold.uLowThreshold;
192 pCtrlData->ctrlDataTrafficIntensityThresholds.TestInterval = ctrlDataInitParams->ctrlDataTrafficThreshold.TestInterval;
193
194 TRACE4(pCtrlData->hReport, REPORT_SEVERITY_INFORMATION, "\nTraffic Intensity parameters:\nEvents enabled = %d\nuHighThreshold = %d\nuLowThreshold = %d\nTestInterval = %d\n\n", pCtrlData->ctrlDataTrafficIntensityEventsEnabled, pCtrlData->ctrlDataTrafficIntensityThresholds.uHighThreshold, pCtrlData->ctrlDataTrafficIntensityThresholds.uLowThreshold, pCtrlData->ctrlDataTrafficIntensityThresholds.TestInterval);
195
196 /* Register the traffic intensity events with the traffic monitor */
197 ctrlData_RegisterTrafficIntensityEvents (pCtrlData);
198
199 /* If the events are enabled, start notification, if disabled - then do nothing */
200 ctrlData_ToggleTrafficIntensityNotification (pCtrlData, pCtrlData->ctrlDataTrafficIntensityEventsEnabled);
201
202 return TI_OK;
203 }
204
205
206 /***************************************************************************
207 * ctrlData_unLoad *
208 ****************************************************************************
209 * DESCRIPTION: This function unload the Ctrl data module.
210 *
211 * INPUTS: hCtrlData - the object
212 *
213 * OUTPUT:
214 *
215 * RETURNS: TI_OK - Unload succesfull
216 * TI_NOK - Unload unsuccesfull
217 ***************************************************************************/
ctrlData_unLoad(TI_HANDLE hCtrlData)218 TI_STATUS ctrlData_unLoad(TI_HANDLE hCtrlData)
219 {
220 ctrlData_t *pCtrlData = (ctrlData_t *)hCtrlData;
221
222 /* check parameters validity */
223 if( pCtrlData == NULL )
224 {
225 return TI_NOK;
226 }
227
228 /* free control module object */
229 os_memoryFree(pCtrlData->hOs, hCtrlData, sizeof(ctrlData_t));
230
231 return TI_OK;
232 }
233
ctrlData_getParamProtType(TI_HANDLE hCtrlData,erpProtectionType_e * protType)234 TI_STATUS ctrlData_getParamProtType(TI_HANDLE hCtrlData, erpProtectionType_e *protType)
235 { /* CTRL_DATA_CURRENT_IBSS_PROTECTION_PARAM */
236 ctrlData_t *pCtrlData = (ctrlData_t *)hCtrlData;
237
238 *protType = pCtrlData->ctrlDataIbssProtectionType;
239 return TI_OK;
240 }
241
ctrlData_getParamPreamble(TI_HANDLE hCtrlData,EPreamble * preamble)242 TI_STATUS ctrlData_getParamPreamble(TI_HANDLE hCtrlData, EPreamble *preamble)
243 { /* CTRL_DATA_CURRENT_PREAMBLE_TYPE_PARAM */
244 ctrlData_t *pCtrlData = (ctrlData_t *)hCtrlData;
245
246 *preamble = pCtrlData->ctrlDataCurrentPreambleType;
247 return TI_OK;
248 }
249
250 /***************************************************************************
251 * ctrlData_getParamBssid *
252 ****************************************************************************
253 * DESCRIPTION: get a specific parameter related to Bssid
254 *
255 * INPUTS: hCtrlData - the object
256 * paramVal - type of parameter
257 *
258 *
259 * OUTPUT: bssid
260 *
261 * RETURNS: TI_OK
262 * TI_NOK
263 ***************************************************************************/
ctrlData_getParamBssid(TI_HANDLE hCtrlData,EInternalParam paramVal,TMacAddr bssid)264 TI_STATUS ctrlData_getParamBssid(TI_HANDLE hCtrlData, EInternalParam paramVal, TMacAddr bssid)
265 {
266 ctrlData_t *pCtrlData = (ctrlData_t *)hCtrlData;
267
268 if (paramVal == CTRL_DATA_CURRENT_BSSID_PARAM) {
269 MAC_COPY (bssid, pCtrlData->ctrlDataCurrentBSSID);
270 }
271 else if (paramVal == CTRL_DATA_MAC_ADDRESS) {
272 TFwInfo *pFwInfo = TWD_GetFWInfo (pCtrlData->hTWD);
273 MAC_COPY (bssid, pFwInfo->macAddress);
274 }
275
276 return TI_OK;
277 }
278
279 /***************************************************************************
280 * ctrlData_getParam *
281 ****************************************************************************
282 * DESCRIPTION: get a specific parameter
283 *
284 * INPUTS: hCtrlData - the object
285 *
286 *
287 * OUTPUT: pParamInfo - structure which include the value of
288 * the requested parameter
289 *
290 * RETURNS: TI_OK
291 * TI_NOK
292 ***************************************************************************/
293
ctrlData_getParam(TI_HANDLE hCtrlData,paramInfo_t * pParamInfo)294 TI_STATUS ctrlData_getParam(TI_HANDLE hCtrlData, paramInfo_t *pParamInfo)
295 {
296 ctrlData_t *pCtrlData = (ctrlData_t *)hCtrlData;
297
298 TRACE1(pCtrlData->hReport, REPORT_SEVERITY_INFORMATION, "ctrlData_getParam() : param=0x%x \n", pParamInfo->paramType);
299
300 switch (pParamInfo->paramType)
301 {
302 case CTRL_DATA_CURRENT_BSSID_PARAM:
303 MAC_COPY (pParamInfo->content.ctrlDataCurrentBSSID,
304 pCtrlData->ctrlDataCurrentBSSID);
305 break;
306
307 case CTRL_DATA_CURRENT_BSS_TYPE_PARAM:
308 pParamInfo->content.ctrlDataCurrentBssType = pCtrlData->ctrlDataCurrentBssType;
309 break;
310
311 case CTRL_DATA_CURRENT_PREAMBLE_TYPE_PARAM:
312 pParamInfo->content.ctrlDataCurrentPreambleType = pCtrlData->ctrlDataCurrentPreambleType;
313 break;
314
315 case CTRL_DATA_MAC_ADDRESS:
316 {
317 TFwInfo *pFwInfo = TWD_GetFWInfo (pCtrlData->hTWD);
318 MAC_COPY (pParamInfo->content.ctrlDataDeviceMacAddress, pFwInfo->macAddress);
319 }
320 break;
321
322 case CTRL_DATA_CURRENT_PROTECTION_STATUS_PARAM:
323 pParamInfo->content.ctrlDataProtectionEnabled = pCtrlData->ctrlDataProtectionEnabled;
324 break;
325
326 case CTRL_DATA_CURRENT_IBSS_PROTECTION_PARAM:
327 pParamInfo->content.ctrlDataIbssProtecionType = pCtrlData->ctrlDataIbssProtectionType;
328 break;
329
330 case CTRL_DATA_CURRENT_RTS_CTS_STATUS_PARAM:
331 pParamInfo->content.ctrlDataRtsCtsStatus = pCtrlData->ctrlDataRtsCtsStatus;
332 break;
333
334 case CTRL_DATA_CLSFR_TYPE:
335 txDataClsfr_GetClsfrType (pCtrlData->hTxDataQ, &pParamInfo->content.ctrlDataClsfrType);
336 break;
337
338 case CTRL_DATA_TRAFFIC_INTENSITY_THRESHOLD:
339 pParamInfo->content.ctrlDataTrafficIntensityThresholds.uHighThreshold = pCtrlData->ctrlDataTrafficIntensityThresholds.uHighThreshold;
340 pParamInfo->content.ctrlDataTrafficIntensityThresholds.uLowThreshold = pCtrlData->ctrlDataTrafficIntensityThresholds.uLowThreshold;
341 pParamInfo->content.ctrlDataTrafficIntensityThresholds.TestInterval = pCtrlData->ctrlDataTrafficIntensityThresholds.TestInterval;
342 break;
343
344 default:
345 TRACE0(pCtrlData->hReport, REPORT_SEVERITY_ERROR, " ctrlData_getParam() : PARAMETER NOT SUPPORTED \n");
346 return (PARAM_NOT_SUPPORTED);
347 }
348
349 return (TI_OK);
350 }
351
352 /***************************************************************************
353 * ctrlData_buildSupportedHwRates *
354 ****************************************************************************
355 * DESCRIPTION: builds HwRatesBitMap (supported rates) for txRatePolicy by anding
356 * the AP support and the Policy rates (Enabled/Disabled rates)
357 *
358 * OUTPUT:
359 *
360 * RETURNS: TI_OK
361 * TI_NOK
362 ***************************************************************************/
ctrlData_buildSupportedHwRates(TI_UINT32 APsupport,TI_UINT32 policySupport)363 static TI_UINT32 ctrlData_buildSupportedHwRates (TI_UINT32 APsupport,
364 TI_UINT32 policySupport)
365 {
366 TI_UINT32 AppRateBitMap = 0;
367 TI_UINT32 HwRatesBitMap = 0;
368
369 /* 1. AND all Supported Rates masks */
370 AppRateBitMap = APsupport & policySupport;
371
372 /* 2. Incase there are no mutual rates: ignor Policy Rate Settings (use only AP Rates) */
373 if ( AppRateBitMap == 0 )
374 {
375 AppRateBitMap = APsupport;
376 }
377
378 /* 3. Set total supported rates bit map for txRatePolicy */
379 rate_DrvBitmapToHwBitmap (AppRateBitMap, &HwRatesBitMap);
380
381 return HwRatesBitMap;
382 }
383
384
385 /***************************************************************************
386 * ctrlData_setTxRatePolicies *
387 ****************************************************************************
388 * DESCRIPTION: This function sets rate fallback policies to be configured to FW
389 * If TSRS is defined to specific AC, the policy is derived from it,
390 * otherwise it is derived from pre-defined map
391 *
392 * INPUTS: pCtrlData - the object
393 *
394 * RETURNS: -
395 *
396 ***************************************************************************/
ctrlData_setTxRatePolicies(ctrlData_t * pCtrlData)397 static void ctrlData_setTxRatePolicies(ctrlData_t *pCtrlData)
398 {
399 TI_UINT32 ac;
400 TI_UINT32 uPolicyRateMask; /* policy rates */
401 TI_UINT32 uSupportedRateMask; /* AP supported rates */
402 TI_UINT32 fwPolicyID = 0;
403 TI_UINT32 uEnabledHwRatesMask;
404 TI_UINT32 uShiftedBit;
405 TI_UINT32 i;
406 TTwdParamInfo param;
407
408 for (ac = 0; ac < MAX_NUM_OF_AC; ac++)
409 {
410 /* 1. If a special rate set is defined for this AC, use its related policy */
411 /* Otherwise use default settings for this class */
412 if (pCtrlData->tsrsParameters[ac].supportedRatesMask != 0)
413 {
414 uPolicyRateMask = pCtrlData->tsrsParameters[ac].policyClassRateMask;
415 uSupportedRateMask = pCtrlData->tsrsParameters[ac].supportedRatesMask;
416 }
417 else
418 {
419 uPolicyRateMask = pCtrlData->uCurrPolicyEnabledRatesMask;
420 uSupportedRateMask = pCtrlData->ctrlDataCurrentRateMask;
421 }
422
423 /* 2. Build a bitMap for the supported rates */
424 uEnabledHwRatesMask = ctrlData_buildSupportedHwRates (uSupportedRateMask, uPolicyRateMask);
425 pCtrlData->ctrlDataTxRatePolicy.rateClass[fwPolicyID].txEnabledRates = uEnabledHwRatesMask;
426
427 TRACE2(pCtrlData->hReport, REPORT_SEVERITY_INFORMATION, "ctrlData_setTxRatePolicies: AC %d, rate-policy 0x%x", ac, uEnabledHwRatesMask);
428
429 /* Note that Long/Short retries are pre-set during configuration stage */
430
431 /* 3. Finally, increase total number of policies */
432 pCtrlData->tsrsParameters[ac].fwPolicyID = fwPolicyID++;
433
434 } /* for (ac = 0; ac < MAX_NUM_OF_AC; ac++) */
435
436 /* Add a specific policy for management packets, which uses only the lowest supported rate */
437 pCtrlData->uMgmtPolicyId = fwPolicyID;
438 uShiftedBit = 1;
439 for (i = 0; i < 32; i++)
440 {
441 if ((uShiftedBit & uEnabledHwRatesMask) != 0)
442 {
443 break;
444 }
445 uShiftedBit = uShiftedBit << 1;
446 }
447 pCtrlData->ctrlDataTxRatePolicy.rateClass[fwPolicyID].txEnabledRates = uShiftedBit;
448 fwPolicyID++;
449
450 /* Download policies to the FW. Num of policies is 8 - one for each AC for every class */
451 TRACE1(pCtrlData->hReport, REPORT_SEVERITY_INFORMATION, "ctrlData_setTxRatePolicies: num of Rate policies: %d\n", fwPolicyID);
452
453 pCtrlData->ctrlDataTxRatePolicy.numOfRateClasses = fwPolicyID;
454 param.paramType = TWD_TX_RATE_CLASS_PARAM_ID;
455 param.content.pTxRatePlicy = &pCtrlData->ctrlDataTxRatePolicy;
456
457 TWD_SetParam (pCtrlData->hTWD, ¶m);
458 }
459
460
461 /***************************************************************************
462 * ctrlData_setParam *
463 ****************************************************************************
464 * DESCRIPTION: set a specific parameter
465 *
466 * INPUTS: hCtrlData - the object
467 * pParamInfo - structure which include the value to set for
468 * the requested parameter
469 *
470 * OUTPUT:
471 *
472 * RETURNS: TI_OK
473 * TI_NOK
474 ***************************************************************************/
475
ctrlData_setParam(TI_HANDLE hCtrlData,paramInfo_t * pParamInfo)476 TI_STATUS ctrlData_setParam(TI_HANDLE hCtrlData, paramInfo_t *pParamInfo)
477 {
478 ctrlData_t *pCtrlData = (ctrlData_t *)hCtrlData;
479 TTwdParamInfo param;
480
481 TRACE1(pCtrlData->hReport, REPORT_SEVERITY_INFORMATION, "ctrlData_setParam() : param=0x%x \n", pParamInfo->paramType);
482
483 switch (pParamInfo->paramType)
484 {
485 case CTRL_DATA_RATE_CONTROL_ENABLE_PARAM:
486 selectRateTable(pCtrlData, pCtrlData->ctrlDataCurrentRateMask);
487
488 ctrlData_setTxRatePolicies(pCtrlData);
489
490 ctrlData_updateTxRateAttributes(hCtrlData); /* Update the TxCtrl module with rate changes. */
491
492 break;
493
494 case CTRL_DATA_CURRENT_BSSID_PARAM:
495 MAC_COPY (pCtrlData->ctrlDataCurrentBSSID,
496 pParamInfo->content.ctrlDataCurrentBSSID);
497 txCtrlParams_setBssId (pCtrlData->hTxCtrl, &(pCtrlData->ctrlDataCurrentBSSID));
498 break;
499
500 case CTRL_DATA_CURRENT_BSS_TYPE_PARAM:
501 if( pParamInfo->content.ctrlDataCurrentBssType != BSS_INFRASTRUCTURE &&
502 pParamInfo->content.ctrlDataCurrentBssType != BSS_INDEPENDENT )
503 return(PARAM_VALUE_NOT_VALID);
504
505 pCtrlData->ctrlDataCurrentBssType = pParamInfo->content.ctrlDataCurrentBssType;
506 txCtrlParams_setBssType (pCtrlData->hTxCtrl, pCtrlData->ctrlDataCurrentBssType);
507 break;
508
509 case CTRL_DATA_CURRENT_PREAMBLE_TYPE_PARAM:
510 if( pParamInfo->content.ctrlDataCurrentPreambleType != PREAMBLE_LONG &&
511 pParamInfo->content.ctrlDataCurrentPreambleType != PREAMBLE_SHORT )
512 return(PARAM_VALUE_NOT_VALID);
513 pCtrlData->ctrlDataCurrentPreambleType = pParamInfo->content.ctrlDataCurrentPreambleType;
514 break;
515
516 case CTRL_DATA_CURRENT_SUPPORTED_RATE_MASK_PARAM:
517 pCtrlData->ctrlDataCurrentRateMask = pParamInfo->content.ctrlDataCurrentRateMask;
518 selectRateTable(pCtrlData, pCtrlData->ctrlDataCurrentRateMask);
519 ctrlData_updateTxRateAttributes(hCtrlData); /* Update the TxCtrl module with rate changes. */
520 break;
521
522 case CTRL_DATA_TSRS_PARAM:
523 ctrlData_storeTSRateSet(pCtrlData, &pParamInfo->content.txDataQosParams);
524
525 break;
526
527 case CTRL_DATA_CURRENT_PROTECTION_STATUS_PARAM:
528 if (pCtrlData->ctrlDataProtectionEnabled != pParamInfo->content.ctrlDataProtectionEnabled)
529 {
530 pCtrlData->ctrlDataProtectionEnabled = pParamInfo->content.ctrlDataProtectionEnabled;
531
532 /* set indication also to TNET */
533 param.paramType = TWD_CTS_TO_SELF_PARAM_ID;
534 if(pCtrlData->ctrlDataProtectionEnabled == TI_TRUE)
535 param.content.halCtrlCtsToSelf = CTS_TO_SELF_ENABLE;
536 else
537 param.content.halCtrlCtsToSelf = CTS_TO_SELF_DISABLE;
538
539 TWD_SetParam (pCtrlData->hTWD, ¶m);
540
541
542 /* In case of using protection fragmentation should be disabled */
543 param.paramType = TWD_FRAG_THRESHOLD_PARAM_ID;
544 if(pCtrlData->ctrlDataProtectionEnabled == TI_TRUE)
545 {
546 /* save last non-protection mode fragmentation threshold */
547 TWD_GetParam(pCtrlData->hTWD,¶m);
548 pCtrlData->lastFragmentThreshold = param.content.halCtrlFragThreshold;
549 /* set fragmentation threshold to max (disable) */
550 param.content.halCtrlFragThreshold = TWD_FRAG_THRESHOLD_MAX;
551 }
552 else
553 param.content.halCtrlFragThreshold = pCtrlData->lastFragmentThreshold;
554
555 TWD_SetParam(pCtrlData->hTWD,¶m);
556 }
557
558 break;
559
560 case CTRL_DATA_CURRENT_IBSS_PROTECTION_PARAM:
561 if(ERP_PROTECTION_STANDARD == pCtrlData->ctrlDataDesiredIbssProtection)
562 {
563 pCtrlData->ctrlDataIbssProtectionType = pParamInfo->content.ctrlDataIbssProtecionType;
564 }
565 else
566 {
567 pCtrlData->ctrlDataIbssProtectionType = ERP_PROTECTION_NONE;
568 }
569
570 /* set indication also to TNET */
571 param.paramType = TWD_CTS_TO_SELF_PARAM_ID;
572 if(pCtrlData->ctrlDataIbssProtectionType != ERP_PROTECTION_NONE)
573 param.content.halCtrlCtsToSelf = CTS_TO_SELF_ENABLE;
574 else
575 param.content.halCtrlCtsToSelf = CTS_TO_SELF_DISABLE;
576
577 TWD_SetParam (pCtrlData->hTWD, ¶m);
578 break;
579
580 case CTRL_DATA_CURRENT_RTS_CTS_STATUS_PARAM:
581 pCtrlData->ctrlDataRtsCtsStatus = pParamInfo->content.ctrlDataRtsCtsStatus;
582 break;
583 case CTRL_DATA_CLSFR_TYPE:
584 txDataClsfr_SetClsfrType (pCtrlData->hTxDataQ, pParamInfo->content.ctrlDataClsfrType);
585 break;
586
587 case CTRL_DATA_CLSFR_CONFIG:
588 txDataClsfr_InsertClsfrEntry(pCtrlData->hTxDataQ, &pParamInfo->content.ctrlDataClsfrInsertTable);
589 break;
590
591 case CTRL_DATA_CLSFR_REMOVE_ENTRY:
592 txDataClsfr_RemoveClsfrEntry(pCtrlData->hTxDataQ, &pParamInfo->content.ctrlDataClsfrInsertTable);
593 break;
594
595 case CTRL_DATA_TOGGLE_TRAFFIC_INTENSITY_EVENTS:
596
597 /* Enable or disable events according to flag */
598 ctrlData_ToggleTrafficIntensityNotification (pCtrlData, (TI_BOOL)pParamInfo->content.ctrlDataTrafficIntensityEventsFlag);
599
600 break;
601
602 case CTRL_DATA_TRAFFIC_INTENSITY_THRESHOLD:
603 {
604 OS_802_11_TRAFFIC_INTENSITY_THRESHOLD_PARAMS *localParams = &pParamInfo->content.ctrlDataTrafficIntensityThresholds;
605 TI_BOOL savedEnableFlag; /* Used to save previous enable/disable flag - before stopping/starting events for change in params */
606
607 /* If any of the parameters has changed, we need to re-register with the Traffic Monitor */
608 if ((localParams->uHighThreshold != pCtrlData->ctrlDataTrafficIntensityThresholds.uHighThreshold) ||
609 (localParams->uLowThreshold != pCtrlData->ctrlDataTrafficIntensityThresholds.uLowThreshold) ||
610 (localParams->TestInterval != pCtrlData->ctrlDataTrafficIntensityThresholds.TestInterval))
611 {
612
613 os_memoryCopy(pCtrlData->hOs, &pCtrlData->ctrlDataTrafficIntensityThresholds,
614 localParams,
615 sizeof(OS_802_11_TRAFFIC_INTENSITY_THRESHOLD_PARAMS));
616
617 savedEnableFlag = pCtrlData->ctrlDataTrafficIntensityEventsEnabled;
618
619 /* Turn off traffic events */
620 ctrlData_ToggleTrafficIntensityNotification (pCtrlData, TI_FALSE);
621
622 /* Unregister current events */
623 ctrlData_UnregisterTrafficIntensityEvents (pCtrlData);
624
625 /* And re-register with new thresholds */
626 ctrlData_RegisterTrafficIntensityEvents (pCtrlData);
627
628 /* Enable events if they were enabled */
629 ctrlData_ToggleTrafficIntensityNotification (pCtrlData, savedEnableFlag);
630
631 }
632 }
633
634 break;
635
636 default:
637 TRACE0(pCtrlData->hReport, REPORT_SEVERITY_ERROR, " ctrlData_setParam() : PARAMETER NOT SUPPORTED \n");
638 return (PARAM_NOT_SUPPORTED);
639 }
640
641 return (TI_OK);
642 }
643
644
645 /***************************************************************************
646 * selectRateTable *
647 ****************************************************************************
648 * DESCRIPTION:
649 *
650 * INPUTS: hCtrlData - the object
651 *
652 * OUTPUT:
653 *
654 * RETURNS:
655 ***************************************************************************/
656
selectRateTable(TI_HANDLE hCtrlData,TI_UINT32 rateMask)657 static void selectRateTable(TI_HANDLE hCtrlData, TI_UINT32 rateMask)
658 {
659 paramInfo_t param;
660 ERate rate;
661 TI_BOOL b11nEnable;
662
663 ctrlData_t *pCtrlData = (ctrlData_t *)hCtrlData;
664
665 rate = rate_GetMaxFromDrvBitmap (rateMask);
666
667 param.paramType = SITE_MGR_OPERATIONAL_MODE_PARAM;
668 siteMgr_getParam(pCtrlData->hSiteMgr, ¶m);
669
670 switch(param.content.siteMgrDot11OperationalMode)
671 {
672 case DOT11_B_MODE:
673 pCtrlData->uCurrPolicyEnabledRatesMask = pCtrlData->policyEnabledRatesMaskCck;
674 break;
675
676 case DOT11_G_MODE:
677 if( (rate == DRV_RATE_11M) ||
678 (rate == DRV_RATE_5_5M)||
679 (rate == DRV_RATE_2M) ||
680 (rate == DRV_RATE_1M) )
681 {
682 pCtrlData->uCurrPolicyEnabledRatesMask = pCtrlData->policyEnabledRatesMaskCck;
683 }
684 else
685 {
686 pCtrlData->uCurrPolicyEnabledRatesMask = pCtrlData->policyEnabledRatesMaskOfdm;
687 }
688 break;
689
690 case DOT11_A_MODE:
691 pCtrlData->uCurrPolicyEnabledRatesMask = pCtrlData->policyEnabledRatesMaskOfdmA;
692 break;
693
694 case DOT11_DUAL_MODE:
695 case DOT11_MAX_MODE:
696 case DOT11_N_MODE:
697 TRACE0(pCtrlData->hReport, REPORT_SEVERITY_ERROR, " uCurrPolicyEnabledRatesMask not configured !!!");
698 break;
699 }
700
701 /* add HT MCS rates */
702 StaCap_IsHtEnable (pCtrlData->hStaCap, &b11nEnable);
703 if (b11nEnable == TI_TRUE)
704 {
705 if ((rate == DRV_RATE_MCS_0) |
706 (rate == DRV_RATE_MCS_1) |
707 (rate == DRV_RATE_MCS_2) |
708 (rate == DRV_RATE_MCS_3) |
709 (rate == DRV_RATE_MCS_4) |
710 (rate == DRV_RATE_MCS_5) |
711 (rate == DRV_RATE_MCS_6) |
712 (rate == DRV_RATE_MCS_7))
713 {
714 pCtrlData->uCurrPolicyEnabledRatesMask = pCtrlData->policyEnabledRatesMaskOfdmN;
715 }
716 }
717 }
718
719
720 /***************************************************************************
721 * ctrlData_stop *
722 ****************************************************************************
723 * DESCRIPTION: This function stop the link control algorithms.
724 *
725 * INPUTS: hCtrlData - the object
726 *
727 * OUTPUT:
728 *
729 * RETURNS: TI_OK
730 * TI_NOK
731 ***************************************************************************/
732
ctrlData_stop(TI_HANDLE hCtrlData)733 TI_STATUS ctrlData_stop(TI_HANDLE hCtrlData)
734 {
735 ctrlData_t *pCtrlData = (ctrlData_t *)hCtrlData;
736
737 /* set Preamble length option to default value*/
738 pCtrlData->ctrlDataCurrentPreambleType = DEF_CURRENT_PREAMBLE;
739
740 os_memoryZero(pCtrlData->hOs,
741 &pCtrlData->tsrsParameters,
742 sizeof(pCtrlData->tsrsParameters));
743
744 TRACE0(pCtrlData->hReport, REPORT_SEVERITY_INFORMATION, " ctrlData_stop() : Link control algorithms stoped \n");
745
746 return TI_OK;
747 }
748
749
750 /***************************************************************************
751 * ctrlData_updateTxRateAttributes *
752 ****************************************************************************
753 * DESCRIPTION: This function updates the TxCtrl module with all Tx rate attributes
754 * whenever any of them changes.
755 * It is called from ctrlData_setParam() after any rate param update.
756 ***************************************************************************/
ctrlData_updateTxRateAttributes(TI_HANDLE hCtrlData)757 void ctrlData_updateTxRateAttributes(TI_HANDLE hCtrlData)
758 {
759 ctrlData_t *pCtrlData = (ctrlData_t *)hCtrlData;
760 TI_UINT8 ac;
761
762 /* For each AC, get current Tx-rate policy for Data and for Mgmt packets and update the TxCtrl module. */
763 for (ac = 0; ac < MAX_NUM_OF_AC; ac++)
764 {
765 txCtrlParams_updateMgmtRateAttributes(pCtrlData->hTxCtrl, pCtrlData->uMgmtPolicyId, ac);
766 txCtrlParams_updateDataRateAttributes(pCtrlData->hTxCtrl, pCtrlData->tsrsParameters[ac].fwPolicyID, ac);
767 }
768 }
769
770 /***************************************************************************
771 * ctrlData_getCurrBssTypeAndCurrBssId *
772 ****************************************************************************
773 * DESCRIPTION: This function return the current BSSID and the
774 * current BSS Type
775 *
776 * INPUTS: hCtrlData - the object
777 *
778 * OUTPUT: pCurrBssid - pointer to return the current bssid
779 * pCurrBssType - pointer to return the current bss type
780 *
781 * RETURNS: void
782 ***************************************************************************/
ctrlData_getCurrBssTypeAndCurrBssId(TI_HANDLE hCtrlData,TMacAddr * pCurrBssid,ScanBssType_e * pCurrBssType)783 void ctrlData_getCurrBssTypeAndCurrBssId(TI_HANDLE hCtrlData, TMacAddr *pCurrBssid,
784 ScanBssType_e *pCurrBssType)
785 {
786 ctrlData_t *pCtrlData = (ctrlData_t *)hCtrlData;
787
788 MAC_COPY (*pCurrBssid, pCtrlData->ctrlDataCurrentBSSID);
789 *pCurrBssType = pCtrlData->ctrlDataCurrentBssType;
790
791 }
792
793
794 /*-----------------------------------------------------------------------------
795 Routine Name: ctrlData_ToggleTrafficIntensityNotification
796 Routine Description: turns ON/OFF traffic intensity notification events
797 from Traffic Monitor module
798 Arguments:
799 Return Value:
800 -----------------------------------------------------------------------------*/
ctrlData_ToggleTrafficIntensityNotification(TI_HANDLE hCtrlData,TI_BOOL enabledFlag)801 void ctrlData_ToggleTrafficIntensityNotification (TI_HANDLE hCtrlData, TI_BOOL enabledFlag)
802 {
803 ctrlData_t *pCtrlData = (ctrlData_t *)hCtrlData;
804 TI_UINT8 idx;
805
806 if (enabledFlag)
807 {
808 for (idx=0; idx < CTRL_DATA_TRAFFIC_INTENSITY_MAX_EVENTS; idx++)
809 {
810 TrafficMonitor_StartEventNotif (pCtrlData->hTrafficMonitor,pCtrlData->ctrlDataTrafficThresholdEvents[idx]);
811 }
812 TRACE0(pCtrlData->hReport, REPORT_SEVERITY_INFORMATION, "ctrlData_ToggleTrafficIntensityNotification (TI_TRUE)\n");
813 }
814 else
815 {
816 for (idx=0; idx < CTRL_DATA_TRAFFIC_INTENSITY_MAX_EVENTS; idx++)
817 {
818 TrafficMonitor_StopEventNotif (pCtrlData->hTrafficMonitor,pCtrlData->ctrlDataTrafficThresholdEvents[idx]);
819 }
820 TRACE0(pCtrlData->hReport, REPORT_SEVERITY_INFORMATION, "ctrlData_ToggleTrafficIntensityNotification (TI_FALSE)\n");
821 }
822 pCtrlData->ctrlDataTrafficIntensityEventsEnabled = enabledFlag;
823
824 }
825
826 /*-----------------------------------------------------------------------------
827 Routine Name: ctrlData_UnregisterTrafficIntensityEvents
828 Routine Description: unregisters existing events from traffic monitor
829 Arguments:
830 Return Value:
831 -----------------------------------------------------------------------------*/
ctrlData_UnregisterTrafficIntensityEvents(TI_HANDLE hCtrlData)832 static void ctrlData_UnregisterTrafficIntensityEvents (TI_HANDLE hCtrlData)
833 {
834 ctrlData_t *pCtrlData = (ctrlData_t *)hCtrlData;
835 TI_UINT8 idx;
836
837 /* Loop through events and unregister them */
838 for (idx=0; idx < CTRL_DATA_TRAFFIC_INTENSITY_MAX_EVENTS; idx++)
839 {
840 TrafficMonitor_UnregEvent (pCtrlData->hTrafficMonitor,pCtrlData->ctrlDataTrafficThresholdEvents[idx]);
841 }
842
843 TRACE0(pCtrlData->hReport, REPORT_SEVERITY_INFORMATION, "ctrlData_UnregisterTrafficIntensityEvents: Unregistered all events\n");
844
845 }
846
847
848 /*-----------------------------------------------------------------------------
849 Routine Name: ctrlData_RegisterTrafficIntensityEvents
850 Routine Description: Registers traffic intensity threshold events through traffic monitor
851 Arguments:
852 Return Value:
853 -----------------------------------------------------------------------------*/
ctrlData_RegisterTrafficIntensityEvents(TI_HANDLE hCtrlData)854 static void ctrlData_RegisterTrafficIntensityEvents (TI_HANDLE hCtrlData)
855 {
856 ctrlData_t *pCtrlData = (ctrlData_t *)hCtrlData;
857 TrafficAlertRegParm_t TrafficAlertRegParm;
858 TI_STATUS status;
859
860 /* Register high threshold "direction up" event */
861 TrafficAlertRegParm.CallBack = ctrlData_TrafficThresholdCrossed;
862 TrafficAlertRegParm.Context = hCtrlData;
863 TrafficAlertRegParm.Cookie = CTRL_DATA_TRAFFIC_INTENSITY_HIGH_CROSSED_ABOVE;
864 TrafficAlertRegParm.Direction = TRAFF_UP;
865 TrafficAlertRegParm.Trigger = TRAFF_EDGE;
866 TrafficAlertRegParm.TimeIntervalMs = pCtrlData->ctrlDataTrafficIntensityThresholds.TestInterval;
867 TrafficAlertRegParm.Threshold = pCtrlData->ctrlDataTrafficIntensityThresholds.uHighThreshold;
868 TrafficAlertRegParm.MonitorType = TX_RX_DIRECTED_FRAMES;
869 pCtrlData->ctrlDataTrafficThresholdEvents[0] = TrafficMonitor_RegEvent(pCtrlData->hTrafficMonitor,&TrafficAlertRegParm,TI_FALSE);
870
871 if (pCtrlData->ctrlDataTrafficThresholdEvents[0] == NULL)
872 {
873 TRACE0(pCtrlData->hReport, REPORT_SEVERITY_ERROR, " ctrlData_RegisterTrafficIntensityEvents() : Failed to register high treshold event (TRAFF_UP) \n");
874 return;
875 }
876
877 /* Register high threshold "direction down" event*/
878 TrafficAlertRegParm.Cookie = CTRL_DATA_TRAFFIC_INTENSITY_HIGH_CROSSED_BELOW;
879 TrafficAlertRegParm.Direction = TRAFF_DOWN;
880 TrafficAlertRegParm.Trigger = TRAFF_EDGE;
881 TrafficAlertRegParm.Threshold = pCtrlData->ctrlDataTrafficIntensityThresholds.uHighThreshold;
882 pCtrlData->ctrlDataTrafficThresholdEvents[1] = TrafficMonitor_RegEvent(pCtrlData->hTrafficMonitor,&TrafficAlertRegParm,TI_FALSE);
883
884 if (pCtrlData->ctrlDataTrafficThresholdEvents[1] == NULL)
885 {
886 TRACE0(pCtrlData->hReport, REPORT_SEVERITY_ERROR, " ctrlData_RegisterTrafficIntensityEvents() : Failed to register high treshold event (TRAFF_DOWN) \n");
887 return;
888 }
889
890 /* Define the "direction below" and "direction above" events as opposites (events that reset eachother)*/
891 status = TrafficMonitor_SetRstCondition(pCtrlData->hTrafficMonitor,
892 pCtrlData->ctrlDataTrafficThresholdEvents[0],
893 pCtrlData->ctrlDataTrafficThresholdEvents[1],
894 TI_TRUE);
895
896 if (status != TI_OK)
897 {
898 TRACE1(pCtrlData->hReport, REPORT_SEVERITY_ERROR , "ctrlData_RegisterTrafficIntensityEvents: TrafficMonitor_SetRstCondition returned status = %d\n",status);
899 }
900
901 /* Register low threshold "direction up" event */
902 TrafficAlertRegParm.Cookie = CTRL_DATA_TRAFFIC_INTENSITY_LOW_CROSSED_ABOVE;
903 TrafficAlertRegParm.Direction = TRAFF_UP;
904 TrafficAlertRegParm.Trigger = TRAFF_EDGE;
905 TrafficAlertRegParm.Threshold = pCtrlData->ctrlDataTrafficIntensityThresholds.uLowThreshold;
906 pCtrlData->ctrlDataTrafficThresholdEvents[2] = TrafficMonitor_RegEvent(pCtrlData->hTrafficMonitor,&TrafficAlertRegParm,TI_FALSE);
907
908 if (pCtrlData->ctrlDataTrafficThresholdEvents[2] == NULL)
909 {
910 TRACE0(pCtrlData->hReport, REPORT_SEVERITY_ERROR, " ctrlData_RegisterTrafficIntensityEvents() : Failed to register low treshold event (TRAFF_UP) \n");
911 return;
912 }
913
914 /* Register low threshold "direction below" event */
915 TrafficAlertRegParm.Cookie = CTRL_DATA_TRAFFIC_INTENSITY_LOW_CROSSED_BELOW;
916 TrafficAlertRegParm.Direction = TRAFF_DOWN;
917 TrafficAlertRegParm.Trigger = TRAFF_EDGE;
918 TrafficAlertRegParm.Threshold = pCtrlData->ctrlDataTrafficIntensityThresholds.uLowThreshold;
919 pCtrlData->ctrlDataTrafficThresholdEvents[3] = TrafficMonitor_RegEvent(pCtrlData->hTrafficMonitor,&TrafficAlertRegParm,TI_FALSE);
920
921 if (pCtrlData->ctrlDataTrafficThresholdEvents[3] == NULL)
922 {
923 TRACE0(pCtrlData->hReport, REPORT_SEVERITY_ERROR, " ctrlData_RegisterTrafficIntensityEvents() : Failed to register low treshold event (TRAFF_DOWN) \n");
924 return;
925 }
926
927 /* Define the "direction below" and "direction above" events as opposites (events that reset eachother)*/
928 status = TrafficMonitor_SetRstCondition(pCtrlData->hTrafficMonitor,
929 pCtrlData->ctrlDataTrafficThresholdEvents[2],
930 pCtrlData->ctrlDataTrafficThresholdEvents[3],
931 TI_TRUE);
932
933 if (status != TI_OK)
934 {
935 TRACE1(pCtrlData->hReport, REPORT_SEVERITY_ERROR , "ctrlData_RegisterTrafficIntensityEvents: TrafficMonitor_SetRstCondition returned status = %d\n",status);
936 }
937
938 TRACE0(pCtrlData->hReport, REPORT_SEVERITY_INFORMATION, " ctrlData_RegisterTrafficIntensityEvents() : finished registering all events \n");
939
940 }
941
942
943 /*-----------------------------------------------------------------------------
944 Routine Name: ctrlData_TrafficThresholdCrossed
945 Routine Description: called whenever traffic intensity threshold is crossed.
946 notifies event handler to send appropriate event with threshold parameters.
947 Arguments:
948 Return Value:
949 -----------------------------------------------------------------------------*/
ctrlData_TrafficThresholdCrossed(TI_HANDLE Context,TI_UINT32 Cookie)950 static void ctrlData_TrafficThresholdCrossed(TI_HANDLE Context,TI_UINT32 Cookie)
951 {
952 ctrlData_t *pCtrlData = (ctrlData_t *)Context;
953 trafficIntensityThresholdCross_t crossInfo;
954
955 switch(Cookie)
956 {
957 case CTRL_DATA_TRAFFIC_INTENSITY_HIGH_CROSSED_ABOVE:
958 crossInfo.thresholdCross = (TI_UINT32)HIGH_THRESHOLD_CROSS;
959 crossInfo.thresholdCrossDirection = (TI_UINT32)CROSS_ABOVE;
960 EvHandlerSendEvent(pCtrlData->hEvHandler, IPC_EVENT_TRAFFIC_INTENSITY_THRESHOLD_CROSSED, (TI_UINT8 *)&crossInfo,sizeof(trafficIntensityThresholdCross_t));
961 break;
962
963 case CTRL_DATA_TRAFFIC_INTENSITY_HIGH_CROSSED_BELOW:
964 crossInfo.thresholdCross = (TI_UINT32)HIGH_THRESHOLD_CROSS;
965 crossInfo.thresholdCrossDirection = (TI_UINT32)CROSS_BELOW;
966 EvHandlerSendEvent(pCtrlData->hEvHandler, IPC_EVENT_TRAFFIC_INTENSITY_THRESHOLD_CROSSED, (TI_UINT8 *)&crossInfo,sizeof(trafficIntensityThresholdCross_t));
967 break;
968
969 case CTRL_DATA_TRAFFIC_INTENSITY_LOW_CROSSED_ABOVE:
970 crossInfo.thresholdCross = (TI_UINT32)LOW_THRESHOLD_CROSS;
971 crossInfo.thresholdCrossDirection = (TI_UINT32)CROSS_ABOVE;
972 EvHandlerSendEvent(pCtrlData->hEvHandler, IPC_EVENT_TRAFFIC_INTENSITY_THRESHOLD_CROSSED, (TI_UINT8 *)&crossInfo,sizeof(trafficIntensityThresholdCross_t));
973 break;
974
975 case CTRL_DATA_TRAFFIC_INTENSITY_LOW_CROSSED_BELOW:
976 crossInfo.thresholdCross = (TI_UINT32)LOW_THRESHOLD_CROSS;
977 crossInfo.thresholdCrossDirection = (TI_UINT32)CROSS_BELOW;
978 EvHandlerSendEvent(pCtrlData->hEvHandler, IPC_EVENT_TRAFFIC_INTENSITY_THRESHOLD_CROSSED, (TI_UINT8 *)&crossInfo,sizeof(trafficIntensityThresholdCross_t));
979 break;
980 default:
981 TRACE0(pCtrlData->hReport, REPORT_SEVERITY_ERROR, " ctrlData_TrafficThresholdCrossed() : Unknown cookie received from traffic monitor !!! \n");
982 break;
983 }
984
985 }
986
987 /*************************************************************************
988 * *
989 * DEBUG FUNCTIONS *
990 * *
991 *************************************************************************/
992
993 #ifdef TI_DBG
994
ctrlData_printTxParameters(TI_HANDLE hCtrlData)995 void ctrlData_printTxParameters(TI_HANDLE hCtrlData)
996 {
997 #ifdef REPORT_LOG
998 ctrlData_t *pCtrlData = (ctrlData_t *)hCtrlData;
999
1000 WLAN_OS_REPORT((" Tx Parameters \n"));
1001 WLAN_OS_REPORT(("-------------------------------------\n"));
1002 WLAN_OS_REPORT(("currentPreamble = %d\n\n",pCtrlData->ctrlDataCurrentPreambleType));
1003 WLAN_OS_REPORT(("ctrlDataCurrentRateMask = 0x%X\n",pCtrlData->ctrlDataCurrentRateMask));
1004 #endif
1005 }
1006
1007
ctrlData_printCtrlBlock(TI_HANDLE hCtrlData)1008 void ctrlData_printCtrlBlock(TI_HANDLE hCtrlData)
1009 {
1010 #ifdef REPORT_LOG
1011 ctrlData_t *pCtrlData = (ctrlData_t *)hCtrlData;
1012 TI_UINT32 i;
1013
1014 WLAN_OS_REPORT((" CtrlData BLock \n"));
1015 WLAN_OS_REPORT(("----------------------\n"));
1016
1017 WLAN_OS_REPORT(("hSiteMgr = 0x%X\n",pCtrlData->hSiteMgr));
1018 WLAN_OS_REPORT(("hTWD = 0x%X\n",pCtrlData->hTWD));
1019 WLAN_OS_REPORT(("hOs = 0x%X\n",pCtrlData->hOs));
1020 WLAN_OS_REPORT(("hReport = 0x%X\n",pCtrlData->hReport));
1021
1022 WLAN_OS_REPORT(("ctrlDataDeviceMacAddress = 0x%X.0x%X.0x%X.0x%X.0x%X.0x%X. \n", pCtrlData->ctrlDataDeviceMacAddress[0],
1023 pCtrlData->ctrlDataDeviceMacAddress[1],
1024 pCtrlData->ctrlDataDeviceMacAddress[2],
1025 pCtrlData->ctrlDataDeviceMacAddress[3],
1026 pCtrlData->ctrlDataDeviceMacAddress[4],
1027 pCtrlData->ctrlDataDeviceMacAddress[5]));
1028
1029 WLAN_OS_REPORT(("ctrlDataCurrentBSSID = 0x%X.0x%X.0x%X.0x%X.0x%X.0x%X. \n", pCtrlData->ctrlDataCurrentBSSID[0],
1030 pCtrlData->ctrlDataCurrentBSSID[1],
1031 pCtrlData->ctrlDataCurrentBSSID[2],
1032 pCtrlData->ctrlDataCurrentBSSID[3],
1033 pCtrlData->ctrlDataCurrentBSSID[4],
1034 pCtrlData->ctrlDataCurrentBSSID[5]));
1035
1036 WLAN_OS_REPORT(("ctrlDataCurrentBssType = %d\n", pCtrlData->ctrlDataCurrentBssType));
1037 WLAN_OS_REPORT(("ctrlDataCurrentRateMask = 0x%X\n", pCtrlData->ctrlDataCurrentRateMask));
1038 WLAN_OS_REPORT(("ctrlDataCurrentPreambleType = %d\n", pCtrlData->ctrlDataCurrentPreambleType));
1039
1040 WLAN_OS_REPORT(("Traffic Intensity threshold events status: %s\n", (pCtrlData->ctrlDataTrafficIntensityEventsEnabled ? "Enabled" : "Disabled")));
1041 WLAN_OS_REPORT(("Traffic Intensity high threshold: %d packets/sec \n", pCtrlData->ctrlDataTrafficIntensityThresholds.uHighThreshold));
1042 WLAN_OS_REPORT(("Traffic Intensity low threshold: %d packets/sec \n", pCtrlData->ctrlDataTrafficIntensityThresholds.uLowThreshold));
1043 WLAN_OS_REPORT(("Traffic Intensity test interval: %d ms\n", pCtrlData->ctrlDataTrafficIntensityThresholds.TestInterval));
1044
1045 for (i=0; i < pCtrlData->ctrlDataTxRatePolicy.numOfRateClasses; i++)
1046 {
1047 WLAN_OS_REPORT(("Rate Enable/Disable Mask = 0x%x\n",
1048 pCtrlData->ctrlDataTxRatePolicy.rateClass[i].txEnabledRates));
1049
1050 WLAN_OS_REPORT(("Long retry = %d, Short retry = %d\n",
1051 pCtrlData->ctrlDataTxRatePolicy.rateClass[i].longRetryLimit,
1052 pCtrlData->ctrlDataTxRatePolicy.rateClass[i].shortRetryLimit));
1053 }
1054 #endif
1055 }
1056
1057
1058 #endif /*TI_DBG*/
1059
1060
1061 /***************************************************************************
1062 * ctrlData_storeTSRateSet
1063 ****************************************************************************
1064 * DESCRIPTION: This function translates TSRS rates into map of retransmissions
1065 * similar to predefined clients rates retransmissions, and stores
1066 * in the Ctrl database
1067 *
1068 * INPUTS: pCtrlData - the object
1069 * acID
1070 * rates array
1071 *
1072 * RETURNS: -
1073 ****************************************************************************/
ctrlData_storeTSRateSet(ctrlData_t * pCtrlData,TTxDataQosParams * tsrsParams)1074 static void ctrlData_storeTSRateSet(ctrlData_t *pCtrlData, TTxDataQosParams *tsrsParams)
1075 {
1076 TI_UINT32 rateCount;
1077 TI_UINT32 acID;
1078 TI_UINT32 tsrsRequestedMap;
1079 ERate rateNumber;
1080
1081 acID = tsrsParams->acID;
1082 os_memoryZero(pCtrlData->hOs,
1083 &(pCtrlData->tsrsParameters[acID]),
1084 sizeof(pCtrlData->tsrsParameters[acID]));
1085
1086 tsrsRequestedMap = 0;
1087
1088 for (rateCount = 0; rateCount < tsrsParams->tsrsArrLen; rateCount++)
1089 {
1090 /* Erase Most significant bit in case it was raised to mark nominal PHY rates (& 0x7F) */
1091 /* Convert multiplication of 500kb/sec to ERate and then to ETxRateClassId */
1092 /* and update retransmission map in accordance to rate definitions */
1093 rateNumber = rate_NumberToDrv ((tsrsParams->tsrsArr[rateCount] & 0x7F) >> 1);
1094
1095 pCtrlData->tsrsParameters[acID].policyClassRateMask = pCtrlData->uCurrPolicyEnabledRatesMask;
1096
1097 tsrsRequestedMap |= 1 << (rateNumber - 1);
1098 }
1099 /* Update supportedRatesMask according to TSRS rates and rates supported */
1100 pCtrlData->tsrsParameters[acID].supportedRatesMask = tsrsRequestedMap;
1101
1102 /* Check that Rate Fallback policy map is not empty; if this is the case, ignore pre-defined policy */
1103 if (pCtrlData->tsrsParameters[acID].policyClassRateMask == 0)
1104 {
1105 pCtrlData->tsrsParameters[acID].policyClassRateMask = pCtrlData->tsrsParameters[acID].supportedRatesMask;
1106 }
1107 }
1108
1109
1110
1111
1112