Esempio n. 1
0
/*----------------------------------------------------------------------------*/
VOID cnmChMngrAbortPrivilege(P_ADAPTER_T prAdapter, P_MSG_HDR_T prMsgHdr)
{
	P_MSG_CH_ABORT_T prMsgChAbort;
	P_CMD_CH_PRIVILEGE_T prCmdBody;
	WLAN_STATUS rStatus;

	ASSERT(prAdapter);
	ASSERT(prMsgHdr);

	prMsgChAbort = (P_MSG_CH_ABORT_T) prMsgHdr;

	prCmdBody = (P_CMD_CH_PRIVILEGE_T)
	    cnmMemAlloc(prAdapter, RAM_TYPE_BUF, sizeof(CMD_CH_PRIVILEGE_T));
	ASSERT(prCmdBody);

	/* To do: exception handle */
	if (!prCmdBody) {
		DBGLOG(CNM, ERROR, ("ChAbort: fail to get buf (net=%d, token=%d)\n",
				    prMsgChAbort->ucNetTypeIndex, prMsgChAbort->ucTokenID));

		cnmMemFree(prAdapter, prMsgHdr);
		return;
	}

	DBGLOG(CNM, INFO, ("ChAbort net=%d token=%d\n",
			   prMsgChAbort->ucNetTypeIndex, prMsgChAbort->ucTokenID));

	prCmdBody->ucNetTypeIndex = prMsgChAbort->ucNetTypeIndex;
	prCmdBody->ucTokenID = prMsgChAbort->ucTokenID;
	prCmdBody->ucAction = CMD_CH_ACTION_ABORT;	/* Abort */

	ASSERT(prCmdBody->ucNetTypeIndex < NETWORK_TYPE_INDEX_NUM);

	/* For monkey testing 20110901 */
	if (prCmdBody->ucNetTypeIndex >= NETWORK_TYPE_INDEX_NUM) {
		DBGLOG(CNM, ERROR, ("CNM: ChAbort with wrong netIdx=%d\n\n",
				    prCmdBody->ucNetTypeIndex));
	}

	rStatus = wlanSendSetQueryCmd(prAdapter,	/* prAdapter */
				      CMD_ID_CH_PRIVILEGE,	/* ucCID */
				      TRUE,	/* fgSetQuery */
				      FALSE,	/* fgNeedResp */
				      FALSE,	/* fgIsOid */
				      NULL,	/* pfCmdDoneHandler */
				      NULL,	/* pfCmdTimeoutHandler */
				      sizeof(CMD_CH_PRIVILEGE_T),	/* u4SetQueryInfoLen */
				      (PUINT_8) prCmdBody,	/* pucInfoBuffer */
				      NULL,	/* pvSetQueryBuffer */
				      0	/* u4SetQueryBufferLen */
	    );

	ASSERT(rStatus == WLAN_STATUS_PENDING);

	cnmMemFree(prAdapter, prCmdBody);
	cnmMemFree(prAdapter, prMsgHdr);

	return;
}				/* end of cnmChMngrAbortPrivilege() */
Esempio n. 2
0
/*----------------------------------------------------------------------------*/
VOID aaaFsmRunEventStart(IN P_MSG_HDR_T prMsgHdr)
{
	P_MSG_SAA_JOIN_REQ_T prJoinReqMsg;
	P_STA_RECORD_T prStaRec;
	P_AIS_BSS_INFO_T prAisBssInfo;


	ASSERT(prMsgHdr);

	prJoinReqMsg = (P_MSG_SAA_JOIN_REQ_T) prMsgHdr;
	prStaRec = prJoinReqMsg->prStaRec;

	ASSERT(prStaRec);

	DBGLOG(SAA, LOUD, ("EVENT-START: Trigger SAA FSM\n"));

	cnmMemFree(prMsgHdr);

	/* 4 <1> Validation of SAA Start Event */
	if (!IS_AP_STA(prStaRec->eStaType)) {

		DBGLOG(SAA, ERROR,
		       ("EVENT-START: STA Type - %d was not supported.\n", prStaRec->eStaType));

		/* Ignore the return value because don't care the prSwRfb */
		saaFsmSendEventJoinComplete(WLAN_STATUS_FAILURE, prStaRec, NULL);

		return;
	}
	/* 4 <2> The previous JOIN process is not completed ? */
	if (prStaRec->eAuthAssocState != AA_STATE_IDLE) {
		DBGLOG(SAA, ERROR, ("EVENT-START: Reentry of SAA Module.\n"));
		prStaRec->eAuthAssocState = AA_STATE_IDLE;
	}
	/* 4 <3> Reset Status Code and Time */
	/* Update Station Record - Status/Reason Code */
	prStaRec->u2StatusCode = STATUS_CODE_SUCCESSFUL;

	/* Update the record join time. */
	GET_CURRENT_SYSTIME(&prStaRec->rLastJoinTime);

	prStaRec->ucTxAuthAssocRetryCount = 0;

	if (prStaRec->prChallengeText) {
		cnmMemFree(prStaRec->prChallengeText);
		prStaRec->prChallengeText = (P_IE_CHALLENGE_TEXT_T) NULL;
	}

	cnmTimerStopTimer(&prStaRec->rTxReqDoneOrRxRespTimer);

	prStaRec->ucStaState = STA_STATE_1;

	/* Trigger SAA MODULE */
	saaFsmSteps(prStaRec, SAA_STATE_SEND_AUTH1, (P_SW_RFB_T) NULL);

	return;
}				/* end of saaFsmRunEventStart() */
Esempio n. 3
0
/*----------------------------------------------------------------------------*/
VOID
cmdBufFreeCmdInfo (
    IN P_ADAPTER_T  prAdapter,
    IN P_CMD_INFO_T prCmdInfo
    )
{
    KAL_SPIN_LOCK_DECLARATION();

    DEBUGFUNC("cmdBufFreeCmdInfo");


    ASSERT(prAdapter);
    ASSERT(prCmdInfo);

    if (prCmdInfo) {
        if (prCmdInfo->pucInfoBuffer) {
            cnmMemFree(prAdapter, prCmdInfo->pucInfoBuffer);
            prCmdInfo->pucInfoBuffer = NULL;
        }

        KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_RESOURCE);
        QUEUE_INSERT_TAIL(&prAdapter->rFreeCmdList, &prCmdInfo->rQueEntry);
        KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_RESOURCE);
    }

    return;

} /* end of cmdBufFreeCmdPacket() */
Esempio n. 4
0
/*----------------------------------------------------------------------------*/
VOID
mboxDestroy (
    IN P_ADAPTER_T prAdapter
    )
{
    P_MBOX_T        prMbox;
    P_MSG_HDR_T     prMsg;
    UINT_8          i;
    KAL_SPIN_LOCK_DECLARATION();

    ASSERT(prAdapter);

    for (i = 0; i < MBOX_ID_TOTAL_NUM; i++) {
        prMbox = &(prAdapter->arMbox[i]);

        while (!LINK_IS_EMPTY(&prMbox->rLinkHead) ) {
            KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_MAILBOX);
            LINK_REMOVE_HEAD(&prMbox->rLinkHead, prMsg, P_MSG_HDR_T);
            KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_MAILBOX);

            ASSERT(prMsg);
            cnmMemFree(prAdapter, prMsg);
        }
    }
}
/*----------------------------------------------------------------------------*/
VOID
cnmMgtPktFree (
    P_ADAPTER_T     prAdapter,
    P_MSDU_INFO_T   prMsduInfo
    )
{
    P_QUE_T         prQueList;
    KAL_SPIN_LOCK_DECLARATION();

    ASSERT(prAdapter);
    ASSERT(prMsduInfo);

    prQueList = &prAdapter->rTxCtrl.rFreeMsduInfoList;

    ASSERT(prMsduInfo->prPacket);
    if (prMsduInfo->prPacket) {
        cnmMemFree(prAdapter, prMsduInfo->prPacket);
        prMsduInfo->prPacket = NULL;
    }

    KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_MSDU_INFO_LIST);
    //added by zhaoyun.wu for 438323,438318,438313 mtk_patch 2015.7.24 begin
    prMsduInfo->fgIsBasicRate = FALSE; //add this line
    //added by zhaoyun.wu for 438323,438318,438313 mtk_patch 2015.7.24 end
    QUEUE_INSERT_TAIL(prQueList, &prMsduInfo->rQueEntry)
    KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_MSDU_INFO_LIST);
}
Esempio n. 6
0
/*----------------------------------------------------------------------------*/
VOID mboxDummy(IN P_ADAPTER_T prAdapter, IN P_MSG_HDR_T prMsgHdr)
{
	ASSERT(prAdapter);

	cnmMemFree(prAdapter, prMsgHdr);

	return;
}
Esempio n. 7
0
/*----------------------------------------------------------------------------*/
VOID cnmChMngrHandleChEvent(P_ADAPTER_T prAdapter, P_WIFI_EVENT_T prEvent)
{
	P_EVENT_CH_PRIVILEGE_T prEventBody;
	P_MSG_CH_GRANT_T prChResp;

	ASSERT(prAdapter);
	ASSERT(prEvent);

	prEventBody = (P_EVENT_CH_PRIVILEGE_T) (prEvent->aucBuffer);
	prChResp = (P_MSG_CH_GRANT_T)
	    cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_CH_GRANT_T));
	ASSERT(prChResp);

	/* To do: exception handle */
	if (!prChResp) {
		DBGLOG(CNM, ERROR, ("ChGrant: fail to get buf (net=%d, token=%d)\n",
				    prEventBody->ucNetTypeIndex, prEventBody->ucTokenID));

		return;
	}

	DBGLOG(CNM, INFO, ("ChGrant net=%d token=%d ch=%d sco=%d\n",
			   prEventBody->ucNetTypeIndex, prEventBody->ucTokenID,
			   prEventBody->ucPrimaryChannel, prEventBody->ucRfSco));

	ASSERT(prEventBody->ucNetTypeIndex < NETWORK_TYPE_INDEX_NUM);
	ASSERT(prEventBody->ucStatus == EVENT_CH_STATUS_GRANT);

	/* Decide message ID based on network and response status */
	if (prEventBody->ucNetTypeIndex == NETWORK_TYPE_AIS_INDEX) {
		prChResp->rMsgHdr.eMsgId = MID_CNM_AIS_CH_GRANT;
	}
