Exemple #1
0
/*----------------------------------------------------------------------------*/
VOID rlmUpdateParamsForAP(P_ADAPTER_T prAdapter, P_BSS_INFO_T prBssInfo, BOOLEAN fgUpdateBeacon)
{
    P_LINK_T prStaList;
    P_STA_RECORD_T prStaRec;
    BOOLEAN fgErpProtectMode, fgSta40mIntolerant;
    BOOLEAN fgUseShortPreamble, fgUseShortSlotTime;
    ENUM_HT_PROTECT_MODE_T eHtProtectMode;
    ENUM_GF_MODE_T eGfOperationMode;
    UINT_8 ucHtOpInfo1;

    ASSERT(prAdapter);
    ASSERT(prBssInfo);

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

    fgErpProtectMode = FALSE;
    eHtProtectMode = HT_PROTECT_MODE_NONE;
    eGfOperationMode = GF_MODE_NORMAL;
    fgSta40mIntolerant = FALSE;
    fgUseShortPreamble = prBssInfo->fgIsShortPreambleAllowed;
    fgUseShortSlotTime = TRUE;
    ucHtOpInfo1 = (UINT_8) CHNL_EXT_SCN;

    prStaList = &prBssInfo->rStaRecOfClientList;

    LINK_FOR_EACH_ENTRY(prStaRec, prStaList, rLinkEntry, STA_RECORD_T) {
        /* ASSERT(prStaRec); */
        if (!prStaRec) {
            DBGLOG(P2P, TRACE, ("prStaRec is NULL in rlmUpdateParamsForAP()\n"));
            break;
        }
        if (prStaRec->fgIsInUse && prStaRec->ucStaState == STA_STATE_3 &&
                prStaRec->ucNetTypeIndex == prBssInfo->ucNetTypeIndex) {
            if (!(prStaRec->ucPhyTypeSet &
                    (PHY_TYPE_SET_802_11GN | PHY_TYPE_SET_802_11A))) {
                /* B-only mode, so mode 1 (ERP protection) */
                fgErpProtectMode = TRUE;
            }

            if (!(prStaRec->ucPhyTypeSet & PHY_TYPE_SET_802_11N)) {
                /* BG-only or A-only */
                eHtProtectMode = HT_PROTECT_MODE_NON_HT;
            } else if (!(prStaRec->u2HtCapInfo & HT_CAP_INFO_SUP_CHNL_WIDTH)) {
                /* 20MHz-only */
                if (eHtProtectMode == HT_PROTECT_MODE_NONE) {
                    eHtProtectMode = HT_PROTECT_MODE_20M;
                }
            }

            if (!(prStaRec->u2HtCapInfo & HT_CAP_INFO_HT_GF)) {
                eGfOperationMode = GF_MODE_PROTECT;
            }

            if (!(prStaRec->u2CapInfo & CAP_INFO_SHORT_PREAMBLE)) {
                fgUseShortPreamble = FALSE;
            }

            if (!(prStaRec->u2CapInfo & CAP_INFO_SHORT_SLOT_TIME)) {
                fgUseShortSlotTime = FALSE;
            }

            if (prStaRec->u2HtCapInfo & HT_CAP_INFO_40M_INTOLERANT) {
                fgSta40mIntolerant = TRUE;
            }
        }
    }			/* end of LINK_FOR_EACH_ENTRY */

    /* Check if HT operation IE about 20/40M bandwidth shall be updated */
    if (prBssInfo->eBssSCO != CHNL_EXT_SCN) {
        if (/*!LINK_IS_EMPTY(prStaList) && */ !fgSta40mIntolerant &&
                                              !prBssInfo->fgObssActionForcedTo20M && !prBssInfo->fgObssBeaconForcedTo20M) {

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

    /* Check if any new parameter may be updated */
    if (prBssInfo->fgErpProtectMode != fgErpProtectMode ||
            prBssInfo->eHtProtectMode != eHtProtectMode ||
            prBssInfo->eGfOperationMode != eGfOperationMode ||
            prBssInfo->ucHtOpInfo1 != ucHtOpInfo1 ||
            prBssInfo->fgUseShortPreamble != fgUseShortPreamble ||
            prBssInfo->fgUseShortSlotTime != fgUseShortSlotTime) {

        prBssInfo->fgErpProtectMode = fgErpProtectMode;
        prBssInfo->eHtProtectMode = eHtProtectMode;
        prBssInfo->eGfOperationMode = eGfOperationMode;
        prBssInfo->ucHtOpInfo1 = ucHtOpInfo1;
        prBssInfo->fgUseShortPreamble = fgUseShortPreamble;
        prBssInfo->fgUseShortSlotTime = fgUseShortSlotTime;

        if (fgUseShortSlotTime) {
            prBssInfo->u2CapInfo |= CAP_INFO_SHORT_SLOT_TIME;
        } else {
            prBssInfo->u2CapInfo &= ~CAP_INFO_SHORT_SLOT_TIME;
        }

        rlmSyncOperationParams(prAdapter, prBssInfo);
        fgUpdateBeacon = TRUE;
    }

    /* Update Beacon content if related IE content is changed */
    if (fgUpdateBeacon) {
        bssUpdateBeaconContent(prAdapter, prBssInfo->ucNetTypeIndex);
    }
}
Exemple #2
0
/*----------------------------------------------------------------------------*/
VOID rlmProcessPublicAction(P_ADAPTER_T prAdapter, P_SW_RFB_T prSwRfb)
{
	P_ACTION_20_40_COEXIST_FRAME prRxFrame;
	P_IE_20_40_COEXIST_T prCoexist;
	P_IE_INTOLERANT_CHNL_REPORT_T prChnlReport;
	P_BSS_INFO_T prBssInfo;
	P_STA_RECORD_T prStaRec;
	PUINT_8 pucIE;
	UINT_16 u2IELength, u2Offset;
	UINT_8 i, j;

	ASSERT(prAdapter);
	ASSERT(prSwRfb);

	prRxFrame = (P_ACTION_20_40_COEXIST_FRAME) prSwRfb->pvHeader;
	prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx);

	if (prRxFrame->ucAction != ACTION_PUBLIC_20_40_COEXIST || !prStaRec || prStaRec->ucStaState != STA_STATE_3 || prSwRfb->u2PacketLen < (WLAN_MAC_MGMT_HEADER_LEN + 5) || prSwRfb->prStaRec->ucBssIndex !=	/* HIF_RX_HDR_GET_NETWORK_IDX(prSwRfb->prHifRxHdr) != */
	    prStaRec->ucBssIndex) {
		return;
	}

	prBssInfo = GET_BSS_INFO_BY_INDEX(prAdapter, prStaRec->ucBssIndex);
	ASSERT(prBssInfo);

	if (!IS_BSS_ACTIVE(prBssInfo) ||
	    prBssInfo->eCurrentOPMode != OP_MODE_ACCESS_POINT ||
	    prBssInfo->eBssSCO == CHNL_EXT_SCN) {
		return;
	}

	prCoexist = &prRxFrame->rBssCoexist;
	if (prCoexist->ucData & (BSS_COEXIST_40M_INTOLERANT | BSS_COEXIST_20M_REQ)) {
		ASSERT(prBssInfo->auc2G_20mReqChnlList[0] <= CHNL_LIST_SZ_2G);
		for (i = 1; i <= prBssInfo->auc2G_20mReqChnlList[0] && i <= CHNL_LIST_SZ_2G; i++) {
			if (prBssInfo->auc2G_20mReqChnlList[i] == prBssInfo->ucPrimaryChannel) {
				break;
			}
		}
		if ((i > prBssInfo->auc2G_20mReqChnlList[0]) && (i <= CHNL_LIST_SZ_2G)) {
			prBssInfo->auc2G_20mReqChnlList[i] = prBssInfo->ucPrimaryChannel;
			prBssInfo->auc2G_20mReqChnlList[0]++;
		}
	}

	/* Process intolerant channel report IE */
	pucIE = (PUINT_8) &prRxFrame->rChnlReport;
	u2IELength = prSwRfb->u2PacketLen - (WLAN_MAC_MGMT_HEADER_LEN + 5);

	IE_FOR_EACH(pucIE, u2IELength, u2Offset) {
		switch (IE_ID(pucIE)) {
		case ELEM_ID_20_40_INTOLERANT_CHNL_REPORT:
			prChnlReport = (P_IE_INTOLERANT_CHNL_REPORT_T) pucIE;

			if (prChnlReport->ucLength <= 1) {
				break;
			}

			/* To do: process regulatory class. Now we assume 2.4G band */

			for (j = 0; j < prChnlReport->ucLength - 1; j++) {
				/* Update non-HT channel list */
				ASSERT(prBssInfo->auc2G_NonHtChnlList[0] <= CHNL_LIST_SZ_2G);
				for (i = 1; i <= prBssInfo->auc2G_NonHtChnlList[0] &&
				     i <= CHNL_LIST_SZ_2G; i++) {
					if (prBssInfo->auc2G_NonHtChnlList[i] ==
					    prChnlReport->aucChannelList[j]) {
						break;
					}
				}
				if ((i > prBssInfo->auc2G_NonHtChnlList[0]) &&
				    (i <= CHNL_LIST_SZ_2G)) {
					prBssInfo->auc2G_NonHtChnlList[i] =
					    prChnlReport->aucChannelList[j];
					prBssInfo->auc2G_NonHtChnlList[0]++;
				}
			}
			break;

		default:
			break;
		}
	}			/* end of IE_FOR_EACH */

	if (rlmUpdateBwByChListForAP(prAdapter, prBssInfo)) {
		bssUpdateBeaconContent(prAdapter, prBssInfo->ucBssIndex);
		rlmSyncOperationParams(prAdapter, prBssInfo);
	}

	/* Check if OBSS scan exemption response should be sent */
	if (prCoexist->ucData & BSS_COEXIST_OBSS_SCAN_EXEMPTION_REQ) {
		rlmObssScanExemptionRsp(prAdapter, prBssInfo, prSwRfb);
	}
}
/*----------------------------------------------------------------------------*/
VOID
rlmUpdateParamsForAP (
    P_ADAPTER_T     prAdapter,
    P_BSS_INFO_T    prBssInfo,
    BOOLEAN         fgUpdateBeacon
    )
{
    P_LINK_T                prStaList;
    P_STA_RECORD_T          prStaRec;
    BOOLEAN                 fgErpProtectMode, fgSta40mIntolerant;
    BOOLEAN                 fgUseShortPreamble, fgUseShortSlotTime;
    ENUM_HT_PROTECT_MODE_T  eHtProtectMode;
    ENUM_GF_MODE_T          eGfOperationMode;
    UINT_8                  ucHtOpInfo1;
#if CFG_SUPPORT_HOTSPOT_OPTIMIZATION
    P_GLUE_INFO_T           prGlueInfo;
#endif

    ASSERT(prAdapter);
    ASSERT(prBssInfo);

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

    fgErpProtectMode = FALSE;
    eHtProtectMode = HT_PROTECT_MODE_NONE;
    eGfOperationMode = GF_MODE_NORMAL;
    fgSta40mIntolerant = FALSE;
    fgUseShortPreamble = prBssInfo->fgIsShortPreambleAllowed;
    fgUseShortSlotTime = TRUE;
    ucHtOpInfo1 = (UINT_8) CHNL_EXT_SCN;

    prStaList = &prBssInfo->rStaRecOfClientList;

    LINK_FOR_EACH_ENTRY(prStaRec, prStaList, rLinkEntry, STA_RECORD_T) {
        //ASSERT(prStaRec);
        if(!prStaRec){
           DBGLOG(P2P, TRACE, ("prStaRec is NULL in rlmUpdateParamsForAP() \n"));
        	break;
        }
        if (prStaRec->fgIsInUse && prStaRec->ucStaState == STA_STATE_3 &&
            prStaRec->ucNetTypeIndex == prBssInfo->ucNetTypeIndex) {
            if (!(prStaRec->ucPhyTypeSet &
                  (PHY_TYPE_SET_802_11GN | PHY_TYPE_SET_802_11A))) {
                /* B-only mode, so mode 1 (ERP protection) */
                fgErpProtectMode = TRUE;
            }

            if (!(prStaRec->ucPhyTypeSet & PHY_TYPE_SET_802_11N)) {
                /* BG-only or A-only */
                eHtProtectMode = HT_PROTECT_MODE_NON_HT;
            }
            else if (!(prStaRec->u2HtCapInfo & HT_CAP_INFO_SUP_CHNL_WIDTH)) {
                /* 20MHz-only */
				/*
					The HT Protection field may be set to 20 MHz protection
					mode only if the following are true:
					¡X All STAs detected (by any means) in the primary channel
						and all STAs detected (by any means) in	the secondary
						channel are HT STAs and all STAs that are members of
						this BSS are HT STAs, and
					¡X This BSS is a 20/40 MHz BSS, and
					¡X There is at least one 20 MHz HT STA associated with this BSS.
				*/
				if (eHtProtectMode == HT_PROTECT_MODE_NONE &&
					prBssInfo->fgAssoc40mBwAllowed) {
                    eHtProtectMode = HT_PROTECT_MODE_20M;
                }
            }

            if (!(prStaRec->u2HtCapInfo & HT_CAP_INFO_HT_GF)) {
                eGfOperationMode = GF_MODE_PROTECT;
            }

            if (!(prStaRec->u2CapInfo & CAP_INFO_SHORT_PREAMBLE)) {
                fgUseShortPreamble = FALSE;
            }

            if (!(prStaRec->u2CapInfo & CAP_INFO_SHORT_SLOT_TIME)) {
                fgUseShortSlotTime = FALSE;
            }

            if (prStaRec->u2HtCapInfo & HT_CAP_INFO_40M_INTOLERANT) {
                fgSta40mIntolerant = TRUE;
            }
        }
    } /* end of LINK_FOR_EACH_ENTRY */

    /* Check if HT operation IE about 20/40M bandwidth shall be updated */
    if (prBssInfo->eBssSCO != CHNL_EXT_SCN) {
        if (/*!LINK_IS_EMPTY(prStaList) && */ !fgSta40mIntolerant &&
            !prBssInfo->fgObssActionForcedTo20M &&
            !prBssInfo->fgObssBeaconForcedTo20M) {

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

#if CFG_SUPPORT_HOTSPOT_OPTIMIZATION
    prGlueInfo = prAdapter->prGlueInfo;
    if (prGlueInfo->prP2PInfo->u4PsLevel & BITS(8, 15))
        fgErpProtectMode = TRUE;
#endif

    /* Check if any new parameter may be updated */
    if (prBssInfo->fgErpProtectMode != fgErpProtectMode ||
        prBssInfo->eHtProtectMode != eHtProtectMode ||
        prBssInfo->eGfOperationMode != eGfOperationMode ||
        prBssInfo->ucHtOpInfo1 != ucHtOpInfo1 ||
        prBssInfo->fgUseShortPreamble != fgUseShortPreamble ||
        prBssInfo->fgUseShortSlotTime != fgUseShortSlotTime) {

        prBssInfo->fgErpProtectMode = fgErpProtectMode;
        prBssInfo->eHtProtectMode = eHtProtectMode;
        prBssInfo->eGfOperationMode = eGfOperationMode;
        prBssInfo->ucHtOpInfo1 = ucHtOpInfo1;
        prBssInfo->fgUseShortPreamble = fgUseShortPreamble;
        prBssInfo->fgUseShortSlotTime = fgUseShortSlotTime;

        if (fgUseShortSlotTime) {
            prBssInfo->u2CapInfo |= CAP_INFO_SHORT_SLOT_TIME;
        }
        else {
            prBssInfo->u2CapInfo &= ~CAP_INFO_SHORT_SLOT_TIME;
        }

        rlmSyncOperationParams(prAdapter, prBssInfo);
        fgUpdateBeacon = TRUE;
    }

    /* Update Beacon content if related IE content is changed */
    if (fgUpdateBeacon) {
        bssUpdateBeaconContent(prAdapter, prBssInfo->ucNetTypeIndex);
    }
}