예제 #1
0
tSirRetStatus macClose(tHalHandle hHal)
{

    tpAniSirGlobal pMac = (tpAniSirGlobal) hHal;

#ifndef GEN6_ONWARDS
    if(pMac->hal.pHalDxe){
#ifdef RTL8652
        extern void * rtlglue_is_data_scratchpad_memory(void *);
        if(rtlglue_is_data_scratchpad_memory(pMac->hal.pHalDxe))
            ;
        else
#endif
            palFreeMemory(pMac, pMac->hal.pHalDxe);
    }
#endif //GEN6_ONWARDS

    peClose(pMac);
#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
    halClose(hHal);
#endif

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

    logDeinit(pMac);

    // Finally, de-allocate the global MAC datastructure:
    palFreeMemory( pMac->hHdd, pMac );

    return eSIR_SUCCESS;
}
예제 #2
0
/* ---------------------------------------------------------------------------
    \fn oemData_SendMBOemDataReq
    \brief Request an OEM DATA REQ to be passed down to PE
    \param pMac:
    \param pOemDataReq: Pointer to the oem data request
    \return eHalStatus     
  -------------------------------------------------------------------------------*/
eHalStatus oemData_SendMBOemDataReq(tpAniSirGlobal pMac, tOemDataReq *pOemDataReq)
{
    eHalStatus status = eHAL_STATUS_SUCCESS;
    tSirOemDataReq* pMsg;
    tANI_U16 msgLen;
    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pOemDataReq->sessionId );

    smsLog(pMac, LOGW, "OEM_DATA: entering Function %s", __func__);
    
    msgLen = (tANI_U16)(sizeof(tSirOemDataReq));

    status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, msgLen);
    if(HAL_STATUS_SUCCESS(status))
    {
        palZeroMemory(pMac->hHdd, pMsg, msgLen);
        pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_OEM_DATA_REQ);
        palCopyMemory(pMac->hHdd, pMsg->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr) );
        status = palCopyMemory(pMac->hHdd, pMsg->oemDataReq, pOemDataReq->oemDataReq, OEM_DATA_REQ_SIZE);
        if(HAL_STATUS_SUCCESS(status))
        {
            smsLog(pMac, LOGW, "OEM_DATA: sending message to pe%s", __func__);
            status = palSendMBMessage(pMac->hHdd, pMsg);
        }
        else
        {
            palFreeMemory(pMac->hHdd, pMsg);
        }
    }

    smsLog(pMac, LOGW, "OEM_DATA: exiting Function %s", __func__);

    return status;
}
예제 #3
0
// 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", __FUNCTION__);
   }
   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", __FUNCTION__);
      }
      else
      {
         sirStatus = uMacPostCtrlMsg( hHal, pBuf );
         if ( eSIR_SUCCESS == sirStatus )
         {
            halStatus = eHAL_STATUS_SUCCESS;
         }
      }
   }

   palFreeMemory( hHdd, pBuf );

   return( halStatus );
}
예제 #4
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;

    status = palAllocateMemory(pMac->hHdd, (void **)&pBcn1, sizeof(tDot11fBeacon1));
    if(status != eSIR_SUCCESS)
    {
        schLog(pMac, LOGE, FL("Failed to allocate memory") );
        return eSIR_FAILURE;
    }

    status = palAllocateMemory(pMac->hHdd, (void **)&pBcn2, sizeof(tDot11fBeacon2));
    if(status != eSIR_SUCCESS)
    {
        schLog(pMac, LOGE, FL("Failed to allocate memory") );
        palFreeMemory(pMac->hHdd, pBcn1);
        return eSIR_FAILURE;
    }

    status = palAllocateMemory(pMac->hHdd, (void **)&pWscProbeRes, sizeof(tDot11fIEWscProbeRes));
    if(status != eSIR_SUCCESS)
    {
        schLog(pMac, LOGE, FL("Failed to allocate memory") );
        palFreeMemory(pMac->hHdd, pBcn1);
        palFreeMemory(pMac->hHdd, pBcn2);
        return eSIR_FAILURE;
    }

    PELOG1(schLog(pMac, LOG1, FL("Setting fixed beacon fields"));)
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)
    {
        palFreeMemory(pMac->hHdd, pMac->pResetMsg);
        pMac->pResetMsg = NULL;
    }
    /* Free the DumpTableEntry */
    for(i=0; i<MAX_DUMP_TABLE_ENTRY; i++)
    {
        palFreeMemory(pMac, pMac->dumpTableEntry[i]);
    }

    return eSIR_SUCCESS;
}
/*
 * Delete TDLD peer info, called from TDLS teardown request.
 */