#if CFG_ENABLE_WIFI_DIRECT
	else if ((prAdapter->fgIsP2PRegistered) &&
		 (prEventBody->ucNetTypeIndex == NETWORK_TYPE_P2P_INDEX)) {
		prChResp->rMsgHdr.eMsgId = MID_CNM_P2P_CH_GRANT;
	}
#endif
#if CFG_ENABLE_BT_OVER_WIFI
	else if (prEventBody->ucNetTypeIndex == NETWORK_TYPE_BOW_INDEX) {
		prChResp->rMsgHdr.eMsgId = MID_CNM_BOW_CH_GRANT;
	}
#endif
	else {
		cnmMemFree(prAdapter, prChResp);
		return;
	}

	prChResp->ucNetTypeIndex = prEventBody->ucNetTypeIndex;
	prChResp->ucTokenID = prEventBody->ucTokenID;
	prChResp->ucPrimaryChannel = prEventBody->ucPrimaryChannel;
	prChResp->eRfSco = (ENUM_CHNL_EXT_T) prEventBody->ucRfSco;
	prChResp->eRfBand = (ENUM_BAND_T) prEventBody->ucRfBand;
	prChResp->eReqType = (ENUM_CH_REQ_TYPE_T) prEventBody->ucReqType;
	prChResp->u4GrantInterval = prEventBody->u4GrantInterval;

	mboxSendMsg(prAdapter, MBOX_ID_0, (P_MSG_HDR_T) prChResp, MSG_SEND_METHOD_BUF);
}
Esempio n. 8
0
/*----------------------------------------------------------------------------*/
VOID rlmDomainSendCmd(P_ADAPTER_T prAdapter, BOOLEAN fgIsOid)
{
	P_DOMAIN_INFO_ENTRY prDomainInfo;
	P_CMD_SET_DOMAIN_INFO_T prCmd;
	WLAN_STATUS rStatus;
	UINT_8 i;
	P_DOMAIN_SUBBAND_INFO prSubBand;

	prDomainInfo = rlmDomainGetDomainInfo(prAdapter);
	ASSERT(prDomainInfo);

	prCmd = cnmMemAlloc(prAdapter, RAM_TYPE_BUF, sizeof(CMD_SET_DOMAIN_INFO_T));
	ASSERT(prCmd);

	/* To do: exception handle */
	if (!prCmd) {
		DBGLOG(RLM, ERROR, ("Domain: no buf to send cmd\n"));
		return;
	}
	kalMemZero(prCmd, sizeof(CMD_SET_DOMAIN_INFO_T));

	prCmd->u2CountryCode = prAdapter->rWifiVar.rConnSettings.u2CountryCode;
	prCmd->u2Reserved = 0;
	prCmd->uc2G4Bandwidth = prAdapter->rWifiVar.rConnSettings.uc2G4BandwidthMode;
	prCmd->uc5GBandwidth = prAdapter->rWifiVar.rConnSettings.uc5GBandwidthMode;

	for (i = 0; i < 6; i++) {
		prSubBand = &prDomainInfo->rSubBand[i];

		prCmd->rSubBand[i].ucRegClass = prSubBand->ucRegClass;
		prCmd->rSubBand[i].ucBand = prSubBand->ucBand;

		if (prSubBand->ucBand != BAND_NULL && prSubBand->ucBand < BAND_NUM) {
			prCmd->rSubBand[i].ucChannelSpan = prSubBand->ucChannelSpan;
			prCmd->rSubBand[i].ucFirstChannelNum = prSubBand->ucFirstChannelNum;
			prCmd->rSubBand[i].ucNumChannels = prSubBand->ucNumChannels;
		}
	}

	/* Update domain info to chip */
	rStatus = wlanSendSetQueryCmd(prAdapter,	/* prAdapter */
				      CMD_ID_SET_DOMAIN_INFO,	/* ucCID */
				      TRUE,	/* fgSetQuery */
				      FALSE,	/* fgNeedResp */
				      fgIsOid,	/* fgIsOid */
				      NULL,	/* pfCmdDoneHandler */
				      NULL,	/* pfCmdTimeoutHandler */
				      sizeof(CMD_SET_DOMAIN_INFO_T),	/* u4SetQueryInfoLen */
				      (PUINT_8) prCmd,	/* pucInfoBuffer */
				      NULL,	/* pvSetQueryBuffer */
				      0	/* u4SetQueryBufferLen */
	    );

	ASSERT(rStatus == WLAN_STATUS_PENDING);

	cnmMemFree(prAdapter, prCmd);
}
BOOLEAN
p2pDevStateInit_REQING_CHANNEL (
    IN P_ADAPTER_T prAdapter,
    IN UINT_8 ucBssIdx,
    IN P_P2P_CHNL_REQ_INFO_T prChnlReqInfo,
    OUT P_ENUM_P2P_DEV_STATE_T peNextState
    )
{
    BOOLEAN fgIsTransition = FALSE;
    P_MSG_P2P_CHNL_REQUEST_T prP2pMsgChnlReq = (P_MSG_P2P_CHNL_REQUEST_T)NULL;

    do {
        ASSERT_BREAK((prAdapter != NULL) && 
                    (prChnlReqInfo != NULL) &&
                    (peNextState != NULL));

        if (LINK_IS_EMPTY(&(prChnlReqInfo->rP2pChnlReqLink))) {
            /* NO Channel Request Pending. */
            DBGLOG(P2P, ERROR, ("NO Pending Channel Request, but enter Req Channel State\n"));
            fgIsTransition = TRUE;
            *peNextState = P2P_DEV_STATE_IDLE;
            break;
        }


        LINK_REMOVE_HEAD(&(prChnlReqInfo->rP2pChnlReqLink),
                        prP2pMsgChnlReq,
                        P_MSG_P2P_CHNL_REQUEST_T);

        ASSERT(prP2pMsgChnlReq);

        prChnlReqInfo->u4MaxInterval = prP2pMsgChnlReq->u4Duration;
        prChnlReqInfo->ucReqChnlNum = prP2pMsgChnlReq->rChannelInfo.ucChannelNum;
        prChnlReqInfo->eChnlSco = prP2pMsgChnlReq->eChnlSco;
        prChnlReqInfo->eBand = prP2pMsgChnlReq->rChannelInfo.eBand;
        prChnlReqInfo->u8Cookie = prP2pMsgChnlReq->u8Cookie;
        prChnlReqInfo->eChnlReqType = prP2pMsgChnlReq->eChnlReqType;
        prChnlReqInfo->eChannelWidth = CW_20_40MHZ;
        prChnlReqInfo->ucCenterFreqS1 = 0;
        prChnlReqInfo->ucCenterFreqS2 = 0;
        
        p2pFuncAcquireCh(prAdapter,
                    ucBssIdx,
                    prChnlReqInfo);
    } while (FALSE);

    if (prP2pMsgChnlReq) {
        cnmMemFree(prAdapter, prP2pMsgChnlReq);
    }

    return fgIsTransition;
} /* p2pDevStateInit_REQING_CHANNEL */
Esempio n. 10
0
/*----------------------------------------------------------------------------*/
VOID
authHandleIEChallengeText (
    P_ADAPTER_T prAdapter,
    P_SW_RFB_T prSwRfb,
    P_IE_HDR_T prIEHdr
    )
{
    P_WLAN_AUTH_FRAME_T prAuthFrame;
    P_STA_RECORD_T prStaRec;
    UINT_16 u2TransactionSeqNum;


    ASSERT(prSwRfb);
    ASSERT(prIEHdr);

    prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx);
    ASSERT(prStaRec);

    if(!prStaRec) {
        return;
    }

    /* For Management, frame header and payload are in a continuous buffer */
    prAuthFrame = (P_WLAN_AUTH_FRAME_T)prSwRfb->pvHeader;

    //WLAN_GET_FIELD_16(&prAuthFrame->u2AuthTransSeqNo, &u2TransactionSeqNum)
    u2TransactionSeqNum = prAuthFrame->u2AuthTransSeqNo; // NOTE(Kevin): Optimized for ARM

    /* Only consider SEQ_2 for Challenge Text */
    if ((u2TransactionSeqNum == AUTH_TRANSACTION_SEQ_2) &&
        (prStaRec->ucAuthAlgNum == AUTH_ALGORITHM_NUM_SHARED_KEY)) {

        /* Free previous allocated TCM memory */
        if (prStaRec->prChallengeText) {
            ASSERT(0);
            cnmMemFree(prAdapter, prStaRec->prChallengeText);
            prStaRec->prChallengeText = (P_IE_CHALLENGE_TEXT_T)NULL;
        }

        if ( ( prStaRec->prChallengeText = cnmMemAlloc(prAdapter, RAM_TYPE_MSG, IE_SIZE(prIEHdr)) ) == NULL) {
            return;
        }

        /* Save the Challenge Text from Auth Seq 2 Frame, before sending Auth Seq 3 Frame */
        COPY_IE(prStaRec->prChallengeText, prIEHdr);
    }

    return;

} /* end of authAddIEChallengeText() */
Esempio n. 11
0
/*----------------------------------------------------------------------------*/
VOID cnmMgtPktFree(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo)
{
    P_QUE_T prQueList;

    KAL_SPIN_LOCK_DECLARATION();

    ASSERT(prAdapter);
    ASSERT(prMsduInfo);

    prQueList = &prAdapter->rTxCtrl.rFreeMsduInfoList;

    ASSERT(prMsduInfo->prPacket);
    if (prMsduInfo->prPacket) {
        cnmMemFree(prAdapter, prMsduInfo->prPacket);
        prMsduInfo->prPacket = NULL;
    }

    KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_MSDU_INFO_LIST);
    QUEUE_INSERT_TAIL(prQueList, &prMsduInfo->rQueEntry)
    KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_MSDU_INFO_LIST);
}
Esempio n. 12
0
/*----------------------------------------------------------------------------*/
VOID
rlmObssScanDone (
    P_ADAPTER_T prAdapter,
    P_MSG_HDR_T prMsgHdr
    )
{
    P_MSG_SCN_SCAN_DONE             prScanDoneMsg;
    P_BSS_INFO_T                    prBssInfo;
    P_MSDU_INFO_T                   prMsduInfo;
    P_ACTION_20_40_COEXIST_FRAME    prTxFrame;
    UINT_16                         i, u2PayloadLen;

    ASSERT(prMsgHdr);

    prScanDoneMsg = (P_MSG_SCN_SCAN_DONE) prMsgHdr;
    prBssInfo = &prAdapter->rWifiVar.arBssInfo[prScanDoneMsg->ucNetTypeIndex];
    ASSERT(prBssInfo);

    DBGLOG(RLM, INFO, ("OBSS Scan Done (NetIdx=%d, Mode=%d)\n",
        prScanDoneMsg->ucNetTypeIndex, prBssInfo->eCurrentOPMode));

    cnmMemFree(prAdapter, prMsgHdr);

#if CFG_ENABLE_WIFI_DIRECT
    /* AP mode */
    if ((prAdapter->fgIsP2PRegistered) &&
        (IS_NET_ACTIVE(prAdapter, prBssInfo->ucNetTypeIndex)) &&
        (prBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT)) {
        return;
    }
#endif

    /* STA mode */
    if (prBssInfo->eCurrentOPMode != OP_MODE_INFRASTRUCTURE ||
        !RLM_NET_PARAM_VALID(prBssInfo) || prBssInfo->u2ObssScanInterval == 0) {
        DBGLOG(RLM, WARN, ("OBSS Scan Done (NetIdx=%d) -- Aborted!!\n",
            prBssInfo->ucNetTypeIndex));
        return;
    }

    /* To do: check 2.4G channel list to decide if obss mgmt should be
     *        sent to associated AP. Note: how to handle concurrent network?
     * To do: invoke rlmObssChnlLevel() to decide if 20/40 BSS coexistence
     *        management frame is needed.
     */
    if ((prBssInfo->auc2G_20mReqChnlList[0] > 0 ||
         prBssInfo->auc2G_NonHtChnlList[0] > 0) &&
        (prMsduInfo = (P_MSDU_INFO_T) cnmMgtPktAlloc(prAdapter,
                      MAC_TX_RESERVED_FIELD + PUBLIC_ACTION_MAX_LEN)) != NULL) {

        DBGLOG(RLM, INFO, ("Send 20/40 coexistence mgmt(20mReq=%d, NonHt=%d)\n",
            prBssInfo->auc2G_20mReqChnlList[0],
            prBssInfo->auc2G_NonHtChnlList[0]));

        prTxFrame = (P_ACTION_20_40_COEXIST_FRAME)
            ((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD);

        prTxFrame->u2FrameCtrl = MAC_FRAME_ACTION;
        COPY_MAC_ADDR(prTxFrame->aucDestAddr, prBssInfo->aucBSSID);
        COPY_MAC_ADDR(prTxFrame->aucSrcAddr, prBssInfo->aucOwnMacAddr);
        COPY_MAC_ADDR(prTxFrame->aucBSSID, prBssInfo->aucBSSID);

        prTxFrame->ucCategory = CATEGORY_PUBLIC_ACTION;
        prTxFrame->ucAction = ACTION_PUBLIC_20_40_COEXIST;

        /* To do: find correct algorithm */
        prTxFrame->rBssCoexist.ucId = ELEM_ID_20_40_BSS_COEXISTENCE;
        prTxFrame->rBssCoexist.ucLength = 1;
        prTxFrame->rBssCoexist.ucData =
            (prBssInfo->auc2G_20mReqChnlList[0] > 0) ? BSS_COEXIST_20M_REQ : 0;

        u2PayloadLen = 2 + 3;

        if (prBssInfo->auc2G_NonHtChnlList[0] > 0) {
            ASSERT(prBssInfo->auc2G_NonHtChnlList[0] <= CHNL_LIST_SZ_2G);

            prTxFrame->rChnlReport.ucId = ELEM_ID_20_40_INTOLERANT_CHNL_REPORT;
            prTxFrame->rChnlReport.ucLength =
                prBssInfo->auc2G_NonHtChnlList[0] + 1;
            prTxFrame->rChnlReport.ucRegulatoryClass = 81; /* 2.4GHz, ch1~13 */
            for (i = 0; i < prBssInfo->auc2G_NonHtChnlList[0] &&
                 i < CHNL_LIST_SZ_2G; i++) {
                prTxFrame->rChnlReport.aucChannelList[i] =
                    prBssInfo->auc2G_NonHtChnlList[i+1];
            }

            u2PayloadLen += IE_SIZE(&prTxFrame->rChnlReport);
        }
        ASSERT((WLAN_MAC_HEADER_LEN + u2PayloadLen) <= PUBLIC_ACTION_MAX_LEN);

        /* Clear up channel lists in 2.4G band */
        prBssInfo->auc2G_20mReqChnlList[0] = 0;
        prBssInfo->auc2G_NonHtChnlList[0] = 0;


        //4 Update information of MSDU_INFO_T
        prMsduInfo->ucPacketType = HIF_TX_PACKET_TYPE_MGMT;   /* Management frame */
        prMsduInfo->ucStaRecIndex = prBssInfo->prStaRecOfAP->ucIndex;
        prMsduInfo->ucNetworkType = prBssInfo->ucNetTypeIndex;
        prMsduInfo->ucMacHeaderLength = WLAN_MAC_MGMT_HEADER_LEN;
        prMsduInfo->fgIs802_1x = FALSE;
        prMsduInfo->fgIs802_11 = TRUE;
        prMsduInfo->u2FrameLength = WLAN_MAC_MGMT_HEADER_LEN + u2PayloadLen;
        prMsduInfo->ucTxSeqNum = nicIncreaseTxSeqNum(prAdapter);
        prMsduInfo->pfTxDoneHandler = NULL;
        prMsduInfo->fgIsBasicRate = FALSE;

        //4 Enqueue the frame to send this action frame.
        nicTxEnqueueMsdu(prAdapter, prMsduInfo);
    } /* end of prMsduInfo != NULL */

    if (prBssInfo->u2ObssScanInterval > 0) {
        DBGLOG(RLM, INFO, ("Set OBSS timer (NetIdx=%d, %d sec)\n",
            prBssInfo->ucNetTypeIndex, prBssInfo->u2ObssScanInterval));

        cnmTimerStartTimer(prAdapter, &prBssInfo->rObssScanTimer,
            prBssInfo->u2ObssScanInterval * MSEC_PER_SEC);
    }
}
Esempio n. 13
0
/*----------------------------------------------------------------------------*/
VOID cnmChMngrRequestPrivilege(P_ADAPTER_T prAdapter, P_MSG_HDR_T prMsgHdr)
{
	P_MSG_CH_REQ_T prMsgChReq;
	P_CMD_CH_PRIVILEGE_T prCmdBody;
	WLAN_STATUS rStatus;

	ASSERT(prAdapter);
	ASSERT(prMsgHdr);

	prMsgChReq = (P_MSG_CH_REQ_T) prMsgHdr;

	prCmdBody = (P_CMD_CH_PRIVILEGE_T)
	    cnmMemAlloc(prAdapter, RAM_TYPE_BUF, sizeof(CMD_CH_PRIVILEGE_T));
	ASSERT(prCmdBody);

	/* To do: exception handle */
	if (!prCmdBody) {
		DBGLOG(CNM, ERROR, ("ChReq: fail to get buf (net=%d, token=%d)\n",
				    prMsgChReq->ucNetTypeIndex, prMsgChReq->ucTokenID));

		cnmMemFree(prAdapter, prMsgHdr);
		return;
	}

	DBGLOG(CNM, INFO, ("ChReq net=%d token=%d b=%d c=%d s=%d\n",
			   prMsgChReq->ucNetTypeIndex, prMsgChReq->ucTokenID,
			   prMsgChReq->eRfBand, prMsgChReq->ucPrimaryChannel, prMsgChReq->eRfSco));

	prCmdBody->ucNetTypeIndex = prMsgChReq->ucNetTypeIndex;
	prCmdBody->ucTokenID = prMsgChReq->ucTokenID;
	prCmdBody->ucAction = CMD_CH_ACTION_REQ;	/* Request */
	prCmdBody->ucPrimaryChannel = prMsgChReq->ucPrimaryChannel;
	prCmdBody->ucRfSco = (UINT_8) prMsgChReq->eRfSco;
	prCmdBody->ucRfBand = (UINT_8) prMsgChReq->eRfBand;
	prCmdBody->ucReqType = (UINT_8) prMsgChReq->eReqType;
	prCmdBody->ucReserved = 0;
	prCmdBody->u4MaxInterval = prMsgChReq->u4MaxInterval;
	COPY_MAC_ADDR(prCmdBody->aucBSSID, prMsgChReq->aucBSSID);

	ASSERT(prCmdBody->ucNetTypeIndex < NETWORK_TYPE_INDEX_NUM);

	/* For monkey testing 20110901 */
	if (prCmdBody->ucNetTypeIndex >= NETWORK_TYPE_INDEX_NUM) {
		DBGLOG(CNM, ERROR, ("CNM: ChReq with wrong netIdx=%d\n\n",
				    prCmdBody->ucNetTypeIndex));
	}

	rStatus = wlanSendSetQueryCmd(prAdapter,	/* prAdapter */
				      CMD_ID_CH_PRIVILEGE,	/* ucCID */
				      TRUE,	/* fgSetQuery */
				      FALSE,	/* fgNeedResp */
				      FALSE,	/* fgIsOid */
				      NULL,	/* pfCmdDoneHandler */
				      NULL,	/* pfCmdTimeoutHandler */
				      sizeof(CMD_CH_PRIVILEGE_T),	/* u4SetQueryInfoLen */
				      (PUINT_8) prCmdBody,	/* pucInfoBuffer */
				      NULL,	/* pvSetQueryBuffer */
				      0	/* u4SetQueryBufferLen */
	    );

	ASSERT(rStatus == WLAN_STATUS_PENDING);

	cnmMemFree(prAdapter, prCmdBody);
	cnmMemFree(prAdapter, prMsgHdr);

	return;
}				/* end of cnmChMngrRequestPrivilege() */
Esempio n. 14
0
/*----------------------------------------------------------------------------*/
VOID
cnmChMngrHandleChEvent (
    P_ADAPTER_T     prAdapter,
    P_WIFI_EVENT_T  prEvent
    )
{
    P_EVENT_CH_PRIVILEGE_T  prEventBody;
    P_MSG_CH_GRANT_T        prChResp;
    P_BSS_INFO_T            prBssInfo;
    P_CNM_INFO_T            prCnmInfo;

    ASSERT(prAdapter);
    ASSERT(prEvent);

    prEventBody = (P_EVENT_CH_PRIVILEGE_T) (prEvent->aucBuffer);
    prChResp = (P_MSG_CH_GRANT_T)
                cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_CH_GRANT_T));
    ASSERT(prChResp);

    /* To do: exception handle */
    if (!prChResp) {
        DBGLOG(CNM, ERROR, ("ChGrant: fail to get buf (net=%d, token=%d)\n",
            prEventBody->ucBssIndex, prEventBody->ucTokenID));

        return;
    }

    DBGLOG(CNM, INFO, ("ChGrant net=%d token=%d ch=%d sco=%d\n",
        prEventBody->ucBssIndex, prEventBody->ucTokenID,
        prEventBody->ucPrimaryChannel, prEventBody->ucRfSco));

    ASSERT(prEventBody->ucBssIndex <= MAX_BSS_INDEX);
    ASSERT(prEventBody->ucStatus == EVENT_CH_STATUS_GRANT);

    prBssInfo = prAdapter->aprBssInfo[prEventBody->ucBssIndex];

    /* Decide message ID based on network and response status */
    if (IS_BSS_AIS(prBssInfo)) {
        prChResp->rMsgHdr.eMsgId = MID_CNM_AIS_CH_GRANT;
    }
