Пример #1
0
/**
 * aniEapolKeyFreeDesc
 *
 * Frees the EAPOL key descriptor and the key bytes contained within it.
 *
 * @param descType the key descriptor type
 * @param keyDescData the key descriptor
 *
 * @return ANI_OK if the operation succeeds
 */
int
aniEapolKeyFreeDesc(int descType, void *keyDescData)
{
    tAniEapolRsnKeyDesc *rsnDesc;

    if( keyDescData )
    {
        if ((descType == ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW)
                || (descType == ANI_EAPOL_KEY_DESC_TYPE_RSN))
        {

            rsnDesc = (tAniEapolRsnKeyDesc *) keyDescData;
            if (rsnDesc->keyData != NULL)
                vos_mem_free(rsnDesc->keyData);

        }
        else {

            VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
                "Supp asked to free illegal type: %d\n", descType);

        }

        vos_mem_free(keyDescData);
    }

    return ANI_OK;
}
Пример #2
0
tSirRetStatus macClose(tHalHandle hHal)
{

    tpAniSirGlobal pMac = (tpAniSirGlobal) hHal;
    uint8_t i =0;

    if (!pMac)
        return eHAL_STATUS_FAILURE;

    peClose(pMac);
    pMac->psOffloadEnabled = FALSE;

    /* Call routine to free-up all CFG data structures */
    cfgDeInit(pMac);

    logDeinit(pMac);

    /* Free the DumpTableEntry */
    for(i=0; i<MAX_DUMP_TABLE_ENTRY; i++)
    {
        vos_mem_free(pMac->dumpTableEntry[i]);
    }

    // Finally, de-allocate the global MAC datastructure:
    vos_mem_free( pMac );

    return eSIR_SUCCESS;
}
/**---------------------------------------------------------------------
 * cfgProcessMbMsg()
 *
 *FUNCTION:
 * CFG mailbox message processing function.
 *
 *LOGIC:
 *
 *ASSUMPTIONS:
 * None.
 *
 *NOTE:
 *
 * @param pMsg    Message pointer
 *
 * @return None.
 *
 */
void
cfgProcessMbMsg(tpAniSirGlobal pMac, tSirMbMsg *pMsg)
{
    tANI_U16    index;
    tANI_U16    len;
    tANI_U32   *pParam;

    // Use type[7:0] as index to function table
    index = CFG_GET_FUNC_INDX(pMsg->type);

    if (index >= (sizeof(gCfgFunc) / sizeof(gCfgFunc[0])))
    {
        vos_mem_free(pMsg);
        return;
    }
    len    = pMsg->msgLen - WNI_CFG_MB_HDR_LEN;
    pParam = ((tANI_U32*)pMsg) + 1;

    // Call processing function
    gCfgFunc[index](pMac, len, pParam);

    // Free up buffer
    vos_mem_free(pMsg);

} /*** end cfgProcessMbMsg() ***/
Пример #4
0
static tSirRetStatus
ibss_peer_add(tpAniSirGlobal pMac, tLimIbssPeerNode *pPeerNode)
{
#ifdef ANI_SIR_IBSS_PEER_CACHING
    tANI_U32 numIbssPeers = (2 * pMac->lim.maxStation);

    if (pMac->lim.gLimNumIbssPeers >= numIbssPeers)
    {
        tLimIbssPeerNode *pTemp, *pPrev;
        pTemp = pPrev = pMac->lim.gLimIbssPeerList;
        while (pTemp->next != NULL)
        {
            pPrev = pTemp;
            pTemp = pTemp->next;
        }
        if(pTemp->beacon)
        {
            vos_mem_free(pTemp->beacon);
        }

        vos_mem_free(pTemp);
        pPrev->next = NULL;
    }
    else
#endif
        pMac->lim.gLimNumIbssPeers++;

    pPeerNode->next = pMac->lim.gLimIbssPeerList;
    pMac->lim.gLimIbssPeerList = pPeerNode;

    return eSIR_SUCCESS;

} 
Пример #5
0
void vos_event_report_payload(v_U16_t event_Id, v_U16_t length, v_VOID_t *pPayload)
{


    tAniHdr *wmsg = NULL;
    v_U8_t *pBuf;
    struct hdd_context_s *pHddCtx;
    v_CONTEXT_t pVosContext= NULL;
    event_report_t *pEvent_report;
    v_U16_t total_len;

     /*Get the global context */
    pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);

     /*Get the Hdd Context */
    pHddCtx = ((VosContextType*)(pVosContext))->pHDDContext;

    /* Send the log data to the ptt app only if it is registered with the wlan driver*/
    if(pHddCtx->ptt_pid != INVALID_PID)
    {
        total_len = sizeof(tAniHdr)+sizeof(event_report_t)+length;

        pBuf =  (v_U8_t*)vos_mem_malloc(total_len);

        if(!pBuf)
        {
            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "vos_mem_malloc failed");
            return;
        }
        wmsg = (tAniHdr*)pBuf;
        wmsg->type = PTT_MSG_DIAG_CMDS_TYPE;
        wmsg->length = total_len;
        wmsg->length = DIAG_SWAP16(wmsg->length);
        pBuf += sizeof(tAniHdr);

        pEvent_report = (event_report_t*)pBuf;
        pEvent_report->diag_type = DIAG_TYPE_EVENTS;
        pEvent_report->event_id = event_Id;
        pEvent_report->length = length;

        pBuf += sizeof(event_report_t);

        memcpy(pBuf, pPayload,length);

        if( ptt_sock_send_msg_to_app(wmsg, 0, ANI_NL_MSG_PUMAC, pHddCtx->ptt_pid) < 0) {
            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                       ("Ptt Socket error sending message to the app!!"));
            vos_mem_free((v_VOID_t*)wmsg);
            pHddCtx->ptt_pid = INVALID_PID;
            return;
        }

        vos_mem_free((v_VOID_t*)wmsg);
    }

    return;

}
/**
 * aniSsmReplayCtrFree
 *
 * Frees the replay counter context.
 *
 * @param ctr the replay counter to free.
 *
 * @return ANI_OK if the operation succeeds
 */