static eHalStatus tdlsDeleteTdlsPeerInfo(tpAniSirGlobal pMac,
                                              tSirMacAddr peerMac)
{
    tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
    tCsrTdlsPeerLinkinfo *peerInfo = 
               findTdlsPeer(pMac, &disInfo->tdlsPotentialPeerList, peerMac) ;
    eHalStatus status = eHAL_STATUS_FAILURE ;

    if((csrLLRemoveEntry(&disInfo->tdlsPotentialPeerList, 
                        &peerInfo->tdlsPeerStaLink, LL_ACCESS_NOLOCK)))
    {
       status = palFreeMemory(pMac->hHdd, (void *)peerInfo) ;

    }

    return status ; 
}
tSirRetStatus macClose(tHalHandle hHal)
{

    tpAniSirGlobal pMac = (tpAniSirGlobal) hHal;

    peClose(pMac);

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

    logDeinit(pMac);

    // Finally, de-allocate the global MAC datastructure:
    palFreeMemory( pMac->hHdd, pMac );

    return eSIR_SUCCESS;
}
예제 #8
0
/**---------------------------------------------------------------------
 * 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])))
        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
    palFreeMemory( pMac->hHdd, (void*)pMsg);

} /*** end cfgProcessMbMsg() ***/
예제 #9
0
tSirRetStatus macPreStart(tHalHandle hHal)
{
   tSirRetStatus status = eSIR_SUCCESS;
   tANI_BOOLEAN memAllocFailed = eANI_BOOLEAN_FALSE;
   tpAniSirGlobal pMac = (tpAniSirGlobal) hHal;
   tANI_U8 i;

   for(i=0; i<MAX_DUMP_TABLE_ENTRY; i++)
   {
      if(palAllocateMemory(pMac->hHdd, ((void *)&pMac->dumpTableEntry[i]), sizeof(tDumpModuleEntry))
          != eHAL_STATUS_SUCCESS)
      {
         memAllocFailed = eANI_BOOLEAN_TRUE;
         break;
      }
      else
      {
         palZeroMemory(pMac->hHdd, pMac->dumpTableEntry[i], sizeof(tSirMbMsg));
      }
   }
   if( memAllocFailed )
   {
      while(i>0)
      {
         i--;
         palFreeMemory(pMac, pMac->dumpTableEntry[i]);
      }
      sysLog(pMac, LOGE, FL("pMac->dumpTableEntry is NULL\n"));
      status = eSIR_FAILURE;
   }

#if defined(ANI_LOGDUMP)
   //logDumpInit must be called before any module starts
   logDumpInit(pMac);
#endif //#if defined(ANI_LOGDUMP)

   return status;
}
예제 #10
0
/**
 * limSendCFParams()
 *
 *FUNCTION:
 * This function is called to send CFP Parameters to WDA, when they are changed.
 *
 *LOGIC:
 *
 *ASSUMPTIONS:
 * NA
 *
 *NOTE:
 * NA
 *
 * @param pMac  pointer to Global Mac structure.
 * @param bssIdx Bss Index of the BSS to which STA is associated.
 * @param cfpCount CFP Count, if that is changed.
 * @param cfpPeriod CFP Period if that is changed.
 *
 * @return success if message send is ok, else false.
 */
tSirRetStatus limSendCFParams(tpAniSirGlobal pMac, tANI_U8 bssIdx, tANI_U8 cfpCount, tANI_U8 cfpPeriod)
{
    tpUpdateCFParams pCFParams = NULL;
    tSirRetStatus   retCode = eSIR_SUCCESS;
    tSirMsgQ msgQ;

    if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
          (void **) &pCFParams,
          sizeof( tUpdateCFParams )))
      {
        limLog( pMac, LOGP,
            FL( "Unable to PAL allocate memory during Update CF Params\n" ));
        retCode = eSIR_MEM_ALLOC_FAILED;
        goto returnFailure;
      }
    palZeroMemory( pMac->hHdd, (tANI_U8 *) pCFParams, sizeof(tUpdateCFParams));
    pCFParams->cfpCount = cfpCount;
    pCFParams->cfpPeriod = cfpPeriod;
    pCFParams->bssIdx     = bssIdx;

    msgQ.type = WDA_UPDATE_CF_IND;
    msgQ.reserved = 0;
    msgQ.bodyptr = pCFParams;
    msgQ.bodyval = 0;
    limLog( pMac, LOG3,
                FL( "Sending WDA_UPDATE_CF_IND..." ));
    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
    if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
    {
        palFreeMemory(pMac->hHdd, pCFParams);
        limLog( pMac, LOGP,
                    FL("Posting  WDA_UPDATE_CF_IND to WDA failed, reason=%X\n"),
                    retCode );
    }
