IN PVOID pDM_VOID)\r
{\r
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;\r
-#if ((DM_ODM_SUPPORT_TYPE == ODM_AP)||(DM_ODM_SUPPORT_TYPE==ODM_ADSL))\r
- odm_EdcaParaInit(pDM_Odm);\r
-#elif (DM_ODM_SUPPORT_TYPE==ODM_WIN)\r
+\r
+#if (DM_ODM_SUPPORT_TYPE==ODM_WIN)\r
PADAPTER Adapter = NULL;\r
HAL_DATA_TYPE *pHalData = NULL;\r
\r
//\r
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;\r
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("odm_EdcaTurboCheck========================>\n"));\r
- \r
+\r
if(!(pDM_Odm->SupportAbility& ODM_MAC_EDCA_TURBO ))\r
return;\r
\r
odm_EdcaTurboCheckCE(pDM_Odm);\r
#endif\r
break;\r
-\r
- case ODM_AP:\r
- case ODM_ADSL:\r
-\r
-#if ((DM_ODM_SUPPORT_TYPE == ODM_AP)||(DM_ODM_SUPPORT_TYPE==ODM_ADSL))\r
- odm_IotEngine(pDM_Odm);\r
-#endif\r
- break; \r
}\r
ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("<========================odm_EdcaTurboCheck\n"));\r
\r
\r
//if ((pDM_Odm->DM_EDCA_Table.prv_traffic_idx != trafficIndex) || (!pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA))\r
{\r
- if(ICType==ODM_RTL8192D)\r
- { \r
+ if (ICType == ODM_RTL8192D) {\r
// Single PHY\r
- if(pDM_Odm->RFType==ODM_2T2R)\r
- {\r
+ if (pDM_Odm->RFType == ODM_2T2R) {\r
EDCA_BE_UL = 0x60a42b; //0x5ea42b;\r
EDCA_BE_DL = 0x60a42b; //0x5ea42b;\r
- }\r
- else\r
- {\r
+ } else {\r
EDCA_BE_UL = 0x6ea42b;\r
EDCA_BE_DL = 0x6ea42b;\r
- }\r
+ }\r
}\r
else\r
{\r
if((ICType==ODM_RTL8192C)&&(pDM_Odm->RFType==ODM_2T2R)) {\r
EDCA_BE_UL = 0x60a42b;\r
EDCA_BE_DL = 0x60a42b;\r
- }\r
- else\r
- {\r
+ } else {\r
EDCA_BE_UL = 0x6ea42b;\r
EDCA_BE_DL = 0x6ea42b;\r
}\r
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE);\r
else //Uplink\r
{\r
- //DbgPrint("pDM_Odm->RFCalibrateInfo.ThermalValue = 0x%X\n", pDM_Odm->RFCalibrateInfo.ThermalValue);\r
- //if(pDM_Odm->RFCalibrateInfo.ThermalValue < pHalData->EEPROMThermalMeter)\r
+ /*DbgPrint("pRFCalibrateInfo->ThermalValue = 0x%X\n", pRFCalibrateInfo->ThermalValue);*/\r
+ /*if(pRFCalibrateInfo->ThermalValue < pHalData->EEPROMThermalMeter)*/\r
if((pDM_Odm->RFCalibrateInfo.ThermalValue < 0x2c) || (*pDM_Odm->pBandType == BAND_ON_2_4G))\r
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE);\r
else\r
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE);\r
else //Uplink\r
{\r
- //DbgPrint("pDM_Odm->RFCalibrateInfo.ThermalValue = 0x%X\n", pDM_Odm->RFCalibrateInfo.ThermalValue);\r
- //if(pDM_Odm->RFCalibrateInfo.ThermalValue < pHalData->EEPROMThermalMeter)\r
+ /*DbgPrint("pRFCalibrateInfo->ThermalValue = 0x%X\n", pRFCalibrateInfo->ThermalValue);*/\r
+ /*if(pRFCalibrateInfo->ThermalValue < pHalData->EEPROMThermalMeter)*/\r
if((pDM_Odm->RFCalibrateInfo.ThermalValue < 0x2c) || (*pDM_Odm->pBandType == BAND_ON_2_4G))\r
ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE);\r
else\r
u4Byte ICType=pDM_Odm->SupportICType;\r
u1Byte WirelessMode=0xFF; //invalid value\r
u4Byte RFType=pDM_Odm->RFType;\r
- u4Byte IOTPeerSubType=0;\r
+ u4Byte IOTPeerSubType = 0;\r
\r
PMGNT_INFO pMgntInfo = &Adapter->MgntInfo;\r
u1Byte TwoPortStatus = (u1Byte)TWO_PORT_STATUS__WITHOUT_ANY_ASSOCIATE;\r
if(WirelessMode==ODM_WM_G)\r
(*EDCA_BE_DL) = edca_setting_DL_GMode[IOTPeer];\r
else\r
- (*EDCA_BE_DL) = edca_setting_DL[IOTPeer];\r
- \r
+ (*EDCA_BE_DL) = edca_setting_DL[IOTPeer];\r
+\r
if(ICType == ODM_RTL8821)\r
(*EDCA_BE_DL) = 0x5ea630;\r
\r
(*EDCA_BE_UL) = 0x5ea42b;\r
(*EDCA_BE_DL) = 0x5ea42b;\r
\r
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("8812A: EDCA_BE_UL=0x%lx EDCA_BE_DL =0x%lx",(*EDCA_BE_UL),(*EDCA_BE_DL)));\r
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("8812A: EDCA_BE_UL=0x%lx EDCA_BE_DL =0x%lx\n",(*EDCA_BE_UL),(*EDCA_BE_DL)));\r
}\r
\r
+ if((ICType==ODM_RTL8814A) && (IOTPeer == HT_IOT_PEER_REALTEK)) /*8814AU and 8814AR*/\r
+ {\r
+ (*EDCA_BE_UL) = 0x5ea42b;\r
+ (*EDCA_BE_DL) = 0xa42b;\r
+\r
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("8814A: EDCA_BE_UL=0x%lx EDCA_BE_DL =0x%lx\n",(*EDCA_BE_UL),(*EDCA_BE_DL)));\r
+ }\r
+\r
+ \r
+\r
// Revised for Atheros DIR-655 IOT issue to improve down link TP, added by Roger, 2013.03.22.\r
if((ICType == ODM_RTL8723A) && (IOTPeerSubType== HT_IOT_PEER_ATHEROS_DIR655) && \r
(pMgntInfo->dot11CurrentChannelNumber == 6))\r
(*EDCA_BE_DL) = 0xa92b;\r
}\r
\r
- ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Special: EDCA_BE_UL=0x%lx EDCA_BE_DL =0x%lx",(*EDCA_BE_UL),(*EDCA_BE_DL)));\r
+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Special: EDCA_BE_UL=0x%lx EDCA_BE_DL =0x%lx, IOTPeer = %d\n",(*EDCA_BE_UL),(*EDCA_BE_DL), IOTPeer));\r
\r
}\r
\r
\r
#endif\r
\r
-#if((DM_ODM_SUPPORT_TYPE==ODM_AP)||(DM_ODM_SUPPORT_TYPE==ODM_ADSL))\r
-\r
-void odm_EdcaParaInit(\r
- IN PVOID pDM_VOID\r
- )\r
-{\r
- PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;\r
- prtl8192cd_priv priv = pDM_Odm->priv;\r
- int mode=priv->pmib->dot11BssType.net_work_type;\r
- \r
- static unsigned int slot_time, sifs_time;\r
- struct ParaRecord EDCA[4];\r
-\r
- memset(EDCA, 0, 4*sizeof(struct ParaRecord));\r
-\r
- sifs_time = 10;\r
- slot_time = 20;\r
-\r
- if (mode & (ODM_WM_N24G|ODM_WM_N5G))\r
- sifs_time = 16;\r
-\r
- if (mode & (ODM_WM_N24G|ODM_WM_N5G| ODM_WM_G|ODM_WM_A))\r
- slot_time = 9;\r
-\r
-\r
-#ifdef RTK_AC_SUPPORT //for 11ac logo, edit aifs time for cca test cases\r
- if(AC_SIGMA_MODE != AC_SIGMA_NONE)\r
- sifs_time = 10; \r
-#endif\r
-\r
-\r
-#if((defined(RTL_MANUAL_EDCA))&&(DM_ODM_SUPPORT_TYPE==ODM_AP))\r
- if( priv->pmib->dot11QosEntry.ManualEDCA ) {\r
- if( OPMODE & WIFI_AP_STATE )\r
- memcpy(EDCA, priv->pmib->dot11QosEntry.AP_manualEDCA, 4*sizeof(struct ParaRecord));\r
- else\r
- memcpy(EDCA, priv->pmib->dot11QosEntry.STA_manualEDCA, 4*sizeof(struct ParaRecord));\r
-\r
- #ifdef WIFI_WMM\r
- if (QOS_ENABLE)\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_VI_PARAM, (EDCA[VI].TXOPlimit<< 16) | (EDCA[VI].ECWmax<< 12) | (EDCA[VI].ECWmin<< 8) | (sifs_time + EDCA[VI].AIFSN* slot_time));\r
- else\r
- #endif\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_VI_PARAM, (EDCA[BE].TXOPlimit<< 16) | (EDCA[BE].ECWmax<< 12) | (EDCA[BE].ECWmin<< 8) | (sifs_time + EDCA[VI].AIFSN* slot_time));\r
-\r
- }else\r
- #endif //RTL_MANUAL_EDCA\r
- {\r
-\r
- if(OPMODE & WIFI_AP_STATE)\r
- {\r
- memcpy(EDCA, rtl_ap_EDCA, 2*sizeof(struct ParaRecord));\r
-\r
- if(mode & (ODM_WM_A|ODM_WM_G|ODM_WM_N24G|ODM_WM_N5G))\r
- memcpy(&EDCA[VI], &rtl_ap_EDCA[VI_AG], 2*sizeof(struct ParaRecord));\r
- else\r
- memcpy(&EDCA[VI], &rtl_ap_EDCA[VI], 2*sizeof(struct ParaRecord));\r
- }\r
- else\r
- {\r
- memcpy(EDCA, rtl_sta_EDCA, 2*sizeof(struct ParaRecord));\r
-\r
- if(mode & (ODM_WM_A|ODM_WM_G|ODM_WM_N24G|ODM_WM_N5G))\r
- memcpy(&EDCA[VI], &rtl_sta_EDCA[VI_AG], 2*sizeof(struct ParaRecord));\r
- else\r
- memcpy(&EDCA[VI], &rtl_sta_EDCA[VI], 2*sizeof(struct ParaRecord));\r
- }\r
- \r
- #ifdef WIFI_WMM\r
- if (QOS_ENABLE)\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_VI_PARAM, (EDCA[VI].TXOPlimit<< 16) | (EDCA[VI].ECWmax<< 12) | (EDCA[VI].ECWmin<< 8) | (sifs_time + EDCA[VI].AIFSN* slot_time));\r
- else\r
- #endif\r
-\r
-#if (DM_ODM_SUPPORT_TYPE==ODM_AP)\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_VI_PARAM, (EDCA[BK].ECWmax<< 12) | (EDCA[BK].ECWmin<< 8) | (sifs_time + EDCA[VI].AIFSN* slot_time));\r
-#elif(DM_ODM_SUPPORT_TYPE==ODM_ADSL)\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_VI_PARAM, (EDCA[BK].ECWmax<< 12) | (EDCA[BK].ECWmin<< 8) | (sifs_time + 2* slot_time));\r
-#endif\r
- \r
-\r
- }\r
-\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_VO_PARAM, (EDCA[VO].TXOPlimit<< 16) | (EDCA[VO].ECWmax<< 12) | (EDCA[VO].ECWmin<< 8) | (sifs_time + EDCA[VO].AIFSN* slot_time));\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (EDCA[BE].TXOPlimit<< 16) | (EDCA[BE].ECWmax<< 12) | (EDCA[BE].ECWmin<< 8) | (sifs_time + EDCA[BE].AIFSN* slot_time));\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_BK_PARAM, (EDCA[BK].TXOPlimit<< 16) | (EDCA[BK].ECWmax<< 12) | (EDCA[BK].ECWmin<< 8) | (sifs_time + EDCA[BK].AIFSN* slot_time));\r
-\r
-#if defined(RTK_AC_SUPPORT) && defined(RTL_MANUAL_EDCA) //for 11ac logo, make BK worse to seperate with BE.\r
- if((AC_SIGMA_MODE != AC_SIGMA_NONE) && (priv->pmib->dot11QosEntry.ManualEDCA))\r
- {\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_BK_PARAM, (EDCA[BK].TXOPlimit<< 16) | (EDCA[BK].ECWmax<< 12) | (EDCA[BK].ECWmin<< 8) | 0xa4 );\r
- }\r
-#endif\r
-\r
-// ODM_Write1Byte(pDM_Odm,ACMHWCTRL, 0x00);\r
-\r
- priv->pshare->iot_mode_enable = 0;\r
-#if(DM_ODM_SUPPORT_TYPE==ODM_AP)\r
- if (priv->pshare->rf_ft_var.wifi_beq_iot)\r
- priv->pshare->iot_mode_VI_exist = 0;\r
- \r
- #ifdef WMM_VIBE_PRI\r
- priv->pshare->iot_mode_BE_exist = 0;\r
- #endif\r
- \r
-#ifdef WMM_BEBK_PRI\r
- priv->pshare->iot_mode_BK_exist = 0;\r
-#endif\r
- \r
- #ifdef LOW_TP_TXOP\r
- priv->pshare->BE_cwmax_enhance = 0;\r
- #endif\r
-\r
-#elif (DM_ODM_SUPPORT_TYPE==ODM_ADSL)\r
- priv->pshare->iot_mode_BE_exist = 0; \r
-#endif\r
- priv->pshare->iot_mode_VO_exist = 0;\r
-}\r
-\r
-BOOLEAN\r
-ODM_ChooseIotMainSTA(\r
- IN PVOID pDM_VOID,\r
- IN PSTA_INFO_T pstat\r
- )\r
-{\r
- PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;\r
- prtl8192cd_priv priv = pDM_Odm->priv;\r
- BOOLEAN bhighTP_found_pstat=FALSE;\r
- \r
- if ((GET_ROOT(priv)->up_time % 2) == 0) {\r
- unsigned int tx_2s_avg = 0;\r
- unsigned int rx_2s_avg = 0;\r
- int i=0, aggReady=0;\r
- unsigned long total_sum = (priv->pshare->current_tx_bytes+priv->pshare->current_rx_bytes);\r
- int assoc_num = GET_ROOT(priv)->assoc_num;\r
-#ifdef MBSSID\r
- if (GET_ROOT(priv)->pmib->miscEntry.vap_enable){\r
- for (i=0; i<RTL8192CD_NUM_VWLAN; ++i)\r
- assoc_num += GET_ROOT(priv)->pvap_priv[i]-> assoc_num;\r
- }\r
-#endif \r
-#ifdef UNIVERSAL_REPEATER\r
- if (IS_DRV_OPEN(GET_VXD_PRIV(GET_ROOT(priv))))\r
- assoc_num += GET_VXD_PRIV(GET_ROOT(priv))-> assoc_num;\r
-#endif\r
-#ifdef WDS\r
- if(GET_ROOT(priv)->pmib->dot11WdsInfo.wdsEnabled)\r
- assoc_num ++;\r
-#endif\r
-\r
-\r
- pstat->current_tx_bytes += pstat->tx_byte_cnt;\r
- pstat->current_rx_bytes += pstat->rx_byte_cnt;\r
-\r
- if (total_sum != 0) {\r
- if (total_sum <= 1000000) {\r
- tx_2s_avg = (unsigned int)((pstat->current_tx_bytes*100) / total_sum);\r
- rx_2s_avg = (unsigned int)((pstat->current_rx_bytes*100) / total_sum);\r
- } else {\r
- tx_2s_avg = (unsigned int)(pstat->current_tx_bytes / (total_sum / 100));\r
- rx_2s_avg = (unsigned int)(pstat->current_rx_bytes / (total_sum / 100));\r
- }\r
-\r
- }\r
-\r
-#if(DM_ODM_SUPPORT_TYPE==ODM_ADSL)\r
- if (pstat->ht_cap_len) {\r
- if ((tx_2s_avg + rx_2s_avg) >=25 ) {//50//\r
-\r
- priv->pshare->highTP_found_pstat = pstat;\r
- bhighTP_found_pstat=TRUE;\r
- }\r
- }\r
-#elif(DM_ODM_SUPPORT_TYPE==ODM_AP)\r
- for(i=0; i<8; i++)\r
- aggReady += (pstat->ADDBA_ready[i]);\r
-\r
- if ((pstat->ht_cap_len && (\r
-#ifdef SUPPORT_TX_AMSDU \r
- AMSDU_ENABLE || \r
-#endif \r
- aggReady)) || (pstat->IOTPeer==HT_IOT_PEER_INTEL))\r
- {\r
- if ((assoc_num==1) || (tx_2s_avg + rx_2s_avg >= 25)) {\r
- priv->pshare->highTP_found_pstat = pstat;\r
- }\r
- \r
- #ifdef CLIENT_MODE\r
- if (OPMODE & WIFI_STATION_STATE) {\r
- if ((tx_2s_avg + rx_2s_avg) >= 20)\r
- priv->pshare->highTP_found_pstat = pstat;\r
- }\r
- #endif \r
- }\r
-#endif\r
- } \r
- else {\r
- pstat->current_tx_bytes = pstat->tx_byte_cnt;\r
- pstat->current_rx_bytes = pstat->rx_byte_cnt;\r
- }\r
-\r
- return bhighTP_found_pstat;\r
-}\r
-\r
-\r
-#ifdef WIFI_WMM\r
-VOID\r
-ODM_IotEdcaSwitch(\r
- IN PVOID pDM_VOID,\r
- IN unsigned char enable\r
- )\r
-{\r
- PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;\r
- prtl8192cd_priv priv = pDM_Odm->priv;\r
- int mode=priv->pmib->dot11BssType.net_work_type;\r
- unsigned int slot_time = 20, sifs_time = 10, BE_TXOP = 47, VI_TXOP = 94;\r
- unsigned int vi_cw_max = 4, vi_cw_min = 3, vi_aifs;\r
-#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)\r
- u32 be_edca, vi_edca;\r
- u16 disable_cfe;\r
-#endif\r
-\r
-#if (DM_ODM_SUPPORT_TYPE==ODM_AP)\r
- if (!(!priv->pmib->dot11OperationEntry.wifi_specific ||\r
- ((OPMODE & WIFI_AP_STATE) && (priv->pmib->dot11OperationEntry.wifi_specific))\r
- #ifdef CLIENT_MODE\r
- || ((OPMODE & WIFI_STATION_STATE) && (priv->pmib->dot11OperationEntry.wifi_specific))\r
- #endif\r
- ))\r
- return;\r
-#endif\r
-\r
-#ifdef RTK_AC_SUPPORT //for 11ac logo, do not dynamic switch edca \r
- if(AC_SIGMA_MODE != AC_SIGMA_NONE)\r
- return;\r
-#endif\r
-\r
- if ((mode & (ODM_WM_N24G|ODM_WM_N5G)) && (priv->pshare->ht_sta_num\r
- #ifdef WDS\r
- || ((OPMODE & WIFI_AP_STATE) && priv->pmib->dot11WdsInfo.wdsEnabled && priv->pmib->dot11WdsInfo.wdsNum)\r
- #endif\r
- ))\r
- sifs_time = 16;\r
-\r
- if (mode & (ODM_WM_N24G|ODM_WM_N5G|ODM_WM_G|ODM_WM_A)) {\r
- slot_time = 9;\r
- } \r
- else\r
- {\r
- BE_TXOP = 94;\r
- VI_TXOP = 188;\r
- }\r
-\r
-#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)\r
- vi_edca = -1;\r
- disable_cfe = -1;\r
-#endif\r
-\r
-#if (DM_ODM_SUPPORT_TYPE==ODM_ADSL)\r
- if (priv->pshare->iot_mode_VO_exist) {\r
- // to separate AC_VI and AC_BE to avoid using the same EDCA settings\r
- if (priv->pshare->iot_mode_BE_exist) {\r
- vi_cw_max = 5;\r
- vi_cw_min = 3;\r
- } else {\r
- vi_cw_max = 6;\r
- vi_cw_min = 4;\r
- }\r
- }\r
- vi_aifs = (sifs_time + ((OPMODE & WIFI_AP_STATE)?1:2) * slot_time);\r
-\r
-#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)\r
- vi_edca = ((VI_TXOP*(1-priv->pshare->iot_mode_VO_exist)) << 16)| (vi_cw_max << 12) | (vi_cw_min << 8) | vi_aifs;\r
-#else\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_VI_PARAM, ((VI_TXOP*(1-priv->pshare->iot_mode_VO_exist)) << 16)| (vi_cw_max << 12) | (vi_cw_min << 8) | vi_aifs);\r
-#endif\r
- \r
-#elif (DM_ODM_SUPPORT_TYPE==ODM_AP)\r
- if ((OPMODE & WIFI_AP_STATE) && priv->pmib->dot11OperationEntry.wifi_specific) {\r
- if (priv->pshare->iot_mode_VO_exist) {\r
- #ifdef WMM_VIBE_PRI\r
- if (priv->pshare->iot_mode_BE_exist) \r
- {\r
- vi_cw_max = 5;\r
- vi_cw_min = 3;\r
- vi_aifs = (sifs_time + ((OPMODE & WIFI_AP_STATE)?1:2) * slot_time);\r
- }\r
- else \r
- #endif\r
- {\r
- vi_cw_max = 6;\r
- vi_cw_min = 4;\r
- vi_aifs = 0x2b;\r
- }\r
- } \r
- else {\r
- vi_aifs = (sifs_time + ((OPMODE & WIFI_AP_STATE)?1:2) * slot_time);\r
- }\r
-\r
-#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)\r
- vi_edca = ((VI_TXOP*(1-priv->pshare->iot_mode_VO_exist)) << 16)\r
- | (vi_cw_max << 12) | (vi_cw_min << 8) | vi_aifs;\r
-#else\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_VI_PARAM, ((VI_TXOP*(1-priv->pshare->iot_mode_VO_exist)) << 16)\r
- | (vi_cw_max << 12) | (vi_cw_min << 8) | vi_aifs);\r
-#endif\r
-\r
- #ifdef WMM_BEBK_PRI\r
- #ifdef CONFIG_RTL_88E_SUPPORT\r
- if ((GET_CHIP_VER(priv) == VERSION_8188E) && priv->pshare->iot_mode_BK_exist) {\r
-#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)\r
- be_edca = (10 << 12) | (6 << 8) | 0x4f;\r
-#else\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_BK_PARAM, (10 << 12) | (6 << 8) | 0x4f);\r
-#endif\r
- }\r
- #endif \r
- #endif\r
-#if defined(CONFIG_WLAN_HAL_8881A) \r
- if (GET_CHIP_VER(priv) == VERSION_8881A) \r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_BK_PARAM, 0xa64f);\r
-#endif \r
- }\r
-#endif\r
-\r
-\r
-\r
-#if (DM_ODM_SUPPORT_TYPE==ODM_AP)\r
- if (priv->pshare->rf_ft_var.wifi_beq_iot && priv->pshare->iot_mode_VI_exist) {\r
-#if defined(CONFIG_RTL_88E_SUPPORT) || defined(CONFIG_RTL_8812_SUPPORT)\r
- if (GET_CHIP_VER(priv) == VERSION_8188E || GET_CHIP_VER(priv) == VERSION_8812E) {\r
-#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)\r
- be_edca = (10 << 12) | (6 << 8) | 0x4f;\r
-#else\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (10 << 12) | (6 << 8) | 0x4f);\r
-#endif\r
- }\r
- else\r
-#endif\r
- {\r
-#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)\r
- be_edca = (10 << 12) | (4 << 8) | 0x4f;\r
-#else\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (10 << 12) | (4 << 8) | 0x4f);\r
-#endif\r
- }\r
- } else if(!enable)\r
-#elif(DM_ODM_SUPPORT_TYPE==ODM_ADSL) \r
- if(!enable) //if iot is disable ,maintain original BEQ PARAM\r
-#endif\r
- {\r
-#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)\r
- be_edca = (((OPMODE & WIFI_AP_STATE)?6:10) << 12) | (4 << 8)\r
- | (sifs_time + 3 * slot_time);\r
- disable_cfe = 1;\r
-#else\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (((OPMODE & WIFI_AP_STATE)?6:10) << 12) | (4 << 8)\r
- | (sifs_time + 3 * slot_time));\r
-#endif\r
-#ifdef CONFIG_PCI_HCI\r
-// ODM_Write2Byte(pDM_Odm, RD_CTRL, ODM_Read2Byte(pDM_Odm, RD_CTRL) | (DIS_TXOP_CFE));\r
-#endif\r
- }\r
- else\r
- {\r
- int txop;\r
- unsigned int cw_max;\r
-#ifdef LOW_TP_TXOP\r
- unsigned int txop_close;\r
-#endif\r
- \r
- #if((DM_ODM_SUPPORT_TYPE==ODM_AP)&&(defined LOW_TP_TXOP))\r
- cw_max = ((priv->pshare->BE_cwmax_enhance) ? 10 : 6);\r
- txop_close = ((priv->pshare->rf_ft_var.low_tp_txop && priv->pshare->rf_ft_var.low_tp_txop_close) ? 1 : 0);\r
-\r
- if(priv->pshare->txop_enlarge == 0xe) //if intel case\r
- txop = (txop_close ? 0 : (BE_TXOP*2));\r
- else //if other case\r
- txop = (txop_close ? 0: (BE_TXOP*priv->pshare->txop_enlarge));\r
- #else\r
- cw_max=6;\r
- if((priv->pshare->txop_enlarge==0xe)||(priv->pshare->txop_enlarge==0xd))\r
- txop=BE_TXOP*2;\r
- else\r
- txop=BE_TXOP*priv->pshare->txop_enlarge;\r
-\r
- #endif\r
- \r
- if (priv->pshare->ht_sta_num\r
- #ifdef WDS\r
- || ((OPMODE & WIFI_AP_STATE) && (mode & (ODM_WM_N24G|ODM_WM_N5G)) &&\r
- priv->pmib->dot11WdsInfo.wdsEnabled && priv->pmib->dot11WdsInfo.wdsNum)\r
- #endif\r
- ) \r
- {\r
-\r
- if (priv->pshare->txop_enlarge == 0xe) {\r
- // is intel client, use a different edca value\r
- //ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (txop<< 16) | (cw_max<< 12) | (4 << 8) | 0x1f);\r
- if (pDM_Odm->RFType==ODM_1T1R) {\r
-#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)\r
- be_edca = (txop << 16) | (5 << 12) | (3 << 8) | 0x1f;\r
-#else\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (txop << 16) | (5 << 12) | (3 << 8) | 0x1f);\r
-#endif\r
- }\r
- else {\r
-#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)\r
- be_edca = (txop << 16) | (8 << 12) | (5 << 8) | 0x1f;\r
-#else\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (txop << 16) | (8 << 12) | (5 << 8) | 0x1f);\r
-#endif\r
- }\r
- \r
-#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)\r
- disable_cfe = 0;\r
-#endif\r
-#ifdef CONFIG_PCI_HCI\r
-// ODM_Write2Byte(pDM_Odm, RD_CTRL, ODM_Read2Byte(pDM_Odm, RD_CTRL) & ~(DIS_TXOP_CFE));\r
-#endif\r
- priv->pshare->txop_enlarge = 2;\r
- } \r
-#if(DM_ODM_SUPPORT_TYPE==ODM_AP)\r
- #ifndef LOW_TP_TXOP\r
- else if (priv->pshare->txop_enlarge == 0xd) {\r
- // is intel ralink, use a different edca value\r
-#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)\r
- be_edca = (txop << 16) | (6 << 12) | (5 << 8) | 0x2b;\r
-#else\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (txop << 16) | (6 << 12) | (5 << 8) | 0x2b);\r
-#endif\r
- priv->pshare->txop_enlarge = 2;\r
- } \r
- #endif\r
-#endif\r
- else \r
- {\r
-// if (txop == 0) {\r
-//#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)\r
-// disable_cfe = 1;\r
-//#endif\r
-//#ifdef CONFIG_PCI_HCI\r
-// ODM_Write2Byte(pDM_Odm, RD_CTRL, ODM_Read2Byte(pDM_Odm, RD_CTRL) | (DIS_TXOP_CFE));\r
-//#endif\r
-// }\r
- \r
- if (pDM_Odm->RFType==ODM_2T2R) {\r
-#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)\r
- be_edca = (txop << 16) | (cw_max << 12) | (4 << 8) | (sifs_time + 3 * slot_time);\r
-#else\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (txop << 16) |\r
- (cw_max << 12) | (4 << 8) | (sifs_time + 3 * slot_time));\r
-#endif\r
- }\r
- else\r
- #if(DM_ODM_SUPPORT_TYPE==ODM_AP)&&(defined LOW_TP_TXOP)\r
- {\r
-#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)\r
- be_edca = (txop << 16) |\r
- (((priv->pshare->BE_cwmax_enhance) ? 10 : 5) << 12) | (3 << 8) | (sifs_time + 2 * slot_time);\r
-#else\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (txop << 16) |\r
- (((priv->pshare->BE_cwmax_enhance) ? 10 : 5) << 12) | (3 << 8) | (sifs_time + 2 * slot_time));\r
-#endif\r
- }\r
- #else\r
- {\r
- PSTA_INFO_T pstat = priv->pshare->highTP_found_pstat;\r
- if ((GET_CHIP_VER(priv)==VERSION_8881A) && pstat && (pstat->IOTPeer == HT_IOT_PEER_HTC))\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, 0x642b);\r
- else {\r
-#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)\r
- be_edca = (txop << 16) | (5 << 12) | (3 << 8) | (sifs_time + 2 * slot_time);\r
- #else\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (txop << 16) |\r
- (5 << 12) | (3 << 8) | (sifs_time + 2 * slot_time));\r
-#endif\r
- }\r
- }\r
- #endif\r
- }\r
- }\r
- else \r
- {\r
- #if((DM_ODM_SUPPORT_TYPE==ODM_AP)&&(defined LOW_TP_TXOP))\r
-#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)\r
- be_edca = (BE_TXOP << 16) | (cw_max << 12) | (4 << 8) | (sifs_time + 3 * slot_time);\r
-#else\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (BE_TXOP << 16) | (cw_max << 12) | (4 << 8) | (sifs_time + 3 * slot_time));\r
-#endif\r
- #else\r
- #if defined(CONFIG_RTL_8196D) || defined(CONFIG_RTL_8197DL) || defined(CONFIG_RTL_8196E) || (defined(CONFIG_RTL_8197D) && !defined(CONFIG_PORT0_EXT_GIGA))\r
-#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)\r
- be_edca = (BE_TXOP*2 << 16) | (cw_max << 12) | (5 << 8) | (sifs_time + 3 * slot_time);\r
- #else\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (BE_TXOP*2 << 16) | (cw_max << 12) | (5 << 8) | (sifs_time + 3 * slot_time));\r
-#endif\r
- #else\r
-#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)\r
- be_edca = (BE_TXOP*2 << 16) | (cw_max << 12) | (4 << 8) | (sifs_time + 3 * slot_time);\r
- #else\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (BE_TXOP*2 << 16) | (cw_max << 12) | (4 << 8) | (sifs_time + 3 * slot_time));\r
- #endif\r
- #endif\r
-/* \r
- if (priv->pshare->txop_enlarge == 0xe) {\r
-#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)\r
- disable_cfe = 0;\r
-#endif\r
- #ifdef CONFIG_PCI_HCI\r
- ODM_Write2Byte(pDM_Odm, RD_CTRL, ODM_Read2Byte(pDM_Odm, RD_CTRL) & ~(DIS_TXOP_CFE));\r
- #endif\r
- } else {\r
-#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)\r
- disable_cfe = 1;\r
-#endif\r
- #ifdef CONFIG_PCI_HCI\r
- ODM_Write2Byte(pDM_Odm, RD_CTRL, ODM_Read2Byte(pDM_Odm, RD_CTRL) | (DIS_TXOP_CFE));\r
- #endif\r
- }\r
-*/ \r
- #endif\r
- }\r
-\r
- }\r
- \r
-#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)\r
- notify_IOT_EDCA_switch(priv, be_edca, vi_edca, disable_cfe);\r
-#endif\r
-}\r
-#endif\r
-\r
-VOID \r
-odm_IotEngine(\r
- IN PVOID pDM_VOID\r
- )\r
-{\r
- PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;\r
- struct rtl8192cd_priv *priv=pDM_Odm->priv;\r
- PSTA_INFO_T pstat = NULL;\r
- u4Byte i;\r
- \r
-#ifdef WIFI_WMM\r
- unsigned int switch_turbo = 0, avg_tp;\r
-#endif \r
-////////////////////////////////////////////////////////\r
-// if EDCA Turbo function is not supported or Manual EDCA Setting\r
-// then return\r
-////////////////////////////////////////////////////////\r
- if(!(pDM_Odm->SupportAbility&ODM_MAC_EDCA_TURBO)){\r
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("ODM_MAC_EDCA_TURBO NOT SUPPORTED\n"));\r
- return;\r
- }\r
- \r
-#if((DM_ODM_SUPPORT_TYPE==ODM_AP)&& defined(RTL_MANUAL_EDCA) && defined(WIFI_WMM))\r
- if(priv->pmib->dot11QosEntry.ManualEDCA){\r
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("ODM_MAC_EDCA_TURBO OFF: MANUAL SETTING\n"));\r
- return ;\r
- }\r
-#endif \r
-\r
-#if !(DM_ODM_SUPPORT_TYPE &ODM_AP)\r
- //////////////////////////////////////////////////////\r
- //find high TP STA every 2s\r
-//////////////////////////////////////////////////////\r
- if ((GET_ROOT(priv)->up_time % 2) == 0) \r
- priv->pshare->highTP_found_pstat==NULL;\r
-\r
-#if 0\r
- phead = &priv->asoc_list;\r
- plist = phead->next;\r
- while(plist != phead) {\r
- pstat = list_entry(plist, struct stat_info, asoc_list);\r
-\r
- if(ODM_ChooseIotMainSTA(pDM_Odm, pstat)); //find the correct station\r
- break;\r
- if (plist == plist->next) //the last plist \r
- break;\r
- plist = plist->next;\r
- };\r
-#endif\r
-\r
- //find highTP STA\r
- for(i=0; i<ODM_ASSOCIATE_ENTRY_NUM; i++) {\r
- pstat = pDM_Odm->pODM_StaInfo[i];\r
- if(IS_STA_VALID(pstat) && (ODM_ChooseIotMainSTA(pDM_Odm, pstat))) //find the correct station\r
- break;\r
- }\r
-\r
- //////////////////////////////////////////////////////\r
- //if highTP STA is not found, then return\r
- //////////////////////////////////////////////////////\r
- if(priv->pshare->highTP_found_pstat==NULL) {\r
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("ODM_MAC_EDCA_TURBO OFF: NO HT STA FOUND\n"));\r
- return;\r
- }\r
-#endif\r
-\r
- pstat=priv->pshare->highTP_found_pstat;\r
- if(pstat) {\r
- if((pstat->tx_avarage + pstat->rx_avarage) < (1<<17)) // 1M bps\r
- pstat = NULL;\r
- }\r
-\r
-#ifdef WIFI_WMM\r
- if (QOS_ENABLE) {\r
- if (!priv->pmib->dot11OperationEntry.wifi_specific \r
- #if(DM_ODM_SUPPORT_TYPE==ODM_AP)\r
- ||((OPMODE & WIFI_AP_STATE) && (priv->pmib->dot11OperationEntry.wifi_specific))\r
- #elif(DM_ODM_SUPPORT_TYPE==ODM_ADSL)\r
- || (priv->pmib->dot11OperationEntry.wifi_specific == 2)\r
- #endif\r
- ) {\r
- if (priv->pshare->iot_mode_enable &&\r
- ((priv->pshare->phw->VO_pkt_count > 50) ||\r
- (priv->pshare->phw->VI_pkt_count > 50) ||\r
- (priv->pshare->phw->BK_pkt_count > 50))) {\r
- priv->pshare->iot_mode_enable = 0;\r
- switch_turbo++;\r
-#ifdef CONFIG_WLAN_HAL_8881A\r
- if (GET_CHIP_VER(priv) == VERSION_8881A) {\r
- RTL_W32(0x460, 0x03086666);\r
- }\r
-#endif //CONFIG_WLAN_HAL_8881A\r
- } else if ((!priv->pshare->iot_mode_enable) &&\r
- ((priv->pshare->phw->VO_pkt_count < 50) &&\r
- (priv->pshare->phw->VI_pkt_count < 50) &&\r
- (priv->pshare->phw->BK_pkt_count < 50))) {\r
- priv->pshare->iot_mode_enable++;\r
- switch_turbo++;\r
-//#ifdef CONFIG_WLAN_HAL_8881A\r
-#if 0\r
- if (GET_CHIP_VER(priv) == VERSION_8881A) {\r
- if (get_bonding_type_8881A()==BOND_8881AB) {\r
- RTL_W32(0x460, 0x03086666);\r
- }\r
- else {\r
- RTL_W32(0x460, 0x0320ffff);\r
- }\r
- }\r
-#endif //CONFIG_WLAN_HAL_8881A\r
- }\r
- }\r
-\r
-\r
- #if(DM_ODM_SUPPORT_TYPE==ODM_AP)\r
- if ((OPMODE & WIFI_AP_STATE) && priv->pmib->dot11OperationEntry.wifi_specific)\r
- #elif (DM_ODM_SUPPORT_TYPE==ODM_ADSL)\r
- if (priv->pmib->dot11OperationEntry.wifi_specific) \r
- #endif\r
- {\r
- if (!priv->pshare->iot_mode_VO_exist && (priv->pshare->phw->VO_pkt_count > 50)) {\r
- priv->pshare->iot_mode_VO_exist++;\r
- switch_turbo++;\r
- } else if (priv->pshare->iot_mode_VO_exist && (priv->pshare->phw->VO_pkt_count < 50)) {\r
- priv->pshare->iot_mode_VO_exist = 0;\r
- switch_turbo++;\r
- }\r
-#if((DM_ODM_SUPPORT_TYPE==ODM_ADSL)||((DM_ODM_SUPPORT_TYPE==ODM_AP)&&(defined WMM_VIBE_PRI)))\r
- if (priv->pshare->iot_mode_VO_exist) {\r
- //printk("[%s %d] BE_pkt_count=%d\n", __FUNCTION__, __LINE__, priv->pshare->phw->BE_pkt_count);\r
- if (!priv->pshare->iot_mode_BE_exist && (priv->pshare->phw->BE_pkt_count > 250)) {\r
- priv->pshare->iot_mode_BE_exist++;\r
- switch_turbo++;\r
- } else if (priv->pshare->iot_mode_BE_exist && (priv->pshare->phw->BE_pkt_count < 250)) {\r
- priv->pshare->iot_mode_BE_exist = 0;\r
- switch_turbo++;\r
- }\r
- }\r
-#endif\r
-\r
-#if((DM_ODM_SUPPORT_TYPE==ODM_ADSL)||((DM_ODM_SUPPORT_TYPE==ODM_AP)&&(defined WMM_BEBK_PRI)))\r
- if (priv->pshare->phw->BE_pkt_count) {\r
- //printk("[%s %d] BK_pkt_count=%d\n", __FUNCTION__, __LINE__, priv->pshare->phw->BK_pkt_count);\r
- if (!priv->pshare->iot_mode_BK_exist && (priv->pshare->phw->BK_pkt_count > 250)) {\r
- priv->pshare->iot_mode_BK_exist++;\r
- switch_turbo++;\r
- } else if (priv->pshare->iot_mode_BK_exist && (priv->pshare->phw->BK_pkt_count < 250)) {\r
- priv->pshare->iot_mode_BK_exist = 0;\r
- switch_turbo++;\r
- }\r
- }\r
-#endif\r
-\r
-#if (DM_ODM_SUPPORT_TYPE==ODM_AP)\r
- if (priv->pshare->rf_ft_var.wifi_beq_iot) \r
- {\r
- if (!priv->pshare->iot_mode_VI_exist && (priv->pshare->phw->VI_rx_pkt_count > 50)) {\r
- priv->pshare->iot_mode_VI_exist++;\r
- switch_turbo++;\r
- } else if (priv->pshare->iot_mode_VI_exist && (priv->pshare->phw->VI_rx_pkt_count < 50)) {\r
- priv->pshare->iot_mode_VI_exist = 0;\r
- switch_turbo++;\r
- }\r
- }\r
-#endif\r
-\r
- }\r
- else if (!pstat || pstat->rssi < priv->pshare->rf_ft_var.txop_enlarge_lower) {\r
- if (priv->pshare->txop_enlarge) {\r
- priv->pshare->txop_enlarge = 0;\r
- if (priv->pshare->iot_mode_enable)\r
- switch_turbo++;\r
- }\r
- }\r
-\r
-#if(defined(CLIENT_MODE) && (DM_ODM_SUPPORT_TYPE==ODM_AP))\r
- if ((OPMODE & WIFI_STATION_STATE) && (priv->pmib->dot11OperationEntry.wifi_specific))\r
- {\r
- if (priv->pshare->iot_mode_enable &&\r
- (((priv->pshare->phw->VO_pkt_count > 50) ||\r
- (priv->pshare->phw->VI_pkt_count > 50) ||\r
- (priv->pshare->phw->BK_pkt_count > 50)) ||\r
- (pstat && (!pstat->ADDBA_ready[0]) & (!pstat->ADDBA_ready[3]))))\r
- {\r
- priv->pshare->iot_mode_enable = 0;\r
- switch_turbo++;\r
- }\r
- else if ((!priv->pshare->iot_mode_enable) &&\r
- (((priv->pshare->phw->VO_pkt_count < 50) &&\r
- (priv->pshare->phw->VI_pkt_count < 50) &&\r
- (priv->pshare->phw->BK_pkt_count < 50)) &&\r
- (pstat && (pstat->ADDBA_ready[0] | pstat->ADDBA_ready[3]))))\r
- {\r
- priv->pshare->iot_mode_enable++;\r
- switch_turbo++;\r
- }\r
- }\r
-#endif\r
-\r
- priv->pshare->phw->VO_pkt_count = 0;\r
- priv->pshare->phw->VI_pkt_count = 0;\r
- priv->pshare->phw->BK_pkt_count = 0;\r
-\r
- #if((DM_ODM_SUPPORT_TYPE==ODM_ADSL)||((DM_ODM_SUPPORT_TYPE==ODM_AP)&&(defined WMM_VIBE_PRI)))\r
- priv->pshare->phw->BE_pkt_count = 0;\r
- #endif\r
- \r
- #if(DM_ODM_SUPPORT_TYPE==ODM_AP)\r
- if (priv->pshare->rf_ft_var.wifi_beq_iot)\r
- priv->pshare->phw->VI_rx_pkt_count = 0;\r
- #endif\r
-\r
- }\r
-#endif\r
-\r
- if ((priv->up_time % 2) == 0) {\r
- /*\r
- * decide EDCA content for different chip vendor\r
- */\r
-#ifdef WIFI_WMM\r
- #if(DM_ODM_SUPPORT_TYPE==ODM_ADSL)\r
- if (QOS_ENABLE && (!priv->pmib->dot11OperationEntry.wifi_specific || (priv->pmib->dot11OperationEntry.wifi_specific == 2)\r
- \r
- #elif(DM_ODM_SUPPORT_TYPE==ODM_AP)\r
- if (QOS_ENABLE && (!priv->pmib->dot11OperationEntry.wifi_specific || \r
- ((OPMODE & WIFI_AP_STATE) && (priv->pmib->dot11OperationEntry.wifi_specific == 2))\r
- #ifdef CLIENT_MODE\r
- || ((OPMODE & WIFI_STATION_STATE) && (priv->pmib->dot11OperationEntry.wifi_specific == 2))\r
- #endif\r
- #endif\r
- ))\r
- \r
- {\r
-\r
- if (pstat && pstat->rssi >= priv->pshare->rf_ft_var.txop_enlarge_upper) {\r
-#ifdef LOW_TP_TXOP\r
- if (pstat->IOTPeer==HT_IOT_PEER_INTEL)\r
- {\r
- if (priv->pshare->txop_enlarge != 0xe)\r
- {\r
- priv->pshare->txop_enlarge = 0xe;\r
-\r
- if (priv->pshare->iot_mode_enable)\r
- switch_turbo++;\r
- }\r
- } \r
- else if (priv->pshare->txop_enlarge != 2) \r
- {\r
- priv->pshare->txop_enlarge = 2;\r
- if (priv->pshare->iot_mode_enable)\r
- switch_turbo++;\r
- }\r
-#else\r
- if (priv->pshare->txop_enlarge != 2)\r
- {\r
- if (pstat->IOTPeer==HT_IOT_PEER_INTEL)\r
- priv->pshare->txop_enlarge = 0xe; \r
- else if (pstat->IOTPeer==HT_IOT_PEER_RALINK)\r
- priv->pshare->txop_enlarge = 0xd; \r
- else if (pstat->IOTPeer==HT_IOT_PEER_HTC)\r
- priv->pshare->txop_enlarge = 0; \r
- else\r
- priv->pshare->txop_enlarge = 2;\r
-\r
- if (priv->pshare->iot_mode_enable)\r
- switch_turbo++;\r
- }\r
-#endif\r
- }\r
- else if (!pstat || pstat->rssi < priv->pshare->rf_ft_var.txop_enlarge_lower) \r
- {\r
- if (priv->pshare->txop_enlarge) {\r
- priv->pshare->txop_enlarge = 0;\r
- if (priv->pshare->iot_mode_enable)\r
- switch_turbo++;\r
- }\r
- }\r
-\r
-#if((DM_ODM_SUPPORT_TYPE==ODM_AP)&&( defined LOW_TP_TXOP))\r
- // for Intel IOT, need to enlarge CW MAX from 6 to 10\r
- if (pstat && pstat->IOTPeer==HT_IOT_PEER_INTEL && (((pstat->tx_avarage+pstat->rx_avarage)>>10) < \r
- priv->pshare->rf_ft_var.cwmax_enhance_thd)) \r
- {\r
- if (!priv->pshare->BE_cwmax_enhance && priv->pshare->iot_mode_enable)\r
- {\r
- priv->pshare->BE_cwmax_enhance = 1;\r
- switch_turbo++;\r
- }\r
- } else {\r
- if (priv->pshare->BE_cwmax_enhance) {\r
- priv->pshare->BE_cwmax_enhance = 0;\r
- switch_turbo++;\r
- }\r
- }\r
-#endif\r
- }\r
-#endif\r
- priv->pshare->current_tx_bytes = 0;\r
- priv->pshare->current_rx_bytes = 0;\r
- }else {\r
- if ((GET_CHIP_VER(priv) == VERSION_8881A)||(GET_CHIP_VER(priv) == VERSION_8192E)|| (GET_CHIP_VER(priv) == VERSION_8188E) ){\r
- unsigned int uldl_tp = (priv->pshare->current_tx_bytes+priv->pshare->current_rx_bytes)>>17;\r
- if((uldl_tp > 40) && (priv->pshare->agg_to!= 1)) {\r
- RTL_W8(0x462, 0x08);\r
- priv->pshare->agg_to = 1;\r
- } else if((uldl_tp < 35) && (priv->pshare->agg_to !=0)) {\r
- RTL_W8(0x462, 0x02);\r
- priv->pshare->agg_to = 0;\r
- } \r
- }\r
- }\r
- \r
-#if((DM_ODM_SUPPORT_TYPE==ODM_AP)&& defined( SW_TX_QUEUE))\r
- if(AMPDU_ENABLE) {\r
-#ifdef TX_EARLY_MODE\r
- if (GET_TX_EARLY_MODE) {\r
- if (!GET_EM_SWQ_ENABLE &&\r
- ((priv->assoc_num > 1) ||\r
- (pstat && pstat->IOTPeer != HT_IOT_PEER_UNKNOWN))) {\r
- if ((priv->pshare->em_tx_byte_cnt >> 17) > EM_TP_UP_BOUND) \r
- priv->pshare->reach_tx_limit_cnt++; \r
- else \r
- priv->pshare->reach_tx_limit_cnt = 0; \r
-\r
- if (priv->pshare->txop_enlarge && priv->pshare->reach_tx_limit_cnt) { //>= WAIT_TP_TIME//\r
- GET_EM_SWQ_ENABLE = 1; \r
- priv->pshare->reach_tx_limit_cnt = 0;\r
-\r
- if (pstat->IOTPeer == HT_IOT_PEER_INTEL)\r
- MAX_EM_QUE_NUM = 12;\r
- else if (pstat->IOTPeer == HT_IOT_PEER_RALINK)\r
- MAX_EM_QUE_NUM = 10;\r
- \r
- enable_em(priv); \r
- }\r
- }\r
- else if (GET_EM_SWQ_ENABLE) {\r
- if ((priv->pshare->em_tx_byte_cnt >> 17) < EM_TP_LOW_BOUND)\r
- priv->pshare->reach_tx_limit_cnt++; \r
- else \r
- priv->pshare->reach_tx_limit_cnt = 0; \r
-\r
- if (!priv->pshare->txop_enlarge || priv->pshare->reach_tx_limit_cnt >= WAIT_TP_TIME) {\r
- GET_EM_SWQ_ENABLE = 0;\r
- priv->pshare->reach_tx_limit_cnt = 0;\r
- disable_em(priv);\r
- }\r
- }\r
- }\r
-#endif\r
-\r
-#if defined(CONFIG_WLAN_HAL_8881A) || defined(CONFIG_WLAN_HAL_8192EE) || defined(CONFIG_RTL_8812_SUPPORT) || defined(CONFIG_WLAN_HAL_8814AE)\r
- if (pDM_Odm->SupportICType == ODM_RTL8881A || pDM_Odm->SupportICType == ODM_RTL8192E || pDM_Odm->SupportICType == ODM_RTL8812 || pDM_Odm->SupportICType == ODM_RTL8814A) { \r
- if (priv->assoc_num > 9)\r
- {\r
- if (priv->swq_txmac_chg >= priv->pshare->rf_ft_var.swq_en_highthd){\r
- if ((priv->swq_decision == 0)){\r
- switch_turbo++;\r
- if (priv->pshare->txop_enlarge == 0)\r
- priv->pshare->txop_enlarge = 2;\r
- priv->swq_decision = 1;\r
- }\r
- else\r
- {\r
- if ((switch_turbo > 0) && (priv->pshare->txop_enlarge == 0) && (priv->pshare->iot_mode_enable != 0))\r
- {\r
- priv->pshare->txop_enlarge = 2;\r
- switch_turbo--;\r
- }\r
- }\r
- }\r
- else if(priv->swq_txmac_chg <= priv->pshare->rf_ft_var.swq_dis_lowthd){\r
- priv->swq_decision = 0;\r
- }\r
- else if ((priv->swq_decision == 1) && (switch_turbo > 0) && (priv->pshare->txop_enlarge == 0) && (priv->pshare->iot_mode_enable != 0)) {\r
- priv->pshare->txop_enlarge = 2;\r
- switch_turbo--;\r
- }\r
- } else {\r
- priv->swq_decision = 0;\r
- }\r
- } else if(CONFIG_WLAN_NOT_HAL_EXIST)\r
-#endif\r
- { \r
- if (priv->assoc_num > 1)\r
- {\r
- if (priv->swq_txmac_chg >= priv->pshare->rf_ft_var.swq_en_highthd){\r
- if ((priv->swq_decision == 0)){\r
- switch_turbo++;\r
- if (priv->pshare->txop_enlarge == 0)\r
- priv->pshare->txop_enlarge = 2;\r
- priv->swq_decision = 1;\r
- }\r
- else\r
- {\r
- if ((switch_turbo > 0) && (priv->pshare->txop_enlarge == 0) && (priv->pshare->iot_mode_enable != 0))\r
- {\r
- priv->pshare->txop_enlarge = 2;\r
- switch_turbo--;\r
- }\r
- }\r
- }\r
- else if(priv->swq_txmac_chg <= priv->pshare->rf_ft_var.swq_dis_lowthd){\r
- priv->swq_decision = 0;\r
- }\r
- else if ((priv->swq_decision == 1) && (switch_turbo > 0) && (priv->pshare->txop_enlarge == 0) && (priv->pshare->iot_mode_enable != 0)) {\r
- priv->pshare->txop_enlarge = 2;\r
- switch_turbo--;\r
- }\r
- }\r
- //#if (defined CONFIG_RTL_819XD))\r
- else if (priv->assoc_num == 1 && (priv->up_time % 2 == 0)\r
-#if (DM_ODM_SUPPORT_TYPE==ODM_AP) && defined(TX_EARLY_MODE)\r
- && (!GET_TX_EARLY_MODE || !GET_EM_SWQ_ENABLE) \r
-#endif\r
- ) {\r
- if ((pstat) && (pstat->ADDBA_ready[0] | pstat->ADDBA_ready[3])) {\r
- //int en_thd = 14417920>>(priv->up_time % 2);\r
- avg_tp = (pstat->current_tx_bytes >> 17);\r
-\r
- //if ((priv->swq_decision == 0) && (pstat->current_tx_bytes > en_thd) && (pstat->current_rx_bytes > en_thd) ) { //50Mbps\r
- if ((priv->swq_decision == 0) && (avg_tp > TP_HIGH_WATER_MARK)) { //55Mbps\r
- //printk("[%s:%d] swq_decision=1 current_tp: %d Mbps\n", __FUNCTION__, __LINE__, avg_tp);\r
- priv->swq_decision = 1;\r
- }\r
- //else if ((priv->swq_decision == 1) && ((pstat->tx_avarage < 4587520) || (pstat->rx_avarage < 4587520))) { //35Mbps\r
- else if ((priv->swq_decision == 1) && (avg_tp < TP_LOW_WATER_MARK)) { //35Mbps\r
- //printk("[%s:%d] swq_decision=0 current_tp: %d Mbps\n", __FUNCTION__, __LINE__, avg_tp);\r
- priv->swq_decision = 0;\r
- }\r
- } else {\r
- priv->swq_decision = 0;\r
- }\r
- }\r
- }\r
- if( (priv->swq_decision == 1) \r
-#if (DM_ODM_SUPPORT_TYPE==ODM_AP) && defined(TX_EARLY_MODE) \r
- || (GET_EM_SWQ_ENABLE == 1) \r
-#endif \r
- ) {\r
- priv->swq_en = 1;\r
- priv->swqen_keeptime = priv->up_time;\r
- } else {\r
- priv->swq_en = 0;\r
- priv->swqen_keeptime = 0;\r
- }\r
- }\r
-#endif\r
-\r
-#ifdef WIFI_WMM\r
-#ifdef LOW_TP_TXOP\r
- if ((!priv->pmib->dot11OperationEntry.wifi_specific || (priv->pmib->dot11OperationEntry.wifi_specific == 2))\r
- && QOS_ENABLE) {\r
- if (switch_turbo || priv->pshare->rf_ft_var.low_tp_txop) {\r
- unsigned int thd_tp;\r
- unsigned char under_thd;\r
- unsigned int curr_tp;\r
-\r
- if (priv->pmib->dot11BssType.net_work_type & (ODM_WM_N24G|ODM_WM_N5G| ODM_WM_G))\r
- {\r
- // Determine the upper bound throughput threshold.\r
- if (priv->pmib->dot11BssType.net_work_type & (ODM_WM_N24G|ODM_WM_N5G)) {\r
- if (priv->assoc_num && priv->assoc_num != priv->pshare->ht_sta_num)\r
- thd_tp = priv->pshare->rf_ft_var.low_tp_txop_thd_g;\r
- else\r
- thd_tp = priv->pshare->rf_ft_var.low_tp_txop_thd_n;\r
- }\r
- else\r
- thd_tp = priv->pshare->rf_ft_var.low_tp_txop_thd_g;\r
-\r
- // Determine to close txop.\r
-#if defined(UNIVERSAL_REPEATER) || defined(MBSSID)\r
- if(IS_STA_VALID(pstat)) \r
- { \r
- struct rtl8192cd_priv *tmppriv;\r
- struct aid_obj *aidarray; \r
- aidarray = container_of(pstat, struct aid_obj, station);\r
- tmppriv = aidarray->priv;\r
-\r
- curr_tp = (unsigned int)(tmppriv->ext_stats.tx_avarage>>17) + (unsigned int)(tmppriv->ext_stats.rx_avarage>>17);\r
- } \r
- else \r
-#endif\r
- curr_tp = (unsigned int)(priv->ext_stats.tx_avarage>>17) + (unsigned int)(priv->ext_stats.rx_avarage>>17);\r
- if (curr_tp <= thd_tp && curr_tp >= priv->pshare->rf_ft_var.low_tp_txop_thd_low)\r
- under_thd = 1;\r
- else\r
- under_thd = 0;\r
- }\r
- else\r
- {\r
- under_thd = 0;\r
- }\r
-\r
- if (switch_turbo) \r
- {\r
- priv->pshare->rf_ft_var.low_tp_txop_close = under_thd;\r
- priv->pshare->rf_ft_var.low_tp_txop_count = 0;\r
- }\r
- else if (priv->pshare->iot_mode_enable && (priv->pshare->rf_ft_var.low_tp_txop_close != under_thd)) {\r
- priv->pshare->rf_ft_var.low_tp_txop_count++;\r
- if (priv->pshare->rf_ft_var.low_tp_txop_close) {\r
- priv->pshare->rf_ft_var.low_tp_txop_count = priv->pshare->rf_ft_var.low_tp_txop_delay;\r
- }\r
- if (priv->pshare->rf_ft_var.low_tp_txop_count ==priv->pshare->rf_ft_var.low_tp_txop_delay) \r
-\r
- { \r
- priv->pshare->rf_ft_var.low_tp_txop_count = 0;\r
- priv->pshare->rf_ft_var.low_tp_txop_close = under_thd;\r
- switch_turbo++;\r
- }\r
- } \r
- else \r
- {\r
- priv->pshare->rf_ft_var.low_tp_txop_count = 0;\r
- }\r
- }\r
- }\r
-#endif \r
-\r
-#ifdef WMM_DSCP_C42\r
- if (switch_turbo) {\r
- if (!priv->pshare->iot_mode_enable && !priv->pshare->aggrmax_change) {\r
- RTL_W16(0x4ca, 0x0404);\r
- priv->pshare->aggrmax_change = 1;\r
- }\r
- else if (priv->pshare->iot_mode_enable && priv->pshare->aggrmax_change) {\r
- RTL_W16(0x4ca, priv->pshare->aggrmax_bak);\r
- priv->pshare->aggrmax_change = 0;\r
- }\r
- } \r
-#endif\r
-#ifdef TX_EARLY_MODE\r
- unsigned int em_tp = ((priv->ext_stats.tx_avarage>>17) + (priv->ext_stats.rx_avarage>>17));\r
- if (em_tp > 80)\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (0x5e << 16) | (4 << 12) | (3 << 8) | 0x19);\r
- else //if (em_tp < 75)\r
- ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (0x5e << 16) | (6 << 12) | (5 << 8) | 0x2b);\r
-#endif\r
- if (switch_turbo)\r
- ODM_IotEdcaSwitch( pDM_Odm, priv->pshare->iot_mode_enable );\r
-#endif\r
-}\r
-#endif\r
\r