int
aniSsmReplayCtrFree(tAniSsmReplayCtr *ctr)
{

    if (ctr->buf != NULL)
        vos_mem_free(ctr->buf);

    vos_mem_free(ctr);

    return ANI_OK;
}
Пример #7
0
static void
ibss_coalesce_free(
    tpAniSirGlobal pMac)
{
    if (pMac->lim.ibssInfo.pHdr != NULL)
        vos_mem_free(pMac->lim.ibssInfo.pHdr);
    if (pMac->lim.ibssInfo.pBeacon != NULL)
        vos_mem_free(pMac->lim.ibssInfo.pBeacon);

    pMac->lim.ibssInfo.pHdr    = NULL;
    pMac->lim.ibssInfo.pBeacon = NULL;
}
/*--------------------------------------------------------------------------
  Reset the FT context.
  ------------------------------------------------------------------------*/
void sme_FTReset(tHalHandle hHal)
{
    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
    if (pMac == NULL)
    {
        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, FL("pMac is NULL"));
        return;
    }
    if (pMac->ft.ftSmeContext.auth_ft_ies != NULL)
    {
#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
        smsLog( pMac, LOGE, FL(" Freeing FT Auth IE %p and setting to NULL"),
            pMac->ft.ftSmeContext.auth_ft_ies);
#endif
        vos_mem_free(pMac->ft.ftSmeContext.auth_ft_ies);
    }
    pMac->ft.ftSmeContext.auth_ft_ies = NULL;
    pMac->ft.ftSmeContext.auth_ft_ies_length = 0;

    if (pMac->ft.ftSmeContext.reassoc_ft_ies != NULL)
    {
#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
        smsLog( pMac, LOGE, FL(" Freeing FT Reassoc  IE %p and setting to NULL"),
            pMac->ft.ftSmeContext.auth_ft_ies);
#endif
        vos_mem_free(pMac->ft.ftSmeContext.reassoc_ft_ies);
    }
    pMac->ft.ftSmeContext.reassoc_ft_ies = NULL;
    pMac->ft.ftSmeContext.reassoc_ft_ies_length = 0;

    if (pMac->ft.ftSmeContext.psavedFTPreAuthRsp != NULL)
    {
#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
        smsLog( pMac, LOGE, FL("Freeing FtPreAuthRsp %p and setting to NULL"),
            pMac->ft.ftSmeContext.psavedFTPreAuthRsp);
#endif
        vos_mem_free(pMac->ft.ftSmeContext.psavedFTPreAuthRsp);
    }
    pMac->ft.ftSmeContext.psavedFTPreAuthRsp = NULL;
    pMac->ft.ftSmeContext.setFTPreAuthState = FALSE;
    pMac->ft.ftSmeContext.setFTPTKState = FALSE;

    if (pMac->ft.ftSmeContext.pCsrFTKeyInfo != NULL)
    {
        vos_mem_zero(pMac->ft.ftSmeContext.pCsrFTKeyInfo,
                       sizeof(tCsrRoamSetKey));
        vos_mem_free(pMac->ft.ftSmeContext.pCsrFTKeyInfo);
    }
    pMac->ft.ftSmeContext.pCsrFTKeyInfo = NULL;
    vos_mem_zero(pMac->ft.ftSmeContext.preAuthbssId, ANI_MAC_ADDR_SIZE);
    pMac->ft.ftSmeContext.FTState = eFT_START_READY;
}
/**
 * aniAsfPacketFree
 *
 * FUNCTION:
 * Free a previously allocated tAniPacket and its internal raw data
 * buffer.
 *
 * @param packet the packet to free
 *
 * @return ANI_OK if the operation succeeds; ANI_E_NULL_VALUE if an
 * unexpected NULL pointer is encountered
 */
int
aniAsfPacketFree(tAniPacket *packet)
{
  if (packet == NULL)
    return ANI_E_NULL_VALUE;

  if (packet->buf != NULL)
    vos_mem_free( packet->buf );

  vos_mem_free( packet );

  return ANI_OK;
}
Пример #10
0
void hdd_sendActionCnf( hdd_adapter_t *pAdapter, tANI_BOOLEAN actionSendSuccess )
{
    hdd_cfg80211_state_t *cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );

    cfgState->actionFrmState = HDD_IDLE;

    hddLog( LOG1, "Send Action cnf, actionSendSuccess %d", actionSendSuccess);
    if( NULL == cfgState->buf )
    {
        return;
    }

    /* If skb is NULL it means this packet was received on CFG80211 interface
     * else it was received on Monitor interface */
    if( cfgState->skb == NULL )
    {
        /*
         * buf is the same pointer it passed us to send. Since we are sending
         * it through control path, we use different buffers.
         * In case of mac80211, they just push it to the skb and pass the same
         * data while sending tx ack status.
         * */
         cfg80211_mgmt_tx_status( pAdapter->dev, cfgState->action_cookie,
                cfgState->buf, cfgState->len, actionSendSuccess, GFP_KERNEL );
         vos_mem_free( cfgState->buf );
         cfgState->buf = NULL;
    }
    else
    {
        hdd_adapter_t* pMonAdapter =
                    hdd_get_adapter( pAdapter->pHddCtx, WLAN_HDD_MONITOR );
        if( pMonAdapter == NULL )
        {
            hddLog( LOGE, "Not able to get Monitor Adapter");
            cfgState->skb = NULL;
            vos_mem_free( cfgState->buf );
            cfgState->buf = NULL;
            complete(&pAdapter->tx_action_cnf_event);
            return;
        }
        /* Send TX completion feedback over monitor interface. */
        hdd_wlan_tx_complete( pMonAdapter, cfgState, actionSendSuccess );
        cfgState->skb = NULL;
        vos_mem_free( cfgState->buf );
        cfgState->buf = NULL;
        /* Look for the next Mgmt packet to TX */
        hdd_mon_tx_mgmt_pkt(pAdapter);
    }
    complete(&pAdapter->tx_action_cnf_event);
}
Пример #11
0
/*--------------------------------------------------------------------------
  Reset the FT context.
  ------------------------------------------------------------------------*/