returnFailure:
    return retCode;
}
예제 #11
0
tSirRetStatus macOpen(tHalHandle *pHalHandle, tHddHandle hHdd, tMacOpenParameters *pMacOpenParms)
{
    tpAniSirGlobal pMac = NULL;

    if(pHalHandle == NULL)
        return eSIR_FAILURE;

    /*
     * Make sure this adapter is not already opened. (Compare pAdaptor pointer in already
     * allocated pMac structures.)
     * If it is opened just return pointer to previously allocated pMac pointer.
     * Or should this result in error?
     */

    /* Allocate pMac */
    if (palAllocateMemory(hHdd, ((void **)&pMac), sizeof(tAniSirGlobal)) != eHAL_STATUS_SUCCESS)
        return eSIR_FAILURE;

    /* Initialize the pMac structure */
    palZeroMemory(hHdd, pMac, sizeof(tAniSirGlobal));

    /** Store the Driver type in pMac Global.*/
    //pMac->gDriverType = pMacOpenParms->driverType;

#ifndef GEN6_ONWARDS
#ifdef RTL8652
    {
        //Leverage 8651c's on-chip data scratchpad memory to lock all HAL DxE data there
        extern void * rtlglue_alloc_data_scratchpad_memory(unsigned int size, char *);
        pMac->hal.pHalDxe = (tpAniHalDxe) rtlglue_alloc_data_scratchpad_memory(sizeof(tAniHalDxe),  "halDxe");
    }
    if(pMac->hal.pHalDxe){
        ;
    }else
#endif
    /* Allocate HalDxe */
    if (palAllocateMemory(hHdd, ((void **)&pMac->hal.pHalDxe), sizeof(tAniHalDxe)) != eHAL_STATUS_SUCCESS){
        palFreeMemory(hHdd, pMac);
        return eSIR_FAILURE;
    }
    /* Initialize the HalDxe structure */
    palZeroMemory(hHdd, pMac->hal.pHalDxe, sizeof(tAniHalDxe));
#endif //GEN6_ONWARDS

    /*
     * Set various global fields of pMac here
     * (Could be platform dependant as some variables in pMac are platform
     * dependant)
     */
    pMac->hHdd      = hHdd;
    pMac->pAdapter  = hHdd; //This line wil be removed
    *pHalHandle     = (tHalHandle)pMac;

    {
        /* Call various PE (and other layer init here) */
        if( eSIR_SUCCESS != logInit(pMac))
           return eSIR_FAILURE;
            
        /* Call routine to initialize CFG data structures */
        if( eSIR_SUCCESS != cfgInit(pMac) )
            return eSIR_FAILURE;

        sysInitGlobals(pMac);

#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
        // This decides whether HW needs to translate the 802.3 frames
        // from the host OS to the 802.11 frames. When set HW does the
        // translation from 802.3 to 802.11 and vice versa
        if(pMacOpenParms->frameTransRequired) {
            pMac->hal.halMac.frameTransEnabled = 1;
        } else {
            pMac->hal.halMac.frameTransEnabled = 0;
        }
#endif

        //Need to do it here in case halOpen fails later on.
#if defined( VOSS_ENABLED )
        tx_voss_wrapper_init(pMac, hHdd);
#endif
    }

#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
    if (eHAL_STATUS_SUCCESS != halOpen(pMac, pHalHandle, hHdd, pMacOpenParms))
        return eSIR_FAILURE;
#endif

    return peOpen(pMac, pMacOpenParms);
}
예제 #12
0
/* Application Specific include files */
#include "halInternal.h"
#include "halHddApis.h"
#include "halDebug.h"
#include "halMTU.h"
#include "halRxp.h"
#include "halPhyApi.h"

