wlan : To remove PAL memory wrapper in PE(1)

This is to remove PAL memory wrapper in PE and replace with vos calls

CRs-Fixed: 520321
Change-Id: I2b7ae46915771a09a20301b14460c9f40a9fa314
diff --git a/CORE/MAC/src/pe/lim/limAdmitControl.c b/CORE/MAC/src/pe/lim/limAdmitControl.c
index d48bd79..cac5573 100644
--- a/CORE/MAC/src/pe/lim/limAdmitControl.c
+++ b/CORE/MAC/src/pe/lim/limAdmitControl.c
@@ -609,8 +609,9 @@
     for (ctspec = 0; ctspec < LIM_NUM_TSPEC_MAX; ctspec++, pTspecList++)
     {
         if ((pTspecList->inuse)
-            && (palEqualMemory( pMac->hHdd,pAddr, pTspecList->staAddr, sizeof(pTspecList->staAddr)))
-            && (palEqualMemory( pMac->hHdd,(tANI_U8 *) pTspecIE, (tANI_U8 *) &pTspecList->tspec, sizeof(tSirMacTspecIE))))
+            && (vos_mem_compare(pAddr, pTspecList->staAddr, sizeof(pTspecList->staAddr)))
+            && (vos_mem_compare((tANI_U8 *) pTspecIE, (tANI_U8 *) &pTspecList->tspec,
+                                            sizeof(tSirMacTspecIE))))
         {
             *ppInfo = pTspecList;
             return eSIR_SUCCESS;
@@ -650,7 +651,8 @@
     {
         if ((pTspecList->inuse)
             && (assocId == pTspecList->assocId)
-            && (palEqualMemory( pMac->hHdd,(tANI_U8 *) pTspecIE, (tANI_U8 *) &pTspecList->tspec, sizeof(tSirMacTspecIE))))
+            && (vos_mem_compare((tANI_U8 *)pTspecIE, (tANI_U8 *)&pTspecList->tspec,
+                sizeof(tSirMacTspecIE))))
         {
             *ppInfo = pTspecList;
             return eSIR_SUCCESS;
@@ -767,7 +769,7 @@
     // update the tspec info
     pTspecList->tspec = *pTspec;
     pTspecList->assocId = assocId;
-    palCopyMemory( pMac->hHdd, pTspecList->staAddr, pAddr, sizeof(pTspecList->staAddr));
+    vos_mem_copy(pTspecList->staAddr, pAddr, sizeof(pTspecList->staAddr));
 
     // for edca tspec's, we are all done
     if (pTspec->tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA)
@@ -928,7 +930,7 @@
     // fill in a schedule if requested
     if (pSch != NULL)
     {
-        palZeroMemory( pMac->hHdd, (tANI_U8 *) pSch, sizeof(*pSch));
+        vos_mem_set((tANI_U8 *) pSch, sizeof(*pSch), 0);
         pSch->svcStartTime   = pAddts->tspec.svcStartTime;
         pSch->svcInterval    = svcInterval;
         pSch->maxSvcDuration = (tANI_U16) pSch->svcInterval; // use SP = SI
@@ -1041,7 +1043,7 @@
   -------------------------------------------------------------*/
 tSirRetStatus limAdmitControlInit(tpAniSirGlobal pMac)
 {
-    palZeroMemory(pMac->hHdd, pMac->lim.tspecInfo , LIM_NUM_TSPEC_MAX * sizeof(tLimTspecInfo));
+    vos_mem_set(pMac->lim.tspecInfo, LIM_NUM_TSPEC_MAX * sizeof(tLimTspecInfo), 0);
     return eSIR_SUCCESS;
 }
 
@@ -1098,16 +1100,17 @@
     tSirMsgQ msg;
     tpAddTsParams pAddTsParam;
 
-    if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pAddTsParam, sizeof(tAddTsParams)))
+    pAddTsParam = vos_mem_malloc(sizeof(tAddTsParams));
+    if (NULL == pAddTsParam)
     {
-       PELOGW(limLog(pMac, LOGW, FL("palAllocateMemory() failed"));)
+       PELOGW(limLog(pMac, LOGW, FL("AllocateMemory() failed"));)
        return eSIR_MEM_ALLOC_FAILED;          
     }
 
-    palZeroMemory( pMac->hHdd, (tANI_U8 *)pAddTsParam, sizeof(tAddTsParams));
+    vos_mem_set((tANI_U8 *)pAddTsParam, sizeof(tAddTsParams), 0);
     pAddTsParam->staIdx = staIdx;
     pAddTsParam->tspecIdx = tspecIdx;
-    palCopyMemory(pMac->hHdd, &pAddTsParam->tspec, &tspecIE, sizeof(tSirMacTspecIE));
+    vos_mem_copy(&pAddTsParam->tspec, &tspecIE, sizeof(tSirMacTspecIE));
     pAddTsParam->sessionId = sessionId;
  
     msg.type = WDA_ADD_TS_REQ;
@@ -1124,7 +1127,7 @@
     {
        PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed"));)
        SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
-       palFreeMemory(pMac->hHdd, (tANI_U8*)pAddTsParam);
+       vos_mem_free(pAddTsParam);
        return eSIR_FAILURE;
     }
   return eSIR_SUCCESS;
@@ -1151,16 +1154,17 @@
   tSirMsgQ msg;
   tpDelTsParams pDelTsParam;
 
-  if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pDelTsParam, sizeof(tDelTsParams)))
+  pDelTsParam = vos_mem_malloc(sizeof(tDelTsParams));
+  if (NULL == pDelTsParam)
   {
-     limLog(pMac, LOGP, FL("palAllocateMemory() failed"));
+     limLog(pMac, LOGP, FL("AllocateMemory() failed"));
      return eSIR_MEM_ALLOC_FAILED;
   }
 
   msg.type = WDA_DEL_TS_REQ;
   msg.bodyptr = pDelTsParam;
   msg.bodyval = 0;
-  palZeroMemory( pMac->hHdd, (tANI_U8 *)pDelTsParam, sizeof(tDelTsParams));
+  vos_mem_set((tANI_U8 *)pDelTsParam, sizeof(tDelTsParams), 0);
 
   //filling message parameters.
   pDelTsParam->staIdx = staIdx;
@@ -1172,7 +1176,7 @@
   if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
   {
      PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed"));)
-     palFreeMemory(pMac->hHdd, (tANI_U8*)pDelTsParam);
+     vos_mem_free(pDelTsParam);
      return eSIR_FAILURE;
   }
   return eSIR_SUCCESS;  
@@ -1268,7 +1272,7 @@
 
 end:
     if( pAddTsRspMsg != NULL )
-        palFreeMemory( pMac->hHdd, (void *)pAddTsRspMsg );
+        vos_mem_free(pAddTsRspMsg);
     return;
 }
 
diff --git a/CORE/MAC/src/pe/lim/limApi.c b/CORE/MAC/src/pe/lim/limApi.c
index fae3da2..08f6bdb 100644
--- a/CORE/MAC/src/pe/lim/limApi.c
+++ b/CORE/MAC/src/pe/lim/limApi.c
@@ -116,22 +116,23 @@
     pMac->lim.gLimMlmScanResultLength = 0;
     pMac->lim.gLimSmeScanResultLength = 0;
 
-    palZeroMemory(pMac->hHdd, pMac->lim.gLimCachedScanHashTable,
-                    sizeof(pMac->lim.gLimCachedScanHashTable));
+    vos_mem_set(pMac->lim.gLimCachedScanHashTable,
+                sizeof(pMac->lim.gLimCachedScanHashTable), 0);
 
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
 
     pMac->lim.gLimMlmLfrScanResultLength = 0;
     pMac->lim.gLimSmeLfrScanResultLength = 0;
 
-    palZeroMemory(pMac->hHdd, pMac->lim.gLimCachedLfrScanHashTable,
-                    sizeof(pMac->lim.gLimCachedLfrScanHashTable));
+    vos_mem_set(pMac->lim.gLimCachedLfrScanHashTable,
+                sizeof(pMac->lim.gLimCachedLfrScanHashTable), 0);
 #endif
     pMac->lim.gLimBackgroundScanChannelId = 0;
     pMac->lim.gLimBackgroundScanStarted = 0;
     pMac->lim.gLimRestoreCBNumScanInterval = LIM_RESTORE_CB_NUM_SCAN_INTERVAL_DEFAULT;
     pMac->lim.gLimRestoreCBCount = 0;
-    palZeroMemory(pMac->hHdd, pMac->lim.gLimLegacyBssidList, sizeof(pMac->lim.gLimLegacyBssidList));
+    vos_mem_set(pMac->lim.gLimLegacyBssidList,
+                sizeof(pMac->lim.gLimLegacyBssidList), 0);
 
     /* Fill in default values */
     pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = 0;
@@ -139,8 +140,8 @@
 
     // abort scan is used to abort an on-going scan
     pMac->lim.abortScan = 0;
-    palZeroMemory(pMac->hHdd, &pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo));
-    palZeroMemory(pMac->hHdd, &pMac->lim.dfschannelList, sizeof(tSirDFSChannelList));
+    vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
+    vos_mem_set(&pMac->lim.dfschannelList, sizeof(tSirDFSChannelList), 0);
 
 //WLAN_SUSPEND_LINK Related
     pMac->lim.gpLimSuspendCallback = NULL;