void sme_FTReset(tHalHandle hHal, tANI_U32 sessionId)
{
   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
   tCsrRoamSession *pSession = NULL;

   if (pMac == NULL) {
      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, FL("pMac is NULL"));
      return;
   }

   pSession = CSR_GET_SESSION(pMac, sessionId);
   if (NULL != pSession) {
      if (pSession->ftSmeContext.auth_ft_ies != NULL) {
#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
          smsLog(pMac, LOG1, FL("Freeing FT Auth IE %p and setting to NULL"),
                pSession->ftSmeContext.auth_ft_ies);
#endif
         vos_mem_free(pSession->ftSmeContext.auth_ft_ies);
         pSession->ftSmeContext.auth_ft_ies = NULL;
      }
      pSession->ftSmeContext.auth_ft_ies_length = 0;

      if (pSession->ftSmeContext.reassoc_ft_ies != NULL) {
#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
          smsLog(pMac, LOG1,
                 FL("Freeing FT Reassoc IE %p and setting to NULL"),
                 pSession->ftSmeContext.reassoc_ft_ies);
#endif
         vos_mem_free(pSession->ftSmeContext.reassoc_ft_ies);
         pSession->ftSmeContext.reassoc_ft_ies = NULL;
      }
      pSession->ftSmeContext.reassoc_ft_ies_length = 0;

      if (pSession->ftSmeContext.psavedFTPreAuthRsp != NULL) {
#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
          smsLog( pMac, LOG1, FL("Freeing FtPreAuthRsp %p and setting to NULL"),
                pSession->ftSmeContext.psavedFTPreAuthRsp);
#endif
          vos_mem_free(pSession->ftSmeContext.psavedFTPreAuthRsp);
          vos_mem_set(pSession->ftSmeContext.psavedFTPreAuthRsp,
                        sizeof(tSirFTPreAuthRsp), 0);
      }
      pSession->ftSmeContext.setFTPreAuthState = VOS_FALSE;
      pSession->ftSmeContext.setFTPTKState = VOS_FALSE;

      vos_mem_zero(pSession->ftSmeContext.preAuthbssId, ANI_MAC_ADDR_SIZE);
      pSession->ftSmeContext.FTState = eFT_START_READY;
   }
}
Пример #12
0
/*--------------------------------------------------------------------------

  \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.
  \param bssType       - station or a
  \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,
                            tSirBssType bssType)
{
    VOS_STATUS status;
    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_malloc(
                                                  sizeof(tpDphHashNode)* (numSta + 1));
            if ( NULL == pMac->lim.gpSession[i].dph.dphHashTable.pHashTable )
            {
                limLog(pMac, LOGE, FL("memory allocate failed!"));
                return NULL;
            }
            pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray = vos_mem_malloc(
                                                       sizeof(tDphHashNode) * (numSta + 1));
            if ( NULL == pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray )
            {
                limLog(pMac, LOGE, FL("memory allocate failed!"));
                vos_mem_free(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 + 1;

            dphHashTableClassInit(pMac,
                           &pMac->lim.gpSession[i].dph.dphHashTable);

            pMac->lim.gpSession[i].gpLimPeerIdxpool = vos_mem_malloc(sizeof(
                                *pMac->lim.gpSession[i].gpLimPeerIdxpool) * (numSta+1));
            if ( NULL == pMac->lim.gpSession[i].gpLimPeerIdxpool )
            {
                PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
                vos_mem_free(pMac->lim.gpSession[i].dph.dphHashTable.pHashTable);
                vos_mem_free(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;
            }
Пример #13
0
/*--------------------------------------------------------------------------
  Initialize the FT context.
  ------------------------------------------------------------------------*/
