예제 #1
0
 BOOL EXPENTRY icqRegisterServerProtocolManager(HICQ icq, const C2SPROTMGR *mgr)
 {
    const ICQMODETABLE *md;

    if(icq->c2s)
    {
       sysLog(icq,"WARNING: More than one server protocol manager installed");
       return FALSE;
    }

    if(mgr->sz != sizeof(C2SPROTMGR))
    {
       sysLog(icq,"Invalid server protocol manager loaded");
       return FALSE;
    }

    if(!mgr->modeButton)
    {
       sysLog(icq,"No mode table defined by protocol manager");
       return FALSE;
    }

    md = mgr->modeButton;

    for(md=mgr->modeButton;md->descr;md++)
       icq->offline = md;

    icq->currentMode    = icqQueryOfflineMode(icq);
    icq->c2s            = mgr;

    return TRUE;
 }
예제 #2
0
static void Log_setCfg(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U32 val)
{
    sysLog(pMac, LOGE, FL("Set %s(0x%x) to value 0x%x\n"),
           gCfgParamName[cfgId], cfgId, val);

    if (cfgSetInt(pMac, (tANI_U16)cfgId, val) != eSIR_SUCCESS)
        sysLog(pMac, LOGE, FL("setting cfgId 0x%x to value 0x%x failed \n"),
               cfgId, val);
     return;
}
int main() {
    bm_Type_Def bm[LENGTH-1] = {{0,0,0,0,0,0}};
    GetData(bm);
    Computed(bm);
    sysLog(bm);
    return 0;
}
예제 #4
0
void
macSysResetReq(tpAniSirGlobal pMac, tANI_U32 rc)
{
    sysLog(pMac, LOGE, FL("Reason Code = 0x%X\n"),rc);

    switch (rc)
    {
    case eSIR_STOP_BSS:
    case eSIR_SME_BSS_RESTART:
    case eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF:
    case eSIR_CFB_FLAG_STUCK_EXCEPTION:
        // FIXME
        //macReset(pMac, rc);
        break;

    case eSIR_EOF_SOF_EXCEPTION:
    case eSIR_BMU_EXCEPTION:
    case eSIR_CP_EXCEPTION:
    case eSIR_LOW_PDU_EXCEPTION:
    case eSIR_USER_TRIG_RESET:
    case eSIR_AHB_HANG_EXCEPTION:
    default:
        macReset(pMac, rc);
        break;

    }
}
예제 #5
0
/**
 * sysBbtProcessMessageCore
 *
 * FUNCTION:
 * Process BBT messages
 *
 * LOGIC:
 *
 * ASSUMPTIONS:
 *
 * NOTE:
 *
 * @param tpAniSirGlobal A pointer to MAC params instance
 * @param pMsg message pointer
 * @param tANI_U32 type
 * @param tANI_U32 sub type
 * @return None
 */
tSirRetStatus
sysBbtProcessMessageCore(tpAniSirGlobal pMac, tpSirMsgQ pMsg, tANI_U32 type,
                         tANI_U32 subType)
{
    static tANI_U32 lastDeauthPacketTime = 0;
    tSirRetStatus ret;
    void*         pBd;
    tMgmtFrmDropReason dropReason;
    vos_pkt_t  *pVosPkt = (vos_pkt_t *)pMsg->bodyptr;
    VOS_STATUS  vosStatus =
              WDA_DS_PeekRxPacketInfo( pVosPkt, (v_PVOID_t *)&pBd, VOS_FALSE );
#ifdef WLAN_FEATURE_11W
    tANI_U8         sessionId;
    tpPESession     psessionEntry;
    tpSirMacMgmtHdr pMacHdr;
#endif /* WLAN_FEATURE_11W */

    pMac->sys.gSysBbtReceived++;

    if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
    {
        goto fail;
    }

    PELOG3(sysLog(pMac, LOG3, FL("Rx Mgmt Frame Subtype: %d\n"), subType);
    sirDumpBuf(pMac, SIR_SYS_MODULE_ID, LOG3, (tANI_U8 *)WDA_GET_RX_MAC_HEADER(pBd), WDA_GET_RX_MPDU_LEN(pBd));
    sirDumpBuf(pMac, SIR_SYS_MODULE_ID, LOG3, WDA_GET_RX_MPDU_DATA(pBd), WDA_GET_RX_PAYLOAD_LEN(pBd));)
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

      pMac->pResetMsg = vos_mem_malloc(sizeof(tSirMbMsg));
      if ( NULL == pMac->pResetMsg )
      {
         sysLog(pMac, LOGE, FL("pMac->pResetMsg is NULL\n"));
         status = eSIR_FAILURE;
         break;
      }
      else
      {
         vos_mem_set(pMac->pResetMsg, sizeof(tSirMbMsg), 0);
      }

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

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

   return status;
}
예제 #7
0
 BOOL EXPENTRY icqRegisterUserDBManager(HICQ icq, const USERDBMGR *mgr)
 {
    if(mgr->sz != sizeof(USERDBMGR))
    {
       sysLog(icq,"Invalid user database manager loaded");
       return FALSE;
    }
    icq->userDB = mgr;
    return TRUE;
 }
