static VOID P2PDiscListenAction( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem) { P2P_DISC_STATE *pCurrState = &(pAd->P2pCfg.DiscCurrentState); PRT_P2P_CONFIG pP2PCtrl = &pAd->P2pCfg; if (pP2PCtrl->P2pCounter.bStartScan == TRUE) pP2PCtrl->P2pCounter.ListenInterval = (RandomByte(pAd) % 3) + pP2PCtrl->P2pCounter.ListenIntervalBias; /* 1~3 */ else pP2PCtrl->P2pCounter.ListenInterval = 5; /* ExtListenInterval is in ms. So /100 */ if (IS_P2P_SUPPORT_EXT_LISTEN(pAd)) pP2PCtrl->P2pCounter.ListenInterval = pP2PCtrl->ExtListenPeriod/100; if (pAd->LatchRfRegs.Channel != pP2PCtrl->ListenChannel) { /* Let BBP register at 20MHz */ rtmp_bbp_set_bw(pAd, BW_20); AsicSwitchChannel(pAd, pP2PCtrl->ListenChannel, FALSE); AsicLockChannel(pAd, pP2PCtrl->ListenChannel); } DBGPRINT(RT_DEBUG_TRACE, ("%s:: Listen interval - %d\n", __FUNCTION__, pP2PCtrl->P2pCounter.ListenInterval)); pP2PCtrl->P2pCounter.bListen = TRUE; *pCurrState = P2P_DISC_LISTEN; }
static VOID ChipBBPAdjust(RTMP_ADAPTER *pAd) { UCHAR rf_bw, ext_ch; UCHAR bbp_val; #ifdef DOT11_N_SUPPORT if (get_ht_cent_ch(pAd, &rf_bw, &ext_ch) == FALSE) #endif /* DOT11_N_SUPPORT */ { rf_bw = BW_20; ext_ch = EXTCHA_NONE; pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel; } rtmp_bbp_set_bw(pAd, rf_bw); /* TX/RX : control channel setting */ rtmp_mac_set_ctrlch(pAd, ext_ch); rtmp_bbp_set_ctrlch(pAd, ext_ch); /* request by Gary 20070208 for middle and long range G Band*/ #ifdef DOT11_N_SUPPORT if (rf_bw == BW_40) bbp_val = (pAd->CommonCfg.Channel > 14) ? 0x48 : 0x38; else #endif /* DOT11_N_SUPPORT */ bbp_val = (pAd->CommonCfg.Channel > 14) ? 0x40 : 0x38; rtmp_bbp_set_agc(pAd, bbp_val, RX_CHAIN_ALL); if (pAd->MACVersion == 0x28600100) { #ifdef RT28xx RT28xx_ch_tunning(pAd, BW_40); #endif /* RT28xx */ } else { RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x12); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, 0x0A); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x10); } DBGPRINT(RT_DEBUG_TRACE, ("%s(): BW_%s, ChannelWidth=%d, Channel=%d, ExtChanOffset=%d(%d) \n", __FUNCTION__, (rf_bw == BW_40 ? "40" : "20"), pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth, pAd->CommonCfg.Channel, pAd->CommonCfg.RegTransmitSetting.field.EXTCHA, pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset)); /* request by Gary 20070208 for middle and long range A Band*/ if (pAd->CommonCfg.Channel > 14) bbp_val = 0x1D; else bbp_val = 0x2D; RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R62, 0x2D); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R63, 0x2D); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R64, 0x2D); /*RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R86, 0x2D);*/ }
INT dev_adjust_radio(RTMP_ADAPTER *pAd) { struct hw_setting *hw_cfg = &pAd->hw_cfg, new_cfg; NdisZeroMemory(&new_cfg, sizeof(struct hw_setting)); /* For all wdev, find the maximum inter-set */ if (hw_cfg->bbp_bw != new_cfg.bbp_bw) { rtmp_bbp_set_bw(pAd, new_cfg.bbp_bw); hw_cfg->bbp_bw = new_cfg.bbp_bw; } if (hw_cfg->cent_ch != new_cfg.cent_ch) { UCHAR ext_ch = EXTCHA_NONE; rtmp_bbp_set_ctrlch(pAd, ext_ch); rtmp_mac_set_ctrlch(pAd, ext_ch); } return TRUE; }
static VOID mt76x0_ate_bbp_adjust( IN PRTMP_ADAPTER pAd) { PATE_INFO pATEInfo = &(pAd->ate); UCHAR rf_bw, ext_ch = EXTCHA_NONE; rf_bw = pATEInfo->TxWI.TXWI_N.BW; rtmp_bbp_set_bw(pAd, rf_bw); /* Tx/Rx : control channel setting */ rtmp_mac_set_ctrlch(pAd, ext_ch); ate_bbp_set_ctrlch(pAd, ext_ch); }
/*======================================================================== Routine Description: AsicSetChannel -- switch channel , bandwidth and 40MHz above/below setting Arguments: ch : Channel number, if 'bw' is BW_40, 'ch' is Center channel [1~14] bw : Bandwidth [BW_20, BW40] ext_ch: 11n bandwidth setting [EXTCHA_NONE, EXTCHA_ABOVE, EXTCHA_BELOW] if 'bw'=BW_20, 'ext_ch' should be EXTCHA_NONE or EXTCHA_ABOVE, these two options have the same effect for BW_20. if 'bw'=BW_20, 'ext_ch' should not be EXTCHA_BELOW Return Value: 0 is success Note: ========================================================================*/ INT AsicSetChannel(UCHAR ch, UCHAR bw, UCHAR ext_ch) { BOOLEAN bScan = FALSE; rtmp_bbp_set_bw(bw); /* Tx/RX : control channel setting */ /*set band as 40MHz above or Below*/ rtmp_bbp_set_ctrlch(ext_ch); rtmp_mac_set_ctrlch(ext_ch); /* Let BBP register at 20MHz to do scan */ AsicSwitchChannel(ch, bScan); return 0; }
/*======================================================================== Routine Description: iot_exec_atcmd_ch_switch -- switch channel and Bandwidth -b: [0/1] 0=BW_20, 1=BW_40 -c: [1~14] Arguments: Return Value: 0 is success Note: In present , the channel range is channel 1~14, and Bandwidth is only support 20MHz ========================================================================*/ int16 iot_exec_atcmd_ch_switch(puchar pCmdBuf, int16 AtCmdLen) { char *argv[MAX_OPTION_COUNT]; char *opString = "b:c:?"; char *endptr = NULL; int16 argc = 0; char opt = 0; uint8 bbp = BW_20; uint8 ch = 0; split_string_cmd(pCmdBuf, AtCmdLen, &argc, argv); opt = getopt(argc, argv, opString); while (opt != -1) { switch (opt) { case 'b': /*power saving level*/ bbp = (uint8)simple_strtol(optarg,&endptr,0); if ((bbp==BW_20) || (bbp==BW_40)) { printf_high("[Set BBP]=%d\n",bbp); rtmp_bbp_set_bw(bbp); } break; case 'c': /*power sleep time*/ ch = (uint8)simple_strtol(optarg,&endptr,0); if ((ch >0) && (ch <= 14)) { printf_high("[Set CH]=%d\n",ch); iot_atcmd_set_channel(ch); } break; case '?': default: break; } opt = getopt(argc, argv, opString); } return 0; }
static VOID P2PDiscCanlAction( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem) { P2P_DISC_STATE *pCurrState = &(pAd->P2pCfg.DiscCurrentState); PRT_P2P_CONFIG pP2PCtrl = &pAd->P2pCfg; UCHAR channel = pP2PCtrl->ListenChannel; UCHAR p2pindex; BOOLEAN bGoBack = TRUE; /* Go back to working channel */ if (INFRA_ON(pAd) || (pAd->flg_p2p_OpStatusFlags != P2P_DISABLE)) { if ((pAd->CommonCfg.Channel != pAd->CommonCfg.CentralChannel) && (pAd->CommonCfg.BBPCurrentBW == BW_40)) channel = pAd->CommonCfg.CentralChannel; else channel = pAd->CommonCfg.Channel; } p2pindex = P2pGroupTabSearch(pAd, pAd->P2pCfg.ConnectingMAC); if (p2pindex != P2P_NOT_FOUND) { if (pAd->P2pTable.Client[p2pindex].P2pClientState > P2PSTATE_DISCOVERY_UNKNOWN) bGoBack = FALSE; } if (bGoBack && (channel != pAd->LatchRfRegs.Channel)) { if (pAd->CommonCfg.BBPCurrentBW == BW_40) rtmp_bbp_set_bw(pAd, BW_40); AsicSwitchChannel(pAd, channel, FALSE); AsicLockChannel(pAd, channel); DBGPRINT(RT_DEBUG_TRACE, ("P2PDiscCanlAction - Restore to channel %d\n",channel)); } *pCurrState = P2P_DISC_IDLE; }
static VOID EnableAPMIMOPSv1( IN RTMP_ADAPTER *pAd, IN BOOLEAN ReduceCorePower) { UCHAR BBPR3 = 0,BBPR1 = 0; ULONG TxPinCfg = 0x00050F0A;/*Gary 2007/08/09 0x050A0A*/ UCHAR BBPR4=0; UCHAR CentralChannel; if(pAd->CommonCfg.Channel>14) TxPinCfg=0x00050F05; TxPinCfg &= 0xFFFFFFF3; TxPinCfg &= 0xFFFFF3FF; pAd->ApCfg.bGreenAPActive=TRUE; CentralChannel = pAd->CommonCfg.CentralChannel; DBGPRINT(RT_DEBUG_INFO, ("Run with BW_20\n")); pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel; CentralChannel = pAd->CommonCfg.Channel; /* Set BBP registers to BW20 */ rtmp_bbp_set_bw(pAd, BW_20); /* RF Bandwidth related registers would be set in AsicSwitchChannel() */ if (pAd->Antenna.field.RxPath>1||pAd->Antenna.field.TxPath>1) { /*Tx/Rx Stream*/ rtmp_bbp_set_txdac(pAd, 0); rtmp_bbp_set_rxpath(pAd, 1); RTMP_IO_WRITE32(pAd, TX_PIN_CFG, TxPinCfg); } AsicSwitchChannel(pAd, CentralChannel, FALSE); DBGPRINT(RT_DEBUG_INFO, ("EnableAPMIMOPS, 305x/28xx changes the # of antenna to 1\n")); }
static INT scan_ch_restore(RTMP_ADAPTER *pAd, UCHAR OpMode) { #ifdef CONFIG_STA_SUPPORT USHORT Status; #endif /* CONFIG_STA_SUPPORT */ INT bw, ch; if (pAd->CommonCfg.BBPCurrentBW != pAd->hw_cfg.bbp_bw) { rtmp_bbp_set_bw(pAd, pAd->hw_cfg.bbp_bw); AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); ch = pAd->CommonCfg.CentralChannel; } else { AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); AsicLockChannel(pAd, pAd->CommonCfg.Channel); ch = pAd->CommonCfg.Channel; } switch(pAd->CommonCfg.BBPCurrentBW) { case BW_80: bw = 80; break; case BW_40: bw = 40; break; case BW_10: bw = 10; break; case BW_20: default: bw =20; break; } DBGPRINT(RT_DEBUG_TRACE, ("SYNC - End of SCAN, restore to %dMHz channel %d, Total BSS[%02d]\n", bw, ch, pAd->ScanTab.BssNr)); #ifdef CONFIG_STA_SUPPORT if (OpMode == OPMODE_STA) { /* If all peer Ad-hoc clients leave, driver would do LinkDown and LinkUp. In LinkUp, CommonCfg.Ssid would copy SSID from MlmeAux. To prevent SSID is zero or wrong in Beacon, need to recover MlmeAux.SSID here. */ if (ADHOC_ON(pAd)) { NdisZeroMemory(pAd->MlmeAux.Ssid, MAX_LEN_OF_SSID); pAd->MlmeAux.SsidLen = pAd->CommonCfg.SsidLen; NdisMoveMemory(pAd->MlmeAux.Ssid, pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen); } /* To prevent data lost. Send an NULL data with turned PSM bit on to current associated AP before SCAN progress. Now, we need to send an NULL data with turned PSM bit off to AP, when scan progress done */ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) && (INFRA_ON(pAd))) { RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) ? TRUE:FALSE), pAd->CommonCfg.bAPSDForcePowerSave ? PWR_SAVE : pAd->StaCfg.Psm); DBGPRINT(RT_DEBUG_TRACE, ("%s -- Send null frame\n", __FUNCTION__)); } #ifdef RT_CFG80211_SUPPORT if (pAd->ApCfg.ApCliTab[MAIN_MBSSID].Valid && RTMP_CFG80211_VIF_P2P_CLI_ON(pAd)) { DBGPRINT(RT_DEBUG_TRACE, ("CFG80211_NULL: PWR_ACTIVE SCAN_END\n")); RT_CFG80211_P2P_CLI_SEND_NULL_FRAME(pAd, PWR_ACTIVE); } #endif /* RT_CFG80211_SUPPORT */ /* keep the latest scan channel, could be 0 for scan complete, or other channel*/ pAd->StaCfg.LastScanChannel = pAd->MlmeAux.Channel; pAd->StaCfg.ScanChannelCnt = 0; /* Suspend scanning and Resume TxData for Fast Scanning*/ if ((pAd->MlmeAux.Channel != 0) && (pAd->StaCfg.bImprovedScan)) /* it is scan pending*/ { pAd->Mlme.SyncMachine.CurrState = SCAN_PENDING; Status = MLME_SUCCESS; DBGPRINT(RT_DEBUG_WARN, ("bFastRoamingScan ~~~ Get back to send data ~~~\n")); RTMPResumeMsduTransmission(pAd); } else { pAd->StaCfg.BssNr = pAd->ScanTab.BssNr; pAd->StaCfg.bImprovedScan = FALSE; pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; Status = MLME_SUCCESS; MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_SCAN_CONF, 2, &Status, 0); RTMP_MLME_HANDLER(pAd); } } #endif /* CONFIG_STA_SUPPORT */ #ifdef CONFIG_AP_SUPPORT if (OpMode == OPMODE_AP) { #ifdef P2P_APCLI_SUPPORT /* P2P CLIENT in WSC Scan or Re-Connect scanning. */ if (P2P_CLI_ON(pAd) && (ApScanRunning(pAd) == TRUE)) { /*MlmeEnqueue(pAd, APCLI_CTRL_STATE_MACHINE, APCLI_CTRL_JOIN_REQ_TIMEOUT, 0, NULL, 0);*/ DBGPRINT(RT_DEBUG_INFO, ("%s:: Scan Done! reset APCLI CTRL State Machine!\n", __FUNCTION__)); pAd->ApCfg.ApCliTab[0].CtrlCurrState = APCLI_CTRL_DISCONNECTED; } #endif /* P2P_APCLI_SUPPORT */ pAd->Mlme.ApSyncMachine.CurrState = AP_SYNC_IDLE; RTMPResumeMsduTransmission(pAd); /* iwpriv set auto channel selection*/ /* scanned all channels*/ if (pAd->ApCfg.bAutoChannelAtBootup==TRUE) { pAd->CommonCfg.Channel = SelectBestChannel(pAd, pAd->ApCfg.AutoChannelAlg); pAd->ApCfg.bAutoChannelAtBootup = FALSE; #ifdef DOT11_N_SUPPORT N_ChannelCheck(pAd); #endif /* DOT11_N_SUPPORT */ APStop(pAd); APStartUp(pAd); } if (!((pAd->CommonCfg.Channel > 14) && (pAd->CommonCfg.bIEEE80211H == TRUE))) AsicEnableBssSync(pAd); } #endif /* CONFIG_AP_SUPPORT */ return TRUE; }
/* ======================================================================== Routine Description: Caller ensures we has 802.11n support. Calls at setting HT from AP/STASetinformation Arguments: pAd - Pointer to our adapter phymode - ======================================================================== */ VOID RTMPSetHT( IN RTMP_ADAPTER *pAd, IN OID_SET_HT_PHYMODE *pHTPhyMode) { UCHAR RxStream = pAd->CommonCfg.RxStream; #ifdef CONFIG_AP_SUPPORT int apidx; #endif /* CONFIG_AP_SUPPORT */ int bw; RT_HT_CAPABILITY *rt_ht_cap = &pAd->CommonCfg.DesiredHtPhy; HT_CAPABILITY_IE *ht_cap= &pAd->CommonCfg.HtCapability; #ifdef CONFIG_AP_SUPPORT /* sanity check for extention channel */ if (CHAN_PropertyCheck(pAd, pAd->CommonCfg.Channel, CHANNEL_NO_FAT_BELOW | CHANNEL_NO_FAT_ABOVE) == TRUE) { /* only 20MHz is allowed */ pHTPhyMode->BW = 0; } else if (pHTPhyMode->ExtOffset == EXTCHA_BELOW) { /* extension channel below this channel is not allowed */ if (CHAN_PropertyCheck(pAd, pAd->CommonCfg.Channel, CHANNEL_NO_FAT_BELOW) == TRUE) { pHTPhyMode->ExtOffset = EXTCHA_ABOVE; } } else if (pHTPhyMode->ExtOffset == EXTCHA_ABOVE) { /* extension channel above this channel is not allowed */ if (CHAN_PropertyCheck(pAd, pAd->CommonCfg.Channel, CHANNEL_NO_FAT_ABOVE) == TRUE) { pHTPhyMode->ExtOffset = EXTCHA_BELOW; } } #endif /* CONFIG_AP_SUPPORT */ DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : HT_mode(%d), ExtOffset(%d), MCS(%d), BW(%d), STBC(%d), SHORTGI(%d)\n", pHTPhyMode->HtMode, pHTPhyMode->ExtOffset, pHTPhyMode->MCS, pHTPhyMode->BW, pHTPhyMode->STBC, pHTPhyMode->SHORTGI)); /* Don't zero supportedHyPhy structure.*/ RTMPZeroMemory(ht_cap, sizeof(HT_CAPABILITY_IE)); RTMPZeroMemory(&pAd->CommonCfg.AddHTInfo, sizeof(pAd->CommonCfg.AddHTInfo)); RTMPZeroMemory(&pAd->CommonCfg.NewExtChanOffset, sizeof(pAd->CommonCfg.NewExtChanOffset)); RTMPZeroMemory(rt_ht_cap, sizeof(RT_HT_CAPABILITY)); if (pAd->CommonCfg.bRdg) { ht_cap->ExtHtCapInfo.PlusHTC = 1; ht_cap->ExtHtCapInfo.RDGSupport = 1; } else { ht_cap->ExtHtCapInfo.PlusHTC = 0; ht_cap->ExtHtCapInfo.RDGSupport = 0; } if (RxStream == 1) { ht_cap->HtCapParm.MaxRAmpduFactor = 2; rt_ht_cap->MaxRAmpduFactor = 2; } else { ht_cap->HtCapParm.MaxRAmpduFactor = 3; rt_ht_cap->MaxRAmpduFactor = 3; } DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : RxBAWinLimit = %d\n", pAd->CommonCfg.BACapability.field.RxBAWinLimit)); /* Mimo power save, A-MSDU size, */ rt_ht_cap->AmsduEnable = (USHORT)pAd->CommonCfg.BACapability.field.AmsduEnable; rt_ht_cap->AmsduSize = (UCHAR)pAd->CommonCfg.BACapability.field.AmsduSize; rt_ht_cap->MimoPs = (UCHAR)pAd->CommonCfg.BACapability.field.MMPSmode; rt_ht_cap->MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity; ht_cap->HtCapInfo.AMsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize; ht_cap->HtCapInfo.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode; ht_cap->HtCapParm.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity; DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : AMsduSize = %d, MimoPs = %d, MpduDensity = %d, MaxRAmpduFactor = %d\n", rt_ht_cap->AmsduSize, rt_ht_cap->MimoPs, rt_ht_cap->MpduDensity, rt_ht_cap->MaxRAmpduFactor)); if(pHTPhyMode->HtMode == HTMODE_GF) { ht_cap->HtCapInfo.GF = 1; rt_ht_cap->GF = 1; } else rt_ht_cap->GF = 0; /* Decide Rx MCSSet*/ switch (RxStream) { case 3: ht_cap->MCSSet[2] = 0xff; case 2: ht_cap->MCSSet[1] = 0xff; case 1: default: ht_cap->MCSSet[0] = 0xff; break; } if (pAd->CommonCfg.bForty_Mhz_Intolerant && (pHTPhyMode->BW == BW_40)) { pHTPhyMode->BW = BW_20; ht_cap->HtCapInfo.Forty_Mhz_Intolerant = 1; } // TODO: shiang-6590, how about the "bw" when channel 14 for JP region??? bw = BW_20; if(pHTPhyMode->BW == BW_40) { ht_cap->MCSSet[4] = 0x1; /* MCS 32*/ ht_cap->HtCapInfo.ChannelWidth = 1; if (pAd->CommonCfg.Channel <= 14) ht_cap->HtCapInfo.CCKmodein40 = 1; rt_ht_cap->ChannelWidth = 1; pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 1; pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = (pHTPhyMode->ExtOffset == EXTCHA_BELOW)? (EXTCHA_BELOW): EXTCHA_ABOVE; /* Set Regsiter for extension channel position.*/ rtmp_mac_set_ctrlch(pAd, pHTPhyMode->ExtOffset); /* Turn on BBP 40MHz mode now only as AP . */ /* Sta can turn on BBP 40MHz after connection with 40MHz AP. Sta only broadcast 40MHz capability before connection.*/ if ((pAd->OpMode == OPMODE_AP) || INFRA_ON(pAd) || ADHOC_ON(pAd) ) { rtmp_bbp_set_ctrlch(pAd, pHTPhyMode->ExtOffset); #ifdef GREENAP_SUPPORT if (pAd->ApCfg.bGreenAPActive == 1) bw = BW_20; else #endif /* GREENAP_SUPPORT */ bw = BW_40; } } else { ht_cap->HtCapInfo.ChannelWidth = 0; rt_ht_cap->ChannelWidth = 0; pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 0; pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = EXTCHA_NONE; pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel; /* Turn on BBP 20MHz mode by request here.*/ bw = BW_20; } #ifdef DOT11_VHT_AC if (pHTPhyMode->BW == BW_40 && pAd->CommonCfg.vht_bw == VHT_BW_80 && pAd->CommonCfg.vht_cent_ch) bw = BW_80; #endif /* DOT11_VHT_AC */ rtmp_bbp_set_bw(pAd, bw); if(pHTPhyMode->STBC == STBC_USE) { if (pAd->Antenna.field.TxPath >= 2) { ht_cap->HtCapInfo.TxSTBC = 1; rt_ht_cap->TxSTBC = 1; } else { ht_cap->HtCapInfo.TxSTBC = 0; rt_ht_cap->TxSTBC = 0; } /* RxSTBC 0: not support, 1: support for 1SS 2: support for 1SS, 2SS 3: support for 1SS, 2SS, 3SS */ if (pAd->Antenna.field.RxPath >= 1) { ht_cap->HtCapInfo.RxSTBC = 1; rt_ht_cap->RxSTBC = 1; } else { ht_cap->HtCapInfo.RxSTBC = 0; rt_ht_cap->RxSTBC = 0; } } else { rt_ht_cap->TxSTBC = 0; rt_ht_cap->RxSTBC = 0; } if(pHTPhyMode->SHORTGI == GI_400) { ht_cap->HtCapInfo.ShortGIfor20 = 1; ht_cap->HtCapInfo.ShortGIfor40 = 1; rt_ht_cap->ShortGIfor20 = 1; rt_ht_cap->ShortGIfor40 = 1; } else { ht_cap->HtCapInfo.ShortGIfor20 = 0; ht_cap->HtCapInfo.ShortGIfor40 = 0; rt_ht_cap->ShortGIfor20 = 0; rt_ht_cap->ShortGIfor40 = 0; } /* We support link adaptation for unsolicit MCS feedback, set to 2.*/ pAd->CommonCfg.AddHTInfo.ControlChan = pAd->CommonCfg.Channel; /* 1, the extension channel above the control channel. */ /* EDCA parameters used for AP's own transmission*/ if (pAd->CommonCfg.APEdcaParm.bValid == FALSE) { pAd->CommonCfg.APEdcaParm.bValid = TRUE; pAd->CommonCfg.APEdcaParm.Aifsn[0] = 3; pAd->CommonCfg.APEdcaParm.Aifsn[1] = 7; pAd->CommonCfg.APEdcaParm.Aifsn[2] = 1; pAd->CommonCfg.APEdcaParm.Aifsn[3] = 1; pAd->CommonCfg.APEdcaParm.Cwmin[0] = 4; pAd->CommonCfg.APEdcaParm.Cwmin[1] = 4; pAd->CommonCfg.APEdcaParm.Cwmin[2] = 3; pAd->CommonCfg.APEdcaParm.Cwmin[3] = 2; pAd->CommonCfg.APEdcaParm.Cwmax[0] = 6; pAd->CommonCfg.APEdcaParm.Cwmax[1] = 10; pAd->CommonCfg.APEdcaParm.Cwmax[2] = 4; pAd->CommonCfg.APEdcaParm.Cwmax[3] = 3; pAd->CommonCfg.APEdcaParm.Txop[0] = 0; pAd->CommonCfg.APEdcaParm.Txop[1] = 0; pAd->CommonCfg.APEdcaParm.Txop[2] = 94; pAd->CommonCfg.APEdcaParm.Txop[3] = 47; } AsicSetEdcaParm(pAd, &pAd->CommonCfg.APEdcaParm); #ifdef TXBF_SUPPORT if (pAd->chipCap.FlgHwTxBfCap) { /* Set ETxBF */ setETxBFCap(pAd, &ht_cap->TxBFCap); /* Check ITxBF */ pAd->CommonCfg.RegTransmitSetting.field.ITxBfEn &= rtmp_chk_itxbf_calibration(pAd); /* Apply to ASIC */ rtmp_asic_set_bf(pAd); } #endif /* TXBF_SUPPORT */ #ifdef CONFIG_AP_SUPPORT IF_DEV_CONFIG_OPMODE_ON_AP(pAd) { for (apidx = 0; apidx < pAd->ApCfg.BssidNum; apidx++) RTMPSetIndividualHT(pAd, apidx); #ifdef WDS_SUPPORT for (apidx = 0; apidx < MAX_WDS_ENTRY; apidx++) RTMPSetIndividualHT(pAd, apidx + MIN_NET_DEVICE_FOR_WDS); #endif /* WDS_SUPPORT */ #ifdef APCLI_SUPPORT for (apidx = 0; apidx < MAX_APCLI_NUM; apidx++) RTMPSetIndividualHT(pAd, apidx + MIN_NET_DEVICE_FOR_APCLI); #endif /* APCLI_SUPPORT */ } #endif /* CONFIG_AP_SUPPORT */ }
INT scan_ch_restore(RTMP_ADAPTER *pAd, UCHAR OpMode) { INT bw, ch; if (pAd->CommonCfg.BBPCurrentBW != pAd->hw_cfg.bbp_bw) rtmp_bbp_set_bw(pAd, pAd->hw_cfg.bbp_bw); if (pAd->hw_cfg.bbp_bw == BW_80) ch = pAd->CommonCfg.vht_cent_ch; else if (pAd->hw_cfg.bbp_bw == BW_40) ch = pAd->CommonCfg.CentralChannel; else ch = pAd->CommonCfg.Channel; ASSERT((ch != 0)); AsicSwitchChannel(pAd, ch, FALSE); AsicLockChannel(pAd, ch); switch(pAd->CommonCfg.BBPCurrentBW) { case BW_80: bw = 80; break; case BW_40: bw = 40; break; case BW_10: bw = 10; break; case BW_20: default: bw =20; break; } DBGPRINT(RT_DEBUG_TRACE, ("SYNC - End of SCAN, restore to %dMHz channel %d, Total BSS[%02d]\n", bw, ch, pAd->ScanTab.BssNr)); #ifdef CONFIG_AP_SUPPORT if (OpMode == OPMODE_AP) { #ifdef APCLI_SUPPORT #ifdef APCLI_AUTO_CONNECT_SUPPORT if (pAd->ApCfg.ApCliAutoConnectRunning == TRUE) { if (!ApCliAutoConnectExec(pAd)) { DBGPRINT(RT_DEBUG_ERROR, ("Error in %s\n", __FUNCTION__)); } } #endif /* APCLI_AUTO_CONNECT_SUPPORT */ #endif /* APCLI_SUPPORT */ pAd->Mlme.ApSyncMachine.CurrState = AP_SYNC_IDLE; RTMPResumeMsduTransmission(pAd); /* keep the latest scan channel, could be 0 for scan complete, or other channel */ pAd->ApCfg.LastScanChannel = pAd->MlmeAux.Channel; pAd->ApCfg.ScanChannelCnt=0; /* Suspend scanning and Resume TxData for Fast Scanning */ if ((pAd->MlmeAux.Channel != 0) && (pAd->ApCfg.bImprovedScan)) { pAd->Mlme.ApSyncMachine.CurrState = AP_SCAN_PENDING; DBGPRINT(RT_DEBUG_TRACE, ("bImprovedScan ~~ Get back to send data\n")); } else pAd->ApCfg.bImprovedScan = FALSE; #ifdef CON_WPS if (pAd->conWscStatus != CON_WPS_STATUS_DISABLED) { MlmeEnqueue(pAd, AP_SYNC_STATE_MACHINE, APMT2_MLME_SCAN_COMPLETE, 0, NULL,0 ); RTMP_MLME_HANDLER(pAd); } #endif /* CON_WPS*/ /* iwpriv set auto channel selection*/ /* scanned all channels*/ if (pAd->ApCfg.bAutoChannelAtBootup==TRUE) { pAd->CommonCfg.Channel = SelectBestChannel(pAd, pAd->ApCfg.AutoChannelAlg); pAd->ApCfg.bAutoChannelAtBootup = FALSE; #ifdef DOT11_N_SUPPORT N_ChannelCheck(pAd); #endif /* DOT11_N_SUPPORT */ APStop(pAd); APStartUp(pAd); } if ((pAd->CommonCfg.Channel > 14) && (pAd->CommonCfg.bIEEE80211H == TRUE) && RadarChannelCheck(pAd, pAd->CommonCfg.Channel) && pAd->Dot11_H.RDMode != RD_SWITCHING_MODE) { if (pAd->Dot11_H.InServiceMonitorCount) { pAd->Dot11_H.RDMode = RD_NORMAL_MODE; AsicEnableBssSync(pAd); } else { pAd->Dot11_H.RDMode = RD_SILENCE_MODE; } } else { AsicEnableBssSync(pAd); } } #endif /* CONFIG_AP_SUPPORT */ return TRUE; }
static INT scan_ch_restore(RTMP_ADAPTER *pAd, UCHAR OpMode) { INT bw, ch; if (pAd->CommonCfg.BBPCurrentBW != pAd->hw_cfg.bbp_bw) { rtmp_bbp_set_bw(pAd, pAd->hw_cfg.bbp_bw); AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); ch = pAd->CommonCfg.CentralChannel; } else { AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); AsicLockChannel(pAd, pAd->CommonCfg.Channel); ch = pAd->CommonCfg.Channel; } switch(pAd->CommonCfg.BBPCurrentBW) { case BW_80: bw = 80; break; case BW_40: bw = 40; break; case BW_10: bw = 10; break; case BW_20: default: bw =20; break; } DBGPRINT(RT_DEBUG_TRACE, ("SYNC - End of SCAN, restore to %dMHz channel %d, Total BSS[%02d]\n", bw, ch, pAd->ScanTab.BssNr)); #ifdef CONFIG_AP_SUPPORT if (OpMode == OPMODE_AP) { pAd->Mlme.ApSyncMachine.CurrState = AP_SYNC_IDLE; RTMPResumeMsduTransmission(pAd); /* iwpriv set auto channel selection*/ /* scanned all channels*/ if (pAd->ApCfg.bAutoChannelAtBootup==TRUE) { pAd->CommonCfg.Channel = SelectBestChannel(pAd, pAd->ApCfg.AutoChannelAlg); pAd->ApCfg.bAutoChannelAtBootup = FALSE; #ifdef DOT11_N_SUPPORT N_ChannelCheck(pAd); #endif /* DOT11_N_SUPPORT */ APStop(pAd); APStartUp(pAd); } if (!((pAd->CommonCfg.Channel > 14) && (pAd->CommonCfg.bIEEE80211H == TRUE))) AsicEnableBssSync(pAd); } #endif /* CONFIG_AP_SUPPORT */ return TRUE; }
INT Set_P2P_Cancel_Proc( IN PRTMP_ADAPTER pAd, IN PSTRING arg) { POS_COOKIE pObj; PRT_P2P_CONFIG pP2PCtrl = &pAd->P2pCfg; PWSC_CTRL pWscControl = NULL; INT val = (INT)simple_strtol(arg, 0, 10); pObj = (POS_COOKIE) pAd->OS_Cookie; if (pObj->ioctl_if_type != INT_P2P) return FALSE; if (val == 1) { pP2PCtrl->P2PConnectState = P2P_CONNECT_IDLE; if (!MAC_ADDR_EQUAL(&ZERO_MAC_ADDR[0], &pP2PCtrl->ConnectingMAC[0])) { UCHAR p2pindex; p2pindex = P2pGroupTabSearch(pAd, pP2PCtrl->ConnectingMAC); if (p2pindex < MAX_P2P_GROUP_SIZE) { if (pAd->P2pTable.Client[p2pindex].Rule == P2P_IS_GO) pAd->P2pTable.Client[p2pindex].P2pClientState = P2PSTATE_DISCOVERY_GO; else pAd->P2pTable.Client[p2pindex].P2pClientState = P2PSTATE_DISCOVERY; pAd->P2pTable.Client[p2pindex].StateCount = 0; } NdisZeroMemory(pP2PCtrl->ConnectingMAC, MAC_ADDR_LEN); } if (P2P_GO_ON(pAd)) { UINT32 i, p2pEntryCnt=0; MAC_TABLE_ENTRY *pEntry; INT IsAPConfigured; pWscControl = &pAd->ApCfg.MBSSID[MAIN_MBSSID].WscControl; IsAPConfigured = pWscControl->WscConfStatus; if (pWscControl->bWscTrigger) { WscStop(pAd, FALSE, pWscControl); pWscControl->WscPinCode = 0; WscBuildBeaconIE(pAd, IsAPConfigured, FALSE, 0, 0, MAIN_MBSSID, NULL, 0, AP_MODE); WscBuildProbeRespIE(pAd, WSC_MSGTYPE_AP_WLAN_MGR, IsAPConfigured, FALSE, 0, 0, (MAIN_MBSSID | MIN_NET_DEVICE_FOR_P2P_GO), NULL, 0, AP_MODE); APUpdateBeaconFrame(pAd, pObj->ioctl_if); } for (i=0; i<MAX_LEN_OF_MAC_TABLE; i++) { pEntry = &pAd->MacTab.Content[i]; if (IS_P2P_GO_ENTRY(pEntry) && (pEntry->WpaState == AS_PTKINITDONE)) p2pEntryCnt++; } DBGPRINT(RT_DEBUG_ERROR, ("%s:: Total= %d. p2pEntry = %d.\n", __FUNCTION__, pAd->MacTab.Size, p2pEntryCnt)); if ((p2pEntryCnt == 0) && (pAd->flg_p2p_OpStatusFlags == P2P_GO_UP)) { #ifdef RTMP_MAC_USB RTEnqueueInternalCmd(pAd, CMDTHREAD_SET_P2P_LINK_DOWN, NULL, 0); #endif /* RTMP_MAC_USB */ } } else if (P2P_CLI_ON(pAd)) { pWscControl = &pAd->ApCfg.MBSSID[MAIN_MBSSID].WscControl; pWscControl->WscPinCode = 0; if (pWscControl->bWscTrigger) WscStop(pAd, TRUE, pWscControl); P2pLinkDown(pAd, P2P_DISCONNECTED); } P2pStopScan(pAd); pP2PCtrl->bPeriodicListen = TRUE; /* Reset bConfirmByUI to its default value */ pP2PCtrl->bConfirmByUI = CONFIRM_BY_UI_DEFAULT; if (INFRA_ON(pAd) || P2P_GO_ON(pAd) || P2P_CLI_ON(pAd)) { INT ch; // TODO: shiang-6590, why we set bw as 40 when BBPCurrentBW == BW_40?? if (pAd->CommonCfg.BBPCurrentBW == BW_40) { rtmp_bbp_set_bw(pAd, BW_40); ch = pAd->CommonCfg.CentralChannel; } else { ch = pAd->CommonCfg.Channel; } AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); } } DBGPRINT(RT_DEBUG_TRACE, ("%s:: Cancel P2P action\n", __FUNCTION__)); return TRUE; }