/* ======================================================================== 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 struct rtmp_adapter *pAd, IN OID_SET_HT_PHYMODE *pHTPhyMode) { u8 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 = (unsigned short)pAd->CommonCfg.BACapability.field.AmsduEnable; rt_ht_cap->AmsduSize = (u8)pAd->CommonCfg.BACapability.field.AmsduSize; rt_ht_cap->MimoPs = (u8)pAd->CommonCfg.BACapability.field.MMPSmode; rt_ht_cap->MpduDensity = (u8)pAd->CommonCfg.BACapability.field.MpduDensity; ht_cap->HtCapInfo.AMsduSize = (unsigned short)pAd->CommonCfg.BACapability.field.AmsduSize; ht_cap->HtCapInfo.MimoPs = (unsigned short)pAd->CommonCfg.BACapability.field.MMPSmode; if (pAd->CommonCfg.ht_ldpc && (pAd->chipCap.phy_caps & fPHY_CAP_LDPC)) ht_cap->HtCapInfo.ht_rx_ldpc = 1; else ht_cap->HtCapInfo.ht_rx_ldpc = 0; ht_cap->HtCapParm.MpduDensity = (u8)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??? //CFG_TODO 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.*/ mt7612u_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) ) { mt7612u_bbp_set_ctrlch(pAd, pHTPhyMode->ExtOffset); 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; } if (pHTPhyMode->BW == BW_40 && pAd->CommonCfg.vht_bw == VHT_BW_80 && pAd->CommonCfg.vht_cent_ch) bw = BW_80; mt7612u_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) set_default_ap_edca_param(pAd); AsicSetEdcaParm(pAd, &pAd->CommonCfg.APEdcaParm); 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); } #ifdef CONFIG_AP_SUPPORT IF_DEV_CONFIG_OPMODE_ON_AP(pAd) { for (apidx = 0; apidx < pAd->ApCfg.BssidNum; apidx++) RTMPSetIndividualHT(pAd, apidx); } #endif /* CONFIG_AP_SUPPORT */ #ifdef CONFIG_STA_SUPPORT IF_DEV_CONFIG_OPMODE_ON_STA(pAd) { RTMPSetIndividualHT(pAd, 0); } #endif /* CONFIG_STA_SUPPORT */ }
/* ========================================================================== Description: Scan next channel ========================================================================== */ VOID ScanNextChannel( IN PRTMP_ADAPTER pAd, IN UCHAR OpMode) { UCHAR ScanType = pAd->MlmeAux.ScanType; UINT ScanTimeIn5gChannel = SHORT_CHANNEL_TIME; BOOLEAN ScanPending = FALSE; RALINK_TIMER_STRUCT *sc_timer; UINT stay_time = 0; #ifdef RALINK_ATE /* Nothing to do in ATE mode. */ if (ATE_ON(pAd)) return; #endif /* RALINK_ATE */ if ((pAd->MlmeAux.Channel == 0) || ScanPending) { scan_ch_restore(pAd, OpMode); } #ifdef RTMP_MAC_USB #endif /* RTMP_MAC_USB */ else { AsicSwitchChannel(pAd, pAd->MlmeAux.Channel, TRUE); AsicLockChannel(pAd, pAd->MlmeAux.Channel); /* Check if channel if passive scan under current regulatory domain */ if (CHAN_PropertyCheck(pAd, pAd->MlmeAux.Channel, CHANNEL_PASSIVE_SCAN) == TRUE) ScanType = SCAN_PASSIVE; if (OpMode == OPMODE_AP) sc_timer = &pAd->MlmeAux.APScanTimer; else sc_timer = &pAd->MlmeAux.ScanTimer; /* We need to shorten active scan time in order for WZC connect issue */ /* Chnage the channel scan time for CISCO stuff based on its IAPP announcement */ if (ScanType == FAST_SCAN_ACTIVE) stay_time = FAST_ACTIVE_SCAN_TIME; else /* must be SCAN_PASSIVE or SCAN_ACTIVE*/ { #ifdef CONFIG_AP_SUPPORT if ((OpMode == OPMODE_AP) && (pAd->ApCfg.bAutoChannelAtBootup)) stay_time = AUTO_CHANNEL_SEL_TIMEOUT; else #endif /* CONFIG_AP_SUPPORT */ if (WMODE_CAP_2G(pAd->CommonCfg.PhyMode) && WMODE_CAP_5G(pAd->CommonCfg.PhyMode)) { if (pAd->MlmeAux.Channel > 14) stay_time = ScanTimeIn5gChannel; else stay_time = MIN_CHANNEL_TIME; } else stay_time = MAX_CHANNEL_TIME; } RTMPSetTimer(sc_timer, stay_time); if (SCAN_MODE_ACT(ScanType)) { if (scan_active(pAd, OpMode, ScanType) == FALSE) return; } /* For SCAN_CISCO_PASSIVE, do nothing and silently wait for beacon or other probe reponse*/ #ifdef CONFIG_AP_SUPPORT if (OpMode == OPMODE_AP) pAd->Mlme.ApSyncMachine.CurrState = AP_SCAN_LISTEN; #endif /* CONFIG_AP_SUPPORT */ } }