예제 #8
0
tSirRetStatus macReset(tpAniSirGlobal pMac, tANI_U32 rc)
{
    tSirRetStatus status = eSIR_SUCCESS;
#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
    if(eHAL_STATUS_SUCCESS != halReset((tHalHandle)pMac, rc))
          status = eSIR_FAILURE;
#else
    sysLog(pMac, LOGE, FL("*************No-op. Need to call WDA reset function \n"));
#endif
    return status;
}
예제 #9
0
 BOOL EXPENTRY icqRegisterSkinManager(HICQ icq, const SKINMGR *mgr)
 {
    DBGTracex(mgr);

    if(!icq || icq->sz != sizeof(ICQ))
    {
       sysLog(icq,"Unexpected ICQ handler received on icqRegisterSkinManager");
       return FALSE;
    }

    if(icq->skin)
    {
       sysLog(icq,"WARNING: More than one skin manager installed");
       return FALSE;
    }

    if(mgr->sz != sizeof(SKINMGR))
    {
       sysLog(icq,"Invalid skin manager loaded");
       return FALSE;
    }

    if(icq->skinRequired && stricmp(icq->skinRequired,mgr->id))
    {
#ifdef EXTENDED_LOG
       icqSysLog(icq,"Skin Manager rejected by configuration");
#endif
       return FALSE;
    }

#ifdef EXTENDED_LOG
    icqSysLog(icq,"Skin Manager loaded");
#endif

    icq->skin     = mgr;

    DBGMessage("Skin manager loaded");

    return TRUE;
 }
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 (!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;
}
예제 #11
0
 BOOL ICQAPI icqRegisterPeerProtocolManager(HICQ icq, const PEERPROTMGR *mgr, void *data)
 {
    char buffer[0x0100];

    if(!mgr)
    {
       sysLog(icq,"Invalid call to icqRegisterPeerProtocolManager");
       return FALSE;
    }

    if(icq->peer)
    {
       sysLog(icq,"WARNING: More than one peer protocol manager installed");
       return FALSE;
    }

    if(mgr->sz != sizeof(PEERPROTMGR))
    {
       sysLog(icq,"Invalid peer protocol manager loaded");
       return FALSE;
    }

    icq->peer     = mgr;
    icq->peerData = data;

    if(mgr->startListener)
    {
       sprintf(buffer,"Starting peer protocol manager version %d as default",mgr->version);
       mgr->startListener(icq,data);
    }
    else
    {
       sprintf(buffer,"Peer protocol manager version %d installed as default",mgr->version);
    }
    sysLog(icq,buffer);


    return TRUE;
 }
