eHalStatus palFillMemory( tHddHandle hHdd, void *pMemory, tANI_U32 numBytes, tANI_BYTE fillValue ) { vos_mem_set( pMemory, numBytes, fillValue ); return( eHAL_STATUS_SUCCESS ); }
/** * @brief wpalMemoryFill - Fill memory with one pattern * @param buf address of buffer to be filled * @param size number of bytes to fill * @param bFill one byte of data to fill in (size) bytes from the start of the * buffer */ void wpalMemoryFill(void *buf, wpt_uint32 size, wpt_byte bFill) { vos_mem_set( buf, size, bFill ); }
int iw_set_scan(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev) ; hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); tCsrScanRequest scanRequest; v_U32_t scanId = 0; eHalStatus status = eHAL_STATUS_SUCCESS; struct iw_scan_req *scanReq = (struct iw_scan_req *)extra; hdd_adapter_t *con_sap_adapter; uint16_t con_dfs_ch; ENTER(); VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: enter !!!",__func__); #ifdef WLAN_BTAMP_FEATURE //Scan not supported when AMP traffic is on. if( VOS_TRUE == WLANBAP_AmpSessionOn() ) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: No scanning when AMP is on",__func__); return eHAL_STATUS_SUCCESS; } #endif /* Block All Scan during DFS operation and send null scan result */ con_sap_adapter = hdd_get_con_sap_adapter(pAdapter); if (con_sap_adapter) { con_dfs_ch = con_sap_adapter->sessionCtx.ap.sapConfig.channel; if (con_dfs_ch == AUTO_CHANNEL_SELECT) con_dfs_ch = con_sap_adapter->sessionCtx.ap.operatingChannel; if (VOS_IS_DFS_CH(con_dfs_ch)) { hddLog(LOGW, "%s:##In DFS Master mode. Scan aborted", __func__); return -EOPNOTSUPP; } } if(pAdapter->scan_info.mScanPending == TRUE) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:mScanPending is TRUE !!!",__func__); return eHAL_STATUS_SUCCESS; } if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); return eHAL_STATUS_SUCCESS; } vos_mem_zero( &scanRequest, sizeof(scanRequest)); if (NULL != wrqu->data.pointer) { /* set scanType, active or passive */ if ((IW_SCAN_TYPE_ACTIVE == scanReq->scan_type) || (eSIR_ACTIVE_SCAN == pHddCtx->ioctl_scan_mode)) { scanRequest.scanType = eSIR_ACTIVE_SCAN; } else { scanRequest.scanType = eSIR_PASSIVE_SCAN; } /* set bssid using sockaddr from iw_scan_req */ vos_mem_copy(scanRequest.bssid, &scanReq->bssid.sa_data, sizeof(scanRequest.bssid) ); if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { if(scanReq->essid_len) { scanRequest.SSIDs.numOfSSIDs = 1; scanRequest.SSIDs.SSIDList =( tCsrSSIDInfo *)vos_mem_malloc(sizeof(tCsrSSIDInfo)); if(scanRequest.SSIDs.SSIDList) { scanRequest.SSIDs.SSIDList->SSID.length = scanReq->essid_len; vos_mem_copy(scanRequest.SSIDs.SSIDList-> SSID.ssId,scanReq->essid,scanReq->essid_len); } else { scanRequest.SSIDs.numOfSSIDs = 0; VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: Unable to allocate memory",__func__); VOS_ASSERT(0); } } } /* set min and max channel time */ scanRequest.minChnTime = scanReq->min_channel_time; scanRequest.maxChnTime = scanReq->max_channel_time; } else { if (pHddCtx->ioctl_scan_mode == eSIR_ACTIVE_SCAN) { /* set the scan type to active */ scanRequest.scanType = eSIR_ACTIVE_SCAN; } else { scanRequest.scanType = eSIR_PASSIVE_SCAN; } vos_mem_set( scanRequest.bssid, sizeof( tCsrBssid ), 0xff ); /* set min and max channel time to zero */ scanRequest.minChnTime = 0; scanRequest.maxChnTime = 0; } /* set BSSType to default type */ scanRequest.BSSType = eCSR_BSS_TYPE_ANY; /*Scan all the channels */ scanRequest.ChannelInfo.numOfChannels = 0; scanRequest.ChannelInfo.ChannelList = NULL; /* set requestType to full scan */ scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN; /* if previous genIE is not NULL, update ScanIE */ if (0 != pwextBuf->genIE.length) { memset( &pAdapter->scan_info.scanAddIE, 0, sizeof(pAdapter->scan_info.scanAddIE) ); memcpy( pAdapter->scan_info.scanAddIE.addIEdata, pwextBuf->genIE.addIEdata, pwextBuf->genIE.length ); pAdapter->scan_info.scanAddIE.length = pwextBuf->genIE.length; pwextBuf->roamProfile.pAddIEScan = pAdapter->scan_info.scanAddIE.addIEdata; pwextBuf->roamProfile.nAddIEScanLength = pAdapter->scan_info.scanAddIE.length; /* clear previous genIE after use it */ memset( &pwextBuf->genIE, 0, sizeof(pwextBuf->genIE) ); } /* push addIEScan in scanRequset if exist */ if (pAdapter->scan_info.scanAddIE.addIEdata && pAdapter->scan_info.scanAddIE.length) { scanRequest.uIEFieldLen = pAdapter->scan_info.scanAddIE.length; scanRequest.pIEField = pAdapter->scan_info.scanAddIE.addIEdata; } status = sme_ScanRequest((WLAN_HDD_GET_CTX(pAdapter))->hHal, pAdapter->sessionId, &scanRequest, &scanId, &hdd_ScanRequestCallback, dev); if (!HAL_STATUS_SUCCESS(status)) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:sme_ScanRequest fail %d!!!",__func__, status); goto error; } pAdapter->scan_info.mScanPending = TRUE; pAdapter->scan_info.scanId = scanId; error: if ((wrqu->data.flags & IW_SCAN_THIS_ESSID) && (scanReq->essid_len)) vos_mem_free(scanRequest.SSIDs.SSIDList); EXIT(); VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: exit !!!",__func__); return status; }
VOS_STATUS vos_open( v_CONTEXT_t *pVosContext, v_SIZE_t hddContextSize ) { VOS_STATUS vStatus = VOS_STATUS_SUCCESS; int iter = 0; tSirRetStatus sirStatus = eSIR_SUCCESS; tMacOpenParameters macOpenParms; WLANTL_ConfigInfoType TLConfig; VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH, "%s: Opening VOSS", __func__); if (NULL == gpVosContext) { VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: Trying to open VOSS without a PreOpen", __func__); VOS_ASSERT(0); return VOS_STATUS_E_FAILURE; } vos_timer_module_init(); if (vos_event_init(&gpVosContext->ProbeEvent) != VOS_STATUS_SUCCESS) { VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: Unable to init probeEvent", __func__); VOS_ASSERT(0); return VOS_STATUS_E_FAILURE; } if (vos_event_init( &(gpVosContext->wdaCompleteEvent) ) != VOS_STATUS_SUCCESS ) { VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: Unable to init wdaCompleteEvent", __func__); VOS_ASSERT(0); goto err_probe_event; } vStatus = vos_mq_init(&gpVosContext->freeVosMq); if (! VOS_IS_STATUS_SUCCESS(vStatus)) { VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: Failed to initialize VOS free message queue", __func__); VOS_ASSERT(0); goto err_wda_complete_event; } for (iter = 0; iter < VOS_CORE_MAX_MESSAGES; iter++) { (gpVosContext->aMsgWrappers[iter]).pVosMsg = &(gpVosContext->aMsgBuffers[iter]); INIT_LIST_HEAD(&gpVosContext->aMsgWrappers[iter].msgNode); vos_mq_put(&gpVosContext->freeVosMq, &(gpVosContext->aMsgWrappers[iter])); } vStatus= vos_sched_open(gpVosContext, &gpVosContext->vosSched, sizeof(VosSchedContext)); if (!VOS_IS_STATUS_SUCCESS(vStatus)) { VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: Failed to open VOS Scheduler", __func__); VOS_ASSERT(0); goto err_msg_queue; } vos_mem_set(&macOpenParms, sizeof(macOpenParms), 0); macOpenParms.frameTransRequired = 1; macOpenParms.driverType = eDRIVER_TYPE_PRODUCTION; vStatus = WDA_open( gpVosContext, gpVosContext->pHDDContext, &macOpenParms ); if (!VOS_IS_STATUS_SUCCESS(vStatus)) { VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: Failed to open WDA module", __func__); VOS_ASSERT(0); goto err_sched_close; } vStatus = vos_packet_open( gpVosContext, &gpVosContext->vosPacket, sizeof( vos_pkt_context_t ) ); if ( !VOS_IS_STATUS_SUCCESS( vStatus ) ) { VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: Failed to open VOS Packet Module", __func__); VOS_ASSERT(0); goto err_wda_close; } vStatus = sysOpen(gpVosContext); if (!VOS_IS_STATUS_SUCCESS(vStatus)) { VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: Failed to open SYS module", __func__); VOS_ASSERT(0); goto err_packet_close; } #ifndef CONFIG_ENABLE_LINUX_REG vStatus = vos_nv_open(); if (!VOS_IS_STATUS_SUCCESS(vStatus)) { VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: Failed to initialize the NV module", __func__); goto err_sys_close; } #endif macOpenParms.frameTransRequired = 1; sirStatus = macOpen(&(gpVosContext->pMACContext), gpVosContext->pHDDContext, &macOpenParms); if (eSIR_SUCCESS != sirStatus) { VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: Failed to open MAC", __func__); VOS_ASSERT(0); goto err_nv_close; } vStatus = sme_Open(gpVosContext->pMACContext); if (!VOS_IS_STATUS_SUCCESS(vStatus)) { VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: Failed to open SME", __func__); VOS_ASSERT(0); goto err_mac_close; } vos_fetch_tl_cfg_parms ( &TLConfig, ((hdd_context_t*)(gpVosContext->pHDDContext))->cfg_ini); vStatus = WLANTL_Open(gpVosContext, &TLConfig); if (!VOS_IS_STATUS_SUCCESS(vStatus)) { VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: Failed to open TL", __func__); VOS_ASSERT(0); goto err_sme_close; } VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH, "%s: VOSS successfully Opened", __func__); *pVosContext = gpVosContext; return VOS_STATUS_SUCCESS; err_sme_close: sme_Close(gpVosContext->pMACContext); err_mac_close: macClose(gpVosContext->pMACContext); err_nv_close: #ifndef CONFIG_ENABLE_LINUX_REG vos_nv_close(); err_sys_close: #endif sysClose(gpVosContext); err_packet_close: vos_packet_close( gpVosContext ); err_wda_close: WDA_close(gpVosContext); err_sched_close: vos_sched_close(gpVosContext); err_msg_queue: vos_mq_deinit(&gpVosContext->freeVosMq); err_wda_complete_event: vos_event_destroy( &gpVosContext->wdaCompleteEvent ); err_probe_event: vos_event_destroy(&gpVosContext->ProbeEvent); return VOS_STATUS_E_FAILURE; }
/*=========================================================================== FUNCTION WLANBAP_XlateRxDataPkt DESCRIPTION HDD will call this API when it has received a 802.3 (TL/UMA has Xlated from 802.11) frame from TL and it wants to form a BT HCI Data Packet - ready to signal up to the BT stack application. PARAMETERS btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. pucAC: Pointer to return the access category vosDataBuff: The data buffer containing the 802.3 frame to be translated to BT HCI Data Packet RETURN VALUE The result code associated with performing the operation VOS_STATUS_E_INVAL: Input parameters are invalid VOS_STATUS_E_FAULT: BAP handle is NULL VOS_STATUS_SUCCESS: Everything is good :) SIDE EFFECTS ============================================================================*/ VOS_STATUS WLANBAP_XlateRxDataPkt ( ptBtampHandle btampHandle, v_U8_t phy_link_handle, /* Used by BAP to indentify the WLAN assoc. (StaId) */ WLANTL_ACEnumType *pucAC, /* Return the AC here. I don't think this is needed */ vos_pkt_t *vosDataBuff ) { WLANBAP_8023HeaderType w8023Header; WLANBAP_HCIACLHeaderType hciACLHeader; v_U8_t aucLLCHeader[WLANBAP_LLC_HEADER_LEN]; ptBtampContext pBtampCtx = (ptBtampContext) btampHandle; VOS_STATUS vosStatus; //v_PVOID_t pHddHdl; /* Handle to return BSL context in */ v_U16_t hciDataLength; /* The HCI packet data length*/ v_U16_t protoType = WLANBAP_BT_AMP_TYPE_DATA; /* The protocol type bytes*/ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ /*------------------------------------------------------------------------ Sanity check params ------------------------------------------------------------------------*/ if ( NULL == pBtampCtx) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Invalid BAP handle value in %s", __FUNCTION__); return VOS_STATUS_E_FAULT; } // Here, I have to make the assumption that this is an // 802.3 header followed by an LLC/SNAP packet. vos_mem_set( &w8023Header, sizeof(w8023Header), 0 ); vosStatus = vos_pkt_pop_head( vosDataBuff, &w8023Header, sizeof(w8023Header)); if ( VOS_STATUS_SUCCESS != vosStatus ) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLAN BAP: Failed to pop 802.3 header from packet %d", vosStatus); return vosStatus; } // Here, is that LLC/SNAP header. // With the BT SIG OUI that I am being handed. vos_mem_set( aucLLCHeader, WLANBAP_LLC_HEADER_LEN, 0 ); vosStatus = vos_pkt_pop_head( vosDataBuff, aucLLCHeader, WLANBAP_LLC_HEADER_LEN); if ( VOS_STATUS_SUCCESS != vosStatus ) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLAN BAP: Failed to pop LLC/SNAP header from packet %d", vosStatus); return vosStatus; } #ifdef BAP_DEBUG // JEZ081003: Remove this after debugging // Should I double check that I am getting the BT SIG OUI ? if ( !(vos_mem_compare( aucLLCHeader, WLANBAP_LLC_HEADER, sizeof(WLANBAP_LLC_HEADER) - WLANBAP_LLC_OUI_SIZE) /* Don't check the last three bytes here */ && vos_mem_compare( &aucLLCHeader[WLANBAP_LLC_OUI_OFFSET], (v_VOID_t*)WLANBAP_BT_AMP_OUI, WLANBAP_LLC_OUI_SIZE))) /* check them here */ { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Invalid LLC header for BT-AMP packet in %s", __FUNCTION__); return VOS_STATUS_E_FAULT; } #endif //BAP_DEBUG /* Now adjust the protocol type bytes*/ protoType = vos_cpu_to_be16( protoType); // check if this is a data frame or other, internal to BAP, type... // we are only handling data frames in here... // The others (Security and AR) are handled by TLs BAP client API. // (Verify with TL) if ( !(vos_mem_compare( &aucLLCHeader[WLANBAP_LLC_PROTO_TYPE_OFFSET], &protoType, //WLANBAP_BT_AMP_TYPE_DATA WLANBAP_LLC_PROTO_TYPE_SIZE))) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Invalid (non-data) frame type in %s", __FUNCTION__); return VOS_STATUS_E_FAULT; } #ifdef BAP_DEBUG // JEZ081003: Remove this after debugging /*------------------------------------------------------------------------ Sanity check the MAC address in the physical link context against the value in the incoming Rx Frame. ------------------------------------------------------------------------*/ if ( !(vos_mem_compare( w8023Header.vDA, pBtampCtx->self_mac_addr, VOS_MAC_ADDR_SIZE) && vos_mem_compare( w8023Header.vSA, pBtampCtx->peer_mac_addr, VOS_MAC_ADDR_SIZE))) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "MAC address mismatch in %s", __FUNCTION__); return VOS_STATUS_E_FAULT; } #endif //BAP_DEBUG /* No lookup is needed. Because TL has already told WLANBAP_STARxCB * the StaId. And I told WLANBAP_STARxCBType the corresponding BSL context * Which he used to lookup the phy_link_handle value. */ // Start filling in the HCI header hciACLHeader.phyLinkHandle = phy_link_handle; // Continue filling in the HCI header //JEZ100913: On Rx the Logical Link is ALWAYS 0. See Vol 2, Sec E, 5.4.2 of spec. hciACLHeader.logLinkHandle = 0; hciACLHeader.PBFlag = WLANBAP_HCI_PKT_AMP; hciACLHeader.BCFlag = 0; /* Now the length field is big-endian?! */ hciDataLength = vos_be16_to_cpu(w8023Header.usLenType); /* Max length WLANBAP_MAX_80211_PAL_PDU_SIZE (1492) */ hciDataLength -= WLANBAP_LLC_HEADER_LEN; /* The HCI packet data length is Little-endian */ hciACLHeader.dataLength = vos_cpu_to_le16(hciDataLength); /* Return the AC here. * (I can't because there is no way to figure out what it is.) */ *pucAC = 0; /* Push on the HCI header */ vos_pkt_push_head(vosDataBuff, &hciACLHeader, WLANBAP_HCI_ACL_HEADER_LEN); return VOS_STATUS_SUCCESS; } /* WLANBAP_XlateRxDataPkt */
eHalStatus sme_FTSendUpdateKeyInd(tHalHandle hHal, tCsrRoamSetKey * pFTKeyInfo) { tSirFTUpdateKeyInfo *pMsg; tANI_U16 msgLen; eHalStatus status = eHAL_STATUS_FAILURE; tAniEdType tmpEdType; tSirKeyMaterial *keymaterial = NULL; tAniEdType edType; tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG int i = 0; smsLog(pMac, LOG1, FL("keyLength %d"), pFTKeyInfo->keyLength); for (i=0; i<pFTKeyInfo->keyLength; i++) smsLog(pMac, LOG1, FL("%02x"), pFTKeyInfo->Key[i]); #endif msgLen = sizeof(tSirFTUpdateKeyInfo); pMsg = vos_mem_malloc(msgLen); if ( NULL == pMsg ) { return eHAL_STATUS_FAILURE; } vos_mem_set(pMsg, msgLen, 0); pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_FT_UPDATE_KEY); pMsg->length = pal_cpu_to_be16(msgLen); keymaterial = &pMsg->keyMaterial; keymaterial->length = pFTKeyInfo->keyLength; edType = csrTranslateEncryptTypeToEdType( pFTKeyInfo->encType ); tmpEdType = pal_cpu_to_be32(edType); keymaterial->edType = tmpEdType; // Set the pMsg->keyMaterial.length field (this length is defined as all // data that follows the edType field // in the tSirKeyMaterial keyMaterial; field). // // !!NOTE: This keyMaterial.length contains the length of a MAX size key, // though the keyLength can be // shorter than this max size. Is LIM interpreting this ok ? keymaterial->numKeys = 1; keymaterial->key[ 0 ].keyId = pFTKeyInfo->keyId; keymaterial->key[ 0 ].unicast = (tANI_U8)eANI_BOOLEAN_TRUE; keymaterial->key[ 0 ].keyDirection = pFTKeyInfo->keyDirection; vos_mem_copy(&keymaterial->key[ 0 ].keyRsc, pFTKeyInfo->keyRsc, CSR_MAX_RSC_LEN); keymaterial->key[ 0 ].paeRole = pFTKeyInfo->paeRole; keymaterial->key[ 0 ].keyLength = pFTKeyInfo->keyLength; if ( pFTKeyInfo->keyLength && pFTKeyInfo->Key ) { vos_mem_copy(&keymaterial->key[ 0 ].key, pFTKeyInfo->Key, pFTKeyInfo->keyLength); if(pFTKeyInfo->keyLength == 16) { smsLog(pMac, LOG1, "SME Set Update Ind keyIdx (%d) encType(%d) key = " "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X", pMsg->keyMaterial.key[0].keyId, (tAniEdType)pMsg->keyMaterial.edType, pMsg->keyMaterial.key[0].key[0], pMsg->keyMaterial.key[0].key[1], pMsg->keyMaterial.key[0].key[2], pMsg->keyMaterial.key[0].key[3], pMsg->keyMaterial.key[0].key[4], pMsg->keyMaterial.key[0].key[5], pMsg->keyMaterial.key[0].key[6], pMsg->keyMaterial.key[0].key[7], pMsg->keyMaterial.key[0].key[8], pMsg->keyMaterial.key[0].key[9], pMsg->keyMaterial.key[0].key[10], pMsg->keyMaterial.key[0].key[11], pMsg->keyMaterial.key[0].key[12], pMsg->keyMaterial.key[0].key[13], pMsg->keyMaterial.key[0].key[14], pMsg->keyMaterial.key[0].key[15]); } } vos_mem_copy( &pMsg->bssId[ 0 ], &pFTKeyInfo->peerMac[ 0 ], sizeof(tCsrBssid) ); smsLog(pMac, LOG1, "BSSID = "MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pMsg->bssId)); status = palSendMBMessage(pMac->hHdd, pMsg); return( status ); }
/*========================================================================== FUNCTION WLANBAP_CleanCB DESCRIPTION Clear out all fields in the BAP context. DEPENDENCIES PARAMETERS IN pBtampCtx: pointer to the BAP control block freeFlag: flag indicating whether to free any allocations. RETURN VALUE The result code associated with performing the operation VOS_STATUS_E_FAULT: pointer to BAP cb is NULL ; access would cause a page fault VOS_STATUS_SUCCESS: Everything is good :) SIDE EFFECTS ============================================================================*/ VOS_STATUS WLANBAP_CleanCB ( ptBtampContext pBtampCtx, v_U32_t freeFlag // 0 /*do not empty*/); ) { v_U16_t i; /* Logical Link index */ tpBtampLogLinkCtx pLogLinkContext = NULL; /*------------------------------------------------------------------------ Sanity check BAP control block ------------------------------------------------------------------------*/ if ( NULL == pBtampCtx ) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Invalid BAP pointer in WLANBAP_CleanCB"); return VOS_STATUS_E_FAULT; } /*------------------------------------------------------------------------ Clean up BAP control block, initialize all values ------------------------------------------------------------------------*/ VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANBAP_CleanCB"); // First, clear out EVERYTHING in the BT-AMP context vos_mem_set( pBtampCtx, sizeof( *pBtampCtx), 0); pBtampCtx->pvosGCtx = NULL; // Initialize physical link state machine to DISCONNECTED state //pBtampCtx->bapPhysLinkMachine = BTAMPFSM_INSTANCEDATA_INIT; // Initialize physical link state machine to DISCONNECTED state vos_mem_copy( &pBtampCtx->bapPhysLinkMachine, &bapPhysLinkMachineInitial, /* BTAMPFSM_INSTANCEDATA_INIT; */ sizeof( pBtampCtx->bapPhysLinkMachine)); VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: Initializing State: %d", __func__, bapPhysLinkMachineInitial.stateVar); VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: Initialized State: %d", __func__, pBtampCtx->bapPhysLinkMachine.stateVar); //VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampContext value: %x", __func__, pBtampCtx); #ifdef BAP_DEBUG /* Trace the tBtampCtx being passed in. */ VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLAN BAP Context Monitor: pBtampCtx value = %x in %s:%d", pBtampCtx, __func__, __LINE__ ); #endif //BAP_DEBUG pBtampCtx->sessionId = 0; pBtampCtx->pAppHdl = NULL; // Per-app BSL context pBtampCtx->pHddHdl = NULL; // Per-app BSL context /* 8 bits of phy_link_handle identifies this association */ pBtampCtx->phy_link_handle = 0; pBtampCtx->channel = 0; pBtampCtx->BAPDeviceRole = BT_RESPONDER; pBtampCtx->ucSTAId = 0; // gNeedPhysLinkCompEvent pBtampCtx->gNeedPhysLinkCompEvent = VOS_FALSE; // gPhysLinkStatus pBtampCtx->gPhysLinkStatus = WLANBAP_STATUS_SUCCESS; // gDiscRequested pBtampCtx->gDiscRequested = VOS_FALSE; // gDiscReason pBtampCtx->gDiscReason = WLANBAP_STATUS_SUCCESS; /* Connection Accept Timer interval*/ pBtampCtx->bapConnectionAcceptTimerInterval = WLANBAP_CONNECTION_ACCEPT_TIMEOUT; /* Link Supervision Timer interval*/ pBtampCtx->bapLinkSupervisionTimerInterval = WLANBAP_LINK_SUPERVISION_TIMEOUT; /* Logical Link Accept Timer interval*/ pBtampCtx->bapLogicalLinkAcceptTimerInterval = WLANBAP_LOGICAL_LINK_ACCEPT_TIMEOUT; /* Best Effort Flush timer interval*/ pBtampCtx->bapBEFlushTimerInterval = WLANBAP_BE_FLUSH_TIMEOUT; // Include the associations MAC addresses vos_mem_copy( pBtampCtx->self_mac_addr, pBtStaOwnMacAddr, /* Where do I get the current MAC address? */ sizeof(pBtampCtx->self_mac_addr)); vos_mem_set( pBtampCtx->peer_mac_addr, sizeof(pBtampCtx->peer_mac_addr), 0); // The array of logical links pBtampCtx->current_log_link_index = 0; /* assigned mod 16 */ pBtampCtx->total_log_link_index = 0; /* should never be >16 */ // Clear up the array of logical links for (i = 0; i < WLANBAP_MAX_LOG_LINKS ; i++) { pLogLinkContext = &pBtampCtx->btampLogLinkCtx[i]; pLogLinkContext->present = 0; pLogLinkContext->uTxPktCompleted = 0; pLogLinkContext->log_link_handle = 0; } // Include the HDD BAP Shim Layer callbacks for Fetch, TxComp, and RxPkt pBtampCtx->pfnBtampFetchPktCB = NULL; pBtampCtx->pfnBtamp_STARxCB = NULL; pBtampCtx->pfnBtampTxCompCB = NULL; /* Implements the callback for ALL asynchronous events. */ pBtampCtx->pBapHCIEventCB = NULL; /* Set the default for event mask */ vos_mem_set( pBtampCtx->event_mask_page_2, sizeof(pBtampCtx->event_mask_page_2), 0); /* Set the default for location data. */ pBtampCtx->btamp_Location_Data_Info.loc_options = 0x58; /* Set the default data transfer mode */ pBtampCtx->ucDataTrafficMode = WLANBAP_FLOW_CONTROL_MODE_BLOCK_BASED; return VOS_STATUS_SUCCESS; }/* WLANBAP_CleanCB */
VOS_STATUS WLANBAP_InitLinkSupervision ( ptBtampHandle btampHandle ) { VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; ptBtampContext pBtampCtx = (ptBtampContext) btampHandle; vos_pkt_t *pLSReqPacket; vos_pkt_t *pLSRepPacket; v_U16_t lsPktln; if ( NULL == pBtampCtx) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Invalid BAP handle value in %s", __FUNCTION__); return VOS_STATUS_E_FAULT; } #if 0 /* Initialize Link supervision data structure */ vos_mem_set(pLsInfo, sizeof(tBtampLS),0); /* Allocate memory for Static Tx Data */ pLsInfo->pTxPktData = vos_mem_malloc(sizeof(tBtampLsPktData)+TX_LS_DATALEN); /* Initialize Static data for LS pkt Tx */ pLsInfo->pTxPktData->BufLen = TX_LS_DATALEN; vos_mem_copy (&pLsInfo->pTxPktData->pBuf, LsTxData, pLsInfo->pTxPktData->BufLen); #endif pBtampCtx->lsReqPktPending = VOS_FALSE; pBtampCtx->retries = 0; vosStatus = WLANBAP_AcquireLSPacket( pBtampCtx, &pLSReqPacket,32, TRUE ); if( VOS_IS_STATUS_SUCCESS( vosStatus ) ) { pBtampCtx->lsReqPacket = pLSReqPacket; } else { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, "%s:AcquireLSPacket failed\n",__FUNCTION__); pBtampCtx->lsReqPacket = NULL; return vosStatus; } vosStatus = WLANBAP_AcquireLSPacket( pBtampCtx, &pLSRepPacket,32,FALSE ); if( VOS_IS_STATUS_SUCCESS( vosStatus ) ) { pBtampCtx->lsRepPacket = pLSRepPacket; } else { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, "%s:AcquireLSPacket failed\n",__FUNCTION__); pBtampCtx->lsRepPacket = NULL; return vosStatus; } vosStatus = vos_pkt_get_packet_length(pBtampCtx->lsRepPacket,&lsPktln); if ( VOS_STATUS_SUCCESS != vosStatus ) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, "%s:vos_pkt_get_length error",__FUNCTION__); return VOS_STATUS_E_FAULT; } pBtampCtx->lsPktln = lsPktln; /* Start Link Supervision Timer if not configured for infinite */ if (pBtampCtx->bapLinkSupervisionTimerInterval) { vosStatus = WLANBAP_StartLinkSupervisionTimer (pBtampCtx, pBtampCtx->bapLinkSupervisionTimerInterval * WLANBAP_BREDR_BASEBAND_SLOT_TIME); } else { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO, "%s:No LS configured for infinite",__FUNCTION__); } return vosStatus; }
/* * TDLS request API, called from HDD to modify an existing TDLS peer */ eHalStatus csrTdlsChangePeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac, tCsrStaParams *pstaParams) { tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); tSmeCmd *tdlsAddStaCmd ; eHalStatus status = eHAL_STATUS_FAILURE ; if (NULL == pstaParams) return status; //If connected and in Infra. Only then allow this if (CSR_IS_SESSION_VALID( pMac, sessionId ) && csrIsConnStateConnectedInfra( pMac, sessionId ) && (NULL != peerMac)){ tdlsAddStaCmd = csrGetCommandBuffer(pMac) ; if (tdlsAddStaCmd) { tTdlsAddStaCmdInfo *tdlsAddStaCmdInfo = &tdlsAddStaCmd->u.tdlsCmd.u.tdlsAddStaCmdInfo ; tdlsAddStaCmdInfo->tdlsAddOper = TDLS_OPER_UPDATE; tdlsAddStaCmd->sessionId = sessionId; vos_mem_copy(tdlsAddStaCmdInfo->peerMac, peerMac, sizeof(tSirMacAddr)) ; tdlsAddStaCmdInfo->capability = pstaParams->capability; tdlsAddStaCmdInfo->uapsdQueues = pstaParams->uapsd_queues; tdlsAddStaCmdInfo->maxSp = pstaParams->max_sp; vos_mem_copy(tdlsAddStaCmdInfo->extnCapability, pstaParams->extn_capability, sizeof(pstaParams->extn_capability)); tdlsAddStaCmdInfo->htcap_present = pstaParams->htcap_present; if(pstaParams->htcap_present) vos_mem_copy( &tdlsAddStaCmdInfo->HTCap, &pstaParams->HTCap, sizeof(pstaParams->HTCap)); else vos_mem_set(&tdlsAddStaCmdInfo->HTCap, sizeof(pstaParams->HTCap), 0); tdlsAddStaCmdInfo->vhtcap_present = pstaParams->vhtcap_present; if(pstaParams->vhtcap_present) vos_mem_copy( &tdlsAddStaCmdInfo->VHTCap, &pstaParams->VHTCap, sizeof(pstaParams->VHTCap)); else vos_mem_set(&tdlsAddStaCmdInfo->VHTCap, sizeof(pstaParams->VHTCap), 0); tdlsAddStaCmdInfo->supportedRatesLen = pstaParams->supported_rates_len; if (0 != pstaParams->supported_rates_len) vos_mem_copy( &tdlsAddStaCmdInfo->supportedRates, pstaParams->supported_rates, pstaParams->supported_rates_len); tdlsAddStaCmd->command = eSmeCommandTdlsAddPeer; tdlsAddStaCmd->u.tdlsCmd.size = sizeof(tTdlsAddStaCmdInfo) ; smePushCommand(pMac, tdlsAddStaCmd, FALSE) ; status = eHAL_STATUS_SUCCESS ; } } return status ; }
/*-------------------------------------------------------------------------- \brief peCreateSession() - creates a new PE session given the BSSID This function returns the session context and the session ID if the session corresponding to the passed BSSID is found in the PE session table. \param pMac - pointer to global adapter context \param bssid - BSSID of the new session \param sessionId -session ID is returned here, if session is created. \return tpPESession - pointer to the session context or NULL if session can not be created. \sa --------------------------------------------------------------------------*/ tpPESession peCreateSession(tpAniSirGlobal pMac, tANI_U8 *bssid , tANI_U8* sessionId, tANI_U16 numSta) { tANI_U8 i; for(i =0; i < pMac->lim.maxBssId; i++) { /* Find first free room in session table */ if(pMac->lim.gpSession[i].valid == FALSE) { vos_mem_set((void*)&pMac->lim.gpSession[i], sizeof(tPESession), 0); //Allocate space for Station Table for this session. pMac->lim.gpSession[i].dph.dphHashTable.pHashTable = vos_mem_vmalloc( sizeof(tpDphHashNode)*numSta); if ( NULL == pMac->lim.gpSession[i].dph.dphHashTable.pHashTable ) { limLog(pMac, LOGE, FL("memory allocate for size %lu failed!"), (long unsigned int) sizeof(tpDphHashNode)*numSta); return NULL; } pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray = vos_mem_vmalloc( sizeof(tDphHashNode)*numSta); if ( NULL == pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray ) { limLog(pMac, LOGE, FL("memory allocate failed for Node array" "of size %lu"), (long unsigned int) sizeof(tDphHashNode)*numSta); vos_mem_vfree(pMac->lim.gpSession[i].dph.dphHashTable.pHashTable); pMac->lim.gpSession[i].dph.dphHashTable.pHashTable = NULL; return NULL; } pMac->lim.gpSession[i].dph.dphHashTable.size = numSta; dphHashTableClassInit(pMac, &pMac->lim.gpSession[i].dph.dphHashTable); pMac->lim.gpSession[i].gpLimPeerIdxpool = vos_mem_vmalloc(sizeof( *pMac->lim.gpSession[i].gpLimPeerIdxpool) * (numSta+1)); if ( NULL == pMac->lim.gpSession[i].gpLimPeerIdxpool ) { limLog(pMac, LOGE, FL("memory allocate failed " "for peerId pool of size %lu!"), (long unsigned int) sizeof(*pMac->lim.gpSession[i].gpLimPeerIdxpool) * (numSta+1)); vos_mem_vfree(pMac->lim.gpSession[i].dph.dphHashTable.pHashTable); vos_mem_vfree(pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray); pMac->lim.gpSession[i].dph.dphHashTable.pHashTable = NULL; pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray = NULL; return NULL; } vos_mem_set(pMac->lim.gpSession[i].gpLimPeerIdxpool, sizeof(*pMac->lim.gpSession[i].gpLimPeerIdxpool) * (numSta+1), 0); pMac->lim.gpSession[i].freePeerIdxHead = 0; pMac->lim.gpSession[i].freePeerIdxTail = 0; pMac->lim.gpSession[i].gLimNumOfCurrentSTAs = 0; /* Copy the BSSID to the session table */ sirCopyMacAddr(pMac->lim.gpSession[i].bssId, bssid); pMac->lim.gpSession[i].valid = TRUE; /* Intialize the SME and MLM states to IDLE */ pMac->lim.gpSession[i].limMlmState = eLIM_MLM_IDLE_STATE; pMac->lim.gpSession[i].limSmeState = eLIM_SME_IDLE_STATE; pMac->lim.gpSession[i].limCurrentAuthType = eSIR_OPEN_SYSTEM; peInitBeaconParams(pMac, &pMac->lim.gpSession[i]); #ifdef WLAN_FEATURE_VOWIFI_11R pMac->lim.gpSession[i].is11Rconnection = FALSE; #endif #ifdef FEATURE_WLAN_ESE pMac->lim.gpSession[i].isESEconnection = FALSE; #endif #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) pMac->lim.gpSession[i].isFastTransitionEnabled = FALSE; #endif #ifdef FEATURE_WLAN_LFR pMac->lim.gpSession[i].isFastRoamIniFeatureEnabled = FALSE; #endif *sessionId = i; pMac->lim.gpSession[i].gLimPhyMode = WNI_CFG_PHY_MODE_11G; //TODO :Check with the team what should be default mode /* Initialize CB mode variables when session is created */ pMac->lim.gpSession[i].htSupportedChannelWidthSet = 0; pMac->lim.gpSession[i].htRecommendedTxWidthSet = 0; pMac->lim.gpSession[i].htSecondaryChannelOffset = 0; #ifdef FEATURE_WLAN_TDLS vos_mem_set(pMac->lim.gpSession[i].peerAIDBitmap, sizeof(pMac->lim.gpSession[i].peerAIDBitmap), 0); pMac->lim.gpSession[i].tdlsChanSwitProhibited = 0; #endif pMac->lim.gpSession[i].fWaitForProbeRsp = 0; pMac->lim.gpSession[i].fIgnoreCapsChange = 0; limLog(pMac, LOG1, FL("Create a new sessionId (%d) with BSSID: " MAC_ADDRESS_STR " Max No. of STA %d"), pMac->lim.gpSession[i].peSessionId, MAC_ADDR_ARRAY(bssid), numSta); return(&pMac->lim.gpSession[i]); } } limLog(pMac, LOGE, FL("Session can not be created.. Reached Max permitted sessions ")); return NULL; }