#if CFG_ENABLE_WIFI_DIRECT
    else if (prAdapter->fgIsP2PRegistered && IS_BSS_P2P(prBssInfo)) {
        prChResp->rMsgHdr.eMsgId = MID_CNM_P2P_CH_GRANT;
    }
#endif
#if CFG_ENABLE_BT_OVER_WIFI
    else if (IS_BSS_BOW(prBssInfo)) {
        prChResp->rMsgHdr.eMsgId = MID_CNM_BOW_CH_GRANT;
    }
#endif
    else {
        cnmMemFree(prAdapter, prChResp);
        return;
    }

    prChResp->ucBssIndex = prEventBody->ucBssIndex;
    prChResp->ucTokenID = prEventBody->ucTokenID;
    prChResp->ucPrimaryChannel = prEventBody->ucPrimaryChannel;
    prChResp->eRfSco = (ENUM_CHNL_EXT_T) prEventBody->ucRfSco;
    prChResp->eRfBand = (ENUM_BAND_T) prEventBody->ucRfBand;
    prChResp->eRfChannelWidth =
            (ENUM_CHANNEL_WIDTH_T) prEventBody->ucRfChannelWidth;
    prChResp->ucRfCenterFreqSeg1 = prEventBody->ucRfCenterFreqSeg1;
    prChResp->ucRfCenterFreqSeg2 = prEventBody->ucRfCenterFreqSeg2;
    prChResp->eReqType = (ENUM_CH_REQ_TYPE_T) prEventBody->ucReqType;
    prChResp->u4GrantInterval = prEventBody->u4GrantInterval;

    mboxSendMsg(prAdapter,
                MBOX_ID_0,
                (P_MSG_HDR_T) prChResp,
                MSG_SEND_METHOD_BUF);

    /* Record current granted BSS for TXM's reference */
    prCnmInfo = &prAdapter->rCnmInfo;
    prCnmInfo->ucBssIndex = prEventBody->ucBssIndex;
    prCnmInfo->ucTokenID = prEventBody->ucTokenID;
    prCnmInfo->fgChGranted = TRUE;
}
Esempio n. 15
0
VOID rlmDomainPassiveScanSendCmd(    
	P_ADAPTER_T     prAdapter, 
    BOOLEAN         fgIsOid	
)
{
    P_DOMAIN_INFO_ENTRY     prDomainInfo;
	P_CMD_SET_DOMAIN_INFO_T prCmd;
    WLAN_STATUS             rStatus;
    P_DOMAIN_SUBBAND_INFO   prSubBand;
    UINT_8                  i;	


	prCmd = cnmMemAlloc(prAdapter, RAM_TYPE_BUF, sizeof(CMD_SET_DOMAIN_INFO_T));
   	ASSERT(prCmd);


	/* To do: exception handle */
	if (!prCmd) {
	   DBGLOG(RLM, ERROR, ("Domain: no buf to send cmd\n"));
	   return;
	}
	kalMemZero(prCmd, sizeof(CMD_SET_DOMAIN_INFO_T));

	prCmd->u2CountryCode = prAdapter->rWifiVar.rConnSettings.u2CountryCode;
	prCmd->u2IsSetPassiveScan = 1;
	prCmd->uc2G4Bandwidth = prAdapter->rWifiVar.rConnSettings.uc2G4BandwidthMode;
	prCmd->uc5GBandwidth = prAdapter->rWifiVar.rConnSettings.uc5GBandwidthMode;
	prCmd->aucReserved[0] = 0;
	prCmd->aucReserved[1] = 0;


	DBGLOG(RLM, INFO, ("rlmDomainPassiveScanSendCmd(), CountryCode = %x\n", prAdapter->rWifiVar.rConnSettings.u2CountryCode));

	if (prAdapter->rWifiVar.rConnSettings.u2CountryCode == COUNTRY_CODE_UDF){
		prDomainInfo = &arSupportedRegDomains_Passive[REG_DOMAIN_PASSIVE_UDF_IDX];
	}
	else{
		prDomainInfo = &arSupportedRegDomains_Passive[REG_DOMAIN_PASSIVE_DEF_IDX];
	}

	for (i = 0; i < 6; i++) {
	   prSubBand = &prDomainInfo->rSubBand[i];

	   prCmd->rSubBand[i].ucRegClass = prSubBand->ucRegClass;
	   prCmd->rSubBand[i].ucBand = prSubBand->ucBand;

	   if (prSubBand->ucBand != BAND_NULL && prSubBand->ucBand < BAND_NUM) {
		   prCmd->rSubBand[i].ucChannelSpan = prSubBand->ucChannelSpan;
		   prCmd->rSubBand[i].ucFirstChannelNum = prSubBand->ucFirstChannelNum;
		   prCmd->rSubBand[i].ucNumChannels = prSubBand->ucNumChannels;
	   }
	}

	rStatus = wlanSendSetQueryCmd (
				prAdapter,					/* prAdapter */
				CMD_ID_SET_DOMAIN_INFO, 	/* ucCID */
				TRUE,						/* fgSetQuery */
				FALSE,						/* fgNeedResp */
				fgIsOid,					/* fgIsOid */
				NULL,						/* pfCmdDoneHandler*/
				NULL,						/* pfCmdTimeoutHandler */
				sizeof(CMD_SET_DOMAIN_INFO_T),	  /* u4SetQueryInfoLen */
				(PUINT_8) prCmd,			/* pucInfoBuffer */
				NULL,						/* pvSetQueryBuffer */
				0							/* u4SetQueryBufferLen */
				);

	ASSERT(rStatus == WLAN_STATUS_PENDING);

	cnmMemFree(prAdapter, prCmd);			
}
Esempio n. 16
0
/*----------------------------------------------------------------------------*/
VOID
rlmDomainSendCmd (
    P_ADAPTER_T     prAdapter,
    BOOLEAN         fgIsOid
    )
{
    P_DOMAIN_INFO_ENTRY     prDomainInfo;
    P_CMD_SET_DOMAIN_INFO_T prCmd;
    WLAN_STATUS             rStatus;
    P_DOMAIN_SUBBAND_INFO   prSubBand;
    UINT_8                  i;	


    prDomainInfo = rlmDomainGetDomainInfo(prAdapter);
    ASSERT(prDomainInfo);

    prCmd = cnmMemAlloc(prAdapter, RAM_TYPE_BUF, sizeof(CMD_SET_DOMAIN_INFO_T));
    ASSERT(prCmd);

    /* To do: exception handle */
    if (!prCmd) {
        DBGLOG(RLM, ERROR, ("Domain: no buf to send cmd\n"));
        return;
    }
    kalMemZero(prCmd, sizeof(CMD_SET_DOMAIN_INFO_T));

    /* previous country code == FF : ignore country code,  current country code == FE : resume */    
    if(prAdapter->rWifiVar.rConnSettings.u2CountryCodeBakup == COUNTRY_CODE_FF){
        if (prAdapter->rWifiVar.rConnSettings.u2CountryCode != COUNTRY_CODE_FE){
            DBGLOG(RLM, INFO, ("Domain: skip country code cmd (0x%x)\n",prAdapter->rWifiVar.rConnSettings.u2CountryCode));            
            return;
        }else{
            DBGLOG(RLM, INFO, ("Domain: disable skip country code cmd (0x%x)\n",prAdapter->rWifiVar.rConnSettings.u2CountryCode));            
        }
    }
        
    prAdapter->rWifiVar.rConnSettings.u2CountryCodeBakup = prAdapter->rWifiVar.rConnSettings.u2CountryCode;
    DBGLOG(RLM, INFO, ("Domain: country code backup %x \n",prAdapter->rWifiVar.rConnSettings.u2CountryCodeBakup));

    prCmd->u2CountryCode = prAdapter->rWifiVar.rConnSettings.u2CountryCode;
    prCmd->u2IsSetPassiveScan = 0;
    prCmd->uc2G4Bandwidth = prAdapter->rWifiVar.rConnSettings.uc2G4BandwidthMode;
    prCmd->uc5GBandwidth = prAdapter->rWifiVar.rConnSettings.uc5GBandwidthMode;
	prCmd->aucReserved[0] = 0;
	prCmd->aucReserved[1] = 0;	

    for (i = 0; i < 6; i++) {
        prSubBand = &prDomainInfo->rSubBand[i];

        prCmd->rSubBand[i].ucRegClass = prSubBand->ucRegClass;
        prCmd->rSubBand[i].ucBand = prSubBand->ucBand;

        if (prSubBand->ucBand != BAND_NULL && prSubBand->ucBand < BAND_NUM) {
            prCmd->rSubBand[i].ucChannelSpan = prSubBand->ucChannelSpan;
            prCmd->rSubBand[i].ucFirstChannelNum = prSubBand->ucFirstChannelNum;
            prCmd->rSubBand[i].ucNumChannels = prSubBand->ucNumChannels;
        }
    }
	
	DBGLOG(RLM, INFO, ("rlmDomainSendCmd(), SetQueryCmd\n"));

    /* Update domain info to chip */
    rStatus = wlanSendSetQueryCmd (
                prAdapter,                  /* prAdapter */
                CMD_ID_SET_DOMAIN_INFO,     /* ucCID */
                TRUE,                       /* fgSetQuery */
                FALSE,                      /* fgNeedResp */
                fgIsOid,                    /* fgIsOid */
                NULL,                       /* pfCmdDoneHandler*/
                NULL,                       /* pfCmdTimeoutHandler */
                sizeof(CMD_SET_DOMAIN_INFO_T),    /* u4SetQueryInfoLen */
                (PUINT_8) prCmd,            /* pucInfoBuffer */
                NULL,                       /* pvSetQueryBuffer */
                0                           /* u4SetQueryBufferLen */
                );

    ASSERT(rStatus == WLAN_STATUS_PENDING);

    cnmMemFree(prAdapter, prCmd);

	rlmDomainPassiveScanSendCmd(prAdapter, fgIsOid);
}