예제 #1
0
CDF_STATUS p2p_process_remain_on_channel_cmd(tpAniSirGlobal pMac,
					     tSmeCmd *p2pRemainonChn)
{
	CDF_STATUS status = CDF_STATUS_E_FAILURE;
	tSirRemainOnChnReq *pMsg;
	uint32_t len;
	tCsrRoamSession *pSession =
		CSR_GET_SESSION(pMac, p2pRemainonChn->sessionId);

	if (!pSession) {
		sms_log(pMac, LOGE, FL("  session %d not found "),
			p2pRemainonChn->sessionId);
		goto error;
	}

	if (!pSession->sessionActive) {
		sms_log(pMac, LOGE,
			FL("  session %d is invalid or listen is disabled "),
			p2pRemainonChn->sessionId);
		goto error;
	}
	len = sizeof(tSirRemainOnChnReq) + pMac->p2pContext.probeRspIeLength;

	if (len > 0xFFFF) {
		/*In coming len for Msg is more then 16bit value */
		sms_log(pMac, LOGE, FL("  Message length is very large, %d"),
			len);
		goto error;
	}

	pMsg = cdf_mem_malloc(len);
	if (NULL == pMsg)
		goto error;
	else {
		CDF_TRACE(CDF_MODULE_ID_SME, CDF_TRACE_LEVEL_INFO, "%s call",
			  __func__);
		cdf_mem_set(pMsg, sizeof(tSirRemainOnChnReq), 0);
		pMsg->messageType = eWNI_SME_REMAIN_ON_CHANNEL_REQ;
		pMsg->length = (uint16_t) len;
		cdf_copy_macaddr(&pMsg->selfMacAddr, &pSession->selfMacAddr);
		pMsg->chnNum = p2pRemainonChn->u.remainChlCmd.chn;
		pMsg->phyMode = p2pRemainonChn->u.remainChlCmd.phyMode;
		pMsg->duration = p2pRemainonChn->u.remainChlCmd.duration;
		pMsg->sessionId = p2pRemainonChn->sessionId;
		pMsg->isProbeRequestAllowed =
			p2pRemainonChn->u.remainChlCmd.isP2PProbeReqAllowed;
		pMsg->scan_id = p2pRemainonChn->u.remainChlCmd.scan_id;
		if (pMac->p2pContext.probeRspIeLength)
			cdf_mem_copy((void *)pMsg->probeRspIe,
				     (void *)pMac->p2pContext.probeRspIe,
				     pMac->p2pContext.probeRspIeLength);
		status = cds_send_mb_message_to_mac(pMsg);
	}
error:
	if (CDF_STATUS_E_FAILURE == status)
		csr_release_roc_req_cmd(pMac);
	return status;
}
eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn)
{
    eHalStatus status = eHAL_STATUS_FAILURE;
    tSirRemainOnChnReq* pMsg;
    tANI_U32 len;
    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, p2pRemainonChn->sessionId );

    if(!pSession)
    {
       smsLog(pMac, LOGE, FL("  session %d not found "), p2pRemainonChn->sessionId);
       goto error;
    }


    if(!pSession->sessionActive)
    {
       smsLog(pMac, LOGE, FL("  session %d is invalid or listen is disabled "),
            p2pRemainonChn->sessionId);
       goto error;
    }
    len = sizeof(tSirRemainOnChnReq) + pMac->p2pContext.probeRspIeLength;

    if( len > 0xFFFF )
    {
       /*In coming len for Msg is more then 16bit value*/
       smsLog(pMac, LOGE, FL("  Message length is very large, %d"),
            len);
       goto error;
    }

    pMsg = vos_mem_malloc(len);
    if ( NULL == pMsg )
        goto error;
    else
    {
        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s call", __func__);
        vos_mem_set(pMsg, sizeof(tSirRemainOnChnReq), 0);
        pMsg->messageType = eWNI_SME_REMAIN_ON_CHANNEL_REQ;
        pMsg->length = (tANI_U16)len;
        vos_mem_copy(pMsg->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
        pMsg->chnNum = p2pRemainonChn->u.remainChlCmd.chn;
        pMsg->phyMode = p2pRemainonChn->u.remainChlCmd.phyMode;
        pMsg->duration = p2pRemainonChn->u.remainChlCmd.duration;
        pMsg->sessionId = p2pRemainonChn->sessionId;
        pMsg->isProbeRequestAllowed = p2pRemainonChn->u.remainChlCmd.isP2PProbeReqAllowed;
        if( pMac->p2pContext.probeRspIeLength )
           vos_mem_copy((void *)pMsg->probeRspIe, (void *)pMac->p2pContext.probeRspIe,
                        pMac->p2pContext.probeRspIeLength);
        status = palSendMBMessage(pMac->hHdd, pMsg);
    }
error:
    if (eHAL_STATUS_FAILURE == status)
       csr_release_roc_req_cmd(pMac);
    return status;
}