void sme_FTOpen(tHalHandle hHal, tANI_U32 sessionId)
{
   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
   eHalStatus     status = eHAL_STATUS_SUCCESS;
   tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);

   if (NULL != pSession) {
      /* Clean up the context */
      vos_mem_set(&pSession->ftSmeContext, sizeof(tftSMEContext), 0);

      pSession->ftSmeContext.pUsrCtx = vos_mem_malloc(
                                         sizeof(tFTRoamCallbackUsrCtx));

      if (NULL == pSession->ftSmeContext.pUsrCtx) {
          smsLog(pMac, LOGE, FL("Memory allocation failure"));
          return;
      }
      pSession->ftSmeContext.pUsrCtx->pMac = pMac;
      pSession->ftSmeContext.pUsrCtx->sessionId = sessionId;

      status =
         vos_timer_init(&pSession->ftSmeContext.preAuthReassocIntvlTimer,
         VOS_TIMER_TYPE_SW,
         sme_PreauthReassocIntvlTimerCallback,
         (void *)pSession->ftSmeContext.pUsrCtx);

      if (eHAL_STATUS_SUCCESS != status) {
         smsLog(pMac, LOGE,
               FL("Preauth Reassoc interval Timer allocation failed"));
         vos_mem_free(pSession->ftSmeContext.pUsrCtx);
         pSession->ftSmeContext.pUsrCtx = NULL;
         return;
      }
   }
}
// Caller of this function MUST dynamically allocate memory for pBuf
// because this funciton will free the memory.
eHalStatus palSendMBMessage(tHddHandle hHdd, void *pBuf)
{
    eHalStatus halStatus = eHAL_STATUS_FAILURE;
    tSirRetStatus sirStatus;
    v_CONTEXT_t vosContext;
    v_VOID_t *hHal;

    vosContext = vos_get_global_context( VOS_MODULE_ID_HDD, hHdd );
    if (NULL == vosContext)
    {
        VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
                  "%s: invalid vosContext", __func__);
    }
    else
    {
        hHal = vos_get_context( VOS_MODULE_ID_SME, vosContext );
        if (NULL == hHal)
        {
            VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
                      "%s: invalid hHal", __func__);
        }
        else
        {
            sirStatus = uMacPostCtrlMsg( hHal, pBuf );
            if ( eSIR_SUCCESS == sirStatus )
            {
                halStatus = eHAL_STATUS_SUCCESS;
            }
        }
    }

    vos_mem_free( pBuf );

    return( halStatus );
}
eHalStatus palSpinLockAlloc( tHddHandle hHdd, tPalSpinLockHandle *pHandle )
{
    eHalStatus halStatus = eHAL_STATUS_FAILURE;
    VOS_STATUS vosStatus;
    vos_lock_t *pLock;

    do
    {
        pLock = vos_mem_malloc( sizeof( vos_lock_t ) );

        if ( NULL == pLock ) break;

        vos_mem_set(pLock, sizeof( vos_lock_t ), 0);

        vosStatus = vos_lock_init( pLock );
        if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
        {
            vos_mem_free( pLock );
            break;
        }

        *pHandle = (tPalSpinLockHandle)pLock;
        halStatus = eHAL_STATUS_SUCCESS;

    } while( 0 );

    return( halStatus );
}
void epping_driver_exit(v_CONTEXT_t pVosContext)
{
    epping_context_t *pEpping_ctx;

    pr_info("%s: unloading driver\n", __func__);

    pEpping_ctx = vos_get_context(VOS_MODULE_ID_HDD, pVosContext);

    if(!pEpping_ctx)
    {
        EPPING_LOG(VOS_TRACE_LEVEL_FATAL,
                   "%s: module exit called before probe",__func__);
    }
    else
    {
        vos_set_unload_in_progress(TRUE);
        vos_set_load_unload_in_progress(VOS_MODULE_ID_VOSS, TRUE);
    }
    hif_unregister_driver();
    vos_mem_free(pEpping_ctx);
    vos_preClose( &pVosContext );
#ifdef MEMORY_DEBUG
    adf_net_buf_debug_exit();
    vos_mem_exit();
#endif
#ifdef TIMER_MANAGER
    vos_timer_exit();
#endif
    pr_info("%s: driver unloaded\n", __func__);
}
eHalStatus csrTdlsProcessSendMgmt( tpAniSirGlobal pMac, tSmeCmd *cmd )
{
    tTdlsSendMgmtCmdInfo *tdlsSendMgmtCmdInfo = &cmd->u.tdlsCmd.u.tdlsSendMgmtCmdInfo ;
    tSirTdlsSendMgmtReq *tdlsSendMgmtReq = NULL ;
    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId );
    eHalStatus status = eHAL_STATUS_FAILURE;

    if (NULL == pSession->pConnectBssDesc)
    {
        smsLog( pMac, LOGE, FL("BSS Description is not present") );
        return eHAL_STATUS_FAILURE;
    }

    status = palAllocateMemory( pMac->hHdd, (void **)&tdlsSendMgmtReq, 
            (sizeof(tSirTdlsSendMgmtReq) + tdlsSendMgmtCmdInfo->len ) );

    if (!HAL_STATUS_SUCCESS( status ) )
    {
        smsLog( pMac, LOGE, FL("alloc failed") );
        VOS_ASSERT(0) ;
        return status ;
    }
    tdlsSendMgmtReq->sessionId = cmd->sessionId;
    //Using dialog as transactionId. This can be used to match response with request
    tdlsSendMgmtReq->transactionId = tdlsSendMgmtCmdInfo->dialog;  
    tdlsSendMgmtReq->reqType =  tdlsSendMgmtCmdInfo->frameType ;
    tdlsSendMgmtReq->dialog =  tdlsSendMgmtCmdInfo->dialog ;
    tdlsSendMgmtReq->statusCode =  tdlsSendMgmtCmdInfo->statusCode ;
    tdlsSendMgmtReq->responder =  tdlsSendMgmtCmdInfo->responder;

    palCopyMemory(pMac->hHdd, tdlsSendMgmtReq->bssid,
                  pSession->pConnectBssDesc->bssId, sizeof (tSirMacAddr));

    palCopyMemory(pMac->hHdd, tdlsSendMgmtReq->peerMac, 
            tdlsSendMgmtCmdInfo->peerMac, sizeof(tSirMacAddr)) ;

    if(tdlsSendMgmtCmdInfo->len && tdlsSendMgmtCmdInfo->buf)
    {
        palCopyMemory(pMac->hHdd, tdlsSendMgmtReq->addIe, tdlsSendMgmtCmdInfo->buf,
                tdlsSendMgmtCmdInfo->len);

    }
    // Send the request to PE.
    smsLog( pMac, LOG1, "sending TDLS Mgmt Frame req to PE " );
    status = tdlsSendMessage(pMac, eWNI_SME_TDLS_SEND_MGMT_REQ, 
            (void *)tdlsSendMgmtReq , sizeof(tSirTdlsSendMgmtReq)+tdlsSendMgmtCmdInfo->len) ;
    if(!HAL_STATUS_SUCCESS( status ) )
    {
        smsLog( pMac, LOGE, FL("Failed to send request to MAC"));
    }
    if(tdlsSendMgmtCmdInfo->len && tdlsSendMgmtCmdInfo->buf)
    {
        //Done with the buf. Free it.
        vos_mem_free( tdlsSendMgmtCmdInfo->buf );
        tdlsSendMgmtCmdInfo->buf = NULL;
        tdlsSendMgmtCmdInfo->len = 0;
    }

    return status;
}
Пример #18
0
/*--------------------------------------------------------------------------
  Cleanup the SME FT Global context.
  ------------------------------------------------------------------------*/
