summaryrefslogtreecommitdiff
path: root/cleopatre/devkit/rt5572drv/MODULE/os/linux/cfg80211drv.c
diff options
context:
space:
mode:
Diffstat (limited to 'cleopatre/devkit/rt5572drv/MODULE/os/linux/cfg80211drv.c')
-rw-r--r--cleopatre/devkit/rt5572drv/MODULE/os/linux/cfg80211drv.c870
1 files changed, 870 insertions, 0 deletions
diff --git a/cleopatre/devkit/rt5572drv/MODULE/os/linux/cfg80211drv.c b/cleopatre/devkit/rt5572drv/MODULE/os/linux/cfg80211drv.c
new file mode 100644
index 0000000000..07a9e59fcb
--- /dev/null
+++ b/cleopatre/devkit/rt5572drv/MODULE/os/linux/cfg80211drv.c
@@ -0,0 +1,870 @@
+/****************************************************************************
+ * Ralink Tech Inc.
+ * Taiwan, R.O.C.
+ *
+ * (c) Copyright 2002, Ralink Technology, Inc.
+ *
+ * All rights reserved. Ralink's source code is an unpublished work and the
+ * use of a copyright notice does not imply otherwise. This source code
+ * contains confidential trade secret material of Ralink Tech. Any attemp
+ * or participation in deciphering, decoding, reverse engineering or in any
+ * way altering the source code is stricitly prohibited, unless the prior
+ * written consent of Ralink Technology, Inc. is obtained.
+ ***************************************************************************/
+
+/****************************************************************************
+
+ Abstract:
+
+ All related CFG80211 function body.
+
+ History:
+
+***************************************************************************/
+
+#ifdef RT_CFG80211_SUPPORT
+
+#include "rt_config.h"
+
+#define RT_CFG80211_DEBUG /* debug use */
+#define CFG80211CB (pAd->pCfg80211_CB)
+
+#ifdef RT_CFG80211_DEBUG
+#define CFG80211DBG(__Flg, __pMsg) DBGPRINT(__Flg, __pMsg)
+#else
+#define CFG80211DBG(__Flg, __pMsg)
+#endif /* RT_CFG80211_DEBUG */
+
+
+
+
+INT CFG80211DRV_IoctlHandle(
+ IN VOID *pAdSrc,
+ IN RTMP_IOCTL_INPUT_STRUCT *wrq,
+ IN INT cmd,
+ IN USHORT subcmd,
+ IN VOID *pData,
+ IN ULONG Data)
+{
+ PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)pAdSrc;
+
+
+ switch(cmd)
+ {
+ case CMD_RTPRIV_IOCTL_80211_START:
+ case CMD_RTPRIV_IOCTL_80211_END:
+ /* nothing to do */
+ break;
+
+ case CMD_RTPRIV_IOCTL_80211_CB_GET:
+ *(VOID **)pData = (VOID *)(pAd->pCfg80211_CB);
+ break;
+
+ case CMD_RTPRIV_IOCTL_80211_CB_SET:
+ pAd->pCfg80211_CB = pData;
+ break;
+
+ case CMD_RTPRIV_IOCTL_80211_CHAN_SET:
+ if (CFG80211DRV_OpsSetChannel(pAd, pData) != TRUE)
+ return NDIS_STATUS_FAILURE;
+ break;
+
+ case CMD_RTPRIV_IOCTL_80211_VIF_CHG:
+ if (CFG80211DRV_OpsChgVirtualInf(pAd, pData, Data) != TRUE)
+ return NDIS_STATUS_FAILURE;
+ break;
+
+ case CMD_RTPRIV_IOCTL_80211_SCAN:
+ CFG80211DRV_OpsScan(pAd);
+ break;
+
+ case CMD_RTPRIV_IOCTL_80211_IBSS_JOIN:
+ CFG80211DRV_OpsJoinIbss(pAd, pData);
+ break;
+
+ case CMD_RTPRIV_IOCTL_80211_STA_LEAVE:
+ CFG80211DRV_OpsLeave(pAd);
+ break;
+
+ case CMD_RTPRIV_IOCTL_80211_STA_GET:
+ if (CFG80211DRV_StaGet(pAd, pData) != TRUE)
+ return NDIS_STATUS_FAILURE;
+ break;
+
+ case CMD_RTPRIV_IOCTL_80211_KEY_ADD:
+ CFG80211DRV_KeyAdd(pAd, pData);
+ break;
+
+ case CMD_RTPRIV_IOCTL_80211_KEY_DEFAULT_SET:
+ break;
+
+ case CMD_RTPRIV_IOCTL_80211_CONNECT_TO:
+ CFG80211DRV_Connect(pAd, pData);
+ break;
+
+#ifdef RFKILL_HW_SUPPORT
+ case CMD_RTPRIV_IOCTL_80211_RFKILL:
+ {
+ UINT32 data = 0;
+ BOOLEAN active;
+
+ /* Read GPIO pin2 as Hardware controlled radio state */
+ RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &data);
+ active = !!(data & 0x04);
+
+ if (!active)
+ {
+ RTMPSetLED(pAd, LED_RADIO_OFF);
+ *(UINT8 *)pData = 0;
+ }
+ else
+ *(UINT8 *)pData = 1;
+ }
+ break;
+#endif /* RFKILL_HW_SUPPORT */
+
+ case CMD_RTPRIV_IOCTL_80211_REG_NOTIFY_TO:
+ CFG80211DRV_RegNotify(pAd, pData);
+ break;
+
+ case CMD_RTPRIV_IOCTL_80211_UNREGISTER:
+ CFG80211_UnRegister(pAd, pData);
+ break;
+
+ case CMD_RTPRIV_IOCTL_80211_BANDINFO_GET:
+ {
+ CFG80211_BAND *pBandInfo = (CFG80211_BAND *)pData;
+ CFG80211_BANDINFO_FILL(pAd, pBandInfo);
+ }
+ break;
+
+ case CMD_RTPRIV_IOCTL_80211_SURVEY_GET:
+ CFG80211DRV_SurveyGet(pAd, pData);
+ break;
+
+ default:
+ return NDIS_STATUS_FAILURE;
+ }
+
+ return NDIS_STATUS_SUCCESS;
+}
+
+
+BOOLEAN CFG80211DRV_OpsSetChannel(
+ VOID *pAdOrg,
+ VOID *pData)
+{
+ PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)pAdOrg;
+ CMD_RTPRIV_IOCTL_80211_CHAN *pChan;
+ UINT8 ChanId;
+ UINT8 IfType;
+ UINT8 ChannelType;
+ STRING ChStr[5] = { 0 };
+#ifdef DOT11_N_SUPPORT
+ UCHAR BW_Old;
+ BOOLEAN FlgIsChanged;
+#endif /* DOT11_N_SUPPORT */
+
+
+ /* init */
+ pChan = (CMD_RTPRIV_IOCTL_80211_CHAN *)pData;
+ ChanId = pChan->ChanId;
+ IfType = pChan->IfType;
+ ChannelType = pChan->ChanType;
+
+#ifdef DOT11_N_SUPPORT
+ if (IfType != RT_CMD_80211_IFTYPE_MONITOR)
+ {
+ /* get channel BW */
+ FlgIsChanged = FALSE;
+ BW_Old = pAd->CommonCfg.RegTransmitSetting.field.BW;
+
+ /* set to new channel BW */
+ if (ChannelType == RT_CMD_80211_CHANTYPE_HT20)
+ {
+ pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20;
+ FlgIsChanged = TRUE;
+ }
+ else if ((ChannelType == RT_CMD_80211_CHANTYPE_HT40MINUS) ||
+ (ChannelType == RT_CMD_80211_CHANTYPE_HT40PLUS))
+ {
+ /* not support NL80211_CHAN_HT40MINUS or NL80211_CHAN_HT40PLUS */
+ /* i.e. primary channel = 36, secondary channel must be 40 */
+ pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40;
+ FlgIsChanged = TRUE;
+ } /* End of if */
+
+ CFG80211DBG(RT_DEBUG_ERROR, ("80211> New BW = %d\n",
+ pAd->CommonCfg.RegTransmitSetting.field.BW));
+
+ /* change HT/non-HT mode (do NOT change wireless mode here) */
+ if (((ChannelType == RT_CMD_80211_CHANTYPE_NOHT) &&
+ (pAd->CommonCfg.HT_Disable == 0)) ||
+ ((ChannelType != RT_CMD_80211_CHANTYPE_NOHT) &&
+ (pAd->CommonCfg.HT_Disable == 1)))
+ {
+ if (ChannelType == RT_CMD_80211_CHANTYPE_NOHT)
+ pAd->CommonCfg.HT_Disable = 1;
+ else
+ pAd->CommonCfg.HT_Disable = 0;
+ /* End of if */
+
+ FlgIsChanged = TRUE;
+ CFG80211DBG(RT_DEBUG_ERROR, ("80211> HT Disable = %d\n",
+ pAd->CommonCfg.HT_Disable));
+ } /* End of if */
+ }
+ else
+ {
+ /* for monitor mode */
+ FlgIsChanged = TRUE;
+ pAd->CommonCfg.HT_Disable = 0;
+ pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40;
+ } /* End of if */
+
+ if (FlgIsChanged == TRUE)
+ SetCommonHT(pAd);
+ /* End of if */
+#endif /* DOT11_N_SUPPORT */
+
+ /* switch to the channel */
+ sprintf(ChStr, "%d", ChanId);
+ if (Set_Channel_Proc(pAd, ChStr) == FALSE)
+ {
+ CFG80211DBG(RT_DEBUG_ERROR, ("80211> Change channel fail!\n"));
+ } /* End of if */
+
+
+ return TRUE;
+}
+
+
+BOOLEAN CFG80211DRV_OpsChgVirtualInf(
+ VOID *pAdOrg,
+ VOID *pFlgFilter,
+ UINT8 IfType)
+{
+
+ return TRUE;
+}
+
+
+BOOLEAN CFG80211DRV_OpsScan(
+ VOID *pAdOrg)
+{
+ PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)pAdOrg;
+
+
+ if (pAd->FlgCfg80211Scanning == TRUE)
+ return FALSE; /* scanning */
+ /* End of if */
+
+ /* do scan */
+ pAd->FlgCfg80211Scanning = TRUE;
+ return TRUE;
+}
+
+
+BOOLEAN CFG80211DRV_OpsJoinIbss(
+ VOID *pAdOrg,
+ VOID *pData)
+{
+ return TRUE;
+}
+
+
+BOOLEAN CFG80211DRV_OpsLeave(
+ VOID *pAdOrg)
+{
+ return TRUE;
+}
+
+
+BOOLEAN CFG80211DRV_StaGet(
+ VOID *pAdOrg,
+ VOID *pData)
+{
+ PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)pAdOrg;
+ CMD_RTPRIV_IOCTL_80211_STA *pIbssInfo;
+
+
+ pIbssInfo = (CMD_RTPRIV_IOCTL_80211_STA *)pData;
+
+#ifdef CONFIG_AP_SUPPORT
+{
+ MAC_TABLE_ENTRY *pEntry;
+ ULONG DataRate = 0;
+ UINT32 RSSI;
+
+
+ pEntry = MacTableLookup(pAd, pIbssInfo->MAC);
+ if (pEntry == NULL)
+ return FALSE;
+ /* End of if */
+
+ /* fill tx rate */
+ getRate(pEntry->HTPhyMode, &DataRate);
+
+ if ((pEntry->HTPhyMode.field.MODE == MODE_HTMIX) ||
+ (pEntry->HTPhyMode.field.MODE == MODE_HTGREENFIELD))
+ {
+ if (pEntry->HTPhyMode.field.BW)
+ pIbssInfo->TxRateFlags |= RT_CMD_80211_TXRATE_BW_40;
+ /* End of if */
+ if (pEntry->HTPhyMode.field.ShortGI)
+ pIbssInfo->TxRateFlags |= RT_CMD_80211_TXRATE_SHORT_GI;
+ /* End of if */
+
+ pIbssInfo->TxRateMCS = pEntry->HTPhyMode.field.MCS;
+ }
+ else
+ {
+ pIbssInfo->TxRateFlags = RT_CMD_80211_TXRATE_LEGACY;
+ pIbssInfo->TxRateMCS = DataRate*1000; /* unit: 100kbps */
+ } /* End of if */
+
+ /* fill signal */
+ RSSI = (pEntry->RssiSample.AvgRssi0 +
+ pEntry->RssiSample.AvgRssi1 +
+ pEntry->RssiSample.AvgRssi2) / 3;
+ pIbssInfo->Signal = RSSI;
+
+ /* fill tx count */
+ pIbssInfo->TxPacketCnt = pEntry->OneSecTxNoRetryOkCount +
+ pEntry->OneSecTxRetryOkCount +
+ pEntry->OneSecTxFailCount;
+
+ /* fill inactive time */
+ pIbssInfo->InactiveTime = pEntry->NoDataIdleCount * 1000; /* unit: ms */
+ pIbssInfo->InactiveTime *= MLME_TASK_EXEC_MULTIPLE;
+ pIbssInfo->InactiveTime /= 20;
+}
+#endif /* CONFIG_AP_SUPPORT */
+
+
+ return TRUE;
+}
+
+
+BOOLEAN CFG80211DRV_KeyAdd(
+ VOID *pAdOrg,
+ VOID *pData)
+{
+
+ return TRUE;
+}
+
+
+BOOLEAN CFG80211DRV_Connect(
+ VOID *pAdOrg,
+ VOID *pData)
+{
+
+ return TRUE;
+}
+
+
+VOID CFG80211DRV_RegNotify(
+ VOID *pAdOrg,
+ VOID *pData)
+{
+ PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)pAdOrg;
+ CMD_RTPRIV_IOCTL_80211_REG_NOTIFY *pRegInfo;
+
+
+ pRegInfo = (CMD_RTPRIV_IOCTL_80211_REG_NOTIFY *)pData;
+
+ /* keep Alpha2 and we can re-call the function when interface is up */
+ pAd->Cfg80211_Alpha2[0] = pRegInfo->Alpha2[0];
+ pAd->Cfg80211_Alpha2[1] = pRegInfo->Alpha2[1];
+
+ /* apply the new regulatory rule */
+ if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_START_UP))
+ {
+ /* interface is up */
+ CFG80211_RegRuleApply(pAd, pRegInfo->pWiphy, (UCHAR *)pRegInfo->Alpha2);
+ }
+ else
+ {
+ CFG80211DBG(RT_DEBUG_ERROR, ("crda> interface is down!\n"));
+ } /* End of if */
+}
+
+
+VOID CFG80211DRV_SurveyGet(
+ VOID *pAdOrg,
+ VOID *pData)
+{
+ PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)pAdOrg;
+ CMD_RTPRIV_IOCTL_80211_SURVEY *pSurveyInfo;
+
+
+ pSurveyInfo = (CMD_RTPRIV_IOCTL_80211_SURVEY *)pData;
+
+ pSurveyInfo->pCfg80211 = pAd->pCfg80211_CB;
+
+#ifdef AP_QLOAD_SUPPORT
+ pSurveyInfo->ChannelTimeBusy = pAd->QloadLatestChannelBusyTimePri;
+ pSurveyInfo->ChannelTimeExtBusy = pAd->QloadLatestChannelBusyTimeSec;
+#endif /* AP_QLOAD_SUPPORT */
+}
+
+
+VOID CFG80211_UnRegister(
+ IN VOID *pAdOrg,
+ IN VOID *pNetDev)
+{
+ PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)pAdOrg;
+
+
+ /* sanity check */
+ if (pAd->pCfg80211_CB == NULL)
+ return;
+ /* End of if */
+
+ CFG80211OS_UnRegister(pAd->pCfg80211_CB, pNetDev);
+ pAd->pCfg80211_CB = NULL;
+ pAd->CommonCfg.HT_Disable = 0;
+}
+
+
+/*
+========================================================================
+Routine Description:
+ Parse and handle country region in beacon from associated AP.
+
+Arguments:
+ pAdCB - WLAN control block pointer
+ pVIE - Beacon elements
+ LenVIE - Total length of Beacon elements
+
+Return Value:
+ NONE
+
+Note:
+========================================================================
+*/
+VOID CFG80211_BeaconCountryRegionParse(
+ IN VOID *pAdCB,
+ IN NDIS_802_11_VARIABLE_IEs *pVIE,
+ IN UINT16 LenVIE)
+{
+ PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)pAdCB;
+ UCHAR *pElement = (UCHAR *)pVIE;
+ UINT32 LenEmt;
+
+
+ while(LenVIE > 0)
+ {
+ pVIE = (NDIS_802_11_VARIABLE_IEs *)pElement;
+
+ if (pVIE->ElementID == IE_COUNTRY)
+ {
+ /* send command to do regulation hint only when associated */
+ RTEnqueueInternalCmd(pAd, CMDTHREAD_REG_HINT_11D,
+ pVIE->data, pVIE->Length);
+ break;
+ } /* End of if */
+
+ LenEmt = pVIE->Length + 2;
+
+ if (LenVIE <= LenEmt)
+ break; /* length is not enough */
+ /* End of if */
+
+ pElement += LenEmt;
+ LenVIE -= LenEmt;
+ } /* End of while */
+} /* End of CFG80211_BeaconCountryRegionParse */
+
+
+/*
+========================================================================
+Routine Description:
+ Hint to the wireless core a regulatory domain from driver.
+
+Arguments:
+ pAd - WLAN control block pointer
+ pCountryIe - pointer to the country IE
+ CountryIeLen - length of the country IE
+
+Return Value:
+ NONE
+
+Note:
+ Must call the function in kernel thread.
+========================================================================
+*/
+VOID CFG80211_RegHint(
+ IN VOID *pAdCB,
+ IN UCHAR *pCountryIe,
+ IN ULONG CountryIeLen)
+{
+ PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)pAdCB;
+
+
+ CFG80211OS_RegHint(CFG80211CB, pCountryIe, CountryIeLen);
+} /* End of CFG80211_RegHint */
+
+
+/*
+========================================================================
+Routine Description:
+ Hint to the wireless core a regulatory domain from country element.
+
+Arguments:
+ pAdCB - WLAN control block pointer
+ pCountryIe - pointer to the country IE
+ CountryIeLen - length of the country IE
+
+Return Value:
+ NONE
+
+Note:
+ Must call the function in kernel thread.
+========================================================================
+*/
+VOID CFG80211_RegHint11D(
+ IN VOID *pAdCB,
+ IN UCHAR *pCountryIe,
+ IN ULONG CountryIeLen)
+{
+ /* no regulatory_hint_11d() in 2.6.32 */
+ PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)pAdCB;
+
+
+ CFG80211OS_RegHint11D(CFG80211CB, pCountryIe, CountryIeLen);
+} /* End of CFG80211_RegHint11D */
+
+
+/*
+========================================================================
+Routine Description:
+ Apply new regulatory rule.
+
+Arguments:
+ pAdCB - WLAN control block pointer
+ pWiphy - Wireless hardware description
+ pAlpha2 - Regulation domain (2B)
+
+Return Value:
+ NONE
+
+Note:
+ Can only be called when interface is up.
+
+ For general mac80211 device, it will be set to new power by Ops->config()
+ In rt2x00/, the settings is done in rt2x00lib_config().
+========================================================================
+*/
+VOID CFG80211_RegRuleApply(
+ IN VOID *pAdCB,
+ IN VOID *pWiphy,
+ IN UCHAR *pAlpha2)
+{
+ PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)pAdCB;
+ VOID *pBand24G, *pBand5G;
+ UINT32 IdBand, IdChan, IdPwr;
+ UINT32 ChanNum, ChanId, Power, RecId, DfsType;
+ BOOLEAN FlgIsRadar;
+ ULONG IrqFlags;
+#ifdef DFS_SUPPORT
+ RADAR_DETECT_STRUCT *pRadarDetect;
+#endif /* DFS_SUPPORT */
+
+
+ CFG80211DBG(RT_DEBUG_ERROR, ("crda> CFG80211_RegRuleApply ==>\n"));
+
+ /* init */
+ pBand24G = NULL;
+ pBand5G = NULL;
+
+ if (pAd == NULL)
+ return;
+
+ RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags);
+
+ /* zero first */
+ NdisZeroMemory(pAd->ChannelList,
+ MAX_NUM_OF_CHANNELS * sizeof(CHANNEL_TX_POWER));
+
+ /* 2.4GHZ & 5GHz */
+ RecId = 0;
+#ifdef DFS_SUPPORT
+ pRadarDetect = &pAd->CommonCfg.RadarDetect;
+#endif /* DFS_SUPPORT */
+
+ /* find the DfsType */
+ DfsType = CE;
+
+ pBand24G = NULL;
+ pBand5G = NULL;
+
+ if (CFG80211OS_BandInfoGet(CFG80211CB, pWiphy, &pBand24G, &pBand5G) == FALSE)
+ return;
+
+#ifdef AUTO_CH_SELECT_ENHANCE
+#ifdef EXT_BUILD_CHANNEL_LIST
+ if ((pAlpha2[0] != '0') && (pAlpha2[1] != '0'))
+ {
+ UINT32 IdReg;
+
+ if (pBand5G != NULL)
+ {
+ for(IdReg=0; ; IdReg++)
+ {
+ if (ChRegion[IdReg].CountReg[0] == 0x00)
+ break;
+ /* End of if */
+
+ if ((pAlpha2[0] == ChRegion[IdReg].CountReg[0]) &&
+ (pAlpha2[1] == ChRegion[IdReg].CountReg[1]))
+ {
+ if (pAd->CommonCfg.DfsType != MAX_RD_REGION)
+ DfsType = pAd->CommonCfg.DfsType;
+ else
+ DfsType = ChRegion[IdReg].DfsType;
+
+ CFG80211DBG(RT_DEBUG_ERROR,
+ ("crda> find region %c%c, DFS Type %d\n",
+ pAlpha2[0], pAlpha2[1], DfsType));
+ break;
+ } /* End of if */
+ } /* End of for */
+ } /* End of if */
+ } /* End of if */
+#endif /* EXT_BUILD_CHANNEL_LIST */
+#endif /* AUTO_CH_SELECT_ENHANCE */
+
+ for(IdBand=0; IdBand<2; IdBand++)
+ {
+ if (((IdBand == 0) && (pBand24G == NULL)) ||
+ ((IdBand == 1) && (pBand5G == NULL)))
+ {
+ continue;
+ } /* End of if */
+
+ if (IdBand == 0)
+ {
+ CFG80211DBG(RT_DEBUG_ERROR, ("crda> reset chan/power for 2.4GHz\n"));
+ }
+ else
+ {
+ CFG80211DBG(RT_DEBUG_ERROR, ("crda> reset chan/power for 5GHz\n"));
+ } /* End of if */
+
+ ChanNum = CFG80211OS_ChanNumGet(CFG80211CB, pWiphy, IdBand);
+
+ for(IdChan=0; IdChan<ChanNum; IdChan++)
+ {
+ if (CFG80211OS_ChanInfoGet(CFG80211CB, pWiphy, IdBand, IdChan,
+ &ChanId, &Power, &FlgIsRadar) == FALSE)
+ {
+ /* the channel is not allowed in the regulatory domain */
+ /* get next channel information */
+ continue;
+ } /* End of if */
+
+ if ((pAd->CommonCfg.PhyMode == PHY_11A) ||
+ (pAd->CommonCfg.PhyMode == PHY_11AN_MIXED))
+ {
+ /* 5G-only mode */
+ if (ChanId <= CFG80211_NUM_OF_CHAN_2GHZ)
+ continue; /* check next */
+ /* End of if */
+ } /* End of if */
+
+ if ((pAd->CommonCfg.PhyMode != PHY_11A) &&
+ (pAd->CommonCfg.PhyMode != PHY_11ABG_MIXED) &&
+ (pAd->CommonCfg.PhyMode != PHY_11AN_MIXED) &&
+ (pAd->CommonCfg.PhyMode != PHY_11ABGN_MIXED) &&
+ (pAd->CommonCfg.PhyMode != PHY_11AGN_MIXED))
+ {
+ /* 2.5G-only mode */
+ if (ChanId > CFG80211_NUM_OF_CHAN_2GHZ)
+ continue; /* check next */
+ /* End of if */
+ } /* End of if */
+
+ for(IdPwr=0; IdPwr<MAX_NUM_OF_CHANNELS; IdPwr++)
+ {
+ if (ChanId == pAd->TxPower[IdPwr].Channel)
+ {
+ /* init the channel info. */
+ NdisMoveMemory(&pAd->ChannelList[RecId],
+ &pAd->TxPower[IdPwr],
+ sizeof(CHANNEL_TX_POWER));
+
+ /* keep channel number */
+ pAd->ChannelList[RecId].Channel = ChanId;
+
+ /* keep maximum tranmission power */
+ pAd->ChannelList[RecId].MaxTxPwr = Power;
+
+ /* keep DFS flag */
+ if (FlgIsRadar == TRUE)
+ pAd->ChannelList[RecId].DfsReq = TRUE;
+ else
+ pAd->ChannelList[RecId].DfsReq = FALSE;
+ /* End of if */
+
+ /* keep DFS type */
+ pAd->ChannelList[RecId].RegulatoryDomain = DfsType;
+
+ /* re-set DFS info. */
+ pAd->CommonCfg.RDDurRegion = DfsType;
+
+ CFG80211DBG(RT_DEBUG_ERROR,
+ ("Chan %03d:\tpower %d dBm, "
+ "DFS %d, DFS Type %d\n",
+ ChanId, Power,
+ ((FlgIsRadar == TRUE)?1:0),
+ DfsType));
+
+ /* change to record next channel info. */
+ RecId ++;
+ break;
+ } /* End of if */
+ } /* End of for */
+ } /* End of for */
+ } /* End of for */
+
+ pAd->ChannelListNum = RecId;
+ RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags);
+
+ CFG80211DBG(RT_DEBUG_ERROR, ("crda> Number of channels = %d\n", RecId));
+} /* End of CFG80211_RegRuleApply */
+
+
+/*
+========================================================================
+Routine Description:
+ Inform us that a scan is got.
+
+Arguments:
+ pAdCB - WLAN control block pointer
+
+Return Value:
+ NONE
+
+Note:
+ Call RT_CFG80211_SCANNING_INFORM, not CFG80211_Scaning
+========================================================================
+*/
+VOID CFG80211_Scaning(
+ IN VOID *pAdCB,
+ IN UINT32 BssIdx,
+ IN UINT32 ChanId,
+ IN UCHAR *pFrame,
+ IN UINT32 FrameLen,
+ IN INT32 RSSI)
+{
+} /* End of CFG80211_Scaning */
+
+
+/*
+========================================================================
+Routine Description:
+ Inform us that scan ends.
+
+Arguments:
+ pAdCB - WLAN control block pointer
+ FlgIsAborted - 1: scan is aborted
+
+Return Value:
+ NONE
+
+Note:
+========================================================================
+*/
+VOID CFG80211_ScanEnd(
+ IN VOID *pAdCB,
+ IN BOOLEAN FlgIsAborted)
+{
+} /* End of CFG80211_ScanEnd */
+
+
+/*
+========================================================================
+Routine Description:
+ Inform CFG80211 about association status.
+
+Arguments:
+ pAdCB - WLAN control block pointer
+ pBSSID - the BSSID of the AP
+ pReqIe - the element list in the association request frame
+ ReqIeLen - the request element length
+ pRspIe - the element list in the association response frame
+ RspIeLen - the response element length
+ FlgIsSuccess - 1: success; otherwise: fail
+
+Return Value:
+ None
+
+Note:
+========================================================================
+*/
+VOID CFG80211_ConnectResultInform(
+ IN VOID *pAdCB,
+ IN UCHAR *pBSSID,
+ IN UCHAR *pReqIe,
+ IN UINT32 ReqIeLen,
+ IN UCHAR *pRspIe,
+ IN UINT32 RspIeLen,
+ IN UCHAR FlgIsSuccess)
+{
+ PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)pAdCB;
+
+
+ CFG80211DBG(RT_DEBUG_ERROR, ("80211> CFG80211_ConnectResultInform ==>\n"));
+
+ CFG80211OS_ConnectResultInform(CFG80211CB,
+ pBSSID,
+ pReqIe,
+ ReqIeLen,
+ pRspIe,
+ RspIeLen,
+ FlgIsSuccess);
+
+ pAd->FlgCfg80211Connecting = FALSE;
+} /* End of CFG80211_ConnectResultInform */
+
+
+/*
+========================================================================
+Routine Description:
+ Re-Initialize wireless channel/PHY in 2.4GHZ and 5GHZ.
+
+Arguments:
+ pAdCB - WLAN control block pointer
+
+Return Value:
+ TRUE - re-init successfully
+ FALSE - re-init fail
+
+Note:
+ CFG80211_SupBandInit() is called in xx_probe().
+ But we do not have complete chip information in xx_probe() so we
+ need to re-init bands in xx_open().
+========================================================================
+*/
+BOOLEAN CFG80211_SupBandReInit(
+ IN VOID *pAdCB)
+{
+ PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)pAdCB;
+ CFG80211_BAND BandInfo;
+
+
+ CFG80211DBG(RT_DEBUG_ERROR, ("80211> re-init bands...\n"));
+
+ /* re-init bands */
+ NdisZeroMemory(&BandInfo, sizeof(BandInfo));
+ CFG80211_BANDINFO_FILL(pAd, &BandInfo);
+
+ return CFG80211OS_SupBandReInit(CFG80211CB, &BandInfo);
+} /* End of CFG80211_SupBandReInit */
+
+
+#endif /* RT_CFG80211_SUPPORT */
+
+/* End of cfg80211drv.c */