예제 #12
0
static void Log_getCfg(tpAniSirGlobal pMac, tANI_U16 cfgId)
{
#define CFG_CTL_INT           0x00080000
    if ((pMac->cfg.gCfgEntry[cfgId].control & CFG_CTL_INT) != 0)
    {
        tANI_U32  val;

        // Get integer parameter
        if (wlan_cfgGetInt(pMac, (tANI_U16)cfgId, &val) != eSIR_SUCCESS)
        {
            sysLog(pMac, LOGE, FL("Get cfgId 0x%x failed\n"), cfgId);
        }
        else
        {
            sysLog( pMac, LOGE, FL("WNI_CFG_%s(%d  0x%x) = %ld\n"),  gCfgParamName[cfgId], cfgId, cfgId, val );
        }
    }
    else
    {
        tANI_U8 buf[CFG_MAX_STR_LEN] = {0} ;
        tANI_U32 valueLen ;

        // Get string parameter
        valueLen = CFG_MAX_STR_LEN ;
        if (wlan_cfgGetStr(pMac, cfgId, buf, &valueLen) != eSIR_SUCCESS)
        {
            sysLog(pMac, LOGE, FL("Get cfgId 0x%x failed\n"), cfgId);
        }
        else
        {
            sysLog( pMac, LOGE, FL("WNI_CFG_%s(%d  0x%x) len=%ld\n"),  gCfgParamName[cfgId], cfgId, cfgId, valueLen );
            sirDumpBuf(pMac, SIR_WDA_MODULE_ID, LOG1, buf, valueLen) ;
        }
    }

    return;
}
예제 #13
0
/**
 * sysBbtProcessMessageCore
 *
 * FUNCTION:
 * Process BBT messages
 *
 * LOGIC:
 *
 * ASSUMPTIONS:
 *
 * NOTE:
 *
 * @param tpAniSirGlobal A pointer to MAC params instance
 * @param pMsg message pointer
 * @param tANI_U32 type
 * @param tANI_U32 sub type
 * @return None
 */