void sme_FTClose(tHalHandle hHal, tANI_U32 sessionId)
{
   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
   tCsrRoamSession *pSession = NULL;

   /* Clear the FT Context */
   sme_FTReset(hHal, sessionId);

   pSession = CSR_GET_SESSION( pMac, sessionId );
   if (NULL != pSession)
   {
      /* check if the timer is running */
      if (VOS_TIMER_STATE_RUNNING ==
            vos_timer_getCurrentState(
                     &pSession->ftSmeContext.preAuthReassocIntvlTimer))
      {
         vos_timer_stop(&pSession->ftSmeContext.preAuthReassocIntvlTimer);
      }

      if (VOS_STATUS_SUCCESS !=
            vos_timer_destroy(&pSession->ftSmeContext.preAuthReassocIntvlTimer))
      {
         smsLog(pMac, LOGE, FL("preAuthReAssocTimer destroy failed"));
      }

      if (pSession->ftSmeContext.pUsrCtx != NULL) {
          smsLog(pMac, LOG1,
                 FL("Freeing ftSmeContext.pUsrCtx and setting to NULL"));
          vos_mem_free(pSession->ftSmeContext.pUsrCtx);
          pSession->ftSmeContext.pUsrCtx = NULL;
      }
   }
}
/**
 * suppRsnFsmFree
 *
 * FUNCTION
 * Frees a previously allocated RSN Key FSM in a BP context. If the
 * RSN Key FSM is not yet allocated, then this is an error.
 * 
 * @param ctx the BP context whose FSM instance is to be freed
 *
 * @return ANI_OK if the operation succeeds
 */
int
suppRsnFsmFree(tBtampContext *ctx)
{
    tSuppRsnFsm *fsm;

    fsm = &ctx->uFsm.suppFsm;

    if( fsm->cryptHandle )
    {  
        vos_crypto_deinit( fsm->cryptHandle );
    }

    bapRsnClearTxRxCallbacks(); 

    if (fsm->lastEapol)
        aniAsfPacketFree(fsm->lastEapol);

    if( fsm->suppCtx )
    {
        if ( fsm->suppCtx->pmk )
        {
            aniAsfPacketFree(fsm->suppCtx->pmk);
        }
        vos_mem_free( fsm->suppCtx );
    }

    // Finally, clear everything out
    vos_mem_zero( fsm, sizeof(tSuppRsnFsm));

    return ANI_OK;
}
/*----------------------------------------------------------------------------
 *
 * This function forms message for cancel of remain on channel. This message
 * is added as data of Vendor Specific information element of debug marker
 * frame.Message will be in form "CANCEL-REMAIN-ON-CHANNEL<first/second-frame>"
 * "-SEQ=<sequence-num>"
 *
 *----------------------------------------------------------------------------*/
eHalStatus limPrepareAndSendCancelRemainOnChannelMsg(tpAniSirGlobal pMac,
                                                               tANI_U8 id)
{
    tANI_U8 *cancelRemainOnChannelMsg;
    eHalStatus status = eHAL_STATUS_SUCCESS;

    cancelRemainOnChannelMsg = vos_mem_malloc( REMAIN_ON_CHANNEL_MSG_SIZE );
    if( NULL == cancelRemainOnChannelMsg )
    {
        limLog( pMac, LOGE,
                FL( "Unable to allocate memory for end of"
                    " remain on channel message" ));
        return eHAL_STATUS_FAILURE;
    }

    snprintf(cancelRemainOnChannelMsg, REMAIN_ON_CHANNEL_MSG_SIZE,
            "CANCEL-REMAIN-ON-CHANNEL%d-SEQ=%d",
            id, pMac->lim.remOnChnSeqNum);
    if( eSIR_FAILURE == limSendRemainOnChannelDebugMarkerFrame(pMac,
                                                 cancelRemainOnChannelMsg) )
    {
        limLog( pMac, LOGE,
                "%s: Could not send %d marker frame to debug cancel"
                " remain on channel", __func__, id);
        status = eHAL_STATUS_FAILURE;
    }
    vos_mem_free( cancelRemainOnChannelMsg );

    return status;

}
static void vos_timer_clean()
{
    v_SIZE_t listSize;
    unsigned long flags;
        
    hdd_list_size(&vosTimerList, &listSize);
    
    if (listSize)
    {
       hdd_list_node_t* pNode;
       VOS_STATUS vosStatus;

       timer_node_t *ptimerNode;
       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
                 "%s: List is not Empty. listSize %d ",
                 __func__, (int)listSize);

       do
       {
          spin_lock_irqsave(&vosTimerList.lock, flags);
          vosStatus = hdd_list_remove_front(&vosTimerList, &pNode);
          spin_unlock_irqrestore(&vosTimerList.lock, flags);
          if (VOS_STATUS_SUCCESS == vosStatus)
          {
             ptimerNode = (timer_node_t*)pNode;
             VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
                       "Timer Leak@ File %s, @Line %d", 
                       ptimerNode->fileName, (int)ptimerNode->lineNum);

             vos_mem_free(ptimerNode);
          }
       } while (vosStatus == VOS_STATUS_SUCCESS);
    }
}
/*-------------------------------------------------------------------------
 *
 * This function forms message for start of remain on channel with channel
 * number, duration and sequence number. This message is added as data of
 * vendor specific information element of Debug Marker Frame. Message will
 * be in form "START-REMAIN-ON-CHANNEL<first/second-frame>-CHN=<channel>"
 * "-FOR-DUR=<duraion>-SEQ=<sequence-num>"
 *
 *-------------------------------------------------------------------------*/