//#ifdef ANI_OS_TYPE_LINUX
#include "halCommonApi.h"   // halCleanup
#endif
#include "cfgApi.h"         // cfgCleanup
#include "limApi.h"         // limCleanup
#include "sirTypes.h"
#include "sysDebug.h"
#include "sysEntryFunc.h"
#include "macInitApi.h"
#if defined(ANI_LOGDUMP)
#include "logDump.h"
#endif //#if defined(ANI_LOGDUMP)

#ifdef TRACE_RECORD
#include "macTrace.h"
#endif

extern tSirRetStatus halDoCfgInit(tpAniSirGlobal pMac);
extern tSirRetStatus halProcessStartEvent(tpAniSirGlobal pMac);




tSirRetStatus macReset(tpAniSirGlobal pMac, tANI_U32 rc);

#ifdef FEATURE_WLAN_INTEGRATED_SOC
tSirRetStatus macPreStart(tHalHandle hHal)
{
   tSirRetStatus status = eSIR_SUCCESS;
   tANI_BOOLEAN memAllocFailed = eANI_BOOLEAN_FALSE;
   tpAniSirGlobal pMac = (tpAniSirGlobal) hHal;
   tANI_U8 i;

   for(i=0; i<MAX_DUMP_TABLE_ENTRY; i++)
   {
      if(palAllocateMemory(pMac->hHdd, ((void *)&pMac->dumpTableEntry[i]), sizeof(tDumpModuleEntry))
          != eHAL_STATUS_SUCCESS)
      {
         memAllocFailed = eANI_BOOLEAN_TRUE;
         break;
      }
      else
      {
         palZeroMemory(pMac->hHdd, pMac->dumpTableEntry[i], sizeof(tSirMbMsg));
      }
   }
   if( memAllocFailed )
   {
      while(i>0)
      {
         i--;
         palFreeMemory(pMac, pMac->dumpTableEntry[i]);
      }
      sysLog(pMac, LOGE, FL("pMac->dumpTableEntry is NULL\n"));
      status = eSIR_FAILURE;
   }

#if defined(ANI_LOGDUMP)
   //logDumpInit must be called before any module starts
   logDumpInit(pMac);
#endif //#if defined(ANI_LOGDUMP)

   return status;
}

tSirRetStatus macStart(tHalHandle hHal, void* pHalMacStartParams)
{
   tSirRetStatus status = eSIR_SUCCESS;
   tpAniSirGlobal pMac = (tpAniSirGlobal) hHal;

   if (NULL == pMac)
   {
      VOS_ASSERT(0);
      status = eSIR_FAILURE;
      return status;
   }

   pMac->gDriverType = ((tHalMacStartParameters*)pHalMacStartParams)->driverType;

   sysLog(pMac, LOG2, FL("called\n"));

   do
   {

#if defined(TRACE_RECORD)
      //Enable Tracing
      macTraceInit(pMac);
#endif

      if (!HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, ((void *)&pMac->pResetMsg), sizeof(tSirMbMsg))))
      {
         sysLog(pMac, LOGE, FL("pMac->pResetMsg is NULL\n"));
         status = eSIR_FAILURE;
         break;
      }
      else
      {
         palZeroMemory(pMac->hHdd, pMac->pResetMsg, sizeof(tSirMbMsg));
      }

      if (pMac->gDriverType != eDRIVER_TYPE_MFG)
      {
         status = peStart(pMac);
      }

   } while(0);
   pMac->sys.abort = false;

   return status;
}