tSirRetStatus
sysBbtProcessMessageCore(tpAniSirGlobal pMac, tpSirMsgQ pMsg, tANI_U32 type,
                         tANI_U32 subType)
{
    tSirRetStatus ret;
    void*         pBd;
    tMgmtFrmDropReason dropReason;
    vos_pkt_t  *pVosPkt = (vos_pkt_t *)pMsg->bodyptr;
    VOS_STATUS  vosStatus =
              WDA_DS_PeekRxPacketInfo( pVosPkt, (v_PVOID_t *)&pBd, VOS_FALSE );
    pMac->sys.gSysBbtReceived++;

    if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
    {
        goto fail;
    }

    PELOGW(sysLog(pMac, LOGW, FL("Rx Mgmt Frame Subtype: %d\n"), subType);
    sirDumpBuf(pMac, SIR_SYS_MODULE_ID, LOGW, (tANI_U8 *)WDA_GET_RX_MAC_HEADER(pBd), WDA_GET_RX_MPDU_LEN(pBd));
    sirDumpBuf(pMac, SIR_SYS_MODULE_ID, LOGW, WDA_GET_RX_MPDU_DATA(pBd), WDA_GET_RX_PAYLOAD_LEN(pBd));)
예제 #14
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;
}
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++)
   {
      pMac->dumpTableEntry[i] = vos_mem_malloc(sizeof(tDumpModuleEntry));
      if ( NULL == pMac->dumpTableEntry[i] )
      {
         memAllocFailed = eANI_BOOLEAN_TRUE;
         break;
      }
      else
      {
         vos_mem_set(pMac->dumpTableEntry[i], sizeof(tSirMbMsg), 0);
      }
   }
   if( memAllocFailed )
   {
      while(i>0)
      {
         i--;
         vos_mem_free(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;
}
/**
 * sysBbtProcessMessageCore
 *
 * FUNCTION:
 * Process BBT messages
 *
 * LOGIC:
 *
 * ASSUMPTIONS:
 *
 * NOTE:
 *
 * @param tpAniSirGlobal A pointer to MAC params instance
 * @param pMsg message pointer
 * @param tANI_U32 type
 * @param tANI_U32 sub type
 * @return None
 */
tSirRetStatus
sysBbtProcessMessageCore(tpAniSirGlobal pMac, tpSirMsgQ pMsg, tANI_U32 type,
                         tANI_U32 subType)
{
    tANI_U32 framecount;
    tSirRetStatus ret;
    void*         pBd;
    tMgmtFrmDropReason dropReason;
    vos_pkt_t  *pVosPkt = (vos_pkt_t *)pMsg->bodyptr;
    VOS_STATUS  vosStatus =
              WDA_DS_PeekRxPacketInfo( pVosPkt, (v_PVOID_t *)&pBd, VOS_FALSE );

    pMac->sys.gSysBbtReceived++;

    if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
    {
        goto fail;
    }

    sysLog(pMac, LOG3, FL("Rx Mgmt Frame Subtype: %d\n"), subType);
    sirDumpBuf(pMac, SIR_SYS_MODULE_ID, LOG3, (tANI_U8 *)WDA_GET_RX_MAC_HEADER(pBd), WDA_GET_RX_MPDU_LEN(pBd));
    sirDumpBuf(pMac, SIR_SYS_MODULE_ID, LOG3, WDA_GET_RX_MPDU_DATA(pBd), WDA_GET_RX_PAYLOAD_LEN(pBd));

    pMac->sys.gSysFrameCount[type][subType]++;
    framecount = pMac->sys.gSysFrameCount[type][subType];

    if(type == SIR_MAC_MGMT_FRAME)
    {
            tpSirMacMgmtHdr mac_hdr;
            /*
             * Drop beacon frames in deferred state to avoid VOSS run out of
             * message wrappers.
             */
            if ((subType == SIR_MAC_MGMT_BEACON) &&
                (!limIsSystemInScanState(pMac)) &&
                (true != GET_LIM_PROCESS_DEFD_MESGS(pMac)) &&
                !pMac->lim.gLimSystemInScanLearnMode) {
                sysLog(pMac, LOG1,
                          FL("dropping received beacon in deffered state"));
                goto fail;
            }

            dropReason = limIsPktCandidateForDrop(pMac, pBd, subType);
            if (dropReason != eMGMT_DROP_NO_DROP) {
                sysLog(pMac, LOG1,
                            FL("Mgmt Frame %d being dropped, reason: %d\n"),
                            subType, dropReason);
                MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_DROP, NO_SESSION, dropReason));
                goto fail;
            }

            mac_hdr = WDA_GET_RX_MAC_HEADER(pBd);
            if (subType == SIR_MAC_MGMT_ASSOC_REQ) {
                sysLog(pMac, LOG1,
                       FL("ASSOC REQ frame allowed: da: " MAC_ADDRESS_STR ", sa: " MAC_ADDRESS_STR ", bssid: " MAC_ADDRESS_STR ", Assoc Req count so far: %d\n"),
                       MAC_ADDR_ARRAY(mac_hdr->da),
                       MAC_ADDR_ARRAY(mac_hdr->sa),
                       MAC_ADDR_ARRAY(mac_hdr->bssId),
                       pMac->sys.gSysFrameCount[type][subType]);
            }

            if (subType == SIR_MAC_MGMT_DEAUTH)
            {
                sysLog(pMac, LOG1,
                       FL("DEAUTH frame allowed: da: " MAC_ADDRESS_STR ", sa: " MAC_ADDRESS_STR ", bssid: " MAC_ADDRESS_STR ", DEAUTH count so far: %d\n"),
                       MAC_ADDR_ARRAY(mac_hdr->da),
                       MAC_ADDR_ARRAY(mac_hdr->sa),
                       MAC_ADDR_ARRAY(mac_hdr->bssId),
                       pMac->sys.gSysFrameCount[type][subType]);
            }
            if (subType == SIR_MAC_MGMT_DISASSOC)
            {
                sysLog(pMac, LOG1,
                       FL("DISASSOC frame allowed: da: " MAC_ADDRESS_STR ", sa: " MAC_ADDRESS_STR ", bssid: " MAC_ADDRESS_STR ", DISASSOC count so far: %d\n"),
                       MAC_ADDR_ARRAY(mac_hdr->da),
                       MAC_ADDR_ARRAY(mac_hdr->sa),
                       MAC_ADDR_ARRAY(mac_hdr->bssId),
                       pMac->sys.gSysFrameCount[type][subType]);
            }

            //Post the message to PE Queue
            ret = (tSirRetStatus) limPostMsgApi(pMac, pMsg);
            if (ret != eSIR_SUCCESS)
            {
                /* Print only one debug failure out of 512 failure messages */
                if(pMac->sys.gSysBbtReceived & 0x0200)
                   sysLog(pMac, LOGE,
                       FL("posting to LIM2 failed, ret %d"), ret);
                goto fail;
            }
            pMac->sys.gSysBbtPostedToLim++;
    }
    else if (type == SIR_MAC_DATA_FRAME)
    {
#ifdef FEATURE_WLAN_ESE
        sysLog(pMac, LOGW, FL("IAPP Frame...\n"));
        //Post the message to PE Queue
        ret = (tSirRetStatus) limPostMsgApi(pMac, pMsg);
        if (ret != eSIR_SUCCESS)
        {
            sysLog(pMac, LOGE, FL("posting to LIM2 failed, ret %d\n"), ret);
            goto fail;
        }
        pMac->sys.gSysBbtPostedToLim++;
#endif
    }
    else
    {
        sysLog(pMac, LOG3, "BBT received Invalid type %d subType %d "
                   "LIM state %X. BD dump is:\n",
                   type, subType, limGetSmeState(pMac));
        sirDumpBuf(pMac, SIR_SYS_MODULE_ID, LOG3,
                       (tANI_U8 *) pBd, WLANHAL_RX_BD_HEADER_SIZE);

        goto fail;
    }

    return eSIR_SUCCESS;

fail:

    pMac->sys.gSysBbtDropped++;
    return eSIR_FAILURE;
}
예제 #17
0
tSirRetStatus macReset(tpAniSirGlobal pMac, tANI_U32 rc)
{
    tSirRetStatus status = eSIR_SUCCESS;
    sysLog(pMac, LOGE, FL("*************No-op. Need to call WDA reset function \n"));
    return status;
}
예제 #18
0
tSirRetStatus macOpen(tHalHandle *pHalHandle, tHddHandle hHdd, tMacOpenParameters *pMacOpenParms)
{
    tpAniSirGlobal p_mac = NULL;
    tSirRetStatus status = eSIR_SUCCESS;
    uint8_t i =0;
    bool mem_alloc_failed = false;

    if(pHalHandle == NULL)
        return eSIR_FAILURE;

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

    /* Allocate p_mac */
    p_mac = vos_mem_malloc(sizeof(tAniSirGlobal));
    if (NULL == p_mac)
        return eSIR_FAILURE;

    /* Initialize the p_mac structure */
    vos_mem_set(p_mac, sizeof(tAniSirGlobal), 0);

    /*
     * Set various global fields of p_mac here
     * (Could be platform dependant as some variables in p_mac are platform
     * dependant)
     */
    p_mac->hHdd      = hHdd;
    *pHalHandle     = (tHalHandle)p_mac;

    {
        /* Call various PE (and other layer init here) */
        if (eSIR_SUCCESS != logInit(p_mac)) {
            vos_mem_free(p_mac);
            return eSIR_FAILURE;
        }

        /* Call routine to initialize CFG data structures */
        if (eSIR_SUCCESS != cfgInit(p_mac)) {
            vos_mem_free(p_mac);
            return eSIR_FAILURE;
        }

        sysInitGlobals(p_mac);
    }

    /* Set the Powersave Offload Capability to TRUE irrespective of
     * INI param as it should be always enabled for qca-cld driver
     */
    p_mac->psOffloadEnabled = TRUE;

    p_mac->scan.nextScanID = FIRST_SCAN_ID;
    /* FW: 0 to 2047 and Host: 2048 to 4095 */
    p_mac->mgmtSeqNum = WLAN_HOST_SEQ_NUM_MIN-1;
    p_mac->first_scan_done = false;

    status = peOpen(p_mac, pMacOpenParms);

    if (eSIR_SUCCESS != status) {
        sysLog(p_mac, LOGE, FL("macOpen failure\n"));
        vos_mem_free(p_mac);
        return status;
    }

    for (i=0; i<MAX_DUMP_TABLE_ENTRY; i++)
    {
        p_mac->dumpTableEntry[i] = vos_mem_malloc(sizeof(tDumpModuleEntry));
        if (NULL == p_mac->dumpTableEntry[i])
        {
            mem_alloc_failed = eANI_BOOLEAN_TRUE;
            break;
        }
        else
        {
            vos_mem_set(p_mac->dumpTableEntry[i], sizeof(tSirMbMsg), 0);
        }
    }

    if (mem_alloc_failed)
    {
        while (i>0)
        {
            i--;
            vos_mem_free(p_mac->dumpTableEntry[i]);
        }

        peClose(p_mac);
        vos_mem_free(p_mac);
        return eSIR_FAILURE;
    }

    return status;
}
예제 #19
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;
}
예제 #20
0
/**
  @brief: This function is used to Aggregate the formated buffer, this
  also check the overflow condition and adds the overflow message
  to the end of the log Dump buffer reserved of MAX_OVERFLOW_MSG size.
  @param: tpAniSirGlobal pMac
  @param: char *pBuf
  @param: variable arguments...
  @return: Returns the number of bytes added to the buffer.
  Returns 0 incase of overflow.

  @note: Currently in windows we do not print the Aggregated buffer as there
  is a limitation on the number of bytes that can be displayed by DbgPrint
  So we print the buffer immediately and we would also aggregate where
  the TestDbg might use this buffer to print out at the application level.
  */