@@ -152,7 +153,8 @@
 static void __limInitBssVars(tpAniSirGlobal pMac)
 {
 
-    palZeroMemory(pMac->hHdd,  (void*)pMac->lim.gpSession,   sizeof(*pMac->lim.gpSession)*pMac->lim.maxBssId);
+    vos_mem_set((void*)pMac->lim.gpSession,
+                 sizeof(*pMac->lim.gpSession)*pMac->lim.maxBssId, 0);
 
 
     //pMac->lim.gpLimStartBssReq = NULL;
@@ -165,9 +167,9 @@
 
    // Place holder for BSS description that we're
    // currently joined with
-   palZeroMemory(pMac->hHdd, &pMac->lim.gLimCurrentBssId, sizeof(tSirMacAddr));
+   vos_mem_set(&pMac->lim.gLimCurrentBssId, sizeof(tSirMacAddr), 0);
    pMac->lim.gLimCurrentChannelId = HAL_INVALID_CHANNEL_ID;
-   palZeroMemory(pMac->hHdd, &pMac->lim.gLimCurrentSSID, sizeof(tSirMacSSid));
+   vos_mem_set(&pMac->lim.gLimCurrentSSID, sizeof(tSirMacSSid), 0);
    pMac->lim.gLimCurrentBssCaps = 0;
    QosCaps is a bit map of various qos capabilities - see defn above
    pMac->lim.gLimCurrentBssQosCaps = 0;
@@ -176,9 +178,9 @@
 
    // Place holder for BSS description that
    // we're currently Reassociating
-   palZeroMemory(pMac->hHdd, &pMac->lim.gLimReassocBssId, sizeof(tSirMacAddr));
+   vos_mem_set(&pMac->lim.gLimReassocBssId, sizeof(tSirMacAddr), 0);
    pMac->lim.gLimReassocChannelId = 0;
-   palZeroMemory(pMac->hHdd, &pMac->lim.gLimReassocSSID, sizeof(tSirMacSSid));
+   vos_mem_set(&pMac->lim.gLimReassocSSID, sizeof(tSirMacSSid), 0);
    pMac->lim.gLimReassocBssCaps = 0;
    pMac->lim.gLimReassocBssQosCaps = 0;
    pMac->lim.gLimReassocBssPropCap = 0;
@@ -214,7 +216,8 @@
     pMac->lim.gLimHeartBeatCount = 0;
 
     // Statistics to keep track of no. beacons rcvd in heart beat interval
-    palZeroMemory(pMac->hHdd, pMac->lim.gLimHeartBeatBeaconStats, sizeof(pMac->lim.gLimHeartBeatBeaconStats));
+    vos_mem_set(pMac->lim.gLimHeartBeatBeaconStats,
+                sizeof(pMac->lim.gLimHeartBeatBeaconStats), 0);
 
 #ifdef WLAN_DEBUG    
     // Debug counters
@@ -224,7 +227,7 @@
     pMac->lim.numLearn = 0;
     pMac->lim.numLearnIgnore = 0;
     pMac->lim.numSme = 0;
-    palZeroMemory(pMac->hHdd, pMac->lim.numMAC, sizeof(pMac->lim.numMAC));
+    vos_mem_set(pMac->lim.numMAC, sizeof(pMac->lim.numMAC), 0);
     pMac->lim.gLimNumAssocReqDropInvldState = 0;
     pMac->lim.gLimNumAssocReqDropACRejectTS = 0;
     pMac->lim.gLimNumAssocReqDropACRejectSta = 0;
@@ -271,17 +274,17 @@
      * when SME_START_BSS_REQ is received.
      */
 
-    palZeroMemory(pMac->hHdd, &pMac->lim.gLimOverlap11gParams, sizeof(tLimProtStaParams));
-    palZeroMemory(pMac->hHdd, &pMac->lim.gLimOverlap11aParams, sizeof(tLimProtStaParams));
-    palZeroMemory(pMac->hHdd, &pMac->lim.gLimOverlapHt20Params, sizeof(tLimProtStaParams));
-    palZeroMemory(pMac->hHdd, &pMac->lim.gLimOverlapNonGfParams, sizeof(tLimProtStaParams));
-    palZeroMemory(pMac->hHdd, &pMac->lim.gLimNoShortParams, sizeof(tLimNoShortParams));
-    palZeroMemory(pMac->hHdd, &pMac->lim.gLimNoShortSlotParams, sizeof(tLimNoShortSlotParams));
+    vos_mem_set(&pMac->lim.gLimOverlap11gParams, sizeof(tLimProtStaParams), 0);
+    vos_mem_set(&pMac->lim.gLimOverlap11aParams, sizeof(tLimProtStaParams), 0);
+    vos_mem_set(&pMac->lim.gLimOverlapHt20Params, sizeof(tLimProtStaParams), 0);
+    vos_mem_set(&pMac->lim.gLimOverlapNonGfParams, sizeof(tLimProtStaParams), 0);
+    vos_mem_set(&pMac->lim.gLimNoShortParams, sizeof(tLimNoShortParams), 0);
+    vos_mem_set(&pMac->lim.gLimNoShortSlotParams, sizeof(tLimNoShortSlotParams), 0);
 
     pMac->lim.gLimPhyMode = 0; 
     pMac->lim.scanStartTime = 0;    // used to measure scan time
 
-    palZeroMemory(pMac->hHdd, pMac->lim.gLimMyMacAddr, sizeof(pMac->lim.gLimMyMacAddr));
+    vos_mem_set(pMac->lim.gLimMyMacAddr, sizeof(pMac->lim.gLimMyMacAddr), 0);
     pMac->lim.ackPolicy = 0;
 
 #if 0 /* Moving all these to session specific elements */
@@ -304,22 +307,22 @@
     // WDS info
     pMac->lim.gLimNumWdsInfoInd = 0;
     pMac->lim.gLimNumWdsInfoSet = 0;
-    palZeroMemory(pMac->hHdd, &pMac->lim.gLimWdsInfo, sizeof(tSirWdsInfo));
+    vos_mem_set(&pMac->lim.gLimWdsInfo, sizeof(tSirWdsInfo), 0);
     /* initialize some parameters */
     limInitWdsInfoParams(pMac);
 
     // Deferred Queue Paramters
-    palZeroMemory(pMac->hHdd, &pMac->lim.gLimDeferredMsgQ, sizeof(tSirAddtsReq));
+    vos_mem_set(&pMac->lim.gLimDeferredMsgQ, sizeof(tSirAddtsReq), 0);
 
     // addts request if any - only one can be outstanding at any time
-    palZeroMemory(pMac->hHdd, &pMac->lim.gLimAddtsReq, sizeof(tSirAddtsReq));
+    vos_mem_set(&pMac->lim.gLimAddtsReq, sizeof(tSirAddtsReq) , 0);
     pMac->lim.gLimAddtsSent = 0;
     pMac->lim.gLimAddtsRspTimerCount = 0;
 
     //protection related config cache
-    palZeroMemory(pMac->hHdd, &pMac->lim.cfgProtection, sizeof(tCfgProtection));
+    vos_mem_set(&pMac->lim.cfgProtection, sizeof(tCfgProtection), 0);
     pMac->lim.gLimProtectionControl = 0;
-    palZeroMemory(pMac->hHdd, &pMac->lim.gLimAlternateRadio, sizeof(tSirAlternateRadioInfo));
+    vos_mem_set(&pMac->lim.gLimAlternateRadio, sizeof(tSirAlternateRadioInfo), 0);
     SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
 
 #if 0
@@ -341,10 +344,11 @@
     pMac->lim.pDialogueTokenHead = NULL;
     pMac->lim.pDialogueTokenTail = NULL;
 
-    palZeroMemory(pMac->hHdd, &pMac->lim.tspecInfo, sizeof(tLimTspecInfo) * LIM_NUM_TSPEC_MAX);
+    vos_mem_set(&pMac->lim.tspecInfo,
+                sizeof(tLimTspecInfo) * LIM_NUM_TSPEC_MAX, 0);
 
     // admission control policy information
-    palZeroMemory(pMac->hHdd, &pMac->lim.admitPolicyInfo, sizeof(tLimAdmitPolicyInfo));
+    vos_mem_set(&pMac->lim.admitPolicyInfo, sizeof(tLimAdmitPolicyInfo), 0);
 
     pMac->lim.gLastBeaconDtimCount = 0;
     pMac->lim.gLastBeaconDtimPeriod = 0;
@@ -357,8 +361,8 @@
 {
     tANI_U32 val;
 #if 0
-    palZeroMemory(pMac->hHdd, pMac->lim.gpLimAIDpool,
-                  sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1));
+    vos_mem_set(pMac->lim.gpLimAIDpool,
+          sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1), 0);
     pMac->lim.freeAidHead = 0;
     pMac->lim.freeAidTail = 0;
 #endif
@@ -376,9 +380,9 @@
     /// MAC level Pre-authentication related globals
     pMac->lim.gLimPreAuthChannelNumber = 0;
     pMac->lim.gLimPreAuthType = eSIR_OPEN_SYSTEM;
-    palZeroMemory(pMac->hHdd, &pMac->lim.gLimPreAuthPeerAddr, sizeof(tSirMacAddr));
+    vos_mem_set(&pMac->lim.gLimPreAuthPeerAddr, sizeof(tSirMacAddr), 0);
     pMac->lim.gLimNumPreAuthContexts = 0;
-    palZeroMemory(pMac->hHdd, &pMac->lim.gLimPreAuthTimerTable, sizeof(tLimPreAuthTable));
+    vos_mem_set(&pMac->lim.gLimPreAuthTimerTable, sizeof(tLimPreAuthTable), 0);
 
     // Placed holder to deauth reason
     pMac->lim.gLimDeauthReasonCode = 0;
@@ -391,8 +395,10 @@
     pMac->lim.gLimDisassocFrameCredit = 0;
 
     //One cache for each overlap and associated case.
-    palZeroMemory(pMac->hHdd, pMac->lim.protStaOverlapCache, sizeof(tCacheParams) * LIM_PROT_STA_OVERLAP_CACHE_SIZE);
-    palZeroMemory(pMac->hHdd, pMac->lim.protStaCache, sizeof(tCacheParams) * LIM_PROT_STA_CACHE_SIZE);
+    vos_mem_set(pMac->lim.protStaOverlapCache,
+                sizeof(tCacheParams) * LIM_PROT_STA_OVERLAP_CACHE_SIZE, 0);
+    vos_mem_set(pMac->lim.protStaCache,
+                sizeof(tCacheParams) * LIM_PROT_STA_CACHE_SIZE, 0);
 
 #if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
     pMac->lim.pSessionEntry = NULL;
@@ -405,7 +411,7 @@
 static void __limInitTitanVars(tpAniSirGlobal pMac)
 {
 #if 0
-    palZeroMemory(pMac->hHdd, &pMac->lim.gLimChannelSwitch, sizeof(tLimChannelSwitchInfo));
+    vos_mem_set(&pMac->lim.gLimChannelSwitch, sizeof(tLimChannelSwitchInfo), 0);
     pMac->lim.gLimChannelSwitch.state               = eLIM_CHANNEL_SWITCH_IDLE;
     pMac->lim.gLimChannelSwitch.secondarySubBand    = PHY_SINGLE_CHANNEL_CENTERED;
 #endif
@@ -583,8 +589,8 @@
    /* WNI_CFG_MAX_PS_POLL */
 
    /* Allocate and fill in power save configuration. */
-   if (palAllocateMemory(pMac->hHdd, (void **)&pPowerSaveConfig,
-        sizeof(tSirPowerSaveCfg)) != eHAL_STATUS_SUCCESS)
+   pPowerSaveConfig = vos_mem_malloc(sizeof(tSirPowerSaveCfg));
+   if (NULL == pPowerSaveConfig)
    {
       PELOGE(limLog(pMac, LOGE, FL("LIM: Cannot allocate memory for power save "
                                   "configuration"));)
@@ -595,8 +601,7 @@
     * already dispatched during initialization process. Re-using the present
     * configuration mask
     */
-   palCopyMemory(pMac->hHdd, pPowerSaveConfig, (tANI_U8 *)&pMac->pmm.gPmmCfg, 
-                 sizeof(tSirPowerSaveCfg));
+   vos_mem_copy(pPowerSaveConfig, (tANI_U8 *)&pMac->pmm.gPmmCfg, sizeof(tSirPowerSaveCfg));
 
    /* Note: it is okay to do this since DAL/HAL is alrady started */
    if ( (pmmSendPowerSaveCfg(pMac, pPowerSaveConfig)) != eSIR_SUCCESS)
@@ -828,7 +833,7 @@
         VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
                 FL("Fixing leak! Deallocating pLimMgmtRegistration node"));
 
-        palFreeMemory(pMac, pLimMgmtRegistration);
+        vos_mem_free(pLimMgmtRegistration);
     }
 
     vos_list_destroy(&pMac->lim.gLimMgmtFrameRegistratinQueue);
@@ -839,7 +844,7 @@
     // free up preAuth table
     if (pMac->lim.gLimPreAuthTimerTable.pTable != NULL)
     {
-        palFreeMemory(pMac->hHdd, pMac->lim.gLimPreAuthTimerTable.pTable);
+        vos_mem_free(pMac->lim.gLimPreAuthTimerTable.pTable);
         pMac->lim.gLimPreAuthTimerTable.pTable = NULL;
         pMac->lim.gLimPreAuthTimerTable.numEntry = 0;
     }
@@ -851,42 +856,42 @@
 
     if(NULL != pMac->lim.pDialogueTokenTail)
     {
-        palFreeMemory(pMac->hHdd, (void *) pMac->lim.pDialogueTokenTail);
+        vos_mem_free(pMac->lim.pDialogueTokenTail);
         pMac->lim.pDialogueTokenTail = NULL;
     }
 
     # if 0
     if (pMac->lim.gpLimStartBssReq != NULL)
     {
-        palFreeMemory(pMac->hHdd, pMac->lim.gpLimStartBssReq);
+        vos_mem_free(pMac->lim.gpLimStartBssReq);
         pMac->lim.gpLimStartBssReq = NULL;
     }
     #endif
 
     if (pMac->lim.gpLimMlmSetKeysReq != NULL)
     {
-        palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmSetKeysReq);
+        vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
         pMac->lim.gpLimMlmSetKeysReq = NULL;
     }
 
     #if 0
     if (pMac->lim.gpLimJoinReq != NULL)
     {
-        palFreeMemory(pMac->hHdd, pMac->lim.gpLimJoinReq);
+        vos_mem_free(pMac->lim.gpLimJoinReq);
         pMac->lim.gpLimJoinReq = NULL;
     }
     #endif
 
     if (pMac->lim.gpLimMlmAuthReq != NULL)
     {
-        palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmAuthReq);
+        vos_mem_free(pMac->lim.gpLimMlmAuthReq);
         pMac->lim.gpLimMlmAuthReq = NULL;
     }
 
 #if 0
     if (pMac->lim.gpLimMlmJoinReq != NULL)
     {
-        palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmJoinReq);
+        vos_mem_free(pMac->lim.gpLimMlmJoinReq);
         pMac->lim.gpLimMlmJoinReq = NULL;
     }
 #endif
@@ -894,40 +899,40 @@
     #if 0
     if (pMac->lim.gpLimReassocReq != NULL)
     {
-        palFreeMemory(pMac->hHdd, pMac->lim.gpLimReassocReq);
+        vos_mem_free(pMac->lim.gpLimReassocReq);
         pMac->lim.gpLimReassocReq = NULL;
     }
     #endif
 
     if (pMac->lim.gpLimMlmRemoveKeyReq != NULL)
     {
-        palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmRemoveKeyReq);
+        vos_mem_free(pMac->lim.gpLimMlmRemoveKeyReq);
         pMac->lim.gpLimMlmRemoveKeyReq = NULL;
     }
 
     if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
     {
-        palFreeMemory(pMac->hHdd, pMac->lim.gpDefdSmeMsgForNOA);
+        vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
         pMac->lim.gpDefdSmeMsgForNOA = NULL;
     }
 
     if (pMac->lim.gpLimMlmScanReq != NULL)
     {
-        palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmScanReq);
+        vos_mem_free(pMac->lim.gpLimMlmScanReq);
         pMac->lim.gpLimMlmScanReq = NULL;
     }
 
 #if 0
     if(NULL != pMac->lim.beacon)
     {
-        palFreeMemory(pMac->hHdd, (void*) pMac->lim.beacon);
+        vos_mem_free((void*) pMac->lim.beacon);
         pMac->lim.beacon = NULL;
      }
 #endif
     #if 0
     if(NULL != pMac->lim.assocReq)
     {
-        palFreeMemory(pMac->hHdd, (void*) pMac->lim.assocReq);
+        vos_mem_free((void*) pMac->lim.assocReq);
         pMac->lim.assocReq= NULL;
      }
     #endif
