/*----------------------------------------------------------------------------*/
VOID
rlmBssInitForAP(
    P_ADAPTER_T  prAdapter,
    P_BSS_INFO_T prBssInfo
    )
{
    ENUM_BAND_T         eBand;
    UINT_8              ucChannel;
    ENUM_CHNL_EXT_T     eSCO;

    ASSERT(prAdapter);
    ASSERT(prBssInfo);

    if (prBssInfo->eCurrentOPMode != OP_MODE_ACCESS_POINT) {
        return;
    }

    /* Operation band, channel shall be ready before invoking this function.
     * Bandwidth may be ready if other network is connected
     */
    prBssInfo->fg40mBwAllowed = FALSE;
    prBssInfo->fgAssoc40mBwAllowed = FALSE;
    prBssInfo->eBssSCO = CHNL_EXT_SCN;

    if (RLM_AP_IS_BW_40_ALLOWED(prAdapter, prBssInfo)) {
        /* In this case, the first BSS's SCO is 40MHz and known, so AP can
         * apply 40MHz bandwidth, but the first BSS's SCO may be changed
         * later if its Beacon lost timeout occurs
         */
        if (cnmPreferredChannel(prAdapter, &eBand, &ucChannel, &eSCO) &&
            eSCO != CHNL_EXT_SCN && ucChannel == prBssInfo->ucPrimaryChannel &&
            eBand == prBssInfo->eBand) {
            prBssInfo->eBssSCO = eSCO;
        }
        else if (cnmBss40mBwPermitted(prAdapter, prBssInfo->ucNetTypeIndex)) {
            prBssInfo->eBssSCO = rlmDecideScoForAP(prAdapter, prBssInfo);
        }

        if (prBssInfo->eBssSCO != CHNL_EXT_SCN) {
            prBssInfo->fg40mBwAllowed = TRUE;
            prBssInfo->fgAssoc40mBwAllowed = TRUE;

            prBssInfo->ucHtOpInfo1 = (UINT_8)
                (((UINT_32) prBssInfo->eBssSCO) | HT_OP_INFO1_STA_CHNL_WIDTH);

            rlmUpdateBwByChListForAP(prAdapter, prBssInfo);
        }
    }

    DBGLOG(RLM, INFO, ("WLAN AP SCO=%d\n", prBssInfo->eBssSCO));
}
Exemple #2
0
/*----------------------------------------------------------------------------*/
VOID rlmBssInitForAP(P_ADAPTER_T prAdapter, P_BSS_INFO_T prBssInfo)
{
	ENUM_BAND_T eBand;
	UINT_8 ucChannel, i;
	ENUM_CHNL_EXT_T eSCO;

	ASSERT(prAdapter);
	ASSERT(prBssInfo);

	if (prBssInfo->eCurrentOPMode != OP_MODE_ACCESS_POINT) {
		return;
	}

	/* Operation band, channel shall be ready before invoking this function.
	 * Bandwidth may be ready if other network is connected
	 */
	prBssInfo->fg40mBwAllowed = FALSE;
	prBssInfo->fgAssoc40mBwAllowed = FALSE;
	prBssInfo->eBssSCO = CHNL_EXT_SCN;

    /* Check if AP can set its bw to 40MHz
     * But if any of BSS is setup in 40MHz, the second BSS would prefer to use 20MHz
     * in order to remain in SCC case
     */
    if (cnmBss40mBwPermitted(prAdapter, prBssInfo->ucBssIndex)) {
		/* In this case, the first BSS's SCO is 40MHz and known, so AP can
		 * apply 40MHz bandwidth, but the first BSS's SCO may be changed
		 * later if its Beacon lost timeout occurs
		 */
		if (cnmPreferredChannel(prAdapter, &eBand, &ucChannel, &eSCO) &&
		    eSCO != CHNL_EXT_SCN && ucChannel == prBssInfo->ucPrimaryChannel &&
		    eBand == prBssInfo->eBand) {
			prBssInfo->eBssSCO = eSCO;
		} else {
			prBssInfo->eBssSCO = rlmDecideScoForAP(prAdapter, prBssInfo);
		}

		if (prBssInfo->eBssSCO != CHNL_EXT_SCN) {
			prBssInfo->fg40mBwAllowed = TRUE;
			prBssInfo->fgAssoc40mBwAllowed = TRUE;

			prBssInfo->ucHtOpInfo1 = (UINT_8)
			    (((UINT_32) prBssInfo->eBssSCO) | HT_OP_INFO1_STA_CHNL_WIDTH);

			rlmUpdateBwByChListForAP(prAdapter, prBssInfo);
		}
	}

	/* Filled the VHT BW/S1/S2 and MCS rate set */
    if(prBssInfo->ucPhyTypeSet & PHY_TYPE_BIT_VHT) {
    	for(i = 0 ; i < 8 ; i++ ){
            prBssInfo->u2VhtBasicMcsSet |= BITS(2*i,(2*i+1));
    	}
    	prBssInfo->u2VhtBasicMcsSet &= (VHT_CAP_INFO_MCS_MAP_MCS9 << VHT_CAP_INFO_MCS_1SS_OFFSET);
        
        if(cnmGetBssMaxBw(prAdapter, prBssInfo->ucBssIndex) < MAX_BW_80MHZ || prBssInfo->eBand == BAND_2G4) {
            prBssInfo->ucVhtChannelWidth = VHT_OP_CHANNEL_WIDTH_20_40;
            prBssInfo->ucVhtChannelFrequencyS1 = 0;
            prBssInfo->ucVhtChannelFrequencyS2 = 0;
        }
        else if(cnmGetBssMaxBw(prAdapter, prBssInfo->ucBssIndex) == MAX_BW_80MHZ) {        
            prBssInfo->ucVhtChannelWidth = VHT_OP_CHANNEL_WIDTH_80;
            prBssInfo->ucVhtChannelFrequencyS1 = nicGetVhtS1(prBssInfo->ucPrimaryChannel);
            prBssInfo->ucVhtChannelFrequencyS2 = 0;
        }
        else {
            //4 TODO: BW160 / BW80+80 support
        }
    }
    else {
        prBssInfo->ucVhtChannelWidth = VHT_OP_CHANNEL_WIDTH_20_40;
        prBssInfo->ucVhtChannelFrequencyS1 = 0;
        prBssInfo->ucVhtChannelFrequencyS2 = 0;
    }



    DBGLOG(RLM, INFO, ("WLAN AP SCO=%d BW=%d S1=%d S2=%d CH=%d Band=%d\n", 
        prBssInfo->eBssSCO,
        prBssInfo->ucVhtChannelWidth,
        prBssInfo->ucVhtChannelFrequencyS1,
        prBssInfo->ucVhtChannelFrequencyS2,
        prBssInfo->ucVhtChannelWidth,
        prBssInfo->eBand
        ));
    
}