int log_sprintf(tpAniSirGlobal pMac, char *pBuf, char *fmt, ...)
{
    tANI_S32 ret = 0;
#ifdef WLAN_DEBUG

#if defined(ANI_OS_TYPE_AMSS)
    AEEVaList args;
    AEEVA_START(args, fmt);
#else
    va_list args;
    va_start(args, fmt);
#endif

    if (pMac->gCurrentLogSize >= MAX_LOGDUMP_SIZE)
        return 0;

#if defined (ANI_OS_TYPE_WINDOWS)
    ret = _vsnprintf(pBuf, (MAX_LOGDUMP_SIZE - pMac->gCurrentLogSize), fmt, args);
#elif (defined (ANI_OS_TYPE_LINUX) || defined (ANI_OS_TYPE_ANDROID))
    ret = vsnprintf(pBuf, (MAX_LOGDUMP_SIZE - pMac->gCurrentLogSize), fmt, args);
#elif defined (ANI_OS_TYPE_OSX)
    ret = vsnprintf(pBuf, (MAX_LOGDUMP_SIZE - pMac->gCurrentLogSize), fmt, args);
    /* BSD kernel has a bug that vsnprintf() always return 0.
     * See bsd/kern/subr_prf.c 
     * Need to verify ...
     */
    if (ret >= 0)
        ret = strlen(pBuf);
#elif defined (ANI_OS_TYPE_AMSS)
    ret = std_vstrlprintf(pBuf, (MAX_LOGDUMP_SIZE - pMac->gCurrentLogSize), fmt, args);
#endif

#if defined(ANI_OS_TYPE_AMSS)
    AEEVA_END(args);
#else
    va_end(args);
#endif

    /* If an output error is encountered, a negative value is returned by vsnprintf */
    if (ret < 0)
        return 0;


    if ((tANI_U32) ret > (MAX_LOGDUMP_SIZE - pMac->gCurrentLogSize)) {
        pBuf += (MAX_LOGDUMP_SIZE - pMac->gCurrentLogSize);
        pMac->gCurrentLogSize = MAX_LOGDUMP_SIZE;

#if defined (ANI_OS_TYPE_WINDOWS)
        ret = _snprintf(pBuf, MAX_OVERFLOW_MSG, "\n-> ***********"
                "\nOutput Exceeded the Buffer Size, message truncated!!\n<- ***********\n");
#elif (defined (ANI_OS_TYPE_LINUX) || defined (ANI_OS_TYPE_ANDROID))
        ret = snprintf(pBuf, MAX_OVERFLOW_MSG, "\n-> ***********"
                "\nOutput Exceeded the Buffer Size, message truncated!!\n<- ***********\n");
#elif defined (ANI_OS_TYPE_OSX)
        ret = snprintf(pBuf, MAX_OVERFLOW_MSG, "\n-> ***********"
                "\nOutput Exceeded the Buffer Size, message truncated!!\n<- ***********\n");
        /* BSD kernel has a bug that snprintf() always return 0.
         * See bsd/kern/subr_prf.c 
         * but NEED TO VERIFY ...
         */
        if (ret >= 0)
            ret = strlen(pBuf);
#elif defined (ANI_OS_TYPE_AMSS)
        ret = snprintf(pBuf, MAX_OVERFLOW_MSG, "\n-> ***********"
                "\nOutput Exceeded the Buffer Size, message truncated!!\n<- ***********\n");
#endif
        /* If an output error is encountered, a negative value is returned by snprintf */
        if (ret < 0)
            return 0;

        if (ret > MAX_OVERFLOW_MSG)
            ret = MAX_OVERFLOW_MSG;
    }

    pMac->gCurrentLogSize += ret;


#if defined (ANI_OS_TYPE_WINDOWS)
    //DbgPrint("%s", pBuf);
    sysLog(pMac, LOGE, FL("%s"), pBuf);
#endif
#endif //for #ifdef WLAN_DEBUG
    return ret;
}