@@ -935,7 +940,7 @@
 #if 0
     if(NULL != pMac->lim.assocRsp)
     {
-        palFreeMemory(pMac->hHdd, (void*) pMac->lim.assocRsp);
+        vos_mem_free((void*) pMac->lim.assocRsp);
         pMac->lim.assocRsp= NULL;
      }
 #endif
@@ -978,55 +983,53 @@
          return eSIR_FAILURE;
     }
 
-    if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
-              (void **) &pMac->lim.limTimers.gpLimCnfWaitTimer, sizeof(TX_TIMER)*pMac->lim.maxStation))
+    pMac->lim.limTimers.gpLimCnfWaitTimer = vos_mem_malloc(sizeof(TX_TIMER) * pMac->lim.maxStation);
+    if (NULL == pMac->lim.limTimers.gpLimCnfWaitTimer)
     {
         PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
         return eSIR_FAILURE;
     }
 
 #if 0
-    if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
-              (void **) &pMac->lim.gpLimAIDpool, 
-              sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1)))
+    pMac->lim.gpLimAIDpool = vos_mem_malloc(sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1));
+    if (NULL == pMac->lim.gpLimAIDpool)
     {
         PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
         return eSIR_FAILURE;
     }
 #endif
-    if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
-        (void **) &pMac->lim.gpSession, sizeof(tPESession)* pMac->lim.maxBssId))
+    pMac->lim.gpSession = vos_mem_malloc(sizeof(tPESession)* pMac->lim.maxBssId);
+    if (NULL == pMac->lim.gpSession)
     {
         limLog(pMac, LOGE, FL("memory allocate failed!"));
         return eSIR_FAILURE;
     }
  
-    palZeroMemory(pMac->hHdd, pMac->lim.gpSession, sizeof(tPESession)*pMac->lim.maxBssId);
+    vos_mem_set(pMac->lim.gpSession, sizeof(tPESession)*pMac->lim.maxBssId, 0);
 
 
  /*
-    if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
-              (void **) &pMac->dph.dphHashTable.pHashTable, sizeof(tpDphHashNode)*pMac->lim.maxStation))
+    pMac->dph.dphHashTable.pHashTable = vos_mem_malloc(sizeof(tpDphHashNode)*pMac->lim.maxStation);
+    if (NULL == pMac->dph.dphHashTable.pHashTable)
     {
         PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
         return eSIR_FAILURE;
     }
 
-    if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
-              (void **) &pMac->dph.dphHashTable.pDphNodeArray, sizeof(tDphHashNode)*pMac->lim.maxStation))
+    pMac->dph.dphHashTable.pDphNodeArray = vos_mem_malloc(sizeof(tDphHashNode)*pMac->lim.maxStation);
+    if (NULL == pMac->dph.dphHashTable.pDphNodeArray)
     {
         PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
         return eSIR_FAILURE;
     }
     */
-
-    if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
-              (void **) &pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation))
+    pMac->pmm.gPmmTim.pTim = vos_mem_malloc(sizeof(tANI_U8)*pMac->lim.maxStation);
+    if (NULL == pMac->pmm.gPmmTim.pTim)
     {
         PELOGE(limLog(pMac, LOGE, FL("memory allocate failed for pTim!"));)
         return eSIR_FAILURE;
     }
-    palZeroMemory(pMac->hHdd, pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation);
+    vos_mem_set(pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation, 0);
 
     pMac->lim.mgmtFrameSessionId = 0xff;
     pMac->lim.deferredMsgCnt = 0;
@@ -1061,22 +1064,22 @@
             peDeleteSession(pMac,&pMac->lim.gpSession[i]);
         }
     }
-    palFreeMemory(pMac->hHdd, pMac->lim.limTimers.gpLimCnfWaitTimer);
+    vos_mem_free(pMac->lim.limTimers.gpLimCnfWaitTimer);
     pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
 #if 0
-    palFreeMemory(pMac->hHdd, pMac->lim.gpLimAIDpool);
+    vos_mem_free(pMac->lim.gpLimAIDpool);
     pMac->lim.gpLimAIDpool = NULL;
 #endif
     
-    palFreeMemory(pMac->hHdd, pMac->lim.gpSession);
+    vos_mem_free(pMac->lim.gpSession);
     pMac->lim.gpSession = NULL;
     /*
-    palFreeMemory(pMac->hHdd, pMac->dph.dphHashTable.pHashTable);
+    vos_mem_free(pMac->dph.dphHashTable.pHashTable);
     pMac->dph.dphHashTable.pHashTable = NULL;
-    palFreeMemory(pMac->hHdd, pMac->dph.dphHashTable.pDphNodeArray);
+    vos_mem_free(pMac->dph.dphHashTable.pDphNodeArray);
     pMac->dph.dphHashTable.pDphNodeArray = NULL;
     */
