WLAN_STATUS wlanoidQueryP2pRssi(IN P_ADAPTER_T prAdapter, IN PVOID pvQueryBuffer, IN UINT_32 u4QueryBufferLen, OUT PUINT_32 pu4QueryInfoLen) { DEBUGFUNC("wlanoidQueryP2pRssi"); ASSERT(prAdapter); ASSERT(pu4QueryInfoLen); if (u4QueryBufferLen) { ASSERT(pvQueryBuffer); } *pu4QueryInfoLen = sizeof(PARAM_RSSI); /* Check for query buffer length */ if (u4QueryBufferLen < *pu4QueryInfoLen) { DBGLOG(REQ, WARN, ("Too short length %ld\n", u4QueryBufferLen)); return WLAN_STATUS_BUFFER_TOO_SHORT; } if (prAdapter->fgIsP2pLinkQualityValid == TRUE && (kalGetTimeTick() - prAdapter->rP2pLinkQualityUpdateTime) <= CFG_LINK_QUALITY_VALID_PERIOD) { PARAM_RSSI rRssi; rRssi = (PARAM_RSSI) prAdapter->rP2pLinkQuality.cRssi; /* ranged from (-128 ~ 30) in unit of dBm */ if (rRssi > PARAM_WHQL_RSSI_MAX_DBM) rRssi = PARAM_WHQL_RSSI_MAX_DBM; else if (rRssi < PARAM_WHQL_RSSI_MIN_DBM) rRssi = PARAM_WHQL_RSSI_MIN_DBM; kalMemCopy(pvQueryBuffer, &rRssi, sizeof(PARAM_RSSI)); return WLAN_STATUS_SUCCESS; } #ifdef LINUX return wlanSendSetQueryCmd(prAdapter, CMD_ID_GET_LINK_QUALITY, FALSE, TRUE, TRUE, nicCmdEventQueryLinkQuality, nicOidCmdTimeoutCommon, *pu4QueryInfoLen, pvQueryBuffer, pvQueryBuffer, u4QueryBufferLen); #else return wlanSendSetQueryCmd(prAdapter, CMD_ID_GET_LINK_QUALITY, FALSE, TRUE, TRUE, nicCmdEventQueryLinkQuality, nicOidCmdTimeoutCommon, 0, NULL, pvQueryBuffer, u4QueryBufferLen); #endif } /* wlanoidQueryP2pRssi */
/*----------------------------------------------------------------------------*/ VOID roamingFsmSendCmd ( IN P_ADAPTER_T prAdapter, IN P_ROAMING_PARAM_T prParam ) { P_ROAMING_INFO_T prRoamingFsmInfo; WLAN_STATUS rStatus; DBGLOG(ROAMING, LOUD, ("->roamingFsmSendCmd(): Current Time = %ld\n", kalGetTimeTick())); prRoamingFsmInfo = (P_ROAMING_INFO_T)&(prAdapter->rWifiVar.rRoamingInfo); rStatus = wlanSendSetQueryCmd ( prAdapter, /* prAdapter */ CMD_ID_ROAMING_TRANSIT, /* ucCID */ TRUE, /* fgSetQuery */ FALSE, /* fgNeedResp */ FALSE, /* fgIsOid */ NULL, /* pfCmdDoneHandler */ NULL, /* pfCmdTimeoutHandler */ sizeof(ROAMING_PARAM_T), /* u4SetQueryInfoLen */ (PUINT_8) prParam, /* pucInfoBuffer */ NULL, /* pvSetQueryBuffer */ 0 /* u4SetQueryBufferLen */ ); ASSERT(rStatus == WLAN_STATUS_PENDING); return; } /* end of roamingFsmSendCmd() */
/*----------------------------------------------------------------------------*/ 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() */
/*----------------------------------------------------------------------------*/ 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); }
WLAN_STATUS wlanoidSetNoaParam(IN P_ADAPTER_T prAdapter, IN PVOID pvSetBuffer, IN UINT_32 u4SetBufferLen, OUT PUINT_32 pu4SetInfoLen) { P_PARAM_CUSTOM_NOA_PARAM_STRUC_T prNoaParam; CMD_CUSTOM_NOA_PARAM_STRUC_T rCmdNoaParam; DEBUGFUNC("wlanoidSetNoaParam"); DBGLOG(INIT, TRACE, ("\n")); ASSERT(prAdapter); ASSERT(pu4SetInfoLen); *pu4SetInfoLen = sizeof(PARAM_CUSTOM_NOA_PARAM_STRUC_T); if (u4SetBufferLen < sizeof(PARAM_CUSTOM_NOA_PARAM_STRUC_T)) { return WLAN_STATUS_INVALID_LENGTH; } ASSERT(pvSetBuffer); prNoaParam = (P_PARAM_CUSTOM_NOA_PARAM_STRUC_T) pvSetBuffer; kalMemZero(&rCmdNoaParam, sizeof(CMD_CUSTOM_NOA_PARAM_STRUC_T)); rCmdNoaParam.u4NoaDurationMs = prNoaParam->u4NoaDurationMs; rCmdNoaParam.u4NoaIntervalMs = prNoaParam->u4NoaIntervalMs; rCmdNoaParam.u4NoaCount = prNoaParam->u4NoaCount; #if 0 return wlanSendSetQueryCmd(prAdapter, CMD_ID_SET_NOA_PARAM, TRUE, FALSE, TRUE, nicCmdEventSetCommon, nicOidCmdTimeoutCommon, sizeof(CMD_CUSTOM_NOA_PARAM_STRUC_T), (PUINT_8) &rCmdNoaParam, pvSetBuffer, u4SetBufferLen); #else return wlanoidSendSetQueryP2PCmd(prAdapter, CMD_ID_SET_NOA_PARAM, TRUE, FALSE, TRUE, NULL, nicOidCmdTimeoutCommon, sizeof(CMD_CUSTOM_NOA_PARAM_STRUC_T), (PUINT_8) &rCmdNoaParam, pvSetBuffer, u4SetBufferLen); #endif }
VOID scnEventReturnChannel(IN P_ADAPTER_T prAdapter, IN UINT_8 ucScnSeqNum) { CMD_SCAN_CANCEL rCmdScanCancel; /* send cancel message to firmware domain */ rCmdScanCancel.ucSeqNum = ucScnSeqNum; rCmdScanCancel.ucIsExtChannel = (UINT_8) FALSE; wlanSendSetQueryCmd(prAdapter, CMD_ID_SCAN_CANCEL, TRUE, FALSE, FALSE, NULL, NULL, sizeof(CMD_SCAN_CANCEL), (PUINT_8) & rCmdScanCancel, NULL, 0); return; } /* scnEventReturnChannel */
WLAN_STATUS wlanoidSetUApsdParam(IN P_ADAPTER_T prAdapter, IN PVOID pvSetBuffer, IN UINT_32 u4SetBufferLen, OUT PUINT_32 pu4SetInfoLen) { P_PARAM_CUSTOM_UAPSD_PARAM_STRUC_T prUapsdParam; CMD_CUSTOM_UAPSD_PARAM_STRUC_T rCmdUapsdParam; P_PM_PROFILE_SETUP_INFO_T prPmProfSetupInfo; P_BSS_INFO_T prBssInfo; DEBUGFUNC("wlanoidSetUApsdParam"); DBGLOG(INIT, TRACE, ("\n")); ASSERT(prAdapter); ASSERT(pu4SetInfoLen); *pu4SetInfoLen = sizeof(PARAM_CUSTOM_UAPSD_PARAM_STRUC_T); if (u4SetBufferLen < sizeof(PARAM_CUSTOM_UAPSD_PARAM_STRUC_T)) { return WLAN_STATUS_INVALID_LENGTH; } ASSERT(pvSetBuffer); prBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); prPmProfSetupInfo = &prBssInfo->rPmProfSetupInfo; prUapsdParam = (P_PARAM_CUSTOM_UAPSD_PARAM_STRUC_T) pvSetBuffer; kalMemZero(&rCmdUapsdParam, sizeof(CMD_CUSTOM_OPPPS_PARAM_STRUC_T)); rCmdUapsdParam.fgEnAPSD = prUapsdParam->fgEnAPSD; prAdapter->rWifiVar.fgSupportUAPSD = prUapsdParam->fgEnAPSD; rCmdUapsdParam.fgEnAPSD_AcBe = prUapsdParam->fgEnAPSD_AcBe; rCmdUapsdParam.fgEnAPSD_AcBk = prUapsdParam->fgEnAPSD_AcBk; rCmdUapsdParam.fgEnAPSD_AcVo = prUapsdParam->fgEnAPSD_AcVo; rCmdUapsdParam.fgEnAPSD_AcVi = prUapsdParam->fgEnAPSD_AcVi; prPmProfSetupInfo->ucBmpDeliveryAC = ((prUapsdParam->fgEnAPSD_AcBe << 0) | (prUapsdParam->fgEnAPSD_AcBk << 1) | (prUapsdParam->fgEnAPSD_AcVi << 2) | (prUapsdParam->fgEnAPSD_AcVo << 3)); prPmProfSetupInfo->ucBmpTriggerAC = ((prUapsdParam->fgEnAPSD_AcBe << 0) | (prUapsdParam->fgEnAPSD_AcBk << 1) | (prUapsdParam->fgEnAPSD_AcVi << 2) | (prUapsdParam->fgEnAPSD_AcVo << 3)); rCmdUapsdParam.ucMaxSpLen = prUapsdParam->ucMaxSpLen; prPmProfSetupInfo->ucUapsdSp = prUapsdParam->ucMaxSpLen; #if 0 return wlanSendSetQueryCmd(prAdapter, CMD_ID_SET_UAPSD_PARAM, TRUE, FALSE, TRUE, nicCmdEventSetCommon, nicOidCmdTimeoutCommon, sizeof(CMD_CUSTOM_OPPPS_PARAM_STRUC_T), (PUINT_8) &rCmdUapsdParam, pvSetBuffer, u4SetBufferLen); #else return wlanoidSendSetQueryP2PCmd(prAdapter, CMD_ID_SET_UAPSD_PARAM, TRUE, FALSE, TRUE, NULL, nicOidCmdTimeoutCommon, sizeof(CMD_CUSTOM_OPPPS_PARAM_STRUC_T), (PUINT_8) &rCmdUapsdParam, pvSetBuffer, u4SetBufferLen); #endif }
/*----------------------------------------------------------------------------*/ WLAN_STATUS wlanoidSetP2pSetNetworkAddress(IN P_ADAPTER_T prAdapter, IN PVOID pvSetBuffer, IN UINT_32 u4SetBufferLen, OUT PUINT_32 pu4SetInfoLen) { WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; UINT_32 i, j; P_CMD_SET_NETWORK_ADDRESS_LIST prCmdNetworkAddressList; P_PARAM_NETWORK_ADDRESS_LIST prNetworkAddressList = (P_PARAM_NETWORK_ADDRESS_LIST) pvSetBuffer; P_PARAM_NETWORK_ADDRESS prNetworkAddress; P_PARAM_NETWORK_ADDRESS_IP prNetAddrIp; UINT_32 u4IpAddressCount, u4CmdSize; PUINT_8 pucBuf = (PUINT_8) pvSetBuffer; DEBUGFUNC("wlanoidSetP2pSetNetworkAddress"); DBGLOG(INIT, TRACE, ("\n")); printk("wlanoidSetP2pSetNetworkAddress (%d)\n", (INT_16) u4SetBufferLen); ASSERT(prAdapter); ASSERT(pu4SetInfoLen); *pu4SetInfoLen = 4; if (u4SetBufferLen < sizeof(PARAM_NETWORK_ADDRESS_LIST)) { return WLAN_STATUS_INVALID_DATA; } *pu4SetInfoLen = 0; u4IpAddressCount = 0; prNetworkAddress = prNetworkAddressList->arAddress; for (i = 0; i < prNetworkAddressList->u4AddressCount; i++) { if (prNetworkAddress->u2AddressType == PARAM_PROTOCOL_ID_TCP_IP && prNetworkAddress->u2AddressLength == sizeof(PARAM_NETWORK_ADDRESS_IP)) { u4IpAddressCount++; } prNetworkAddress = (P_PARAM_NETWORK_ADDRESS) ((UINT_32) prNetworkAddress + (UINT_32) (prNetworkAddress-> u2AddressLength + OFFSET_OF (PARAM_NETWORK_ADDRESS, aucAddress))); } /* construct payload of command packet */ u4CmdSize = OFFSET_OF(CMD_SET_NETWORK_ADDRESS_LIST, arNetAddress) + sizeof(IPV4_NETWORK_ADDRESS) * u4IpAddressCount; if (u4IpAddressCount == 0) { u4CmdSize = sizeof(CMD_SET_NETWORK_ADDRESS_LIST); } prCmdNetworkAddressList = (P_CMD_SET_NETWORK_ADDRESS_LIST) kalMemAlloc(u4CmdSize, VIR_MEM_TYPE); if (prCmdNetworkAddressList == NULL) return WLAN_STATUS_FAILURE; /* fill P_CMD_SET_NETWORK_ADDRESS_LIST */ prCmdNetworkAddressList->ucNetTypeIndex = NETWORK_TYPE_P2P_INDEX; /* only to set IP address to FW once ARP filter is enabled */ if (prAdapter->fgEnArpFilter) { prCmdNetworkAddressList->ucAddressCount = (UINT_8) u4IpAddressCount; prNetworkAddress = prNetworkAddressList->arAddress; printk("u4IpAddressCount (%ld)\n", (INT_32) u4IpAddressCount); for (i = 0, j = 0; i < prNetworkAddressList->u4AddressCount; i++) { if (prNetworkAddress->u2AddressType == PARAM_PROTOCOL_ID_TCP_IP && prNetworkAddress->u2AddressLength == sizeof(PARAM_NETWORK_ADDRESS_IP)) { prNetAddrIp = (P_PARAM_NETWORK_ADDRESS_IP) prNetworkAddress->aucAddress; kalMemCopy(prCmdNetworkAddressList->arNetAddress[j].aucIpAddr, &(prNetAddrIp->in_addr), sizeof(UINT_32)); j++; pucBuf = (PUINT_8) &prNetAddrIp->in_addr; printk("prNetAddrIp->in_addr:%d:%d:%d:%d\n", (UINT_8) pucBuf[0], (UINT_8) pucBuf[1], (UINT_8) pucBuf[2], (UINT_8) pucBuf[3]); } prNetworkAddress = (P_PARAM_NETWORK_ADDRESS) ((UINT_32) prNetworkAddress + (UINT_32) (prNetworkAddress-> u2AddressLength + OFFSET_OF (PARAM_NETWORK_ADDRESS, aucAddress))); } } else { prCmdNetworkAddressList->ucAddressCount = 0; } rStatus = wlanSendSetQueryCmd(prAdapter, CMD_ID_SET_IP_ADDRESS, TRUE, FALSE, TRUE, nicCmdEventSetIpAddress, nicOidCmdTimeoutCommon, u4CmdSize, (PUINT_8) prCmdNetworkAddressList, pvSetBuffer, u4SetBufferLen); kalMemFree(prCmdNetworkAddressList, VIR_MEM_TYPE, u4CmdSize); return rStatus; } /* end of wlanoidSetP2pSetNetworkAddress() */
/*----------------------------------------------------------------------------*/ 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() */
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); }
/*----------------------------------------------------------------------------*/ 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); }