Ejemplo n.º 1
0
static inline UCHAR SelectClearChannelRandom(
	IN PRTMP_ADAPTER pAd
	)
{
	UCHAR cnt, ch = 0, i, RadomIdx;
	/*BOOLEAN bFindIt = FALSE;*/
	UINT8 TempChList[MAX_NUM_OF_CHANNELS] = {0};
	
	if (pAd->CommonCfg.bIEEE80211H)
	{
        cnt = 0;

        /* Filter out an available channel list */
        for (i = 0; i < pAd->ChannelListNum; i++)
        {
            /* Check DFS channel RemainingTimeForUse */
            if (pAd->ChannelList[i].RemainingTimeForUse)
            	continue;

            /* disable for now because no skip list is provided */
            /* Check skip channel list */
            /*
            if (AutoChannelSkipListCheck(pAd, pAd->ChannelList[i].Channel) == TRUE)
            	continue;
            */
#ifdef DOT11_N_SUPPORT
            /* Check N-group of BW40 */
            /* ?What is this? Somebody tell me */
            if (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40 &&
                !(pAd->ChannelList[i].Flags & CHANNEL_40M_CAP))
                continue;
#endif /* DOT11_N_SUPPORT */

            /* Store available channel to temp list */
            TempChList[cnt++] = pAd->ChannelList[i].Channel;
		}

		/* Randomly select a channel from temp list */
		if (cnt)
		{
			RadomIdx = RandomByte2(pAd)%cnt;
			ch = TempChList[RadomIdx];
		}
		else
		{
			ch = get_channel_by_reference(pAd, 1);
		}
		
	}
	else
	{
		ch = pAd->ChannelList[RandomByte2(pAd)%pAd->ChannelListNum].Channel;
		if (ch == 0)
			ch = FirstChannel(pAd);
	}
	DBGPRINT(RT_DEBUG_TRACE,("%s(): Select Channel %d\n", __FUNCTION__, ch));
	return ch;

}
Ejemplo n.º 2
0
static inline UCHAR SelectClearChannelRandom(
	IN PRTMP_ADAPTER pAd
	)
{
	UCHAR cnt, ch = 0, i, RadomIdx;
	UINT8 TempChList[MAX_NUM_OF_CHANNELS] = {0};
	
	if (pAd->CommonCfg.bIEEE80211H)
	{
		cnt = 0;
		
		/* Filter out an available channel list */
		for (i = 0; i < pAd->ChannelListNum; i++)
		{
			/* Check DFS channel RemainingTimeForUse */
			if (pAd->ChannelList[i].RemainingTimeForUse)
				continue;

			/* Check skip channel list */
			if (AutoChannelSkipListCheck(pAd, pAd->ChannelList[i].Channel) == TRUE)
				continue;

#ifdef DOT11_N_SUPPORT
			/* Check N-group of BW40 */
			if (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40 &&
				!(pAd->ChannelList[i].Flags & CHANNEL_40M_CAP))
				continue;

#ifdef DOT11_VHT_AC
			/* Check VHT-group of BW80 */
			if (pAd->CommonCfg.vht_bw == VHT_BW_80 &&
				!(pAd->ChannelList[i].Flags & CHANNEL_80M_CAP))
				continue;
#endif /* DOT11_VHT_AC */
#endif /* DOT11_N_SUPPORT */

			/* Store available channel to temp list */
			TempChList[cnt++] = pAd->ChannelList[i].Channel;
		}

		/* Randomly select a channel from temp list */
		if (cnt)
		{
			RadomIdx = RandomByte2(pAd)%cnt;
			ch = TempChList[RadomIdx];
		}
		else
		{
			ch = get_channel_by_reference(pAd, 1);
		}
		
	}
	else
	{
		ch = pAd->ChannelList[RandomByte2(pAd)%pAd->ChannelListNum].Channel;
		if (ch == 0)
			ch = FirstChannel(pAd);
	}
	printk("%s(): Select Channel %d\n", __FUNCTION__, ch);
	return ch;

}