-    palFreeMemory(pMac->hHdd, pMac->pmm.gPmmTim.pTim);
+    vos_mem_free(pMac->pmm.gPmmTim.pTim);
     pMac->pmm.gPmmTim.pTim = NULL;
     if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->lim.lkPeGlobalLock ) ) )
     {
@@ -1607,9 +1610,9 @@
     int i;
     if (!pStaParams->numSta)
     {
-        palCopyMemory( pMac->hHdd, pMac->lim.protStaOverlapCache[0].addr,
-                      bssId,
-                      sizeof(tSirMacAddr));
+        vos_mem_copy(pMac->lim.protStaOverlapCache[0].addr,
+                     bssId,
+                     sizeof(tSirMacAddr));
         pMac->lim.protStaOverlapCache[0].active = true;
 
         pStaParams->numSta = 1;
@@ -1621,7 +1624,7 @@
     {
         if (pMac->lim.protStaOverlapCache[i].active)
         {
-            if (palEqualMemory( pMac->hHdd,pMac->lim.protStaOverlapCache[i].addr,
+            if (vos_mem_compare( pMac->lim.protStaOverlapCache[i].addr,
                           bssId,
                           sizeof(tSirMacAddr))) {
                 return; }
@@ -1636,9 +1639,9 @@
     }
     else
     {
-        palCopyMemory( pMac->hHdd, pMac->lim.protStaOverlapCache[i].addr,
-                      bssId,
-                      sizeof(tSirMacAddr));
+        vos_mem_copy(pMac->lim.protStaOverlapCache[i].addr,
+                     bssId,
+                     sizeof(tSirMacAddr));
         pMac->lim.protStaOverlapCache[i].active = true;
 
         pStaParams->numSta++;
@@ -1808,9 +1811,9 @@
               3 * sizeof(tANI_U8) + // reserved fields
               pBeacon->ssId.length + 1;
 
-        palCopyMemory( pMac->hHdd, apNewCaps.bssId,
-                      psessionEntry->bssId,
-                      sizeof(tSirMacAddr));
+        vos_mem_copy(apNewCaps.bssId,
+                     psessionEntry->bssId,
+                     sizeof(tSirMacAddr));
         if (newChannel != psessionEntry->currentOperChannel)
         {
             PELOGE(limLog(pMac, LOGE, FL("Channel Change from %d --> %d  - "
@@ -1838,8 +1841,8 @@
         }
         else
             apNewCaps.channelId = psessionEntry->currentOperChannel;
-        palCopyMemory( pMac->hHdd, (tANI_U8 *) &apNewCaps.ssId,
-                      (tANI_U8 *) &pBeacon->ssId,
+        vos_mem_copy((tANI_U8 *) &apNewCaps.ssId,
+                     (tANI_U8 *) &pBeacon->ssId,
                       pBeacon->ssId.length + 1);
 
         psessionEntry->fIgnoreCapsChange = false;
@@ -2086,10 +2089,8 @@
          return;
     }
 
-    if (eHAL_STATUS_SUCCESS !=
-                    palAllocateMemory(pMac->hHdd,
-                                      (void **) &pSirSmeMicFailureInd,
-                                      sizeof(tSirSmeMicFailureInd)))
+    pSirSmeMicFailureInd = vos_mem_malloc(sizeof(tSirSmeMicFailureInd));
+    if (NULL == pSirSmeMicFailureInd)
     {
         // Log error
        limLog(pMac, LOGP,
@@ -2102,24 +2103,24 @@
     pSirSmeMicFailureInd->sessionId = psessionEntry->smeSessionId;
 
     vos_mem_copy(pSirSmeMicFailureInd->bssId,
-        pSirMicFailureInd->bssId,
-        sizeof(tSirMacAddr));
+                 pSirMicFailureInd->bssId,
+                 sizeof(tSirMacAddr));
 
     vos_mem_copy(pSirSmeMicFailureInd->info.srcMacAddr,
-        pSirMicFailureInd->info.srcMacAddr,
-        sizeof(tSirMacAddr));
+                 pSirMicFailureInd->info.srcMacAddr,
+                 sizeof(tSirMacAddr));
 
     vos_mem_copy(pSirSmeMicFailureInd->info.taMacAddr,
-        pSirMicFailureInd->info.taMacAddr,
-        sizeof(tSirMacAddr));
+                 pSirMicFailureInd->info.taMacAddr,
+                 sizeof(tSirMacAddr));
 
     vos_mem_copy(pSirSmeMicFailureInd->info.dstMacAddr,
-        pSirMicFailureInd->info.dstMacAddr,
-        sizeof(tSirMacAddr));
+                 pSirMicFailureInd->info.dstMacAddr,
+                 sizeof(tSirMacAddr));
 
     vos_mem_copy(pSirSmeMicFailureInd->info.rxMacAddr,
-        pSirMicFailureInd->info.rxMacAddr,
-        sizeof(tSirMacAddr));
+                 pSirMicFailureInd->info.rxMacAddr,
+                 sizeof(tSirMacAddr));
 
     pSirSmeMicFailureInd->info.multicast = 
                                    pSirMicFailureInd->info.multicast;
@@ -2131,7 +2132,7 @@
                                   pSirMicFailureInd->info.IV1;
 
     vos_mem_copy(pSirSmeMicFailureInd->info.TSC,
-         pSirMicFailureInd->info.TSC,SIR_CIPHER_SEQ_CTR_SIZE);
+                 pSirMicFailureInd->info.TSC,SIR_CIPHER_SEQ_CTR_SIZE);
 
     mmhMsg.type = eWNI_SME_MIC_FAILURE_IND;
     mmhMsg.bodyptr = pSirSmeMicFailureInd;
diff --git a/CORE/MAC/src/pe/lim/limAssocUtils.c b/CORE/MAC/src/pe/lim/limAssocUtils.c
index f34c999..3af01df 100644
--- a/CORE/MAC/src/pe/lim/limAssocUtils.c
+++ b/CORE/MAC/src/pe/lim/limAssocUtils.c
@@ -121,8 +121,8 @@
 limCmpSSid(tpAniSirGlobal pMac, tSirMacSSid *prxSSid,tpPESession psessionEntry)
 {
 
-    if( palEqualMemory( pMac->hHdd,  (tANI_U8* ) prxSSid, (tANI_U8 *) &psessionEntry->ssId, 
-                                    (tANI_U8) (psessionEntry->ssId.length + 1)))
+    if (vos_mem_compare((tANI_U8* ) prxSSid, (tANI_U8 *) &psessionEntry->ssId,
+                       (tANI_U8) (psessionEntry->ssId.length + 1)))
         return true;
     else
         return false;
@@ -277,10 +277,11 @@
     tSirMacRateSet    *pRateSet, basicRate;
     tANI_U8    i, j, k, match;
 
-    if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pRateSet, sizeof(tSirMacRateSet)))
+    pRateSet = vos_mem_malloc(sizeof(tSirMacRateSet));
+    if (NULL == pRateSet)
     {
         // Log error
-        limLog(pMac, LOGP, FL("call to palAllocateMemory failed for RATESET"));
+        limLog(pMac, LOGP, FL("call to AllocateMemory failed for RATESET"));
 
         return false;
     }
@@ -295,14 +296,15 @@
         limLog(pMac, LOGP, FL("could not retrieve Operational rateset"));
 
         // Free up memory allocated for rateset
-        palFreeMemory( pMac->hHdd, (tANI_U8 *) pRateSet);
+        vos_mem_free((tANI_U8 *) pRateSet);
 
         return false;
     }
     #endif //TO SUPPORT BT-AMP
 
     /* Copy operational rate set from session Entry */
-    palCopyMemory(pMac->hHdd,  pRateSet->rate,  (psessionEntry->rateSet.rate),  psessionEntry->rateSet.numRates);
+    vos_mem_copy(pRateSet->rate, (psessionEntry->rateSet.rate),
+                 psessionEntry->rateSet.numRates);
     
     pRateSet->numRates = psessionEntry->rateSet.numRates;
 
@@ -332,14 +334,14 @@
         if (!match)
         {
             // Free up memory allocated for rateset
-            palFreeMemory( pMac->hHdd, (tANI_U8 *) pRateSet);
+            vos_mem_free((tANI_U8 *)pRateSet);
 
             return false;
         }
     }
 
     // Free up memory allocated for rateset
-    palFreeMemory( pMac->hHdd, (tANI_U8 *) pRateSet);
+    vos_mem_free((tANI_U8 *)pRateSet);
 
     return true;
 } /****** end limCheckRxBasicRates() ******/
@@ -475,9 +477,9 @@
     {
         for(j = 0; j < pRSNIe->pwise_cipher_suite_count; j++)
         {
-            if(palEqualMemory(pMac,&rxRSNIe.pwise_cipher_suites[i],
-                                  &pRSNIe->pwise_cipher_suites[j],
-                                  sizeof(pRSNIe->pwise_cipher_suites[j])))
+            if (vos_mem_compare(&rxRSNIe.pwise_cipher_suites[i],
+                                &pRSNIe->pwise_cipher_suites[j],
+                                sizeof(pRSNIe->pwise_cipher_suites[j])))
             {
                 match = 1;
                 break;
@@ -577,9 +579,9 @@
     {
         for(j = 0; j < pWPAIe->unicast_cipher_count; j++)
         {
-            if(palEqualMemory(pMac,rxWPAIe.unicast_ciphers[i],
-                                  pWPAIe->unicast_ciphers[j],
-                                  4))
+            if (vos_mem_compare(rxWPAIe.unicast_ciphers[i],
+                               pWPAIe->unicast_ciphers[j],
+                               4))
             {
                 match = 1;
                 break;
@@ -778,7 +780,7 @@
         // MLM state machine
         if (psessionEntry->pLimMlmJoinReq)
         {
-            palFreeMemory( pMac->hHdd, (tANI_U8 *) psessionEntry->pLimMlmJoinReq);
+            vos_mem_free(psessionEntry->pLimMlmJoinReq);
             psessionEntry->pLimMlmJoinReq = NULL;
         }
 
@@ -801,10 +803,9 @@
            limLog( pMac, LOGW, FL("Lim Posting DISASSOC_CNF to Sme. Trigger: %X"), mlmStaContext.cleanupTrigger);
 
 
-        palCopyMemory( pMac->hHdd,
-                   (tANI_U8 *) &mlmDisassocCnf.peerMacAddr,
-                   (tANI_U8 *) staDsAddr,
-                   sizeof(tSirMacAddr));
+        vos_mem_copy((tANI_U8 *) &mlmDisassocCnf.peerMacAddr,
+                     (tANI_U8 *) staDsAddr,
+                      sizeof(tSirMacAddr));
         mlmDisassocCnf.resultCode = statusCode;
         mlmDisassocCnf.disassocTrigger =
                                    mlmStaContext.cleanupTrigger;
@@ -825,8 +826,8 @@
          * Issue Deauth Confirm to SME.
          */
         limLog( pMac, LOGW, FL("Lim Posting DEAUTH_CNF to Sme. Trigger: %X"), mlmStaContext.cleanupTrigger);
-        palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmDeauthCnf.peerMacAddr,
-                      (tANI_U8 *) staDsAddr,
+        vos_mem_copy((tANI_U8 *) &mlmDeauthCnf.peerMacAddr,
+                     (tANI_U8 *) staDsAddr,
                       sizeof(tSirMacAddr));
         mlmDeauthCnf.resultCode    = statusCode;
         mlmDeauthCnf.deauthTrigger =
@@ -848,9 +849,9 @@
          * Issue Purge Ind to SME.
          */
         limLog( pMac, LOGW, FL("Lim Posting PURGE_STA_IND to Sme. Trigger: %X"), mlmStaContext.cleanupTrigger) ;
-        palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmPurgeStaInd.peerMacAddr,
-                      (tANI_U8 *) staDsAddr,
-                      sizeof(tSirMacAddr));
+        vos_mem_copy((tANI_U8 *) &mlmPurgeStaInd.peerMacAddr,
+                     (tANI_U8 *) staDsAddr,
+                     sizeof(tSirMacAddr));
         mlmPurgeStaInd.reasonCode   = (tANI_U8) mlmStaContext.disassocReason;
         mlmPurgeStaInd.aid          = staDsAssocId;
         mlmPurgeStaInd.purgeTrigger = mlmStaContext.cleanupTrigger;
@@ -889,7 +890,7 @@
         }
         else
         {
-        palFreeMemory( pMac->hHdd, psessionEntry->pLimJoinReq);
+        vos_mem_free(psessionEntry->pLimJoinReq);
         psessionEntry->pLimJoinReq = NULL;
 
         if(mlmStaContext.resultCode != eSIR_SME_SUCCESS)
@@ -962,7 +963,7 @@
 
         if (pAuthNode)
         {
-            palCopyMemory( pMac->hHdd, (tANI_U8 *) pAuthNode->peerMacAddr,
+            vos_mem_copy((tANI_U8 *) pAuthNode->peerMacAddr,
                           peerAddr,
                           sizeof(tSirMacAddr));
             pAuthNode->fTimerStarted = 0;
@@ -1006,10 +1007,10 @@
             // Assoction confirmation is complete, free the copy of association request frame
             if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame) 
             {
-                palFreeMemory(pMac->hHdd,((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
+                vos_mem_free(((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
                 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
             }            
-            palFreeMemory(pMac->hHdd, psessionEntry->parsedAssocReq[pStaDs->assocId]);    
+            vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
             psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
         }
     }
@@ -1051,7 +1052,7 @@
         {
             if (psessionEntry->protStaCache[i].active)
             {
-                if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr,
+                if (vos_mem_compare(psessionEntry->protStaCache[i].addr,
                         pStaDs->staAddr, sizeof(tSirMacAddr)))
                 {
                     psessionEntry->gLimHt20Params.numSta--;
@@ -1109,7 +1110,7 @@
                     {
                         if (psessionEntry->protStaCache[i].active)
                         {
-                            if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr,
+                            if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
                                     pStaDs->staAddr, sizeof(tSirMacAddr)))
                             {
                                 psessionEntry->gLim11aParams.numSta--;
@@ -1147,7 +1148,7 @@
                 {
                     if (psessionEntry->protStaCache[i].active)
                     {
-                        if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr,
+                        if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
                                 pStaDs->staAddr, sizeof(tSirMacAddr)))
                         {
                             psessionEntry->gLim11bParams.numSta--;
@@ -1181,7 +1182,7 @@
                     {
                         if (psessionEntry->protStaCache[i].active)
                         {
-                            if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr,
+                            if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
                                     pStaDs->staAddr, sizeof(tSirMacAddr)))
                             {
                                 psessionEntry->gLim11gParams.numSta--;
@@ -1217,7 +1218,7 @@
                 {
                     if (psessionEntry->protStaCache[i].active)
                     {
-                        if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr,
+                        if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
                                 pStaDs->staAddr, sizeof(tSirMacAddr)))
                         {
                             psessionEntry->gLimNonGfParams.numSta--;
@@ -1253,7 +1254,7 @@
                 {
                     if (psessionEntry->protStaCache[i].active)
                     {
-                        if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr,
+                        if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
                                 pStaDs->staAddr, sizeof(tSirMacAddr)))
                         {
                             psessionEntry->gLimLsigTxopParams.numSta--;
@@ -1299,7 +1300,7 @@
           {
              if (psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
              {
-                if (palEqualMemory( pMac->hHdd, psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
+                if (vos_mem_compare( psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
                                    pStaDs->staAddr, sizeof(tSirMacAddr)))
                 {
                     psessionEntry->gLimNoShortParams.numNonShortPreambleSta--;
@@ -1315,7 +1316,8 @@
          // enable short preamble
          PELOG1(limLog(pMac, LOG1, FL("All associated STAs have short preamble support now."));)
          //reset the cache
-         palZeroMemory( pMac->hHdd, (tANI_U8 *)&psessionEntry->gLimNoShortParams , sizeof(tLimNoShortParams));
+         vos_mem_set((tANI_U8 *)&psessionEntry->gLimNoShortParams,
+                      sizeof(tLimNoShortParams), 0);
          if (limEnableShortPreamble(pMac, true, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
              PELOGE(limLog(pMac, LOGE, FL("Cannot enable short preamble"));)
       }
@@ -1348,7 +1350,7 @@
           {
              if (psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
              {
-                if (palEqualMemory( pMac->hHdd, psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
+                if (vos_mem_compare(psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
                     pStaDs->staAddr, sizeof(tSirMacAddr)))
                     {
                         psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta--;
@@ -1366,7 +1368,7 @@
              {
                if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
                {
-                  if (palEqualMemory( pMac->hHdd, pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
+                  if (vos_mem_compare(pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
                       pStaDs->staAddr, sizeof(tSirMacAddr)))
                   {
                       pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta--;
@@ -1386,7 +1388,8 @@
          // enable short slot time
          PELOG1(limLog(pMac, LOG1, FL("All associated STAs have short slot time support now."));)
          //reset the cache
-         palZeroMemory( pMac->hHdd, (tANI_U8 *)&psessionEntry->gLimNoShortSlotParams , sizeof(tLimNoShortSlotParams));
+         vos_mem_set((tANI_U8 *)&psessionEntry->gLimNoShortSlotParams,
+                     sizeof(tLimNoShortSlotParams), 0);
          // in case of AP set SHORT_SLOT_TIME to enable
          if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
          {
@@ -1402,7 +1405,8 @@
             // enable short slot time
             PELOG1(limLog(pMac, LOG1, FL("All associated STAs have short slot time support now."));)
             //reset the cache
-            palZeroMemory( pMac->hHdd, (tANI_U8 *)&pMac->lim.gLimNoShortSlotParams , sizeof(tLimNoShortSlotParams));
+            vos_mem_set((tANI_U8 *)&pMac->lim.gLimNoShortSlotParams,
+                        sizeof(tLimNoShortSlotParams), 0);
             // in case of AP set SHORT_SLOT_TIME to enable
             if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
             {
@@ -1707,7 +1711,7 @@
         tANI_U8 aRateIndex = 0;
         tANI_U8 bRateIndex = 0;
 
-        palZeroMemory( pMac->hHdd, (tANI_U8 *) pRates, sizeof(tSirSupportedRates));
+        vos_mem_set((tANI_U8 *) pRates, sizeof(tSirSupportedRates), 0);
         for(i = 0;i < tempRateSet.numRates; i++)
         {
             min = 0;
@@ -1870,7 +1874,8 @@
     #endif // TO SUPPORT BT-AMP
 
     /* copy operational rate set from psessionEntry */
-    palCopyMemory(pMac->hHdd,(tempRateSet.rate),(psessionEntry->rateSet.rate),psessionEntry->rateSet.numRates);
+    vos_mem_copy((tempRateSet.rate), (psessionEntry->rateSet.rate),
+                 psessionEntry->rateSet.numRates);
     tempRateSet.numRates = (tANI_U8) psessionEntry->rateSet.numRates;
 
     if (phyMode == WNI_CFG_PHY_MODE_11G)
@@ -1883,7 +1888,8 @@
                       (tANI_U8 *) &tempRateSet2.rate,
                       &val) != eSIR_SUCCESS)
         #endif
-        palCopyMemory(pMac->hHdd,(tempRateSet2.rate),(psessionEntry->extRateSet.rate),psessionEntry->extRateSet.numRates);
+        vos_mem_copy((tempRateSet2.rate), (psessionEntry->extRateSet.rate),
+                     psessionEntry->extRateSet.numRates);
         tempRateSet2.numRates = (tANI_U8) psessionEntry->extRateSet.numRates;
     }
     else
@@ -1996,7 +2002,7 @@
         tpSirSupportedRates  rates = &pStaDs->supportedRates;
         tANI_U8 aRateIndex = 0;
         tANI_U8 bRateIndex = 0;
-        palZeroMemory( pMac->hHdd, (tANI_U8 *) rates, sizeof(tSirSupportedRates));
+        vos_mem_set((tANI_U8 *) rates, sizeof(tSirSupportedRates), 0);
         for(i = 0;(i < tempRateSet2.numRates && i < SIR_MAC_RATESET_EID_MAX ); i++)
         {
             for(j = 0;(j < tempRateSet.numRates && j < SIR_MAC_RATESET_EID_MAX); j++)
@@ -2127,13 +2133,13 @@
     
     sirCopyMacAddr(staMac,psessionEntry->selfMacAddr);
 
-    if( eHAL_STATUS_SUCCESS !=
-        palAllocateMemory( pMac->hHdd, (void **) &pAddStaParams, sizeof( tAddStaParams )))
-      {
-        limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
-        return eSIR_MEM_ALLOC_FAILED;
-      }
-    palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams, sizeof(tAddStaParams));
+    pAddStaParams = vos_mem_malloc(sizeof(tAddStaParams));
+    if (NULL == pAddStaParams)
+    {
+       limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
+       return eSIR_MEM_ALLOC_FAILED;
+    }
+    vos_mem_set((tANI_U8 *) pAddStaParams, sizeof(tAddStaParams), 0);
 
     if ((limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) ||
         (limGetSystemRole(psessionEntry) == eLIM_STA_IN_IBSS_ROLE) ||
@@ -2149,15 +2155,15 @@
     else
         pStaAddr = &staMac;
 
-    palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->staMac,
-                  (tANI_U8 *) *pStaAddr, sizeof(tSirMacAddr));
-    palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->bssId,
-                   psessionEntry->bssId, sizeof(tSirMacAddr));
+    vos_mem_copy((tANI_U8 *) pAddStaParams->staMac,
+                 (tANI_U8 *) *pStaAddr, sizeof(tSirMacAddr));
+    vos_mem_copy((tANI_U8 *) pAddStaParams->bssId,
+                  psessionEntry->bssId, sizeof(tSirMacAddr));
 
     limFillSupportedRatesInfo(pMac, pStaDs, &pStaDs->supportedRates,psessionEntry);
 
     //Copy legacy rates
-    palCopyMemory(pMac->hHdd, (tANI_U8*)&pAddStaParams->supportedRates,
+    vos_mem_copy ((tANI_U8*)&pAddStaParams->supportedRates,
                   (tANI_U8*)&pStaDs->supportedRates, sizeof(tSirSupportedRates));
 
     pAddStaParams->assocId = pStaDs->assocId;
@@ -2348,7 +2354,7 @@
           SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
         limLog( pMac, LOGE, FL("ADD_STA_REQ for aId %d failed (reason %X)"),
                             pStaDs->assocId, retCode );
-        palFreeMemory(pMac->hHdd, (void*)pAddStaParams);
+        vos_mem_free(pAddStaParams);
     }
 
   return retCode;
@@ -2389,13 +2395,14 @@
     tSirMsgQ msgQ;
     tSirRetStatus     retCode = eSIR_SUCCESS;
 
-    if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **) &pDelStaParams, sizeof( tDeleteStaParams )))
+    pDelStaParams = vos_mem_malloc(sizeof( tDeleteStaParams ));
+    if (NULL == pDelStaParams)
     {
-        limLog( pMac, LOGP, FL( "Unable to PAL allocate memory during ADD_STA" ));
+        limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
         return eSIR_MEM_ALLOC_FAILED;
     }
 
-    palZeroMemory( pMac->hHdd, (tANI_U8 *) pDelStaParams, sizeof(tDeleteStaParams));
+    vos_mem_set((tANI_U8 *) pDelStaParams, sizeof(tDeleteStaParams), 0);
 
   //
   // DPH contains the STA index only for "peer" STA entries.
@@ -2471,7 +2478,7 @@
            SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
         limLog( pMac, LOGE, FL("Posting DELETE_STA_REQ to HAL failed, reason=%X"),
                         retCode );
-        palFreeMemory(pMac->hHdd, (void*)pDelStaParams);
+        vos_mem_free(pDelStaParams);
     }
 
     return retCode;
@@ -2517,7 +2524,7 @@
     if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
         limLog( pMac, LOGE, FL("Posting ADD_STA_REQ to HAL failed, reason=%X"), retCode );
-        palFreeMemory(pMac->hHdd, (void*)pAddStaParams);
+        vos_mem_free(pAddStaParams);
     }
     //
     // Dont need it any more
@@ -2581,20 +2588,20 @@
     #endif //TO SUPPORT BT-AMP
     sirCopyMacAddr(staMac,psessionEntry->selfMacAddr);
 
-    if( eHAL_STATUS_SUCCESS !=
-        palAllocateMemory( pMac->hHdd, (void **) &pAddStaParams, sizeof( tAddStaParams )))
+    pAddStaParams = vos_mem_malloc(sizeof(tAddStaParams));
+    if (NULL == pAddStaParams)
     {
-        limLog( pMac, LOGP, FL( "Unable to PAL allocate memory during ADD_STA" ));
+        limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
         return eSIR_MEM_ALLOC_FAILED;
     }
-    palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams, sizeof(tAddStaParams));
+    vos_mem_set((tANI_U8 *) pAddStaParams, sizeof(tAddStaParams), 0);
 
     /// Add STA context at MAC HW (BMU, RHP & TFP)
-    palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->staMac,
-                  (tANI_U8 *) staMac, sizeof(tSirMacAddr));
+    vos_mem_copy((tANI_U8 *) pAddStaParams->staMac,
+                 (tANI_U8 *) staMac, sizeof(tSirMacAddr));
 
-    palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->bssId,
-                psessionEntry->bssId, sizeof(tSirMacAddr));
+    vos_mem_copy((tANI_U8 *) pAddStaParams->bssId,
+                 psessionEntry->bssId, sizeof(tSirMacAddr));
 
     pAddStaParams->assocId = psessionEntry->limAID;
     pAddStaParams->staType = STA_ENTRY_SELF;
@@ -2698,7 +2705,7 @@
   if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
         limLog( pMac, LOGE, FL("Posting ADD_STA_REQ to HAL failed, reason=%X"), retCode );
-        palFreeMemory(pMac->hHdd, (void*)pAddStaParams);
+        vos_mem_free(pAddStaParams);
     }
       return retCode;
 }
@@ -2911,9 +2918,9 @@
     tANI_U32             noa;
     tANI_U32             TotalNum_NoADesc = 0;
 
-    palCopyMemory( pMac->hHdd, currentSSID.ssId,
-                       psessionEntry->ssId.ssId,
-                       psessionEntry->ssId.length);
+    vos_mem_copy(currentSSID.ssId,
+                 psessionEntry->ssId.ssId,
+                 psessionEntry->ssId.length);
    
     currentSSID.length = (tANI_U8)psessionEntry->ssId.length ;
 
@@ -2923,7 +2930,7 @@
         ( (SIR_MAC_MGMT_FRAME  == pHdr->fc.type) &&
           (SIR_MAC_MGMT_PROBE_RSP == pHdr->fc.subType) ) &&
         currentSSID.length &&
-        (!palEqualMemory( pMac->hHdd,(tANI_U8 *) &pBPR->ssId,
+        (!vos_mem_compare((tANI_U8 *) &pBPR->ssId,
                    (tANI_U8 *) &currentSSID,
                    (tANI_U8) (1 + currentSSID.length)) ))
     {
@@ -3032,7 +3039,7 @@
     tANI_U16 ieLen,
     tpSirProbeRespBeacon beaconStruct )
 {
-  palZeroMemory( pMac->hHdd, (tANI_U8 *) beaconStruct, sizeof( tSirProbeRespBeacon ));
+  vos_mem_set((tANI_U8 *) beaconStruct, sizeof( tSirProbeRespBeacon ), 0);
 
   PELOG3(limLog( pMac, LOG3,
       FL( "In limExtractApCapabilities: The IE's being received are:" ));
@@ -3079,13 +3086,13 @@
     tSirMsgQ msgQ;
     tSirRetStatus     retCode = eSIR_SUCCESS;
     
-     if( eHAL_STATUS_SUCCESS !=
-        palAllocateMemory( pMac->hHdd, (void **) &pDelBssParams, sizeof( tDeleteBssParams )))
-     {
-        limLog( pMac, LOGP, FL( "Unable to PAL allocate memory during ADD_BSS" ));
+    pDelBssParams = vos_mem_malloc(sizeof(tDeleteBssParams));
+    if (NULL == pDelBssParams)
+    {
+        limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_BSS" ));
         return eSIR_MEM_ALLOC_FAILED;
-     }
-     palZeroMemory( pMac->hHdd, (tANI_U8 *) pDelBssParams, sizeof(tDeleteBssParams));
+    }
+    vos_mem_set((tANI_U8 *) pDelBssParams, sizeof(tDeleteBssParams), 0);
 
 
     pDelBssParams->sessionId = psessionEntry->peSessionId; //update PE session Id
@@ -3122,7 +3129,7 @@
     {
         SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
         limLog( pMac, LOGE, FL("Posting DELETE_BSS_REQ to HAL failed, reason=%X"), retCode );
-        palFreeMemory(pMac->hHdd, (void*)pDelBssParams);
+        vos_mem_free(pDelBssParams);
     }
 
     return retCode;
@@ -3169,24 +3176,23 @@
     tpDphHashNode pStaDs = NULL;
     tANI_U8 chanWidthSupp = 0;
     // Package SIR_HAL_ADD_BSS_REQ message parameters
-    if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
-                                                  (void **) &pAddBssParams,
-                                                  sizeof( tAddBssParams )))
+    pAddBssParams = vos_mem_malloc(sizeof( tAddBssParams ));
+    if (NULL == pAddBssParams)
     {
         limLog( pMac, LOGP,
-                FL( "Unable to PAL allocate memory during ADD_BSS" ));
+                FL( "Unable to allocate memory during ADD_BSS" ));
         retCode = eSIR_MEM_ALLOC_FAILED;
         goto returnFailure;
     }
     else
-        palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ));
+        vos_mem_set((tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ), 0);
 
-    palCopyMemory( pMac->hHdd,  pAddBssParams->bssId,bssDescription->bssId,
-                   sizeof( tSirMacAddr ));
+    vos_mem_copy(pAddBssParams->bssId,bssDescription->bssId,
+                 sizeof(tSirMacAddr));
     // Fill in tAddBssParams selfMacAddr
-    palCopyMemory( pMac->hHdd,  pAddBssParams->selfMacAddr, 
-                   psessionEntry->selfMacAddr,
-                   sizeof( tSirMacAddr ));
+    vos_mem_copy(pAddBssParams->selfMacAddr,
+                 psessionEntry->selfMacAddr,
+                 sizeof(tSirMacAddr));
     
     if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
     {
@@ -3214,8 +3220,8 @@
     pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
 
     pAddBssParams->rateSet.numRates = pAssocRsp->supportedRates.numRates;
-    palCopyMemory( pMac->hHdd,  pAddBssParams->rateSet.rate,
-                   pAssocRsp->supportedRates.rate, pAssocRsp->supportedRates.numRates );
+    vos_mem_copy(pAddBssParams->rateSet.rate,
+                 pAssocRsp->supportedRates.rate, pAssocRsp->supportedRates.numRates);
 
     pAddBssParams->nwType = bssDescription->nwType;
     
@@ -3281,9 +3287,9 @@
         /* staType = PEER*/
         pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
 
-        palCopyMemory( pMac->hHdd,  pAddBssParams->staContext.bssId,
-                       bssDescription->bssId,
-                       sizeof( tSirMacAddr ));
+        vos_mem_copy(pAddBssParams->staContext.bssId,
+                     bssDescription->bssId,
+                     sizeof( tSirMacAddr));
         pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
 
         /* Fill Assoc id from the dph table */
@@ -3374,7 +3380,7 @@
         if (pStaDs != NULL)
         {
             limFillSupportedRatesInfo(pMac, pStaDs, &pStaDs->supportedRates,psessionEntry);
-            palCopyMemory(pMac->hHdd, (tANI_U8*)&pAddBssParams->staContext.supportedRates,
+            vos_mem_copy((tANI_U8*)&pAddBssParams->staContext.supportedRates,
                                                 (tANI_U8*)&pStaDs->supportedRates,
                                                 sizeof(tSirSupportedRates));
         }
@@ -3445,7 +3451,7 @@
     if( eSIR_SUCCESS != retCode) 
     {
         SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
-        palFreeMemory(pMac->hHdd, pAddBssParams);
+        vos_mem_free(pAddBssParams);
         limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
                 retCode );
         goto returnFailure;
@@ -3472,26 +3478,25 @@
     tANI_U8 chanWidthSupp = 0;
     tpSirBssDescription bssDescription = &psessionEntry->pLimJoinReq->bssDescription;
 
-    if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, 
-                                                (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
+    pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
+    if (NULL == pBeaconStruct)
     {
-        limLog(pMac, LOGE, FL("Unable to PAL allocate memory during ADD_BSS") );
+        limLog(pMac, LOGE, FL("Unable to allocate memory during ADD_BSS") );
         return eSIR_MEM_ALLOC_FAILED;
     }
 
 
     // Package SIR_HAL_ADD_BSS_REQ message parameters
-    if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
-                                                  (void **) &pAddBssParams,
-                                                  sizeof( tAddBssParams )))
+    pAddBssParams = vos_mem_malloc(sizeof(tAddBssParams));
+    if (NULL == pAddBssParams)
     {
         limLog( pMac, LOGP,
-                FL( "Unable to PAL allocate memory during ADD_BSS" ));
+                FL( "Unable to allocate memory during ADD_BSS" ));
         retCode = eSIR_MEM_ALLOC_FAILED;
         goto returnFailure;
     }
     
-    palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ));
+    vos_mem_set((tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ), 0);
 
 
     limExtractApCapabilities( pMac,
@@ -3501,13 +3506,13 @@
 
     if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
         limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
-        palCopyMemory( pMac->hHdd,  pAddBssParams->bssId,bssDescription->bssId,
-                   sizeof( tSirMacAddr ));
+        vos_mem_copy(pAddBssParams->bssId, bssDescription->bssId,
+                     sizeof(tSirMacAddr));
 
     // Fill in tAddBssParams selfMacAddr
-    palCopyMemory( pMac->hHdd,  pAddBssParams->selfMacAddr, 
-                   psessionEntry->selfMacAddr,
-                   sizeof( tSirMacAddr ));
+    vos_mem_copy(pAddBssParams->selfMacAddr,
+                 psessionEntry->selfMacAddr,
+                 sizeof(tSirMacAddr));
 
     /* Incorrect BSS Type which caused UMA Descriptor to be overwritten on
      * top of an already established Infra link. This lead to issues in 
@@ -3530,8 +3535,8 @@
 
 
     pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
-    palCopyMemory( pMac->hHdd,  pAddBssParams->rateSet.rate,
-                   pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates );
+    vos_mem_copy(pAddBssParams->rateSet.rate,
+                 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
 
     pAddBssParams->nwType = bssDescription->nwType;
     
@@ -3593,9 +3598,9 @@
     {
         pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
 
-        palCopyMemory( pMac->hHdd,  pAddBssParams->staContext.bssId,
-                       bssDescription->bssId,
-                       sizeof( tSirMacAddr ));
+        vos_mem_copy(pAddBssParams->staContext.bssId,
+                     bssDescription->bssId,
+                     sizeof(tSirMacAddr));
         pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
 
         pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
@@ -3742,7 +3747,7 @@
     if( eSIR_SUCCESS != retCode) 
     {
         SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
-        palFreeMemory(pMac->hHdd, pAddBssParams);
+        vos_mem_free(pAddBssParams);
         limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
                 retCode );
         goto returnFailure;
@@ -3750,13 +3755,13 @@
     }
     else
     {
-        palFreeMemory(pMac->hHdd, pBeaconStruct);    
+        vos_mem_free(pBeaconStruct);
         return retCode;
     }
 
  returnFailure:
     // Clean-up will be done by the caller...
-    palFreeMemory(pMac->hHdd, pBeaconStruct);
+    vos_mem_free(pBeaconStruct);
     return retCode;
 }
 
@@ -3789,7 +3794,7 @@
       return;
     }
     staDsAssocId = pStaDs->assocId;
-    palCopyMemory( pMac->hHdd, (tANI_U8 *)staDsAddr,
+    vos_mem_copy((tANI_U8 *)staDsAddr,
             pStaDs->staAddr,
             sizeof(tSirMacAddr));
 
@@ -4022,14 +4027,14 @@
 
     length = sizeof(tSirSmeUnprotMgmtFrameInd) + frameLen;
 
-    if (eHAL_STATUS_SUCCESS !=
-         palAllocateMemory(pMac->hHdd, (void **)&pSirSmeMgmtFrame, length))
+    pSirSmeMgmtFrame = vos_mem_malloc(length);
+    if (NULL == pSirSmeMgmtFrame)
     {
         limLog(pMac, LOGP,
-               FL("palAllocateMemory failed for tSirSmeUnprotectedMgmtFrameInd"));
+               FL("AllocateMemory failed for tSirSmeUnprotectedMgmtFrameInd"));
         return;
     }
-    palZeroMemory(pMac->hHdd, (void*)pSirSmeMgmtFrame, length);
+    vos_mem_set((void*)pSirSmeMgmtFrame, length, 0);
 
     pSirSmeMgmtFrame->sessionId = sessionId;
     pSirSmeMgmtFrame->frameType = frameType;
diff --git a/CORE/MAC/src/pe/lim/limFT.c b/CORE/MAC/src/pe/lim/limFT.c
index 369515f..338c5e4 100644
--- a/CORE/MAC/src/pe/lim/limFT.c
+++ b/CORE/MAC/src/pe/lim/limFT.c
@@ -248,7 +248,15 @@
 
     // Now we are starting fresh make sure all's cleanup.
     limFTInit(pMac);
-    pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_FAILURE;  // Can set it only after sending auth
+    // Can set it only after sending auth
+    pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_FAILURE;
+
+    if( pMac->ft.ftPEContext.pFTPreAuthReq &&
+        pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
+    {
+        vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
+        pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
+    }
 
     // We need information from the Pre-Auth Req. Lets save that
     pMac->ft.ftPEContext.pFTPreAuthReq = (tpSirFTPreAuthReq)pMsg->bodyptr;
@@ -270,7 +278,12 @@
         limPrintMacAddr( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, LOGE );
         // Post the FT Pre Auth Response to SME
         limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, NULL);
-        pMac->ft.ftPEContext.pFTPreAuthReq = NULL;	
+        if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
+        {
+            vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
+            pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
+        }
+        pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
         return TRUE;
     }
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
@@ -384,24 +397,24 @@
     tANI_U8 chanWidthSupp = 0;
     tSchBeaconStruct *pBeaconStruct;
 
-    if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, 
-                                                (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
+    pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
+    if (NULL == pBeaconStruct)
     {
-        limLog(pMac, LOGE, FL("Unable to PAL allocate memory for creating ADD_BSS") );
+        limLog(pMac, LOGE, FL("Unable to allocate memory for creating ADD_BSS") );
         return eSIR_MEM_ALLOC_FAILED;
     }
 
     // Package SIR_HAL_ADD_BSS_REQ message parameters
-    if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
-        (void **) &pAddBssParams, sizeof( tAddBssParams )))
+    pAddBssParams = vos_mem_malloc(sizeof( tAddBssParams ));
+    if (NULL == pAddBssParams)
     {
-        palFreeMemory(pMac->hHdd, pBeaconStruct);
+        vos_mem_free(pBeaconStruct);
         limLog( pMac, LOGP,
-                FL( "Unable to PAL allocate memory for creating ADD_BSS" ));
+                FL( "Unable to allocate memory for creating ADD_BSS" ));
         return (eSIR_MEM_ALLOC_FAILED);
     }
     
-    palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ));
+    vos_mem_set((tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ), 0);
 
 
     limExtractApCapabilities( pMac,
@@ -411,12 +424,12 @@
     if (pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
         limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, pftSessionEntry);
 
-    palCopyMemory( pMac->hHdd, pAddBssParams->bssId, bssDescription->bssId,
-        sizeof( tSirMacAddr ));
+    vos_mem_copy(pAddBssParams->bssId, bssDescription->bssId,
+                 sizeof(tSirMacAddr));
 
     // Fill in tAddBssParams selfMacAddr
-    palCopyMemory( pMac->hHdd,  pAddBssParams->selfMacAddr, pftSessionEntry->selfMacAddr,
-        sizeof( tSirMacAddr ));
+    vos_mem_copy(pAddBssParams->selfMacAddr, pftSessionEntry->selfMacAddr,
+                 sizeof(tSirMacAddr));
 
     pAddBssParams->bssType = pftSessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
     pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
@@ -434,8 +447,8 @@
 
 
     pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
-    palCopyMemory( pMac->hHdd,  pAddBssParams->rateSet.rate,
-                   pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates );
+    vos_mem_copy(pAddBssParams->rateSet.rate,
+                 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
 
     pAddBssParams->nwType = bssDescription->nwType;
     
@@ -486,9 +499,9 @@
     {
         pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
 
-        palCopyMemory( pMac->hHdd,  pAddBssParams->staContext.bssId,
-                       bssDescription->bssId,
-                       sizeof( tSirMacAddr ));
+        vos_mem_copy(pAddBssParams->staContext.bssId,
+                     bssDescription->bssId,
+                     sizeof(tSirMacAddr));
         pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
 
         pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
@@ -577,7 +590,7 @@
     limLog( pMac, LOG1, FL( "Saving SIR_HAL_ADD_BSS_REQ for pre-auth ap..." ));
 #endif
 
-    palFreeMemory(pMac->hHdd, pBeaconStruct);
+    vos_mem_free(pBeaconStruct);
     return 0;
 }
 
@@ -596,10 +609,10 @@
     tPowerdBm        regMax;
     tSchBeaconStruct *pBeaconStruct;
 
-    if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, 
-                                                (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
+    pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
+    if (NULL == pBeaconStruct)
     {
-        limLog(pMac, LOGE, FL("Unable to PAL allocate memory for creating limFillFTSession") );
+        limLog(pMac, LOGE, FL("Unable to allocate memory for creating limFillFTSession") );
         return NULL;
     }
 
@@ -630,16 +643,16 @@
                             pBeaconStruct );
 
     pftSessionEntry->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
-    palCopyMemory( pMac->hHdd,  pftSessionEntry->rateSet.rate,
-        pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates );
+    vos_mem_copy(pftSessionEntry->rateSet.rate,
+        pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
 
     pftSessionEntry->extRateSet.numRates = pBeaconStruct->extendedRates.numRates;
-    palCopyMemory(pMac->hHdd, pftSessionEntry->extRateSet.rate, 
+    vos_mem_copy(pftSessionEntry->extRateSet.rate,
         pBeaconStruct->extendedRates.rate, pftSessionEntry->extRateSet.numRates);
 
 
     pftSessionEntry->ssId.length = pBeaconStruct->ssId.length;
-    palCopyMemory( pMac->hHdd, pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId,
+    vos_mem_copy(pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId,
         pftSessionEntry->ssId.length);
 
 
@@ -717,7 +730,7 @@
 
     pftSessionEntry->encryptType = psessionEntry->encryptType;
 
-    palFreeMemory(pMac->hHdd, pBeaconStruct);
+    vos_mem_free(pBeaconStruct);
     return pftSessionEntry;
 }
 
@@ -901,7 +914,7 @@
     //tSirRetStatus   sirStatus = eSIR_SUCCESS;
 
     pFTPreAuthRsp = (tpSirFTPreAuthRsp)vos_mem_malloc(rspLen);
-    if(NULL == pFTPreAuthRsp)
+    if (NULL == pFTPreAuthRsp)
     {
        PELOGE(limLog( pMac, LOGE, "Failed to allocate memory");)
        VOS_ASSERT(pFTPreAuthRsp != NULL);
@@ -912,7 +925,7 @@
     PELOGE(limLog( pMac, LOG1, "%s: Auth Rsp = %p", pFTPreAuthRsp);)
 #endif
          
-    palZeroMemory(pMac, (tANI_U8*)pFTPreAuthRsp, rspLen);
+    vos_mem_set((tANI_U8*)pFTPreAuthRsp, rspLen, 0);
     pFTPreAuthRsp->messageType = eWNI_SME_FT_PRE_AUTH_RSP;
     pFTPreAuthRsp->length = (tANI_U16) rspLen;
     pFTPreAuthRsp->status = status;
@@ -1084,17 +1097,17 @@
         limLog(pMac, LOGE, FL("pAddBssReq is NULL"));
         return;
     }
-    if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmReassocReq,
-        sizeof(tLimMlmReassocReq)))
+    pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
+    if (NULL == pMlmReassocReq)
     {
         // Log error
-        limLog(pMac, LOGE, FL("call to palAllocateMemory failed for mlmReassocReq"));
+        limLog(pMac, LOGE, FL("call to AllocateMemory failed for mlmReassocReq"));
         return;
     }
 
-    palCopyMemory( pMac->hHdd, pMlmReassocReq->peerMacAddr,
-                  psessionEntry->bssId,
-                  sizeof(tSirMacAddr));
+    vos_mem_copy(pMlmReassocReq->peerMacAddr,
+                 psessionEntry->bssId,
+                 sizeof(tSirMacAddr));
 
     if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
                   (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
@@ -1105,7 +1118,7 @@
          * from CFG. Log error.
          */
         limLog(pMac, LOGE, FL("could not retrieve ReassocFailureTimeout value"));
-        palFreeMemory(pMac->hHdd, pMlmReassocReq);
+        vos_mem_free(pMlmReassocReq);
         return;
     }
 
@@ -1116,7 +1129,7 @@
          * from CFG. Log error.
          */
         limLog(pMac, LOGE, FL("could not retrieve Capabilities value"));
-        palFreeMemory(pMac->hHdd, pMlmReassocReq);
+        vos_mem_free(pMlmReassocReq);
         return;
     }
     pMlmReassocReq->capabilityInfo = caps;
@@ -1129,7 +1142,7 @@
        eSIR_SUCCESS)
     {
        limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
-       palFreeMemory(pMac->hHdd, pMlmReassocReq);
+       vos_mem_free(pMlmReassocReq);
        return;
     }
 
@@ -1142,7 +1155,7 @@
             * from CFG. Log error.
           */
           limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
-          palFreeMemory(pMac->hHdd, pMlmReassocReq);
+          vos_mem_free(pMlmReassocReq);
           return;
        }
     }
@@ -1155,21 +1168,21 @@
             * from CFG. Log error.
             */
          limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
-         palFreeMemory(pMac->hHdd, pMlmReassocReq);
+         vos_mem_free(pMlmReassocReq);
          return;
       }
     }
     if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
                         psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
     {
-        palFreeMemory(pMac->hHdd, pMlmReassocReq);
+        vos_mem_free(pMlmReassocReq);
         return;
     }
 
     if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
                         psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
     {
-        palFreeMemory(pMac->hHdd, pMlmReassocReq);
+        vos_mem_free(pMlmReassocReq);
         return;
     }
 
@@ -1259,8 +1272,8 @@
     /* Store the key information in the ADD BSS parameters */
     pAddBssParams->extSetStaKeyParamValid = 1;
     pAddBssParams->extSetStaKeyParam.encType = pKeyInfo->keyMaterial.edType;
-    palCopyMemory( pMac->hHdd, (tANI_U8 *) &pAddBssParams->extSetStaKeyParam.key,
-                  (tANI_U8 *) &pKeyInfo->keyMaterial.key, sizeof( tSirKeys ));
+    vos_mem_copy((tANI_U8 *) &pAddBssParams->extSetStaKeyParam.key,
+                 (tANI_U8 *) &pKeyInfo->keyMaterial.key, sizeof(tSirKeys));
     if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
     {
         limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC" ));
@@ -1319,11 +1332,10 @@
     tANI_U8 sessionId;
     int i;
 
-    if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
-                (void **)&pAggrAddTsParam,
-                sizeof(tAggrAddTsParams)))
+    pAggrAddTsParam = vos_mem_malloc(sizeof(tAggrAddTsParams));
+    if (NULL == pAggrAddTsParam)
     {
-        PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory() failed"));)
+        PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
         return eSIR_MEM_ALLOC_FAILED;
     }
 
@@ -1331,7 +1343,7 @@
 
     if (psessionEntry == NULL) {
         PELOGE(limLog(pMac, LOGE, FL("psession Entry Null for sessionId = %d"), aggrQosReq->sessionId);)
-        palFreeMemory(pMac->hHdd, (tANI_U8*)pAggrAddTsParam);
+        vos_mem_free(pAggrAddTsParam);
         return eSIR_FAILURE;
     }
 
@@ -1339,12 +1351,12 @@
     if (pSta == NULL)
     {
         PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp"));)
-        palFreeMemory(pMac->hHdd, (tANI_U8*)pAggrAddTsParam);
+        vos_mem_free(pAggrAddTsParam);
         return eSIR_FAILURE;
     }
 
-    palZeroMemory( pMac->hHdd, (tANI_U8 *)pAggrAddTsParam,
-            sizeof(tAggrAddTsParams));
+    vos_mem_set((tANI_U8 *)pAggrAddTsParam,
+                 sizeof(tAggrAddTsParams), 0);
     pAggrAddTsParam->staIdx = psessionEntry->staId;
     // Fill in the sessionId specific to PE
     pAggrAddTsParam->sessionId = sessionId;
@@ -1406,7 +1418,7 @@
             {
                 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed "));)
                 pMac->lim.gLimAddtsSent = false;
-                palFreeMemory(pMac->hHdd, (tANI_U8*)pAggrAddTsParam);
+                vos_mem_free(pAggrAddTsParam);
                 return eSIR_FAILURE; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
             }
 
@@ -1429,7 +1441,7 @@
     {
        PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed"));)
        SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
-       palFreeMemory(pMac->hHdd, (tANI_U8*)pAggrAddTsParam);
+       vos_mem_free(pAggrAddTsParam);
        return eSIR_FAILURE;
     }
 
@@ -1448,14 +1460,14 @@
         return;
     }
 
-    if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp,
-                sizeof(tSirAggrQosRsp)))
+    rsp = vos_mem_malloc(sizeof(tSirAggrQosRsp));
+    if (NULL == rsp)
     {
-        limLog(pMac, LOGP, FL("palAllocateMemory failed for tSirAggrQosRsp"));
+        limLog(pMac, LOGP, FL("AllocateMemory failed for tSirAggrQosRsp"));
         return;
     }
 
-    palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
+    vos_mem_set((tANI_U8 *) rsp, sizeof(*rsp), 0);
     rsp->messageType = eWNI_SME_FT_AGGR_QOS_RSP;
     rsp->sessionId = smesessionId;
     rsp->length = sizeof(*rsp);
@@ -1507,7 +1519,7 @@
         PELOGE(limLog(pMac, LOGE, FL("Cant find session entry for %s"), __func__);)
         if( pAggrQosRspMsg != NULL )
         {
-            palFreeMemory( pMac->hHdd, (void *)pAggrQosRspMsg );
+            vos_mem_free(pAggrQosRspMsg);
         }
         return;
     }
@@ -1545,7 +1557,7 @@
             psessionEntry->smeSessionId);
     if( pAggrQosRspMsg != NULL )
     {
-        palFreeMemory( pMac->hHdd, (void *)pAggrQosRspMsg );
+        vos_mem_free(pAggrQosRspMsg);
     }
     return;
 }
diff --git a/CORE/MAC/src/pe/lim/limIbssPeerMgmt.c b/CORE/MAC/src/pe/lim/limIbssPeerMgmt.c
index 178c934..56ce4f5 100644
--- a/CORE/MAC/src/pe/lim/limIbssPeerMgmt.c
+++ b/CORE/MAC/src/pe/lim/limIbssPeerMgmt.c
@@ -92,9 +92,9 @@
 
     while (pTempNode != NULL)
     {
-        if (palEqualMemory( pMac->hHdd,(tANI_U8 *) macAddr,
-                      (tANI_U8 *) &pTempNode->peerMacAddr,
-                      sizeof(tSirMacAddr)) )
+        if (vos_mem_compare((tANI_U8 *) macAddr,
+                            (tANI_U8 *) &pTempNode->peerMacAddr,
+                            sizeof(tSirMacAddr)))
             break;
         pTempNode = pTempNode->next;
     }
@@ -142,10 +142,10 @@
         }
         if(pTemp->beacon)
         {
-            palFreeMemory(pMac->hHdd, pTemp->beacon);
+            vos_mem_free(pTemp->beacon);
         }
 
-        palFreeMemory( pMac->hHdd, (tANI_U8 *) pTemp);
+        vos_mem_free(pTemp);
         pPrev->next = NULL;
     }
     else
@@ -188,7 +188,7 @@
     tLimIbssPeerNode    *pPeer,
     tpPESession         psessionEntry)
 {
-    palCopyMemory( pMac->hHdd, pPeer->peerMacAddr, pHdr->sa, sizeof(tSirMacAddr));
+    vos_mem_copy(pPeer->peerMacAddr, pHdr->sa, sizeof(tSirMacAddr));
 
     pPeer->capabilityInfo       = pBeacon->capabilityInfo;
     pPeer->extendedRatesPresent = pBeacon->extendedRatesPresent;
@@ -200,9 +200,9 @@
         (pBeacon->HTCaps.present))
     {
         pPeer->htCapable =  pBeacon->HTCaps.present;
-        palCopyMemory(pMac->hHdd, (tANI_U8 *)pPeer->supportedMCSSet,
-                        (tANI_U8 *)pBeacon->HTCaps.supportedMCSSet,
-                        sizeof(pPeer->supportedMCSSet));
+        vos_mem_copy((tANI_U8 *)pPeer->supportedMCSSet,
+                     (tANI_U8 *)pBeacon->HTCaps.supportedMCSSet,
+                     sizeof(pPeer->supportedMCSSet));
         pPeer->htGreenfield = (tANI_U8)pBeacon->HTCaps.greenField;
         pPeer->htSupportedChannelWidthSet = ( tANI_U8 ) pBeacon->HTCaps.supportedChannelWidthSet;
         pPeer->htMIMOPSState =  (tSirMacHTMIMOPowerSaveState)pBeacon->HTCaps.mimoPowerSave;
@@ -223,18 +223,20 @@
         pPeer->vhtCapable = pBeacon->VHTCaps.present;
 
         // Collect VHT capabilities from beacon
-        palCopyMemory(pMac->hHdd, (tANI_U8 *) &pPeer->VHTCaps, (tANI_U8 *) &pBeacon->VHTCaps, sizeof(tDot11fIEVHTCaps) );
+        vos_mem_copy((tANI_U8 *) &pPeer->VHTCaps,
+                     (tANI_U8 *) &pBeacon->VHTCaps,
+                     sizeof(tDot11fIEVHTCaps));
     }
 #endif
     pPeer->erpIePresent = pBeacon->erpPresent;
 
-    palCopyMemory( pMac->hHdd, (tANI_U8 *) &pPeer->supportedRates,
-                  (tANI_U8 *) &pBeacon->supportedRates,
-                  pBeacon->supportedRates.numRates + 1);
+    vos_mem_copy((tANI_U8 *) &pPeer->supportedRates,
+                 (tANI_U8 *) &pBeacon->supportedRates,
+                 pBeacon->supportedRates.numRates + 1);
     if (pPeer->extendedRatesPresent)
-        palCopyMemory( pMac->hHdd, (tANI_U8 *) &pPeer->extendedRates,
-                          (tANI_U8 *) &pBeacon->extendedRates,
-                          pBeacon->extendedRates.numRates + 1);
+        vos_mem_copy((tANI_U8 *) &pPeer->extendedRates,
+                     (tANI_U8 *) &pBeacon->extendedRates,
+                     pBeacon->extendedRates.numRates + 1);
     else
         pPeer->extendedRates.numRates = 0;
 
@@ -414,9 +416,9 @@
     tpAniSirGlobal pMac)
 {
     if (pMac->lim.ibssInfo.pHdr != NULL)
-        palFreeMemory(pMac->hHdd, pMac->lim.ibssInfo.pHdr);
+        vos_mem_free(pMac->lim.ibssInfo.pHdr);
     if (pMac->lim.ibssInfo.pBeacon != NULL)
-        palFreeMemory(pMac->hHdd, pMac->lim.ibssInfo.pBeacon);
+        vos_mem_free(pMac->lim.ibssInfo.pBeacon);
 
     pMac->lim.ibssInfo.pHdr    = NULL;
     pMac->lim.ibssInfo.pBeacon = NULL;
@@ -431,29 +433,25 @@
     tpSirMacMgmtHdr     pHdr,
     tpSchBeaconStruct   pBeacon)
 {
-    eHalStatus status;
-
     // get rid of any saved info
     ibss_coalesce_free(pMac);
 
-    status = palAllocateMemory(pMac->hHdd, (void **) &pMac->lim.ibssInfo.pHdr,
-                               sizeof(*pHdr));
-    if (status != eHAL_STATUS_SUCCESS)
+    pMac->lim.ibssInfo.pHdr = vos_mem_malloc(sizeof(*pHdr));
+    if (NULL == pMac->lim.ibssInfo.pHdr)
     {
         PELOGE(limLog(pMac, LOGE, FL("ibbs-save: Failed malloc pHdr"));)
         return;
     }
-    status = palAllocateMemory(pMac->hHdd, (void **) &pMac->lim.ibssInfo.pBeacon,
-                               sizeof(*pBeacon));
-    if (status != eHAL_STATUS_SUCCESS)
+    pMac->lim.ibssInfo.pBeacon = vos_mem_malloc(sizeof(*pBeacon));
+    if (NULL == pMac->lim.ibssInfo.pBeacon)
     {
         PELOGE(limLog(pMac, LOGE, FL("ibbs-save: Failed malloc pBeacon"));)
         ibss_coalesce_free(pMac);
         return;
     }
 
-    palCopyMemory(pMac->hHdd, pMac->lim.ibssInfo.pHdr, pHdr, sizeof(*pHdr));
-    palCopyMemory(pMac->hHdd, pMac->lim.ibssInfo.pBeacon, pBeacon, sizeof(*pBeacon));
+    vos_mem_copy(pMac->lim.ibssInfo.pHdr, pHdr, sizeof(*pHdr));
+    vos_mem_copy(pMac->lim.ibssInfo.pBeacon, pBeacon, sizeof(*pBeacon));
 }
 
 /*
@@ -540,7 +538,7 @@
 
     if(beacon != NULL)
     {
-        palFreeMemory(pMac->hHdd, beacon);
+        vos_mem_free(beacon);
     }
 }
 
@@ -562,8 +560,8 @@
         return;
     }
 
-    palCopyMemory( pMac->hHdd, psessionEntry->bssId, pHdr->bssId,
-                   sizeof(tSirMacAddr));
+    vos_mem_copy(psessionEntry->bssId, pHdr->bssId,
+                 sizeof(tSirMacAddr));
 
     #if 0
     if (cfgSetStr(pMac, WNI_CFG_BSSID, (tANI_U8 *) pHdr->bssId, sizeof(tSirMacAddr))
@@ -599,10 +597,9 @@
     {
         psessionEntry->shortSlotTimeSupported = pBeacon->capabilityInfo.shortSlotTime;
     }
-    palCopyMemory( pMac->hHdd,
-       (tANI_U8 *) &psessionEntry->pLimStartBssReq->operationalRateSet,
-       (tANI_U8 *) &pBeacon->supportedRates,
-       pBeacon->supportedRates.numRates);
+    vos_mem_copy((tANI_U8 *) &psessionEntry->pLimStartBssReq->operationalRateSet,
+                 (tANI_U8 *) &pBeacon->supportedRates,
+                  pBeacon->supportedRates.numRates);
 
     #if 0
     if (cfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET,
@@ -639,13 +636,13 @@
     * even though all the nodes are capable of doing CB.
     * so it is decided to leave the self HT capabilties intact. This may change if some issues are found in interop.
     */
-    palZeroMemory(pMac->hHdd, (void *) &mlmStartReq, sizeof(mlmStartReq));
+    vos_mem_set((void *) &mlmStartReq, sizeof(mlmStartReq), 0);
 
-    palCopyMemory(pMac->hHdd, mlmStartReq.bssId, pHdr->bssId, sizeof(tSirMacAddr));
+    vos_mem_copy(mlmStartReq.bssId, pHdr->bssId, sizeof(tSirMacAddr));
     mlmStartReq.rateSet.numRates = psessionEntry->pLimStartBssReq->operationalRateSet.numRates;
-    palCopyMemory(pMac->hHdd, &mlmStartReq.rateSet.rate[0],
-                  &psessionEntry->pLimStartBssReq->operationalRateSet.rate[0],
-                  mlmStartReq.rateSet.numRates);
+    vos_mem_copy(&mlmStartReq.rateSet.rate[0],
+                 &psessionEntry->pLimStartBssReq->operationalRateSet.rate[0],
+                 mlmStartReq.rateSet.numRates);
     mlmStartReq.bssType             = eSIR_IBSS_MODE;
     mlmStartReq.beaconPeriod        = pBeacon->beaconInterval;
     mlmStartReq.nwType              = psessionEntry->pLimStartBssReq->nwType; //psessionEntry->nwType is also OK????
@@ -667,9 +664,9 @@
     mlmStartReq.cbMode              = psessionEntry->pLimStartBssReq->cbMode;
 
     // Copy the SSID for RxP filtering based on SSID.
-    palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmStartReq.ssId,
-        (tANI_U8 *) &psessionEntry->pLimStartBssReq->ssId,
-        psessionEntry->pLimStartBssReq->ssId.length + 1);
+    vos_mem_copy((tANI_U8 *) &mlmStartReq.ssId,
+                 (tANI_U8 *) &psessionEntry->pLimStartBssReq->ssId,
+                  psessionEntry->pLimStartBssReq->ssId.length + 1);
 
     PELOG1(limLog(pMac, LOG1, FL("invoking ADD_BSS as part of coalescing!"));)
     if (limMlmAddBss(pMac, &mlmStartReq,psessionEntry) != eSIR_SME_SUCCESS)
@@ -735,7 +732,7 @@
     pMac->lim.gLimNumIbssPeers = 0;
 
     // ibss info - params for which ibss to join while coalescing
-    palZeroMemory(pMac->hHdd, &pMac->lim.ibssInfo, sizeof(tAniSirLimIbss));
+    vos_mem_set(&pMac->lim.ibssInfo, sizeof(tAniSirLimIbss), 0);
 } /*** end limIbssInit() ***/
 
 /**
@@ -798,9 +795,9 @@
 
         if(pCurrNode->beacon)
         {
-            palFreeMemory(pMac->hHdd, pCurrNode->beacon);
+            vos_mem_free(pCurrNode->beacon);
         }
-        palFreeMemory( pMac->hHdd, (tANI_U8 *) pCurrNode);
+        vos_mem_free(pCurrNode);
         if (pMac->lim.gLimNumIbssPeers > 0) // be paranoid
             pMac->lim.gLimNumIbssPeers--;
         pCurrNode = pTempNode;
@@ -873,9 +870,9 @@
 
     while (pTempNode != NULL)
     {
-        if (palEqualMemory( pMac->hHdd,(tANI_U8 *) macAddr,
-                      (tANI_U8 *) &pTempNode->peerMacAddr,
-                      sizeof(tSirMacAddr)) )
+        if (vos_mem_compare((tANI_U8 *) macAddr,
+                            (tANI_U8 *) &pTempNode->peerMacAddr,
+                            sizeof(tSirMacAddr)) )
         {
             // Found node to be deleted
             if (pMac->lim.gLimIbssPeerList == pTempNode) /** First Node to be deleted*/
@@ -885,10 +882,10 @@
 
             if(pTempNode->beacon)
             {
-                palFreeMemory(pMac->hHdd, pTempNode->beacon);
+                vos_mem_free(pTempNode->beacon);
                 pTempNode->beacon = NULL;
             }
-            palFreeMemory( pMac->hHdd, (tANI_U8 *) pTempNode);
+            vos_mem_free(pTempNode);
             pMac->lim.gLimNumIbssPeers--;
             return;
         }
@@ -972,8 +969,7 @@
           PELOG1(limLog(pMac, LOG1, FL("Addr: "));)
           PELOG1(limPrintMacAddr(pMac, pMac->lim.protStaCache[i].addr, LOG1);)
 
-          if (palEqualMemory( pMac->hHdd,
-              pMac->lim.protStaCache[i].addr,
+          if (vos_mem_compare(pMac->lim.protStaCache[i].addr,
               peerMacAddr, sizeof(tSirMacAddr)))
           {
               PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active."), i);)
@@ -994,9 +990,9 @@
       return;
   }
 
-  palCopyMemory( pMac->hHdd, pMac->lim.protStaCache[i].addr,
-                peerMacAddr,
-                sizeof(tSirMacAddr));
+  vos_mem_copy(pMac->lim.protStaCache[i].addr,
+               peerMacAddr,
+               sizeof(tSirMacAddr));
 
   pMac->lim.protStaCache[i].protStaCacheType = protStaCacheType;
   pMac->lim.protStaCache[i].active = true;
@@ -1096,7 +1092,7 @@
     tSirMacAddr         *pPeerAddr = (tSirMacAddr *) pBody;
     tUpdateBeaconParams beaconParams; 
 
-    palZeroMemory( pMac->hHdd, (tANI_U8 *) &beaconParams, sizeof(tUpdateBeaconParams));
+    vos_mem_set((tANI_U8 *) &beaconParams, sizeof(tUpdateBeaconParams), 0);
 
     if (pBody == 0)
     {
@@ -1178,7 +1174,7 @@
     {
         PELOGE(limLog(pMac, LOGE, FL("IBSS: ADD_STA_RSP for unknown MAC addr "));)
         limPrintMacAddr(pMac, pAddStaParams->staMac, LOGE);
-        palFreeMemory( pMac->hHdd, (void *) pAddStaParams );
+        vos_mem_free(pAddStaParams);
         return eSIR_FAILURE;
     }
 
@@ -1186,7 +1182,7 @@
     {
         PELOGE(limLog(pMac, LOGE, FL("IBSS: ADD_STA_RSP error (%x) "), pAddStaParams->status);)
         limPrintMacAddr(pMac, pAddStaParams->staMac, LOGE);
-        palFreeMemory( pMac->hHdd, (void *) pAddStaParams );
+        vos_mem_free(pAddStaParams);
         return eSIR_FAILURE;
     }
 
@@ -1203,7 +1199,7 @@
                            pStaDs->ucUcastSig, pStaDs->ucBcastSig,
                            eWNI_SME_IBSS_NEW_PEER_IND,
                            psessionEntry->smeSessionId);
-    palFreeMemory( pMac->hHdd, (void *) pAddStaParams );
+    vos_mem_free(pAddStaParams);
 
     return eSIR_SUCCESS;
 }
@@ -1236,7 +1232,7 @@
 
     end:
     if(pDelBss != NULL)
-        palFreeMemory( pMac->hHdd, (void *) pDelBss );
+        vos_mem_free(pDelBss);
 }
 
 
@@ -1261,11 +1257,11 @@
     infoLen = sizeof(tSirMacAddr) + sizeof(tSirMacChanNum) +
               sizeof(tANI_U8) + pBeacon->ssId.length + 1;
 
-    palZeroMemory(pMac->hHdd, (void *) &newBssInfo, sizeof(newBssInfo));
-    palCopyMemory( pMac->hHdd, newBssInfo.bssId, pHdr->bssId, sizeof(tSirMacAddr));
+    vos_mem_set((void *) &newBssInfo, sizeof(newBssInfo), 0);
+    vos_mem_copy(newBssInfo.bssId, pHdr->bssId, sizeof(tSirMacAddr));
     newBssInfo.channelNumber = (tSirMacChanNum) pAddBss->currentOperChannel;
-    palCopyMemory( pMac->hHdd, (tANI_U8 *) &newBssInfo.ssId,
-                  (tANI_U8 *) &pBeacon->ssId, pBeacon->ssId.length + 1);
+    vos_mem_copy((tANI_U8 *) &newBssInfo.ssId,
+                 (tANI_U8 *) &pBeacon->ssId, pBeacon->ssId.length + 1);
 
     PELOGW(limLog(pMac, LOGW, FL("Sending JOINED_NEW_BSS notification to SME."));)
 
@@ -1358,7 +1354,7 @@
 
     end:
     if(pDelBss != NULL)
-        palFreeMemory( pMac->hHdd, (void *) pDelBss );
+        vos_mem_free(pDelBss);
     /* Delete PE session once BSS is deleted */
     if (NULL != psessionEntry) {
         limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, rc,psessionEntry->smeSessionId,psessionEntry->transactionId);
@@ -1403,14 +1399,14 @@
     tpDphHashNode       pStaDs;
     tUpdateBeaconParams beaconParams; 
 
-    palZeroMemory( pMac->hHdd, (tANI_U8 *) &beaconParams, sizeof(tUpdateBeaconParams));
+    vos_mem_set((tANI_U8 *)&beaconParams, sizeof(tUpdateBeaconParams), 0);
 
     sirCopyMacAddr(currentBssId,psessionEntry->bssId);
 
     limLog(pMac, LOG1, FL("Current BSSID :" MAC_ADDRESS_STR " Received BSSID :" MAC_ADDRESS_STR ),
                                   MAC_ADDR_ARRAY(currentBssId), MAC_ADDR_ARRAY(pHdr->bssId));
     /* Check for IBSS Coalescing only if Beacon is from different BSS */
-    if ( !palEqualMemory( pMac->hHdd, currentBssId, pHdr->bssId, sizeof( tSirMacAddr ) ) )
+    if ( !vos_mem_compare(currentBssId, pHdr->bssId, sizeof( tSirMacAddr )))
     {
         if (! fTsfLater) // No Coalescing happened.
         {
@@ -1448,8 +1444,8 @@
 #endif
         frameLen = sizeof(tLimIbssPeerNode) + ieLen - sizeof(tANI_U32);
 
-        if (eHAL_STATUS_SUCCESS !=
-            palAllocateMemory(pMac->hHdd, (void **) &pPeerNode, (tANI_U16)frameLen))
+        pPeerNode = vos_mem_malloc((tANI_U16)frameLen);
+        if (NULL == pPeerNode)
         {
             limLog(pMac, LOGP, FL("alloc fail (%d bytes) storing IBSS peer info"),
                    frameLen);
@@ -1460,14 +1456,14 @@
         pPeerNode->beaconLen = 0;
 
         ibss_peer_collect(pMac, pBeacon, pHdr, pPeerNode,psessionEntry);
-        if(eHAL_STATUS_SUCCESS !=
-                palAllocateMemory(pMac->hHdd, (void**)&pPeerNode->beacon, ieLen))
-       {
+        pPeerNode->beacon = vos_mem_malloc(ieLen);
+        if (NULL == pPeerNode->beacon)
+        {
                 PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store beacon"));)
         }
         else
         {
-            palCopyMemory(pMac->hHdd, pPeerNode->beacon, pIEs, ieLen);
+            vos_mem_copy(pPeerNode->beacon, pIEs, ieLen);
             pPeerNode->beaconLen = (tANI_U16)ieLen;
         }
         ibss_peer_add(pMac, pPeerNode);
@@ -1599,7 +1595,7 @@
                 else
                     pPrevNode->next = pTempNode->next;
 
-                palFreeMemory(pMac->hHdd,pTempNode);
+                vos_mem_free(pTempNode);
                 pMac->lim.gLimNumIbssPeers--;
 
                 pTempNode = pTempNextNode; //Since we deleted current node, prevNode remains same.
@@ -1685,8 +1681,8 @@
                 {
                     if (pMac->lim.protStaCache[i].active)
                     {
-                        if (palEqualMemory( pMac->hHdd,pMac->lim.protStaCache[i].addr,
-                                pStaDs->staAddr, sizeof(tSirMacAddr)))
+                        if (vos_mem_compare(pMac->lim.protStaCache[i].addr,
+                                            pStaDs->staAddr, sizeof(tSirMacAddr)))
                         {
                             psessionEntry->gLim11bParams.numSta--;
                             pMac->lim.protStaCache[i].active = false;