#else /* FEATURE_WLAN_INTEGRATED_SOC */
tSirRetStatus macStart(tHalHandle hHal, void* pHalMacStartParams)
{
    tANI_U8 i;
    tSirRetStatus status = eSIR_SUCCESS;
    eHalStatus             halStatus;
    tpAniSirGlobal pMac = (tpAniSirGlobal) hHal;
    tANI_BOOLEAN memAllocFailed = eANI_BOOLEAN_FALSE;

    if(NULL == pMac)
    {
        VOS_ASSERT(0);
        status = eSIR_FAILURE;
        return status;
    }

    pMac->gDriverType = ((tHalMacStartParameters *)pHalMacStartParams)->driverType;

    sysLog(pMac, LOG2, FL("called\n"));

    do
    {
        for(i=0; i<MAX_DUMP_TABLE_ENTRY; i++)
        {
            if(palAllocateMemory(pMac->hHdd, ((void **)&pMac->dumpTableEntry[i]), sizeof(tDumpModuleEntry))
                != eHAL_STATUS_SUCCESS)
            {
                memAllocFailed = eANI_BOOLEAN_TRUE;
                break;
            }
            else
            {
                palZeroMemory(pMac->hHdd, pMac->dumpTableEntry[i], sizeof(tSirMbMsg));
            }
        }
        if( memAllocFailed )
        {
            while(i>0)
            {
                i--;
                palFreeMemory(pMac, pMac->dumpTableEntry[i]);
            }
            sysLog(pMac, LOGE, FL("pMac->dumpTableEntry is NULL\n"));
            status = eSIR_FAILURE;
            break;
        }
        else
        {
#if defined(ANI_LOGDUMP)
            logDumpInit(pMac);
#endif //#if defined(ANI_LOGDUMP)
        }

#if defined(TRACE_RECORD)
        //Enable Tracing
        macTraceInit(pMac);
#endif
        if (!HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, ((void **)&pMac->pResetMsg), sizeof(tSirMbMsg))))
        {
            sysLog(pMac, LOGE, FL("pMac->pResetMsg is NULL\n"));
            status = eSIR_FAILURE;
            break;
        }
        else
        {
            palZeroMemory(pMac->hHdd, pMac->pResetMsg, sizeof(tSirMbMsg));
        }

        halStatus = halStart(hHal, (tHalMacStartParameters*)pHalMacStartParams );

        if ( !HAL_STATUS_SUCCESS(halStatus) )
        {
            sysLog(pMac,LOGE, FL("halStart failed with error code = %d\n"), halStatus);
            status = eSIR_FAILURE;
        }
        else if(pMac->gDriverType != eDRIVER_TYPE_MFG)
        {
            peStart(pMac);
        }

    }while(0);
    pMac->sys.abort = false;

    return status;
}
tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb)
{
    tSirMsgQ msg;
    tpAniSirGlobal pMac = (tpAniSirGlobal)pSirGlobal;


    tSirMbMsg* pMbLocal;
    msg.type = pMb->type;
    msg.bodyval = 0;

    WDALOG3(wdaLog(pMac, LOG3, FL("msgType %d, msgLen %d\n" ),
                   pMb->type, pMb->msgLen));

    // copy the message from host buffer to firmware buffer
    // this will make sure that firmware allocates, uses and frees
    // it's own buffers for mailbox message instead of working on
    // host buffer

    // second parameter, 'wait option', to palAllocateMemory is ignored on Windows
    if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMbLocal, pMb->msgLen))
    {
        WDALOGE( wdaLog(pMac, LOGE, FL("Buffer Allocation failed!\n")));
        return eSIR_FAILURE;
    }

    palCopyMemory(pMac, (void *)pMbLocal, (void *)pMb, pMb->msgLen);
    msg.bodyptr = pMbLocal;

    switch (msg.type & HAL_MMH_MB_MSG_TYPE_MASK)
    {
    case WDA_MSG_TYPES_BEGIN:    // Posts a message to the HAL MsgQ
        wdaPostCtrlMsg(pMac, &msg);
        break;

    case SIR_LIM_MSG_TYPES_BEGIN:    // Posts a message to the LIM MsgQ
        limPostMsgApi(pMac, &msg);
        break;

    case SIR_CFG_MSG_TYPES_BEGIN:    // Posts a message to the CFG MsgQ
        wdaPostCfgMsg(pMac, &msg);
        break;

    case SIR_PMM_MSG_TYPES_BEGIN:    // Posts a message to the PMM MsgQ
        pmmPostMessage(pMac, &msg);
        break;

    case SIR_PTT_MSG_TYPES_BEGIN:
        WDALOGW( wdaLog(pMac, LOGW, FL("%s:%d: message type = 0x%X"),
                        __func__, __LINE__, msg.type));
        vos_mem_free(msg.bodyptr);
        break;


    default:
        WDALOGW( wdaLog(pMac, LOGW, FL("Unknown message type = "
                                       "0x%X\n"),
                        msg.type));

        // Release the memory.
        if (palFreeMemory( pMac->hHdd, (void*)(msg.bodyptr))
                != eHAL_STATUS_SUCCESS)
        {
            WDALOGE( wdaLog(pMac, LOGE, FL("Buffer Allocation failed!\n")));
            return eSIR_FAILURE;
        }
        break;
    }

    return eSIR_SUCCESS;

} // uMacPostCtrlMsg()
예제 #14
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.
  
  \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)
        {
            palZeroMemory(pMac, (void*)&pMac->lim.gpSession[i], sizeof(tPESession));

            //Allocate space for Station Table for this session.
            if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
                     (void **) &pMac->lim.gpSession[i].dph.dphHashTable.pHashTable, sizeof(tpDphHashNode)*numSta))
            {
                limLog(pMac, LOGE, FL("memory allocate failed!\n"));
                return NULL;
            }

            if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
                  (void **) &pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray, sizeof(tDphHashNode)*numSta))
            {
                limLog(pMac, LOGE, FL("memory allocate failed!\n"));
                palFreeMemory(pMac->hHdd,pMac->lim.gpSession[i].dph.dphHashTable.pHashTable);
                return NULL;
            }
            pMac->lim.gpSession[i].dph.dphHashTable.size = numSta;

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

            /* 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_CCX
            pMac->lim.gpSession[i].isCCXconnection = FALSE;
#endif

#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || 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 
            return(&pMac->lim.gpSession[i]);
        }
    }
    limLog(pMac, LOGE, FL("Session can not be created.. Reached Max permitted sessions \n "));
    return NULL;
}
예제 #15
0
tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb)
{
   tSirMsgQ msg;
   tpAniSirGlobal pMac = (tpAniSirGlobal)pSirGlobal;

#ifdef ANI_OS_TYPE_RTAI_LINUX

   msg.type = pMb->type;
   msg.bodyptr = pMb;
   msg.bodyval = 0;
   WDALOG3( wdaLog(pMac, LOG3, FL("msgType %d, msgLen %d\n" ),
        pMb->type, pMb->msgLen));
#else

   tSirMbMsg* pMbLocal;
   msg.type = pMb->type;
   msg.bodyval = 0;

   WDALOG3(wdaLog(pMac, LOG3, FL("msgType %d, msgLen %d\n" ),
        pMb->type, pMb->msgLen));

   // copy the message from host buffer to firmware buffer
   // this will make sure that firmware allocates, uses and frees
   // it's own buffers for mailbox message instead of working on
   // host buffer

   // second parameter, 'wait option', to palAllocateMemory is ignored on Windows
   if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMbLocal, pMb->msgLen))
   {
      WDALOGE( wdaLog(pMac, LOGE, FL("Buffer Allocation failed!\n")));
      return eSIR_FAILURE;
   }

   palCopyMemory(pMac, (void *)pMbLocal, (void *)pMb, pMb->msgLen);
   msg.bodyptr = pMbLocal;
#endif

   switch (msg.type & HAL_MMH_MB_MSG_TYPE_MASK)
   {
   case WDA_MSG_TYPES_BEGIN:    // Posts a message to the HAL MsgQ
      wdaPostCtrlMsg(pMac, &msg);
      break;

   case SIR_LIM_MSG_TYPES_BEGIN:    // Posts a message to the LIM MsgQ
      limPostMsgApi(pMac, &msg);
      break;

   case SIR_CFG_MSG_TYPES_BEGIN:    // Posts a message to the CFG MsgQ
      wdaPostCfgMsg(pMac, &msg);
      break;

   case SIR_PMM_MSG_TYPES_BEGIN:    // Posts a message to the PMM MsgQ
      pmmPostMessage(pMac, &msg);
      break;

#if defined(ANI_MANF_DIAG) || defined(ANI_PHY_DEBUG)
   case SIR_PTT_MSG_TYPES_BEGIN:
#ifndef FEATURE_WLAN_INTEGRATED_SOC
      halNimPTTPostMsgApi(pMac, &msg); // Posts a message to the NIM PTT MsgQ
#endif /* FEATURE_WLAN_INTEGRATED_SOC */
      break;