eHalStatus limPrepareAndSendStartRemainOnChannelMsg(tpAniSirGlobal pMac,
                      tSirRemainOnChnReq *MsgRemainonChannel, tANI_U8 id)
{
    tANI_U8 *startRemainOnChannelMsg;
    eHalStatus status = eHAL_STATUS_SUCCESS;

    startRemainOnChannelMsg = vos_mem_malloc( REMAIN_ON_CHANNEL_MSG_SIZE );
    if( NULL == startRemainOnChannelMsg )
    {
        limLog(pMac, LOGE,
                FL("Unable to allocate memory for remain on channel message"));
        return eHAL_STATUS_FAILURE;
    }

    snprintf(startRemainOnChannelMsg, REMAIN_ON_CHANNEL_MSG_SIZE,
            "START-REMAIN-ON-CHANNEL%d-CHN=%d-FOR-DUR=%d-SEQ=%d",
            id, MsgRemainonChannel->chnNum, MsgRemainonChannel->duration,
            pMac->lim.remOnChnSeqNum);

    if( eSIR_FAILURE == limSendRemainOnChannelDebugMarkerFrame(pMac,
                                                      startRemainOnChannelMsg) )
    {
        limLog( pMac, LOGE,
                "%s: Could not send %d debug marker frame at start"
                " of remain on channel", __func__, id);
        status = eHAL_STATUS_FAILURE;
    }
    vos_mem_free( startRemainOnChannelMsg );

    return status;

}
int epping_cookie_init(epping_context_t*pEpping_ctx)
{
   A_UINT32 i, j;

   pEpping_ctx->cookie_list = NULL;
   pEpping_ctx->cookie_count = 0;
   for (i = 0; i < MAX_COOKIE_SLOTS_NUM; i++) {
      pEpping_ctx->s_cookie_mem[i] =
         vos_mem_malloc(sizeof(struct epping_cookie)*MAX_COOKIE_SLOT_SIZE);
      if (pEpping_ctx->s_cookie_mem[i] == NULL) {
         EPPING_LOG(VOS_TRACE_LEVEL_FATAL,
            "%s: no mem for cookie (idx = %d)", __func__, i);
         goto error;
      }
      vos_mem_zero(pEpping_ctx->s_cookie_mem[i],
         sizeof(struct epping_cookie)*MAX_COOKIE_SLOT_SIZE);
   }
   adf_os_spinlock_init(&pEpping_ctx->cookie_lock);

   for (i = 0; i < MAX_COOKIE_SLOTS_NUM; i++) {
      struct epping_cookie *cookie_mem = pEpping_ctx->s_cookie_mem[i];
      for (j = 0; j < MAX_COOKIE_SLOT_SIZE; j++) {
         epping_free_cookie(pEpping_ctx, &cookie_mem[j]);
      }
   }
   return 0;
error:
   for (i = 0; i < MAX_COOKIE_SLOTS_NUM; i++) {
      if (pEpping_ctx->s_cookie_mem[i]) {
         vos_mem_free(pEpping_ctx->s_cookie_mem[i]);
         pEpping_ctx->s_cookie_mem[i] = NULL;
      }
   }
   return -ENOMEM;
}
Пример #24
0
eHalStatus wlan_hdd_remain_on_channel_callback( tHalHandle hHal, void* pCtx,
                                                eHalStatus status )
{
    hdd_adapter_t *pAdapter = (hdd_adapter_t*) pCtx;
    hdd_cfg80211_state_t *cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
    hdd_remain_on_chan_ctx_t *pRemainChanCtx = cfgState->remain_on_chan_ctx;

    if( pRemainChanCtx == NULL )
    {
       hddLog( LOGW,
          "%s: No Rem on channel pending for which Rsp is received", __func__);
       return eHAL_STATUS_SUCCESS;
    }

    hddLog( LOG1, "Received remain on channel rsp");

    cfgState->remain_on_chan_ctx = NULL;

    if( REMAIN_ON_CHANNEL_REQUEST == pRemainChanCtx->rem_on_chan_request )
    {
        if( cfgState->buf )
        {
           hddLog( LOGP, 
                   "%s: We need to receive yet an ack from one of tx packet",
                   __func__);
        }
        cfg80211_remain_on_channel_expired( pRemainChanCtx->dev,
                              pRemainChanCtx->cookie,
                              &pRemainChanCtx->chan,
                              pRemainChanCtx->chan_type, GFP_KERNEL );
    }

    vos_mem_free( pRemainChanCtx );

    if ( ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode ) ||
         ( WLAN_HDD_P2P_CLIENT == pAdapter->device_mode ) ||
         ( WLAN_HDD_P2P_DEVICE == pAdapter->device_mode )
       )
    {
        tANI_U8 sessionId = pAdapter->sessionId;
        sme_DeregisterMgmtFrame(
                   hHal, sessionId,
                   (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_PROBE_REQ << 4),
                    NULL, 0 );
    }
    else if ( ( WLAN_HDD_SOFTAP== pAdapter->device_mode ) ||
              ( WLAN_HDD_P2P_GO == pAdapter->device_mode )
            )
    {
        WLANSAP_DeRegisterMgmtFrame(
                (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
                (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_PROBE_REQ << 4),
                NULL, 0 );
    }

    complete(&pAdapter->cancel_rem_on_chan_var);
    return eHAL_STATUS_SUCCESS;
}
Пример #25
0
/*------------------------------------------------------------------
 *
 * Below function is called if pMac->fP2pListenOffload enabled and hdd
 * requests a remain on channel.
 *
 *------------------------------------------------------------------*/
