H A D | Hal8188ERateAdaptive.c | 96 struct odm_ra_info *pRaInfo, odm_SetTxRPTTiming_8188E() 103 if (DynamicTxRPTTiming[idx] == pRaInfo->RptTime) odm_SetTxRPTTiming_8188E() 116 pRaInfo->RptTime = DynamicTxRPTTiming[idx]; odm_SetTxRPTTiming_8188E() 119 ("pRaInfo->RptTime = 0x%x\n", pRaInfo->RptTime)); odm_SetTxRPTTiming_8188E() 123 struct odm_ra_info *pRaInfo) odm_RateDown_8188E() 130 if (!pRaInfo) { odm_RateDown_8188E() 132 ("odm_RateDown_8188E(): pRaInfo is NULL\n")); odm_RateDown_8188E() 135 RateID = pRaInfo->PreRate; odm_RateDown_8188E() 136 LowestRate = pRaInfo->LowestRate; odm_RateDown_8188E() 137 HighestRate = pRaInfo->HighestRate; odm_RateDown_8188E() 141 RateID, LowestRate, HighestRate, pRaInfo->RateSGI)); odm_RateDown_8188E() 144 } else if (pRaInfo->RateSGI) { odm_RateDown_8188E() 145 pRaInfo->RateSGI = 0; odm_RateDown_8188E() 149 if (pRaInfo->RAUseRate & BIT(i)) { odm_RateDown_8188E() 159 if (pRaInfo->RAWaitingCounter == 1) { odm_RateDown_8188E() 160 pRaInfo->RAWaitingCounter += 1; odm_RateDown_8188E() 161 pRaInfo->RAPendingCounter += 1; odm_RateDown_8188E() 162 } else if (pRaInfo->RAWaitingCounter == 0) { odm_RateDown_8188E() 165 pRaInfo->RAWaitingCounter = 0; odm_RateDown_8188E() 166 pRaInfo->RAPendingCounter = 0; odm_RateDown_8188E() 169 if (pRaInfo->RAPendingCounter >= 4) odm_RateDown_8188E() 170 pRaInfo->RAPendingCounter = 4; odm_RateDown_8188E() 172 pRaInfo->DecisionRate = RateID; odm_RateDown_8188E() 173 odm_SetTxRPTTiming_8188E(dm_odm, pRaInfo, 2); odm_RateDown_8188E() 178 pRaInfo->RAWaitingCounter, pRaInfo->RAPendingCounter)); odm_RateDown_8188E() 180 ("Rate down to RateID %d RateSGI %d\n", RateID, pRaInfo->RateSGI)); odm_RateDown_8188E() 188 struct odm_ra_info *pRaInfo odm_RateUp_8188E() 196 if (!pRaInfo) { odm_RateUp_8188E() 198 ("odm_RateUp_8188E(): pRaInfo is NULL\n")); odm_RateUp_8188E() 201 RateID = pRaInfo->PreRate; odm_RateUp_8188E() 202 HighestRate = pRaInfo->HighestRate; odm_RateUp_8188E() 206 if (pRaInfo->RAWaitingCounter == 1) { odm_RateUp_8188E() 207 pRaInfo->RAWaitingCounter = 0; odm_RateUp_8188E() 208 pRaInfo->RAPendingCounter = 0; odm_RateUp_8188E() 209 } else if (pRaInfo->RAWaitingCounter > 1) { odm_RateUp_8188E() 210 pRaInfo->PreRssiStaRA = pRaInfo->RssiStaRA; odm_RateUp_8188E() 213 odm_SetTxRPTTiming_8188E(dm_odm, pRaInfo, 0); odm_RateUp_8188E() 219 if (pRaInfo->RAUseRate & BIT(i)) { odm_RateUp_8188E() 225 if (pRaInfo->SGIEnable && (pRaInfo->RateSGI != 1)) odm_RateUp_8188E() 226 pRaInfo->RateSGI = 1; odm_RateUp_8188E() 227 else if ((pRaInfo->SGIEnable) != 1) odm_RateUp_8188E() 228 pRaInfo->RateSGI = 0; odm_RateUp_8188E() 233 if (pRaInfo->RAWaitingCounter == odm_RateUp_8188E() 234 (4+PendingForRateUpFail[pRaInfo->RAPendingCounter])) odm_RateUp_8188E() 235 pRaInfo->RAWaitingCounter = 0; odm_RateUp_8188E() 237 pRaInfo->RAWaitingCounter++; odm_RateUp_8188E() 239 pRaInfo->DecisionRate = RateID; odm_RateUp_8188E() 244 pRaInfo->RAWaitingCounter, pRaInfo->RAPendingCounter)); odm_RateUp_8188E() 250 static void odm_ResetRaCounter_8188E(struct odm_ra_info *pRaInfo) odm_ResetRaCounter_8188E() argument 254 RateID = pRaInfo->DecisionRate; odm_ResetRaCounter_8188E() 255 pRaInfo->NscUp = (N_THRESHOLD_HIGH[RateID]+N_THRESHOLD_LOW[RateID])>>1; odm_ResetRaCounter_8188E() 256 pRaInfo->NscDown = (N_THRESHOLD_HIGH[RateID]+N_THRESHOLD_LOW[RateID])>>1; odm_ResetRaCounter_8188E() 260 struct odm_ra_info *pRaInfo odm_RateDecision_8188E() 270 if (pRaInfo->Active && (pRaInfo->TOTAL > 0)) { /* STA used and data packet exits */ odm_RateDecision_8188E() 271 if ((pRaInfo->RssiStaRA < (pRaInfo->PreRssiStaRA - 3)) || odm_RateDecision_8188E() 272 (pRaInfo->RssiStaRA > (pRaInfo->PreRssiStaRA + 3))) { odm_RateDecision_8188E() 273 pRaInfo->RAWaitingCounter = 0; odm_RateDecision_8188E() 274 pRaInfo->RAPendingCounter = 0; odm_RateDecision_8188E() 277 if (pRaInfo->PreRate > pRaInfo->HighestRate) odm_RateDecision_8188E() 278 RateID = pRaInfo->HighestRate; odm_RateDecision_8188E() 280 RateID = pRaInfo->PreRate; odm_RateDecision_8188E() 281 if (pRaInfo->RssiStaRA > RSSI_THRESHOLD[RateID]) odm_RateDecision_8188E() 288 (" NscDown init is %d\n", pRaInfo->NscDown)); odm_RateDecision_8188E() 291 pRaInfo->NscDown += pRaInfo->RTY[i] * RETRY_PENALTY[PenaltyID1][i]; odm_RateDecision_8188E() 294 (" NscDown is %d, total*penalty[5] is %d\n", pRaInfo->NscDown, odm_RateDecision_8188E() 295 (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID1][5]))); odm_RateDecision_8188E() 297 if (pRaInfo->NscDown > (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID1][5])) odm_RateDecision_8188E() 298 pRaInfo->NscDown -= pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID1][5]; odm_RateDecision_8188E() 300 pRaInfo->NscDown = 0; odm_RateDecision_8188E() 305 (" NscUp init is %d\n", pRaInfo->NscUp)); odm_RateDecision_8188E() 308 pRaInfo->NscUp += pRaInfo->RTY[i] * RETRY_PENALTY[PenaltyID2][i]; odm_RateDecision_8188E() 312 pRaInfo->NscUp, (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID2][5]))); odm_RateDecision_8188E() 314 if (pRaInfo->NscUp > (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID2][5])) odm_RateDecision_8188E() 315 pRaInfo->NscUp -= pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID2][5]; odm_RateDecision_8188E() 317 pRaInfo->NscUp = 0; odm_RateDecision_8188E() 321 pRaInfo->RssiStaRA, RtyPtID, PenaltyID1, PenaltyID2, RateID, pRaInfo->NscDown, pRaInfo->NscUp, pRaInfo->RateSGI)); odm_RateDecision_8188E() 322 if ((pRaInfo->NscDown < N_THRESHOLD_LOW[RateID]) || odm_RateDecision_8188E() 323 (pRaInfo->DROP > DROPING_NECESSARY[RateID])) odm_RateDecision_8188E() 324 odm_RateDown_8188E(dm_odm, pRaInfo); odm_RateDecision_8188E() 325 else if (pRaInfo->NscUp > N_THRESHOLD_HIGH[RateID]) odm_RateDecision_8188E() 326 odm_RateUp_8188E(dm_odm, pRaInfo); odm_RateDecision_8188E() 328 if (pRaInfo->DecisionRate > pRaInfo->HighestRate) odm_RateDecision_8188E() 329 pRaInfo->DecisionRate = pRaInfo->HighestRate; odm_RateDecision_8188E() 331 if ((pRaInfo->DecisionRate) == (pRaInfo->PreRate)) odm_RateDecision_8188E() 337 odm_SetTxRPTTiming_8188E(dm_odm, pRaInfo, 1); odm_RateDecision_8188E() 343 pRaInfo->PreRate = pRaInfo->DecisionRate; /* YJ, add, 120120 */ odm_RateDecision_8188E() 345 odm_ResetRaCounter_8188E(pRaInfo); odm_RateDecision_8188E() 350 static int odm_ARFBRefresh_8188E(struct odm_dm_struct *dm_odm, struct odm_ra_info *pRaInfo) odm_ARFBRefresh_8188E() argument 356 switch (pRaInfo->RateID) { odm_ARFBRefresh_8188E() 358 pRaInfo->RAUseRate = (pRaInfo->RateMask)&0x0f8ff015; odm_ARFBRefresh_8188E() 361 pRaInfo->RAUseRate = (pRaInfo->RateMask)&0x0f8ff010; odm_ARFBRefresh_8188E() 364 pRaInfo->RAUseRate = (pRaInfo->RateMask)&0x0f8ff005; odm_ARFBRefresh_8188E() 367 pRaInfo->RAUseRate = (pRaInfo->RateMask)&0x0f8ff000; odm_ARFBRefresh_8188E() 370 pRaInfo->RAUseRate = (pRaInfo->RateMask)&0x00000ff5; odm_ARFBRefresh_8188E() 373 pRaInfo->RAUseRate = (pRaInfo->RateMask)&0x00000ff0; odm_ARFBRefresh_8188E() 376 pRaInfo->RAUseRate = (pRaInfo->RateMask)&0x0000000d; odm_ARFBRefresh_8188E() 380 pRaInfo->RAUseRate = (pRaInfo->RateMask)&MaskFromReg; odm_ARFBRefresh_8188E() 384 pRaInfo->RAUseRate = (pRaInfo->RateMask)&MaskFromReg; odm_ARFBRefresh_8188E() 388 pRaInfo->RAUseRate = (pRaInfo->RateMask)&MaskFromReg; odm_ARFBRefresh_8188E() 392 pRaInfo->RAUseRate = (pRaInfo->RateMask)&MaskFromReg; odm_ARFBRefresh_8188E() 395 pRaInfo->RAUseRate = (pRaInfo->RateMask); odm_ARFBRefresh_8188E() 399 if (pRaInfo->RAUseRate) { odm_ARFBRefresh_8188E() 401 if ((pRaInfo->RAUseRate)&BIT(i)) { odm_ARFBRefresh_8188E() 402 pRaInfo->HighestRate = i; odm_ARFBRefresh_8188E() 407 pRaInfo->HighestRate = 0; odm_ARFBRefresh_8188E() 410 if (pRaInfo->RAUseRate) { odm_ARFBRefresh_8188E() 412 if ((pRaInfo->RAUseRate) & BIT(i)) { odm_ARFBRefresh_8188E() 413 pRaInfo->LowestRate = i; odm_ARFBRefresh_8188E() 418 pRaInfo->LowestRate = 0; odm_ARFBRefresh_8188E() 420 if (pRaInfo->HighestRate > 0x13) odm_ARFBRefresh_8188E() 421 pRaInfo->PTModeSS = 3; odm_ARFBRefresh_8188E() 422 else if (pRaInfo->HighestRate > 0x0b) odm_ARFBRefresh_8188E() 423 pRaInfo->PTModeSS = 2; odm_ARFBRefresh_8188E() 424 else if (pRaInfo->HighestRate > 0x0b) odm_ARFBRefresh_8188E() 425 pRaInfo->PTModeSS = 1; odm_ARFBRefresh_8188E() 427 pRaInfo->PTModeSS = 0; odm_ARFBRefresh_8188E() 429 ("ODM_ARFBRefresh_8188E(): PTModeSS =%d\n", pRaInfo->PTModeSS)); odm_ARFBRefresh_8188E() 431 if (pRaInfo->DecisionRate > pRaInfo->HighestRate) odm_ARFBRefresh_8188E() 432 pRaInfo->DecisionRate = pRaInfo->HighestRate; odm_ARFBRefresh_8188E() 436 pRaInfo->RateID, pRaInfo->RateMask, pRaInfo->RAUseRate, pRaInfo->HighestRate, pRaInfo->DecisionRate)); odm_ARFBRefresh_8188E() 440 static void odm_PTTryState_8188E(struct odm_ra_info *pRaInfo) odm_PTTryState_8188E() argument 442 pRaInfo->PTTryState = 0; odm_PTTryState_8188E() 443 switch (pRaInfo->PTModeSS) { odm_PTTryState_8188E() 445 if (pRaInfo->DecisionRate >= 0x19) odm_PTTryState_8188E() 446 pRaInfo->PTTryState = 1; odm_PTTryState_8188E() 449 if (pRaInfo->DecisionRate >= 0x11) odm_PTTryState_8188E() 450 pRaInfo->PTTryState = 1; odm_PTTryState_8188E() 453 if (pRaInfo->DecisionRate >= 0x0a) odm_PTTryState_8188E() 454 pRaInfo->PTTryState = 1; odm_PTTryState_8188E() 457 if (pRaInfo->DecisionRate >= 0x03) odm_PTTryState_8188E() 458 pRaInfo->PTTryState = 1; odm_PTTryState_8188E() 461 pRaInfo->PTTryState = 0; odm_PTTryState_8188E() 465 if (pRaInfo->RssiStaRA < 48) { odm_PTTryState_8188E() 466 pRaInfo->PTStage = 0; odm_PTTryState_8188E() 467 } else if (pRaInfo->PTTryState == 1) { odm_PTTryState_8188E() 468 if ((pRaInfo->PTStopCount >= 10) || odm_PTTryState_8188E() 469 (pRaInfo->PTPreRssi > pRaInfo->RssiStaRA + 5) || odm_PTTryState_8188E() 470 (pRaInfo->PTPreRssi < pRaInfo->RssiStaRA - 5) || odm_PTTryState_8188E() 471 (pRaInfo->DecisionRate != pRaInfo->PTPreRate)) { odm_PTTryState_8188E() 472 if (pRaInfo->PTStage == 0) odm_PTTryState_8188E() 473 pRaInfo->PTStage = 1; odm_PTTryState_8188E() 474 else if (pRaInfo->PTStage == 1) odm_PTTryState_8188E() 475 pRaInfo->PTStage = 3; odm_PTTryState_8188E() 477 pRaInfo->PTStage = 5; odm_PTTryState_8188E() 479 pRaInfo->PTPreRssi = pRaInfo->RssiStaRA; odm_PTTryState_8188E() 480 pRaInfo->PTStopCount = 0; odm_PTTryState_8188E() 482 pRaInfo->RAstage = 0; odm_PTTryState_8188E() 483 pRaInfo->PTStopCount++; odm_PTTryState_8188E() 486 pRaInfo->PTStage = 0; odm_PTTryState_8188E() 487 pRaInfo->RAstage = 0; odm_PTTryState_8188E() 489 pRaInfo->PTPreRate = pRaInfo->DecisionRate; odm_PTTryState_8188E() 492 static void odm_PTDecision_8188E(struct odm_ra_info *pRaInfo) odm_PTDecision_8188E() argument 501 num_total = pRaInfo->TOTAL * PT_PENALTY[5]; odm_PTDecision_8188E() 503 numsc += pRaInfo->RTY[j] * PT_PENALTY[j]; odm_PTDecision_8188E() 509 temp_stage = (pRaInfo->PTStage + 1) >> 1; odm_PTDecision_8188E() 515 pRaInfo->PTSmoothFactor = (pRaInfo->PTSmoothFactor>>1) + (pRaInfo->PTSmoothFactor>>2) + stage_id*16+2; odm_PTDecision_8188E() 516 if (pRaInfo->PTSmoothFactor > 192) odm_PTDecision_8188E() 517 pRaInfo->PTSmoothFactor = 192; odm_PTDecision_8188E() 518 stage_id = pRaInfo->PTSmoothFactor >> 6; odm_PTDecision_8188E() 522 if (pRaInfo->DROP > 3) odm_PTDecision_8188E() 524 pRaInfo->PTStage = temp_stage; odm_PTDecision_8188E() 556 struct odm_ra_info *pRaInfo = &dm_odm->RAInfo[macid]; ODM_RAInfo_Init() local 576 pRaInfo->DecisionRate = max_rate_idx; ODM_RAInfo_Init() 577 pRaInfo->PreRate = max_rate_idx; ODM_RAInfo_Init() 578 pRaInfo->HighestRate = max_rate_idx; ODM_RAInfo_Init() 579 pRaInfo->LowestRate = 0; ODM_RAInfo_Init() 580 pRaInfo->RateID = 0; ODM_RAInfo_Init() 581 pRaInfo->RateMask = 0xffffffff; ODM_RAInfo_Init() 582 pRaInfo->RssiStaRA = 0; ODM_RAInfo_Init() 583 pRaInfo->PreRssiStaRA = 0; ODM_RAInfo_Init() 584 pRaInfo->SGIEnable = 0; ODM_RAInfo_Init() 585 pRaInfo->RAUseRate = 0xffffffff; ODM_RAInfo_Init() 586 pRaInfo->NscDown = (N_THRESHOLD_HIGH[0x13]+N_THRESHOLD_LOW[0x13])/2; ODM_RAInfo_Init() 587 pRaInfo->NscUp = (N_THRESHOLD_HIGH[0x13]+N_THRESHOLD_LOW[0x13])/2; ODM_RAInfo_Init() 588 pRaInfo->RateSGI = 0; ODM_RAInfo_Init() 589 pRaInfo->Active = 1; /* Active is not used at present. by page, 110819 */ ODM_RAInfo_Init() 590 pRaInfo->RptTime = 0x927c; ODM_RAInfo_Init() 591 pRaInfo->DROP = 0; ODM_RAInfo_Init() 592 pRaInfo->RTY[0] = 0; ODM_RAInfo_Init() 593 pRaInfo->RTY[1] = 0; ODM_RAInfo_Init() 594 pRaInfo->RTY[2] = 0; ODM_RAInfo_Init() 595 pRaInfo->RTY[3] = 0; ODM_RAInfo_Init() 596 pRaInfo->RTY[4] = 0; ODM_RAInfo_Init() 597 pRaInfo->TOTAL = 0; ODM_RAInfo_Init() 598 pRaInfo->RAWaitingCounter = 0; ODM_RAInfo_Init() 599 pRaInfo->RAPendingCounter = 0; ODM_RAInfo_Init() 600 pRaInfo->PTActive = 1; /* Active when this STA is use */ ODM_RAInfo_Init() 601 pRaInfo->PTTryState = 0; ODM_RAInfo_Init() 602 pRaInfo->PTStage = 5; /* Need to fill into HW_PWR_STATUS */ ODM_RAInfo_Init() 603 pRaInfo->PTSmoothFactor = 192; ODM_RAInfo_Init() 604 pRaInfo->PTStopCount = 0; ODM_RAInfo_Init() 605 pRaInfo->PTPreRate = 0; ODM_RAInfo_Init() 606 pRaInfo->PTPreRssi = 0; ODM_RAInfo_Init() 607 pRaInfo->PTModeSS = 0; ODM_RAInfo_Init() 608 pRaInfo->RAstage = 0; ODM_RAInfo_Init() 660 struct odm_ra_info *pRaInfo = NULL; ODM_RA_UpdateRateInfo_8188E() local 668 pRaInfo = &(dm_odm->RAInfo[macid]); ODM_RA_UpdateRateInfo_8188E() 669 pRaInfo->RateID = RateID; ODM_RA_UpdateRateInfo_8188E() 670 pRaInfo->RateMask = RateMask; ODM_RA_UpdateRateInfo_8188E() 671 pRaInfo->SGIEnable = SGIEnable; ODM_RA_UpdateRateInfo_8188E() 672 odm_ARFBRefresh_8188E(dm_odm, pRaInfo); ODM_RA_UpdateRateInfo_8188E() 677 struct odm_ra_info *pRaInfo = NULL; ODM_RA_SetRSSI_8188E() local 684 pRaInfo = &(dm_odm->RAInfo[macid]); ODM_RA_SetRSSI_8188E() 685 pRaInfo->RssiStaRA = Rssi; ODM_RA_SetRSSI_8188E() 94 odm_SetTxRPTTiming_8188E( struct odm_dm_struct *dm_odm, struct odm_ra_info *pRaInfo, u8 extend ) odm_SetTxRPTTiming_8188E() argument 122 odm_RateDown_8188E(struct odm_dm_struct *dm_odm, struct odm_ra_info *pRaInfo) odm_RateDown_8188E() argument
|