#endif

   default:
      WDALOGW( wdaLog(pMac, LOGW, FL("Unknown message type = "
             "0x%X\n"),
             msg.type));

      // Release the memory.
      if (palFreeMemory( pMac->hHdd, (void*)(msg.bodyptr))
            != eHAL_STATUS_SUCCESS)
      {
         WDALOGE( wdaLog(pMac, LOGE, FL("Buffer Allocation failed!\n")));
         return eSIR_FAILURE;
      }
      break;
   }

   return eSIR_SUCCESS;

} // uMacPostCtrlMsg()
예제 #16
0
static void freeCfgReq(tHddHandle hHdd, tCfgReq *req)
{
    palFreeMemory(hHdd, (void*)req) ;
}
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)
    {
        return 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.
        palFreeMemory( pMac->hHdd, tdlsSendMgmtCmdInfo->buf );
        tdlsSendMgmtCmdInfo->buf = NULL;
        tdlsSendMgmtCmdInfo->len = 0;
    }

    return status;
}
예제 #18
0
/*--------------------------------------------------------------------------
  \brief peDeleteSession() - deletes the PE session given the session ID.

    
  \param pMac                   - pointer to global adapter context
  \param sessionId             -session ID of the session which needs to be deleted.
    
  \sa
  --------------------------------------------------------------------------*/
void peDeleteSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
{
    tANI_U16 i = 0;
    tANI_U16 n;
    TX_TIMER *timer_ptr;

    limLog(pMac, LOGW, FL("Trying to delete a session %d.\n "), psessionEntry->peSessionId);

    for (n = 0; n < pMac->lim.maxStation; n++)
    {
        timer_ptr = &pMac->lim.limTimers.gpLimCnfWaitTimer[n];

        if(psessionEntry->peSessionId == timer_ptr->sessionId)
        {
            if(VOS_TRUE == tx_timer_running(timer_ptr))
            {
                tx_timer_deactivate(timer_ptr);
            }
        }
    }
    
    if(psessionEntry->pLimStartBssReq != NULL)
    {
        palFreeMemory( pMac->hHdd, psessionEntry->pLimStartBssReq );
        psessionEntry->pLimStartBssReq = NULL;
    }

    if(psessionEntry->pLimJoinReq != NULL)
    {
        palFreeMemory( pMac->hHdd, psessionEntry->pLimJoinReq );
        psessionEntry->pLimJoinReq = NULL;
    }

    if(psessionEntry->pLimReAssocReq != NULL)
    {
        palFreeMemory( pMac->hHdd, psessionEntry->pLimReAssocReq );
        psessionEntry->pLimReAssocReq = NULL;
    }

    if(psessionEntry->pLimMlmJoinReq != NULL)
    {
        palFreeMemory( pMac->hHdd, psessionEntry->pLimMlmJoinReq );
        psessionEntry->pLimMlmJoinReq = NULL;
    }

    if(psessionEntry->dph.dphHashTable.pHashTable != NULL)
    {
        palFreeMemory(pMac->hHdd, psessionEntry->dph.dphHashTable.pHashTable);
        psessionEntry->dph.dphHashTable.pHashTable = NULL;
    }

    if(psessionEntry->dph.dphHashTable.pDphNodeArray != NULL)
    {
        palFreeMemory(pMac->hHdd, psessionEntry->dph.dphHashTable.pDphNodeArray);
        psessionEntry->dph.dphHashTable.pDphNodeArray = NULL;
    }

    if(psessionEntry->beacon != NULL)
    {
        palFreeMemory( pMac->hHdd, psessionEntry->beacon);
        psessionEntry->beacon = NULL;
    }

    if(psessionEntry->assocReq != NULL)
    {
        palFreeMemory( pMac->hHdd, psessionEntry->assocReq);
        psessionEntry->assocReq = NULL;
    }

    if(psessionEntry->assocRsp != NULL)
    {
        palFreeMemory( pMac->hHdd, psessionEntry->assocRsp);
        psessionEntry->assocRsp = NULL;
    }


    if(psessionEntry->parsedAssocReq != NULL)
    {
        // Cleanup the individual allocation first
        for (i=0; i < psessionEntry->dph.dphHashTable.size; i++)
        {
            if ( psessionEntry->parsedAssocReq[i] != NULL )
            {
                if( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrame )
                {
                   palFreeMemory(pMac->hHdd, 
                      ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrame);
                   ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrame = NULL;
                   ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrameLength = 0;
                }
                palFreeMemory(pMac->hHdd, (void *)psessionEntry->parsedAssocReq[i]);
                psessionEntry->parsedAssocReq[i] = NULL;
            }
        }
        // Cleanup the whole block
        palFreeMemory(pMac->hHdd, (void *)psessionEntry->parsedAssocReq);
        psessionEntry->parsedAssocReq = NULL;
    }

#ifdef FEATURE_WLAN_CCX
    limCleanupCcxCtxt(pMac, psessionEntry); 
#endif

    psessionEntry->valid = FALSE;
    return;
}