static eHalStatus limSendHalReqRemainOnChanOffload(tpAniSirGlobal pMac,
                                      tSirRemainOnChnReq *pRemOnChnReq)
{
    tSirScanOffloadReq *pScanOffloadReq;
    tSirMsgQ msg;
    tSirRetStatus rc = eSIR_SUCCESS;
    tANI_U8 bssid[SIR_MAC_ADDR_LENGTH] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};

    pScanOffloadReq = vos_mem_malloc(sizeof(tSirScanOffloadReq));
    if (NULL == pScanOffloadReq)
    {
        limLog(pMac, LOGE,
                FL("Memory allocation failed for pScanOffloadReq"));
        return eHAL_STATUS_FAILURE;
    }

    vos_mem_zero(pScanOffloadReq, sizeof(tSirScanOffloadReq));

    msg.type = WDA_START_SCAN_OFFLOAD_REQ;
    msg.bodyptr = pScanOffloadReq;
    msg.bodyval = 0;

    vos_mem_copy((tANI_U8 *) pScanOffloadReq->selfMacAddr,
                 (tANI_U8 *) pRemOnChnReq->selfMacAddr,
                 sizeof(tSirMacAddr));

    vos_mem_copy((tANI_U8 *) pScanOffloadReq->bssId,
                 (tANI_U8 *) bssid,
                 sizeof(tSirMacAddr));
    pScanOffloadReq->scanType = eSIR_PASSIVE_SCAN;
    pScanOffloadReq->p2pScanType = P2P_SCAN_TYPE_LISTEN;
    pScanOffloadReq->minChannelTime = pRemOnChnReq->duration;
    pScanOffloadReq->maxChannelTime = pRemOnChnReq->duration;
    pScanOffloadReq->sessionId = pRemOnChnReq->sessionId;
    pScanOffloadReq->channelList.numChannels = 1;
    pScanOffloadReq->channelList.channelNumber[0] = pRemOnChnReq->chnNum;

    limLog(pMac, LOG1,
            FL("Req-rem-on-channel: duration %u, session %hu, chan %hu"),
            pRemOnChnReq->duration, pRemOnChnReq->sessionId,
            pRemOnChnReq->chnNum);

    rc = wdaPostCtrlMsg(pMac, &msg);
    if (rc != eSIR_SUCCESS)
    {
        limLog(pMac, LOGE, FL("wdaPostCtrlMsg() return failure %u"),
                rc);
        vos_mem_free(pScanOffloadReq);
        return eHAL_STATUS_FAILURE;
    }

    pMac->lim.fOffloadScanPending = 1;
    pMac->lim.fOffloadScanP2PListen = 1;

    return eHAL_STATUS_SUCCESS;
}
Пример #26
0
tSirRetStatus schSetFixedBeaconFields(tpAniSirGlobal pMac,tpPESession psessionEntry)
{
    tpAniBeaconStruct pBeacon = (tpAniBeaconStruct)
                                   pMac->sch.schObject.gSchBeaconFrameBegin;
    tpSirMacMgmtHdr mac;
    tANI_U16        offset;
    tANI_U8        *ptr;
    tDot11fBeacon1 *pBcn1;
    tDot11fBeacon2 *pBcn2;
    tANI_U32        i, nStatus, nBytes;
    tANI_U32        wpsApEnable=0, tmp;
    tDot11fIEWscProbeRes      *pWscProbeRes;
    tANI_U8  *pExtraIe = NULL;
    tANI_U32 extraIeLen =0;
    tANI_U16 extraIeOffset = 0;
    tANI_U16 p2pIeOffset = 0;
    tSirRetStatus status = eSIR_SUCCESS;

    pBcn1 = vos_mem_malloc(sizeof(tDot11fBeacon1));
    if ( NULL == pBcn1 )
    {
        schLog(pMac, LOGE, FL("Failed to allocate memory") );
        return eSIR_FAILURE;
    }

    pBcn2 = vos_mem_malloc(sizeof(tDot11fBeacon2));
    if ( NULL == pBcn2 )
    {
        schLog(pMac, LOGE, FL("Failed to allocate memory") );
        vos_mem_free(pBcn1);
        return eSIR_FAILURE;
    }

    pWscProbeRes = vos_mem_malloc(sizeof(tDot11fIEWscProbeRes));
    if ( NULL == pWscProbeRes )
    {
        schLog(pMac, LOGE, FL("Failed to allocate memory") );
        vos_mem_free(pBcn1);
        vos_mem_free(pBcn2);
        return eSIR_FAILURE;
    }

    PELOG1(schLog(pMac, LOG1, FL("Setting fixed beacon fields"));)
int wlan_logging_sock_activate_svc(int log_fe_to_console, int num_buf)
{
	int i = 0;
	unsigned long irq_flag;

	pr_info("%s: Initalizing FEConsoleLog = %d NumBuff = %d\n",
			__func__, log_fe_to_console, num_buf);

	gapp_pid = INVALID_PID;

	gplog_msg = (struct log_msg *) vmalloc(
			num_buf * sizeof(struct log_msg));
	if (!gplog_msg) {
		pr_err("%s: Could not allocate memory\n", __func__);
		return -ENOMEM;
	}

	vos_mem_zero(gplog_msg, (num_buf * sizeof(struct log_msg)));

	gwlan_logging.log_fe_to_console = !!log_fe_to_console;
	gwlan_logging.num_buf = num_buf;

	spin_lock_init(&gwlan_logging.spin_lock);

	spin_lock_irqsave(&gwlan_logging.spin_lock, irq_flag);
	INIT_LIST_HEAD(&gwlan_logging.free_list);
	INIT_LIST_HEAD(&gwlan_logging.filled_list);

	for (i = 0; i < num_buf; i++) {
		list_add(&gplog_msg[i].node, &gwlan_logging.free_list);
		gplog_msg[i].index = i;
	}
	gwlan_logging.pcur_node = (struct log_msg *)
		(gwlan_logging.free_list.next);
	list_del_init(gwlan_logging.free_list.next);
	spin_unlock_irqrestore(&gwlan_logging.spin_lock, irq_flag);

	init_waitqueue_head(&gwlan_logging.wait_queue);
	gwlan_logging.exit = false;
	init_completion(&gwlan_logging.shutdown_comp);
	gwlan_logging.thread = kthread_create(wlan_logging_thread, NULL,
					"wlan_logging_thread");
	if (IS_ERR(gwlan_logging.thread)) {
		pr_err("%s: Could not Create LogMsg Thread Controller",
		       __func__);
		vos_mem_free(gplog_msg);
		return -ENOMEM;
	}
	wake_up_process(gwlan_logging.thread);

	nl_srv_register(ANI_NL_MSG_LOG, wlan_logging_proc_sock_rx_msg);

	pr_info("%s: Activated wlan_logging svc\n", __func__);
	return 0;
}
Пример #28
0
/*--------------------------------------------------------------------------
  Cleanup the SME FT Global context. 
  ------------------------------------------------------------------------*/
void sme_FTClose(tHalHandle hHal)
{
    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );

    if (pMac->ft.ftSmeContext.auth_ft_ies != NULL)
    {
#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
        smsLog( pMac, LOGE, FL(" Freeing %p and setting to NULL\n"), 
            pMac->ft.ftSmeContext.auth_ft_ies);
#endif
        vos_mem_free(pMac->ft.ftSmeContext.auth_ft_ies);
        pMac->ft.ftSmeContext.auth_ft_ies = NULL;
    }
    pMac->ft.ftSmeContext.auth_ft_ies_length = 0;                        

    if (pMac->ft.ftSmeContext.reassoc_ft_ies != NULL)
    {
#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
        smsLog( pMac, LOGE, FL(" Freeing %p and setting to NULL\n"), 
            pMac->ft.ftSmeContext.reassoc_ft_ies);
#endif
        vos_mem_free(pMac->ft.ftSmeContext.reassoc_ft_ies);
        pMac->ft.ftSmeContext.reassoc_ft_ies = NULL;                        
    }
    pMac->ft.ftSmeContext.reassoc_ft_ies_length = 0;                        

    pMac->ft.ftSmeContext.FTState = eFT_START_READY;
    vos_mem_zero(pMac->ft.ftSmeContext.preAuthbssId, ANI_MAC_ADDR_SIZE);

    if (pMac->ft.ftSmeContext.psavedFTPreAuthRsp != NULL)
    {
#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
        smsLog( pMac, LOGE, FL("%s: Freeing %p and setting to NULL\n"), 
            pMac->ft.ftSmeContext.psavedFTPreAuthRsp);
#endif
        vos_mem_free(pMac->ft.ftSmeContext.psavedFTPreAuthRsp);
        pMac->ft.ftSmeContext.psavedFTPreAuthRsp = NULL;                        
    }

    palTimerFree(pMac->hHdd, pMac->ft.ftSmeContext.preAuthReassocIntvlTimer);
}
Пример #29
0
tSirRetStatus macStop(tHalHandle hHal, tHalStopType stopType)
{
    tANI_U8 i;
    tpAniSirGlobal pMac = (tpAniSirGlobal) hHal;
    peStop(pMac);
    cfgCleanup( pMac );
    
    
    if(false == pMac->sys.abort)
    {
        vos_mem_free(pMac->pResetMsg);
        pMac->pResetMsg = NULL;
    }
    
    for(i=0; i<MAX_DUMP_TABLE_ENTRY; i++)
    {
        vos_mem_free(pMac->dumpTableEntry[i]);
    }

    return eSIR_SUCCESS;
}
tSirRetStatus macStop(tHalHandle hHal, tHalStopType stopType)
{
    tANI_U8 i;
    tpAniSirGlobal pMac = (tpAniSirGlobal) hHal;
    peStop(pMac);
    cfgCleanup( pMac );
    // need to free memory if not called in reset context.
    // in reset context this memory will be freed by HDD.
    if(false == pMac->sys.abort)
    {
        vos_mem_free(pMac->pResetMsg);
        pMac->pResetMsg = NULL;
    }
    /* Free the DumpTableEntry */
    for(i=0; i<MAX_DUMP_TABLE_ENTRY; i++)
    {
        vos_mem_free(pMac->dumpTableEntry[i]);
    }

    return eSIR_SUCCESS;
}