/** * \fn StaCap_GetHtCapabilitiesIe * \brief Get the desired STA HT capabilities IE. get the physical HT capabilities from TWD * and build HT capabilities IE. * * \note * \param hStaCap - The module object * \param pRequest - pointer to request buffer\n * \param len - size of returned IE\n * \return TI_OK on success or TI_NOK on failure * \sa */ TI_STATUS StaCap_GetHtCapabilitiesIe (TI_HANDLE hStaCap, TI_UINT8 *pRequest, TI_UINT32 *pLen) { TStaCap *pStaCap = (TStaCap *)hStaCap; TTwdHtCapabilities *pTwdHtCapabilities; TI_UINT8 *pDataBuf = pRequest; TStaCapHtCapabilities tHtCapabilities; TI_BOOL bWmeEnable; /* verify that WME flag enable */ qosMngr_GetWmeEnableFlag (pStaCap->hQosMngr, &bWmeEnable); if (bWmeEnable == TI_FALSE) { *pLen = 0; return TI_OK; } TWD_GetTwdHtCapabilities (pStaCap->hTWD, &pTwdHtCapabilities); /* verify that 802.11n flag enable */ if (pTwdHtCapabilities->b11nEnable == TI_FALSE) { *pLen = 0; return TI_OK; } /* * set TWD values to HT capabilities structure * * Note: all numbers after "<<" represent the position of the values in the filed according * to 11n SPEC. */ tHtCapabilities.uHtCapabilitiesInfo = ((pTwdHtCapabilities->uChannelWidth << 1) | (pTwdHtCapabilities->uRxSTBC << 8) | (pTwdHtCapabilities->uMaxAMSDU << 11)| (DSSS_CCK_MODE << 12)); tHtCapabilities.uHtCapabilitiesInfo |= ((((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_LDPC_CODING) ? 1 : 0) << 0) | (((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_GREENFIELD_FRAME_FORMAT) ? 1 : 0) << 4) | (((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_SHORT_GI_FOR_20MHZ_PACKETS) ? 1 : 0) << 5) | (((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_SHORT_GI_FOR_40MHZ_PACKETS) ? 1 : 0) << 6) | (((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_SUPPORT_FOR_STBC_IN_TRANSMISSION) ? 1 : 0) << 7) | (((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_DELAYED_BLOCK_ACK) ? 1 : 0) << 10) | (((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_DSSS_CCK_IN_40_MHZ) ? 1 : 0) << 12) | (((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_LSIG_TXOP_PROTECTION) ? 1 : 0) << 15)); tHtCapabilities.uAMpduParam = ((pTwdHtCapabilities->uMaxAMPDU << 0) | (pTwdHtCapabilities->uAMPDUSpacing << 2)); /* copy RX supported MCS rates */ os_memoryCopy (pStaCap->hOs, tHtCapabilities.tSuppMcsSet.aRxMscBitmask, pTwdHtCapabilities->aRxMCS, RX_TX_MCS_BITMASK_SIZE); tHtCapabilities.tSuppMcsSet.uHighestSupportedDataRate = pTwdHtCapabilities->uRxMaxDataRate; /* check if supported MCS rates identical to TX and RX */ if( 0 == os_memoryCompare(pStaCap->hOs, pTwdHtCapabilities->aRxMCS, pTwdHtCapabilities->aTxMCS, RX_TX_MCS_BITMASK_SIZE)) { tHtCapabilities.tSuppMcsSet.uTxRxSetting = ((TX_MCS_SET_YES << 0) | /* set supported TX MCS rate */ (TX_RX_NOT_EQUAL_NO << 1)); /* set TX&RX MCS rate are equal */ } /* in case supported MCS rates TX different from the RX */ else { TI_UINT32 i; /* check if there are TX MCS rates supported */ for (i = 0; i <= (RX_TX_MCS_BITMASK_SIZE - 1); ++i) { if (pTwdHtCapabilities->aTxMCS[i] != 0) { break; } } /* TX MCS supported */ if(i <= (RX_TX_MCS_BITMASK_SIZE -1)) { tHtCapabilities.tSuppMcsSet.uTxRxSetting = ((TX_MCS_SET_YES << 0) | /* set supported TX MCS rates */ (TX_RX_NOT_EQUAL_YES << 1)); /* set TX&RX MCS rates different */ } /* TX MCS not supported */ else { tHtCapabilities.tSuppMcsSet.uTxRxSetting = (TX_MCS_SET_NO << 0); /* set no supported TX MCS rates */ } } tHtCapabilities.uExteCapabilities = (((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_PCO) ? 1 : 0) << 0); if (tHtCapabilities.uExteCapabilities != 0) { tHtCapabilities.uExteCapabilities |= (pTwdHtCapabilities->uPCOTransTime << 1); } tHtCapabilities.uExteCapabilities |= ((pTwdHtCapabilities->uMCSFeedback << 8) | (HTC_SUPPORT_NO << 10)); tHtCapabilities.uTxBfCapabilities = ((IMPLICIT_TXBF_REC_CAPABLE << 0) | (TRANSMIT_STAGGERED_SOUNDING_CAPABLE << 2)); tHtCapabilities.uAselCapabilities = 0x0; /* build IE */ *pDataBuf = HT_CAPABILITIES_IE_ID; *(pDataBuf + 1) = DOT11_HT_CAPABILITIES_ELE_LEN; COPY_WLAN_WORD(pDataBuf + 2, &(tHtCapabilities.uHtCapabilitiesInfo)); *(pDataBuf + 4) = tHtCapabilities.uAMpduParam; os_memoryCopy (pStaCap->hOs, pDataBuf + 5, tHtCapabilities.tSuppMcsSet.aRxMscBitmask, RX_TX_MCS_BITMASK_SIZE); COPY_WLAN_WORD(pDataBuf + 15, &(tHtCapabilities.tSuppMcsSet.uHighestSupportedDataRate)); *(pDataBuf + 17) = tHtCapabilities.tSuppMcsSet.uTxRxSetting; /* clear the reserved bytes */ os_memoryZero (pStaCap->hOs, (pDataBuf + 18), 3); COPY_WLAN_WORD(pDataBuf + 21, &(tHtCapabilities.uExteCapabilities)); COPY_WLAN_LONG(pDataBuf + 23, &(tHtCapabilities.uTxBfCapabilities)); *(pDataBuf + 27) = tHtCapabilities.uAselCapabilities; *pLen = DOT11_HT_CAPABILITIES_ELE_LEN + sizeof(dot11_eleHdr_t); return TI_OK; }
/** * \fn mlme_assocCapBuild * \brief builds capabilties of assoc request * * builds capabilties of assoc request according to the mlme params * * \param pCtx - pointer to mlme_t * \param cap - <output> pointer to the built capablities * \return TI_OK if auth send successfully * TI_NOK otherwise * * \sa mlme_assocRequestMsgBuild */ TI_STATUS mlme_assocCapBuild(mlme_t *pCtx, TI_UINT16 *cap) { paramInfo_t param; TI_STATUS status; EDot11Mode mode; TI_UINT32 rateSuppMask, rateBasicMask; TI_UINT8 ratesBuf[DOT11_MAX_SUPPORTED_RATES]; TI_UINT32 len = 0, ofdmIndex = 0; TI_BOOL b11nEnable, bWmeEnable; *cap = 0; /* Bss type */ param.paramType = CTRL_DATA_CURRENT_BSS_TYPE_PARAM; status = ctrlData_getParam(pCtx->hCtrlData, ¶m); if (status == TI_OK) { if (param.content.ctrlDataCurrentBssType == BSS_INFRASTRUCTURE) { *cap |= DOT11_CAPS_ESS; } else { *cap |= DOT11_CAPS_IBSS; } } else { return TI_NOK; } /* Privacy */ param.paramType = RSN_ENCRYPTION_STATUS_PARAM; status = rsn_getParam(pCtx->hRsn, ¶m); if (status == TI_OK) { if (param.content.rsnEncryptionStatus != TWD_CIPHER_NONE) { *cap |= DOT11_CAPS_PRIVACY; } } else { return TI_NOK; } /* Preamble */ param.paramType = SITE_MGR_DESIRED_PREAMBLE_TYPE_PARAM; status = siteMgr_getParam(pCtx->hSiteMgr, ¶m); if (status == TI_OK) { if (param.content.siteMgrCurrentPreambleType == PREAMBLE_SHORT) *cap |= DOT11_CAPS_SHORT_PREAMBLE; } else { return TI_NOK; } /* Pbcc */ param.paramType = SITE_MGR_CURRENT_RATE_PAIR_PARAM; status = siteMgr_getParam(pCtx->hSiteMgr, ¶m); if (status == TI_OK) { if(param.content.siteMgrCurrentRateMask.supportedRateMask & DRV_RATE_MASK_22_PBCC) *cap |= DOT11_CAPS_PBCC; } else { return TI_NOK; } /* Checking if the station supports Spectrum Management (802.11h) */ param.paramType = REGULATORY_DOMAIN_MANAGEMENT_CAPABILITY_ENABLED_PARAM; status = regulatoryDomain_getParam(pCtx->hRegulatoryDomain, ¶m); if (status == TI_OK ) { if( param.content.spectrumManagementEnabled) *cap |= DOT11_SPECTRUM_MANAGEMENT; } else { return TI_NOK; } /* slot time */ param.paramType = SITE_MGR_OPERATIONAL_MODE_PARAM; status = siteMgr_getParam(pCtx->hSiteMgr, ¶m); if(status == TI_OK) { mode = param.content.siteMgrDot11OperationalMode; } else return TI_NOK; if(mode == DOT11_G_MODE) { /* new requirement: the short slot time should be set only if the AP's modulation is OFDM (highest rate) */ /* get Rates */ param.paramType = SITE_MGR_CURRENT_RATE_PAIR_PARAM; status = siteMgr_getParam(pCtx->hSiteMgr, ¶m); if (status == TI_OK) { rateBasicMask = param.content.siteMgrCurrentRateMask.basicRateMask; rateSuppMask = param.content.siteMgrCurrentRateMask.supportedRateMask; } else { return TI_NOK; } /* convert the bit map to the rates array */ rate_DrvBitmapToNetStr (rateSuppMask, rateBasicMask, ratesBuf, &len, &ofdmIndex); if(ofdmIndex < len) *cap |= DOT11_CAPS_SHORT_SLOT_TIME; /* param.paramType = SITE_MGR_CURRENT_MODULATION_TYPE_PARAM; status = siteMgr_getParam(pCtx->hSiteMgr, ¶m); if(param.content.siteMgrCurrentModulationType == DRV_MODULATION_OFDM) *cap |= DOT11_CAPS_SHORT_SLOT_TIME; */ } /* Primary Site support HT ? */ param.paramType = SITE_MGR_PRIMARY_SITE_HT_SUPPORT; siteMgr_getParam(pCtx->hSiteMgr, ¶m); if (param.content.bPrimarySiteHtSupport == TI_TRUE) { /* Immediate Block Ack subfield - (is WME on?) AND (is HT Enable?) */ /* verify 11n_Enable and Chip type */ StaCap_IsHtEnable (pCtx->hStaCap, &b11nEnable); /* verify that WME flag enable */ qosMngr_GetWmeEnableFlag (pCtx->hQosMngr, &bWmeEnable); if ((b11nEnable != TI_FALSE) && (bWmeEnable != TI_FALSE)) { *cap |= DOT11_CAPS_IMMEDIATE_BA; } } return TI_OK; }